Commit 5d1e5c8b authored by Heikki Linnakangas's avatar Heikki Linnakangas

Check for BuildIndexValueDescription returning NULL in gist_page_items

Per Coverity. BuildIndexValueDescription() cannot actually return NULL in
this instance, because it only returns NULL if the user doesn't have the
required privileges, and this function can only be used by superuser. But
better safe than sorry.
parent 15251c0a
...@@ -247,14 +247,20 @@ gist_page_items(PG_FUNCTION_ARGS) ...@@ -247,14 +247,20 @@ gist_page_items(PG_FUNCTION_ARGS)
index_deform_tuple(itup, RelationGetDescr(indexRel), index_deform_tuple(itup, RelationGetDescr(indexRel),
itup_values, itup_isnull); itup_values, itup_isnull);
key_desc = BuildIndexValueDescription(indexRel, itup_values, itup_isnull);
memset(nulls, 0, sizeof(nulls)); memset(nulls, 0, sizeof(nulls));
values[0] = DatumGetInt16(offset); values[0] = DatumGetInt16(offset);
values[1] = ItemPointerGetDatum(&itup->t_tid); values[1] = ItemPointerGetDatum(&itup->t_tid);
values[2] = Int32GetDatum((int) IndexTupleSize(itup)); values[2] = Int32GetDatum((int) IndexTupleSize(itup));
values[3] = CStringGetTextDatum(key_desc);
key_desc = BuildIndexValueDescription(indexRel, itup_values, itup_isnull);
if (key_desc)
values[3] = CStringGetTextDatum(key_desc);
else
{
values[3] = (Datum) 0;
nulls[3] = true;
}
tuplestore_putvalues(tupstore, tupdesc, values, nulls); tuplestore_putvalues(tupstore, tupdesc, values, nulls);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment