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

Appearance settings

Commit 94fec48

Browse filesBrowse files
committed
Add regression test for two-phase transaction in postgres_fdw
postgres_fdw does not support two-phase transactions, so let's add a small negative test case to check after it. Note that this is checked using an end-of-xact callback to ensure a proper connection cleanup with the foreign server, which is called before checking if a server is able to handle 2PC with max_prepared_xacts, so this test does not need an alternate output file. Author: Gilles Darold Discussion: https://postgr.es/m/20191108090507.GC1768@paquier.xyz
1 parent 1379fd5 commit 94fec48
Copy full SHA for 94fec48

File tree

Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed

‎contrib/postgres_fdw/expected/postgres_fdw.out

Copy file name to clipboardExpand all lines: contrib/postgres_fdw/expected/postgres_fdw.out
+13Lines 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

Copy file name to clipboardExpand all lines: contrib/postgres_fdw/sql/postgres_fdw.sql
+7Lines 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+
SELECT count(*) FROM ft1;
2486+
-- error here
2487+
PREPARE TRANSACTION 'fdw_tpc';
2488+
ROLLBACK;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.