Re: BUG #15977: Inconsistent behavior in chained transactions - Mailing list pgsql-hackers

From fn ln
Subject Re: BUG #15977: Inconsistent behavior in chained transactions
Date
Msg-id CA+99BHpwajvLbOfnFqFVrDaCP4AEg0Yn7icQ2miWe1-FFm8ndQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15977: Inconsistent behavior in chained transactions  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
No, but instead always do an implicit COMMIT after each statement, like SELECT 1; SELECT 2; (not \;) in psql.
The PostgreSQL document even states that 'Issuing COMMIT when not inside a transaction does no harm, but it will provoke a warning message.' for a long time,
but in fact it have side-effect when used in an implicit transactions.
If we can ensure that the COMMIT/ROLLBACK really does nothing, we don't have to distinguish CHAIN and NO CHAIN errors anymore.

2019年9月8日(日) 2:04 Fabien COELHO <coelho@cri.ensmp.fr>:

>> Now, I'd prefer error in all cases, no doubt about that, which might be
>> considered a regression. A way around that could be to have a GUC decide
>> between a strict behavior (error) and the old behavior (warning).
>
> I think it's more better to have a GUC to disable implicit transaction
> 'block' feature, because that's probably the root of all issues.

Hmmm… I'm not sure that erroring out on "SELECT 1" because there is no
explicit "BEGIN" is sellable, even under some GUC.

--
Fabien.

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: BUG #15977: Inconsistent behavior in chained transactions
Next
From: Tom Lane
Date:
Subject: Re: SQL-spec incompatibilities in similar_escape() and related stuff