Surely this code in setrefs.c is wrong? - Mailing list pgsql-hackers

From Tom Lane
Subject Surely this code in setrefs.c is wrong?
Date
Msg-id 2277537.1694301772@sss.pgh.pa.us
Whole thread Raw
Responses Re: Surely this code in setrefs.c is wrong?
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18097: Immutable expression not allowed in generated at
Next
From: David Rowley
Date:
Subject: Re: Surely this code in setrefs.c is wrong?