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.
pull/62/head
Heikki Linnakangas 5 years ago
parent 15251c0a60
commit 5d1e5c8b75
  1. 10
      contrib/pageinspect/gistfuncs.c

@ -247,14 +247,20 @@ gist_page_items(PG_FUNCTION_ARGS)
index_deform_tuple(itup, RelationGetDescr(indexRel),
itup_values, itup_isnull);
key_desc = BuildIndexValueDescription(indexRel, itup_values, itup_isnull);
memset(nulls, 0, sizeof(nulls));
values[0] = DatumGetInt16(offset);
values[1] = ItemPointerGetDatum(&itup->t_tid);
values[2] = Int32GetDatum((int) IndexTupleSize(itup));
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);
}

Loading…
Cancel
Save