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