From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: depesz@depesz.com
Subject: Do blocks support transaction control?
Date: Fri, 23 Sep 2022 13:33:54 +0000
Message-ID: <166394003436.654.15293085988078557076@wrigleys.postgresql.org> (raw)
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?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, depesz@depesz.com
Subject: Re: Do blocks support transaction control?
In-Reply-To: <166394003436.654.15293085988078557076@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox