From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Geoghegan <pg(at)bowt(dot)ie> |
Cc: | Vik Fearing <vik(at)postgresfriends(dot)org>, Pantelis Theodosiou <ypercube(at)gmail(dot)com>, Lukas Eder <lukas(dot)eder(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #16958: "Invalid reference to FROM-clause entry for table" when qualifying columns in "on conflict .. where" |
Date: | 2021-04-11 00:20:43 |
Message-ID: | 2556685.1618100443@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Peter Geoghegan <pg(at)bowt(dot)ie> writes:
> On Sat, Apr 10, 2021 at 9:28 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> It does seem like a pointless prohibition, but the comment about it in
>> the source code implies it was intentional. Peter, do you remember
>> why?
> No. The intention was to make it like CREATE INDEX. Apparently CREATE
> INDEX allows the columns to be qualified, though, so that explanation
> doesn't justify it.
OK. Here's a more fleshed-out patch that makes an effort to get rid of
duplicate namespace-munging.
I found that creating the EXCLUDED RTE soon enough to draw the complaint
I wanted about bogus references also caused this interesting change in
the regression test results:
ERROR: column "keyy" does not exist
LINE 1: ...nsertconflicttest values (1, 'Apple') on conflict (keyy) do ...
^
-HINT: Perhaps you meant to reference the column "insertconflicttest.key".
+HINT: Perhaps you meant to reference the column "insertconflicttest.key" or the column "excluded.key".
-- Have useful HINT for EXCLUDED.* RTE within UPDATE:
This seems to me like an independent bug: why is the misspelled-column-
name hint machinery including inaccessible columns in its results?
That seems much more likely to be confusing than helpful. But if there
is actually a defensible reason for doing that, then this seems like
an okay change.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
allow-table-qual-in-ON-CONFLICT-1.patch | text/x-diff | 9.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Sandeep Thakkar | 2021-04-11 04:18:31 | Re: BUG #16957: initdb.exe initialize a database cluster has stopped working |
Previous Message | Peter Geoghegan | 2021-04-10 16:54:06 | Re: BUG #16958: "Invalid reference to FROM-clause entry for table" when qualifying columns in "on conflict .. where" |