From: | PG Doc comments form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-docs(at)lists(dot)postgresql(dot)org |
Cc: | depesz(at)depesz(dot)com |
Subject: | Do blocks support transaction control? |
Date: | 2022-09-23 13:33:54 |
Message-ID: | 166394003436.654.15293085988078557076@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/14/sql-do.html
Description:
Apparently now DO blocks support COMMIT; - which make them more like
procedures than functions.
Tried it with:
create table z (a int4, b int4);
insert into z (a,b) select i, i from generate_Series(1,10) i;
do $$
declare
begin
update z set b = 2;
commit;
perform pg_sleep(120);
end;
$$ language plpgsql;
And while it was running, in another psql sessions, I:
1. could see b= 2
2. could update any of the rows in z.
Is it documented anywhere? DO docs say that do is like function, which it
doesn't seem to be?
From | Date | Subject | |
---|---|---|---|
Next Message | PG Doc comments form | 2022-09-24 02:41:27 | How to access a database in the pgadmin UI |
Previous Message | Tom Lane | 2022-09-23 02:17:16 | Re: Documentation on pgdump(1) uses "regular expression" instead of "psql pattern" |