Skip to content

Commit

Permalink
Address review on attstattarget is nullable, define pg compatible fun…
Browse files Browse the repository at this point in the history
…ctions for it
  • Loading branch information
naisila committed Oct 16, 2024
1 parent 7497419 commit ef60a25
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/backend/distributed/deparser/citus_ruleutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,17 @@ pg_get_tablecolumnoptionsdef_string(Oid tableRelationId)
* If the user changed the column's statistics target, create
* alter statement and add statement to a list for later processing.
*/
HeapTuple tp = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(tableRelationId),
Int16GetDatum(attributeForm->attnum));
int32 targetAttstattarget = getAttstattarget_compat(tp);
ReleaseSysCache(tp);
HeapTuple atttuple = SearchSysCache2(ATTNUM,
ObjectIdGetDatum(tableRelationId),
Int16GetDatum(attributeForm->attnum));
if (!HeapTupleIsValid(atttuple))
{
elog(ERROR, "cache lookup failed for attribute %d of relation %u",
attributeForm->attnum, tableRelationId);
}

int32 targetAttstattarget = getAttstattarget_compat(atttuple);
ReleaseSysCache(atttuple);
if (targetAttstattarget >= 0)
{
StringInfoData statement = { NULL, 0, 0, 0 };
Expand Down

0 comments on commit ef60a25

Please sign in to comment.