Re: Rollback on include error in psql

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Rollback on include error in psql
Date: 2014-12-30 00:09:16
Message-ID: 54A1ED2C.2070701@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

On 12/29/2014 03:56 PM, David Johnston wrote:
>
>

>
>
> ​So you think psql should issue "COMMIT;" even if it is exiting due to
> "ON_ERROR_STOP"?

I say yes, if it is a non-SQL error. As Viktor stated, SQL errors abort
the transaction.

>
> Whether you do or don't can you show me where in the documentation the
> current behavior is described?

Your biggest issue seems to be with --single-transaction and
ON_ERROR_STOP so:

--single-transaction

When psql executes a script, adding this option wraps BEGIN/COMMIT
around the script to execute it as a single transaction.

Therefore:

BEGIN;
script
COMMIT;

I would and have agreed with your previous statements that it is not
clear enough that \i is not an SQL command and an error with same is
ignored by the transaction. Outside of that I see no problem.

>
> ​David J.​
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Johnston 2014-12-30 00:26:40 Re: [GENERAL] Rollback on include error in psql
Previous Message Tom Lane 2014-12-30 00:01:29 Re: BUG #12368: Installation from source does not add libxml support even using --with-libxml.

Browse pgsql-general by date

  From Date Subject
Next Message Mike Cardwell 2014-12-30 00:18:58 Re: Hostnames, IDNs, Punycode and Unicode Case Folding
Previous Message Tom Lane 2014-12-30 00:09:02 Re: Hostnames, IDNs, Punycode and Unicode Case Folding