Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit94fec48

Browse files
committed
Add regression test for two-phase transaction in postgres_fdw
postgres_fdw does not support two-phase transactions, so let's add asmall negative test case to check after it. Note that this is checkedusing an end-of-xact callback to ensure a proper connection cleanup withthe foreign server, which is called before checking if a server is ableto handle 2PC with max_prepared_xacts, so this test does not need analternate output file.Author: Gilles DaroldDiscussion:https://postgr.es/m/20191108090507.GC1768@paquier.xyz
1 parent1379fd5 commit94fec48

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

‎contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8781,3 +8781,16 @@ SELECT b, avg(a), max(a), count(*) FROM pagg_tab GROUP BY b HAVING sum(a) < 700
87818781

87828782
-- Clean-up
87838783
RESET enable_partitionwise_aggregate;
8784+
-- Two-phase transactions are not supported.
8785+
BEGIN;
8786+
SELECT count(*) FROM ft1;
8787+
count
8788+
-------
8789+
822
8790+
(1 row)
8791+
8792+
-- error here
8793+
PREPARE TRANSACTION 'fdw_tpc';
8794+
ERROR: cannot PREPARE a transaction that has operated on postgres_fdw foreign tables
8795+
ROLLBACK;
8796+
WARNING: there is no transaction in progress

‎contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,3 +2479,10 @@ SELECT b, avg(a), max(a), count(*) FROM pagg_tab GROUP BY b HAVING sum(a) < 700
24792479

24802480
-- Clean-up
24812481
RESET enable_partitionwise_aggregate;
2482+
2483+
-- Two-phase transactions are not supported.
2484+
BEGIN;
2485+
SELECTcount(*)FROM ft1;
2486+
-- error here
2487+
PREPARE TRANSACTION'fdw_tpc';
2488+
ROLLBACK;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp