With statements does not modify original table untill it is "complete"

Started by PG Bug reporting formabout 7 years ago1 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/queries-with.html
Description:

I think it should be more more visible that data does not change in the
table, untill the with statement is complete. It took some trial-and-error
and fine-reading of the manual before I got this part.

My test code was as following:

create table test(id bigint);
insert into test(id) VALUES(1), (2), (3), (4);
with del as
(delete from test where id in (1, 2))
select * from test;
id
----
1
2
3
4
(4 rows)