Surely this code in setrefs.c is wrong?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Surely this code in setrefs.c is wrong?
Date: 2023-09-09 23:22:52
Message-ID: 2277537.1694301772@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I happened to notice this bit in fix_expr_common's processing
of ScalarArrayOpExprs:

set_sa_opfuncid(saop);
record_plan_function_dependency(root, saop->opfuncid);

if (!OidIsValid(saop->hashfuncid))
record_plan_function_dependency(root, saop->hashfuncid);

if (!OidIsValid(saop->negfuncid))
record_plan_function_dependency(root, saop->negfuncid);

Surely those if-conditions are exactly backward, and we should be
recording nonzero hashfuncid and negfuncid entries, not zero ones.
As-is, the code's a no-op because record_plan_function_dependency
will ignore OIDs less than FirstUnpinnedObjectId, including zero.

"git blame" blames 50e17ad28 and 29f45e299 for these, so v14
has only half the problem of later branches.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2023-09-10 09:07:53 Re: Surely this code in setrefs.c is wrong?
Previous Message Tom Lane 2023-09-09 22:56:42 Re: BUG #18097: Immutable expression not allowed in generated at