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.98.2) (envelope-from ) id 1xDmoz-00000000i1e-0cI3 for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Oct 2026 17:49:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xDmnx-0000000C9Sc-0guu for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Oct 2026 17:48:49 +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.98.2) (envelope-from ) id 1xDmnw-0000000C9SU-3iwf for pgsql-hackers@lists.postgresql.org; Mon, 05 Oct 2026 17:48:48 +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.98.2) (envelope-from ) id 1xDmnv-00000000VzV-0b0U for pgsql-hackers@postgresql.org; Mon, 05 Oct 2026 17:48:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 695HmiBg1087920; Mon, 5 Oct 2026 13:48:44 -0400 From: Tom Lane To: Nathan Bossart cc: pgsql-hackers@postgresql.org Subject: Re: COPY FROM ... WHERE fails for negated operators In-reply-to: References: Comments: In-reply-to Nathan Bossart message dated "Mon, 05 Oct 2026 12:07:17 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1087918.1791222524.1@sss.pgh.pa.us> Date: Mon, 05 Oct 2026 13:48:44 -0400 Message-ID: <1087919.1791222524@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nathan Bossart writes: > The following steps produce a "cache lookup failed for function" error: > CREATE TABLE t (a int); > COPY t FROM stdin WHERE NOT (a > 0); > 1 > 0 > \. > I think what's happening is that negate_clause() is calling get_negator() > with a 0 argument because DoCopy() neglects to call fix_opfuncids() (like > RelationGetIndexPredicate() does). The attached patch fixes this. Ugh. We really ought to get rid of fix_opfuncids() in favor of insisting that operator clauses be filled in fully from the start. But that's not happening right now, so I concur with this fix for the moment. regards, tom lane