Re: PG12 change to DO UPDATE SET column references

From: James Coleman <jtc331(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PG12 change to DO UPDATE SET column references
Date: 2024-01-20 21:45:07
Message-ID: CAAaqYe88yOFhHjAS-0RzHkTDmx+NAg=4Km1udnyAkpayiOoVLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 20, 2024 at 12:59 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> James Coleman <jtc331(at)gmail(dot)com> writes:
> > I do wonder if it's plausible (and sufficiently easy) to improve the
> > error message here. "column 'foo' of relation 'foo'" makes one thing
> > that you've written foo.foo, (in my real-world case the error message
> > also cut off the sql past "foo.", and so I couldn't even tell if the
> > sql was just malformed). At the very least it'd be nice to have a HINT
> > here (perhaps just when the relation and column name match).
>
> > Before I look at where it is, Is such an improvement something we'd be
> > interested in?
>
> A HINT if the bogus column name (1) matches the relation name and
> (2) is field-qualified seems plausible to me. Then it's pretty
> likely to be a user misunderstanding about whether to write the
> relation name.

Attached is a patch to do just that. We could also add tests for
regular UPDATEs if you think that's useful.

Regards,
James Coleman

Attachment Content-Type Size
v1-0001-Helpful-hint-for-qualified-target-column-in-UPDAT.patch application/octet-stream 6.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-01-20 22:44:00 Re: Make documentation builds reproducible
Previous Message Pavel Stehule 2024-01-20 20:26:40 Re: Schema variables - new implementation for Postgres 15