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-21 00:12:11
Message-ID: CAAaqYe-fbgHNJiaprDgLPcZKZ04+PdzH02uqkz+22tpZ77t0mQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 20, 2024 at 5:57 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> James Coleman <jtc331(at)gmail(dot)com> writes:
> > On Sat, Jan 20, 2024 at 12:59 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> 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.
>
> Pushed with minor alterations:
>
> 1. I think our usual style for conditional hints is to use a ternary
> expression within the ereport, rather than duplicating code. In this
> case that way allows not touching any of the existing lines, making
> review easier.

Ah, I'd wondered if we had a pattern for that, but I didn't know what
I was looking for.

> 2. I thought we should test the UPDATE case as well as the ON CONFLICT
> case, but I didn't think we needed quite as many tests as you had
> here. I split up the responsibility so that one test covers the
> alias case and the other the no-alias case.

That all makes sense. I figured it was better to have tests show all
the possible combinations for review and then you could whittle them
down as you saw fit.

Thanks for reviewing and committing!

Regards,
James Coleman

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2024-01-21 01:06:36 Re: Change GUC hashtable to use simplehash?
Previous Message Tom Lane 2024-01-20 22:59:48 Re: Make documentation builds reproducible