COPY FROM ... WHERE fails for negated operators
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
This thread has been committed, so CI has stopped here. Anything below is the last result it produced.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t254072psql -h localhost -U postgresBuilt from patchset v1 (message #1), October 05, 2026 at 05:17 PM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t254072_1 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t254072_1 && git checkout t254072_1Patchset v1 (message #1) is on t254072_1
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.
--
nathan
Nathan Bossart <nathandbossart@gmail.com> 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
On Mon, Oct 05, 2026 at 01:48:44PM -0400, Tom Lane wrote:
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.
Committed, thanks.
--
nathan