slightly unexpected result

Поиск
Список
Период
Сортировка
От Torsten Förtsch
Тема slightly unexpected result
Дата
Msg-id CAKkG4_kM1yuqw1oimYM_fAzsSJqQkejWW5yHqw_WfOng+9Y4TQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: slightly unexpected result
Список pgsql-general
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 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 the table content after the query I see the i=i+1 part was executed.

Is this expected behavior?

Thanks,
Torsten

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Unable to install postgresql and pgadmin
Следующее
От: duc hiep ha
Дата:
Сообщение: failed to setup barman backup when Posgres is running in Podman Container