Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread James Coleman
On Sat, Jan 20, 2024 at 5:57 PM Tom Lane wrote: > > James Coleman writes: > > On Sat, Jan 20, 2024 at 12:59 PM Tom Lane 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 misu

Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread Tom Lane
James Coleman writes: > On Sat, Jan 20, 2024 at 12:59 PM Tom Lane 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. >

Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread James Coleman
On Sat, Jan 20, 2024 at 12:59 PM Tom Lane wrote: > > James Coleman 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 >

Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread Tom Lane
James Coleman 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 tel

Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread James Coleman
On Sat, Jan 20, 2024 at 11:12 AM Tom Lane wrote: > > James Coleman writes: > > Suppose I have this table: > > create table foo (id int primary key); > > > On PG11 this works: > > postgres=# insert into foo (id) values (1) on conflict (id) do update > > set foo.id = 1; > > INSERT 0 1 > > Hmm, are

Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread Tom Lane
James Coleman writes: > Suppose I have this table: > create table foo (id int primary key); > On PG11 this works: > postgres=# insert into foo (id) values (1) on conflict (id) do update > set foo.id = 1; > INSERT 0 1 Hmm, are you sure about that? I get ERROR: column "foo" of relation "foo" do

Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread David G. Johnston
On Saturday, January 20, 2024, James Coleman wrote: > > > Well, egg on my face for definitely missing that in the docs. > > Unfortunately that doesn't explain why it works on PG11 and not on PG12. > It was a bug that got fixed. I’m sure a search of the mailing list archives or Git will turn up t

Re: PG12 change to DO UPDATE SET column references

2024-01-20 Thread James Coleman
On Fri, Jan 19, 2024 at 1:53 PM David G. Johnston wrote: > > On Fri, Jan 19, 2024 at 10:01 AM James Coleman wrote: >> >> Making this more confusing is the fact that if I want to do something >> like "SET bar = foo.bar + 1" the table qualification cannot be present >> on the setting column but is

Re: PG12 change to DO UPDATE SET column references

2024-01-19 Thread David G. Johnston
On Fri, Jan 19, 2024 at 10:01 AM James Coleman wrote: > Making this more confusing is the fact that if I want to do something > like "SET bar = foo.bar + 1" the table qualification cannot be present > on the setting column but is required on the reading column. > > There isn't anything in the doc

PG12 change to DO UPDATE SET column references

2024-01-19 Thread James Coleman
Hello, I realize this is almost ancient history at this point, but I ran into a surprising behavior change from PG11->12 with ON CONFLICT ... DO UPDATE SET ... Suppose I have this table: create table foo (id int primary key); On PG11 this works: postgres=# insert into foo (id) values (1) on conf