Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands - Mailing list pgsql-bugs

From Daniel Verite
Subject Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands
Date
Msg-id 37325fb7-8014-4028-9bcf-60d83f4fe8dd@manitou-mail.org
Whole thread Raw
In response to Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
    David G. Johnston wrote:


> drop table if exists performupdate;
> create table performupdate (val integer);
> insert into performupdate values (2);
> \startpipeline
> update performupdate set val = val * 2;
> --create database benchtest;
> select 1/0;
> --rollback
> \endpipeline
> DO $$BEGIN RAISE NOTICE 'Value = %', (select val from performupdate); END;
> $$
>
> I get this result - the post-pipeline DO block never executes and I
> expected that it would.

pgbench stops the script on errors. If the script was reduced to

 select 1/0;
 DO $$BEGIN RAISE NOTICE 'print this; END; $$

the DO statement would not be executed either.
When the error happens inside a pipeline section, it's the same.
The pgbench code collects the results sent by the server to clear up,
but the script is aborted at this point, and the DO block is not going
to be sent to the server.


Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite



pgsql-bugs by date:

Previous
From: Timo Stolz
Date:
Subject: If a row-level security policy contains a set returning function, pg_dump returns an incorrect serialization of that policy if the return type of the function was altered
Next
From: Harinath Kanchu
Date:
Subject: Trusted extension cannot be dropped by the owner of the extension