Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qf7I3-009blU-Ao for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Sep 2023 23:22:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qf7I1-004mBv-Ts for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Sep 2023 23:22:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qf7I1-004mBn-Ji for pgsql-hackers@lists.postgresql.org; Sat, 09 Sep 2023 23:22:57 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qf7Hy-003gRc-EW for pgsql-hackers@lists.postgresql.org; Sat, 09 Sep 2023 23:22:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 389NMq6I2277538; Sat, 9 Sep 2023 19:22:52 -0400 From: Tom Lane To: David Rowley cc: pgsql-hackers@lists.postgresql.org Subject: Surely this code in setrefs.c is wrong? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2277536.1694301772.1@sss.pgh.pa.us> Date: Sat, 09 Sep 2023 19:22:52 -0400 Message-ID: <2277537.1694301772@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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