Re: [PATCH][DOC] Fix for PREPARE TRANSACTION doc and postgres_fdw message.
Gilles DAROLD <gilles@darold.net>
From: Gilles Darold <gilles@darold.net>
To: Michael Paquier <michael@paquier.xyz>
Cc: Etsuro Fujita <etsuro.fujita@gmail.com>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-11-11T15:43:18Z
Lists: pgsql-hackers
Attachments
- patch_postgres_fdw_2pc_test-v1.diff (text/x-patch) patch v1
Le 09/11/2019 à 02:22, Michael Paquier a écrit :
> On Fri, Nov 08, 2019 at 10:19:01AM +0100, Gilles Darold wrote:
>> I don't think so. The support or not of 2PC is on foreign data wrapper
>> side. In postgres_fdw contrib the error for use with 2PC is not part of
>> the test but it will be thrown anyway. I guess that a test will be
>> valuable only if there is support for readonly query.
> That's what I call a case for negative testing. We don't allow 2PC to
> be used so there is a point in having a test to make sure of that.
> This way, if the code in this area is refactored or changed, we still
> make sure that 2PC is correctly prevented. My suggestion is to close
> this gap. One point here is that this requires an alternate output
> file because of max_prepared_transactions and there is no point in
> creating one with all the tests of postgres_fdw in a single file as we
> have now as it would create 8k lines of expected file bloat, so it
> would be better to split the tests first. My 2c.
> --
> Michael
Hi Michael, it looks that a separate test is not required at least for
this test. Here is a patch that enable the test in
contrib/postgres_fdw/, expected output:
-- Make sure that 2PC is correctly prevented
BEGIN;
SELECT count(*) FROM ft1;
count
-------
822
(1 row)
-- Must throw an error
PREPARE TRANSACTION 'fdw_tpc';
ERROR: cannot PREPARE a transaction that has operated on
postgres_fdw foreign tables
ROLLBACK;
WARNING: there is no transaction in progress
--
Gilles Darold
http://www.darold.net/
Commits
-
Add regression test for two-phase transaction in postgres_fdw
- 94fec48516a7 13.0 landed
-
postgres_fdw: Fix error message for PREPARE TRANSACTION.
- 1bd67d535843 9.4.25 landed
- b260ce9c19b6 9.5.20 landed
- bca0aed2d01c 9.6.16 landed
- 0c7a28a5eabd 10.11 landed
- 042e82cef949 11.6 landed
- 0cc31cc32da0 12.1 landed
- 879c11761571 13.0 landed