From 7d4667c6203d0174903a53de9d1730fbec26576b Mon Sep 17 00:00:00 2001 From: Etsuro Fujita Date: Sun, 8 Jun 2025 17:30:00 +0900 Subject: Revert "postgres_fdw: Inherit the local transaction's access/deferrable modes." We concluded that commit e5a3c9d9b is a feature rather than a fix; since it was added after feature freeze, revert it. Reported-by: Fujii Masao Reported-by: Michael Paquier Reported-by: Robert Haas Discussion: https://postgr.es/m/ed2296f1-1a6b-4932-b870-5bb18c2591ae%40oss.nttdata.com --- contrib/postgres_fdw/expected/postgres_fdw.out | 134 ------------------------- 1 file changed, 134 deletions(-) (limited to 'contrib/postgres_fdw/expected') diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out index eb4716bed81..2185b42bb4f 100644 --- a/contrib/postgres_fdw/expected/postgres_fdw.out +++ b/contrib/postgres_fdw/expected/postgres_fdw.out @@ -12384,140 +12384,6 @@ SELECT count(*) FROM remote_application_name DROP FOREIGN TABLE remote_application_name; DROP VIEW my_application_name; -- =================================================================== --- test read-only and/or deferrable transactions --- =================================================================== -CREATE TABLE loct (f1 int, f2 text); -CREATE FUNCTION locf() RETURNS SETOF loct LANGUAGE SQL AS - 'UPDATE public.loct SET f2 = f2 || f2 RETURNING *'; -CREATE VIEW locv AS SELECT t.* FROM locf() t; -CREATE FOREIGN TABLE remt (f1 int, f2 text) - SERVER loopback OPTIONS (table_name 'locv'); -CREATE FOREIGN TABLE remt2 (f1 int, f2 text) - SERVER loopback2 OPTIONS (table_name 'locv'); -INSERT INTO loct VALUES (1, 'foo'), (2, 'bar'); -START TRANSACTION READ ONLY; -SAVEPOINT s; -SELECT * FROM remt; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK TO s; -RELEASE SAVEPOINT s; -SELECT * FROM remt; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK; -START TRANSACTION; -SAVEPOINT s; -SET transaction_read_only = on; -SELECT * FROM remt; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK TO s; -RELEASE SAVEPOINT s; -SET transaction_read_only = on; -SELECT * FROM remt; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK; -START TRANSACTION; -SAVEPOINT s; -SELECT * FROM remt; -- should work - f1 | f2 -----+-------- - 1 | foofoo - 2 | barbar -(2 rows) - -SET transaction_read_only = on; -SELECT * FROM remt; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK TO s; -RELEASE SAVEPOINT s; -SELECT * FROM remt; -- should work - f1 | f2 -----+-------- - 1 | foofoo - 2 | barbar -(2 rows) - -SET transaction_read_only = on; -SELECT * FROM remt; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK; -START TRANSACTION; -SAVEPOINT s; -SELECT * FROM remt; -- should work - f1 | f2 -----+-------- - 1 | foofoo - 2 | barbar -(2 rows) - -SET transaction_read_only = on; -SELECT * FROM remt2; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK TO s; -RELEASE SAVEPOINT s; -SELECT * FROM remt; -- should work - f1 | f2 -----+-------- - 1 | foofoo - 2 | barbar -(2 rows) - -SET transaction_read_only = on; -SELECT * FROM remt2; -- should fail -ERROR: cannot execute UPDATE in a read-only transaction -CONTEXT: SQL function "locf" statement 1 -remote SQL command: SELECT f1, f2 FROM public.locv -ROLLBACK; -DROP FOREIGN TABLE remt; -CREATE FOREIGN TABLE remt (f1 int, f2 text) - SERVER loopback OPTIONS (table_name 'loct'); -START TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY; -SELECT * FROM remt; - f1 | f2 -----+----- - 1 | foo - 2 | bar -(2 rows) - -COMMIT; -START TRANSACTION ISOLATION LEVEL SERIALIZABLE DEFERRABLE; -SELECT * FROM remt; - f1 | f2 -----+----- - 1 | foo - 2 | bar -(2 rows) - -COMMIT; -START TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE; -SELECT * FROM remt; - f1 | f2 -----+----- - 1 | foo - 2 | bar -(2 rows) - -COMMIT; --- Clean up -DROP FOREIGN TABLE remt; -DROP FOREIGN TABLE remt2; -DROP VIEW locv; -DROP FUNCTION locf(); -DROP TABLE loct; --- =================================================================== -- test parallel commit and parallel abort -- =================================================================== ALTER SERVER loopback OPTIONS (ADD parallel_commit 'true'); -- cgit v1.2.3