pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add hint about not qualifying UPDATE...SET target with relation
Date: Sat, 20 Jan 2024 22:54:20 +0000
Message-ID: <E1rRKEG-002MGc-2Z@gemulon.postgresql.org> (raw)

Add hint about not qualifying UPDATE...SET target with relation name.

Target columns in UPDATE ... SET must not be qualified with the target
table; we disallow this because it'd create ambiguity about which name
is the column name in case of field-qualified names.  However, newbies
have been seen to expect that they could qualify a target name just
like other names.  The error message when they do is confusing:
"column "foo" of relation "foo" does not exist".  To improve matters,
issue a HINT if the invalid name is qualified and matches the
relation's alias.

James Coleman (editorialized a bit by me)

Discussion: https://postgr.es/m/CAAaqYe8S2Qa060UV-YF5GoSd5PkEhLV94x-fEi3=TOtpaXCV+w@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/58447e31890ace0d552a4bf693744bef3a5335e6

Modified Files
--------------
src/backend/parser/analyze.c                  | 3 +++
src/test/regress/expected/insert_conflict.out | 6 ++++++
src/test/regress/expected/update.out          | 6 ++++++
src/test/regress/sql/insert_conflict.sql      | 3 +++
src/test/regress/sql/update.sql               | 3 +++
5 files changed, 21 insertions(+)



Message-ID: <E1rRKEG-002MGc-2Z@gemulon.postgresql.org>
Permalink:  ../E1rRKEG-002MGc-2Z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rRKEG-002MGc-2Z@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add hint about not qualifying UPDATE...SET target with relation
  In-Reply-To: <E1rRKEG-002MGc-2Z@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox