Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-14 Thread Bruce Momjian
On Fri, Jul 8, 2022 at 11:18:43PM -0400, Bruce Momjian wrote: > On Fri, Jul 1, 2022 at 08:11:36AM -0700, David G. Johnston wrote: > > That said, I still think that the current wording should be tweak with > > respect > > to row vs. rows (especially if we continue to call it a table): > > > > Cu

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-11 Thread Robert Haas
On Fri, Jul 8, 2022 at 11:18 PM Bruce Momjian wrote: > I found two places where a singular "row" would be better, doc patch > attached. +1. -- Robert Haas EDB: http://www.enterprisedb.com

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-08 Thread Bruce Momjian
On Fri, Jul 1, 2022 at 08:11:36AM -0700, David G. Johnston wrote: > That said, I still think that the current wording should be tweak with respect > to row vs. rows (especially if we continue to call it a table): > > Current: > "The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to th

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-01 Thread David G. Johnston
On Fri, Jul 1, 2022 at 7:58 AM Peter Geoghegan wrote: > On Fri, Jul 1, 2022 at 6:01 AM Robert Haas wrote: > > What would probably help more is adding something like this to the > > error message: > > > > HINT: column "b" could refer to any of these relations: "foo", "excluded" > > > > That could

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-01 Thread Peter Geoghegan
On Fri, Jul 1, 2022 at 6:01 AM Robert Haas wrote: > What would probably help more is adding something like this to the > error message: > > HINT: column "b" could refer to any of these relations: "foo", "excluded" > > That could also help people who encounter this error in other > situations. I'm

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-01 Thread Peter Geoghegan
On Fri, Jul 1, 2022 at 6:40 AM Tom Lane wrote: > Robert Haas writes: > > What would probably help more is adding something like this to the > > error message: > > HINT: column "b" could refer to any of these relations: "foo", "excluded" > > +1, that seems like it could be handy across the board.

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-01 Thread Tom Lane
Robert Haas writes: > I think that the issue here is simply that because both the updated > table and the "excluded" pseudo-table are visible here, and have the > same columns, an unqualified name is ambiguous. I don't really think > that it's worth documenting. The error message you get if you fa

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-01 Thread Robert Haas
On Thu, Jun 30, 2022 at 6:40 PM Peter Geoghegan wrote: > 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 appear

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-07-01 Thread Robert Haas
On Thu, Jun 30, 2022 at 5:05 PM Peter Geoghegan wrote: > On Thu, Jun 30, 2022 at 1:43 PM Robert Haas wrote: > > rhaas=# insert into foo values (1, 'frob') on conflict (a) do update > > set b = (select b || 'nitz' from excluded); > > ERROR: relation "excluded" does not exist > > LINE 1: ...ct (a)

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-06-30 Thread Peter Geoghegan
On Thu, Jun 30, 2022 at 3:07 PM David G. Johnston 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

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-06-30 Thread David G. Johnston
On Thu, Jun 30, 2022 at 2:31 PM Peter Geoghegan wrote: > On Thu, Jun 30, 2022 at 2:07 PM David G. Johnston > wrote: > > Current: > > "The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the > > existing row using the table's name (or an alias), and to [rows] proposed > > for insert

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-06-30 Thread Peter Geoghegan
On Thu, Jun 30, 2022 at 2:07 PM David G. Johnston wrote: > Current: > "The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the > existing row using the table's name (or an alias), and to [rows] proposed > for insertion using the special excluded table." > > The word table in that sen

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-06-30 Thread David G. Johnston
On Thu, Jun 30, 2022 at 1:43 PM Robert Haas wrote: > On Thu, Jun 9, 2022 at 11:40 AM David G. Johnston > wrote: > > As one cannot place excluded in a FROM clause (subquery) in the > > ON CONFLICT clause referring to it as a table, ... > > Well, it would be nice if you had included a test

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-06-30 Thread Peter Geoghegan
On Thu, Jun 30, 2022 at 1:43 PM Robert Haas wrote: > rhaas=# insert into foo values (1, 'frob') on conflict (a) do update > set b = (select b || 'nitz' from excluded); > ERROR: relation "excluded" does not exist > LINE 1: ...ct (a) do update set b = (select b || 'nitz' from excluded); > > I do fi

Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-06-30 Thread Robert Haas
On Thu, Jun 9, 2022 at 11:40 AM David G. Johnston wrote: > As one cannot place excluded in a FROM clause (subquery) in the > ON CONFLICT clause referring to it as a table, ... Well, it would be nice if you had included a test case rather than leaving it to the reviewer or committer to con

doc: Clarify what "excluded" represents for INSERT ON CONFLICT

2022-06-09 Thread David G. Johnston
Hi, Reposting this on its own thread. https://www.postgresql.org/message-id/flat/CAKFQuwby1aMsJDMeibaBaohgoaZhivAo4WcqHC1%3D9-GDZ3TSng%40mail.gmail.com As one cannot place excluded in a FROM clause (subquery) in the ON CONFLICT clause referring to it as a table, with plural rows none