Re: slightly unexpected result

2024-01-10 Thread Bruce Momjian
On Wed, Jan 10, 2024 at 09:06:31AM -0700, David G. Johnston wrote: > It is mostly documented. > > https://www.postgresql.org/docs/current/queries-with.html# > QUERIES-WITH-MODIFYING > """ > Only one of the modifications takes place, but it is not easy (and sometimes > not possible) to reliably

Re: slightly unexpected result

2024-01-10 Thread David G. Johnston
On Wed, Jan 10, 2024 at 8:46 AM Bruce Momjian wrote: > On Wed, Jan 10, 2024 at 12:29:54PM +0100, Torsten Förtsch wrote: > > > > > To me that was a bit surprising. I would have expected it to fail with > > something like "can't update the same row twice in the same command". > > > > If I check

Re: slightly unexpected result

2024-01-10 Thread Bruce Momjian
On Wed, Jan 10, 2024 at 12:29:54PM +0100, Torsten Förtsch wrote: > Hi, > > imagine a simple table with 1 row > > =# table tf; >  i | x   > ---+ >  1 | xx > (1 row) > > And this query: > > with x as (update tf set i=i+1 returning *) > , y as (update tf set x=x||'yy' returning *) > select *

slightly unexpected result

2024-01-10 Thread Torsten Förtsch
Hi, imagine a simple table with 1 row =# table tf; i | x ---+ 1 | xx (1 row) And this query: with x as (update tf set i=i+1 returning *) , y as (update tf set x=x||'yy' returning *) select * from x,y; My PG14 gives this result i | x | i | x ---+---+---+--- (0 rows) To me that was a