Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands
Date: 2022-07-19 11:16:21
Message-ID: 37325fb7-8014-4028-9bcf-60d83f4fe8dd@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Harinath Kanchu 2022-07-20 06:44:05 Trusted extension cannot be dropped by the owner of the extension
Previous Message Timo Stolz 2022-07-19 10:22:02 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2022-07-19 11:33:16 Re: Proposal: allow database-specific role memberships
Previous Message Martin Kalcher 2022-07-19 11:15:42 Re: [PATCH] Introduce array_shuffle() and array_sample()