From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT |
Date: | 2022-06-30 22:40:23 |
Message-ID: | CAH2-Wz=O1=_DCzPCLtjgnh6n=Lwsr-vVv4Ddhd7sQ4yiYgPKHw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jun 30, 2022 at 3:07 PM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> Yes, and based on a single encounter I agree this doesn't seem like a broadly encountered issue. My takeaway from that eventually led to this proposal. The "Other Person" who is complaining about the docs is one of the mentors on the Discord server and works for one of the corporate contributors to the community. (I suppose Discord is considered public so maybe this redaction is unnecessary...)
My impression from reading this transcript is that the user was
confused as to why they needed to qualify the target table name in the
ON CONFLICT DO UPDATE's WHERE clause -- they didn't have to qualify it
in the targetlist that appears in "SET ... ", so why the need to do it
in the WHERE clause? This isn't something that upsert statements need
to do all that often, just because adding additional conditions to the
WHERE clause isn't usually necessary. That much makes sense to me -- I
*can* imagine how that could cause confusion.
If that interpretation is correct, then it's not clear what it should
mean for how the INSERT documentation describes EXCLUDED. EXCLUDED is
involved here, since EXCLUDED is the thing that creates the ambiguity,
but that seems almost incidental to me. This user would probably not
have been confused if they didn't need to use a WHERE clause (very
much the common case), even when expression evaluation involving
EXCLUDED in the SET was still used (also common).
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2022-06-30 23:16:24 | Re: [PATCH] minor reloption regression tests improvement |
Previous Message | Peter Eisentraut | 2022-06-30 22:37:23 | Re: Avoid unecessary MemSet call (src/backend/utils/cache/relcache.c) |