test-for-bug-17355.patch
text/x-patch
Filename: test-for-bug-17355.patch
Type: text/x-patch
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| contrib/postgres_fdw/expected/bug-17355.out | 27 | 0 |
| contrib/postgres_fdw/Makefile | 1 | 0 |
| contrib/postgres_fdw/specs/bug-17355.spec | 42 | 0 |
diff --git a/contrib/postgres_fdw/Makefile b/contrib/postgres_fdw/Makefile
index c1b0cad453f..02150ad8e2c 100644
--- a/contrib/postgres_fdw/Makefile
+++ b/contrib/postgres_fdw/Makefile
@@ -17,6 +17,7 @@ EXTENSION = postgres_fdw
DATA = postgres_fdw--1.0.sql postgres_fdw--1.0--1.1.sql
REGRESS = postgres_fdw
+ISOLATION = bug-17355
ifdef USE_PGXS
PG_CONFIG = pg_config
diff --git a/contrib/postgres_fdw/expected/bug-17355.out b/contrib/postgres_fdw/expected/bug-17355.out
new file mode 100644
index 00000000000..1c829cd52c3
--- /dev/null
+++ b/contrib/postgres_fdw/expected/bug-17355.out
@@ -0,0 +1,27 @@
+Parsed test spec with 2 sessions
+
+starting permutation: s1i s1b s1u s2d s1c
+step s1i: INSERT INTO pt VALUES (3000);
+step s1b: BEGIN;
+step s1u: UPDATE pt SET a = a;
+step s2d: DELETE FROM pt RETURNING *; <waiting ...>
+step s1c: COMMIT;
+step s2d: <... completed>
+ a|b
+----+-
+3000|
+(1 row)
+
+
+starting permutation: s1i s1b s1u s2u s1c
+step s1i: INSERT INTO pt VALUES (3000);
+step s1b: BEGIN;
+step s1u: UPDATE pt SET a = a;
+step s2u: UPDATE pt SET a = a RETURNING *; <waiting ...>
+step s1c: COMMIT;
+step s2u: <... completed>
+ a|b
+----+-
+3000|
+(1 row)
+
diff --git a/contrib/postgres_fdw/specs/bug-17355.spec b/contrib/postgres_fdw/specs/bug-17355.spec
new file mode 100644
index 00000000000..b99aa50b052
--- /dev/null
+++ b/contrib/postgres_fdw/specs/bug-17355.spec
@@ -0,0 +1,42 @@
+setup
+{
+CREATE EXTENSION postgres_fdw;
+
+CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
+DO $d$
+ BEGIN
+ EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
+ OPTIONS (dbname '$$||current_database()||$$',
+ port '$$||current_setting('port')||$$'
+ )$$;
+ END;
+$d$;
+CREATE USER MAPPING FOR CURRENT_USER SERVER loopback;
+CREATE TABLE pt (a int, b int) PARTITION BY RANGE (a);
+CREATE TABLE base_tbl2 (a int, b int);
+-- CREATE TABLE p2 PARTITION OF pt FOR VALUES FROM (2000) TO (3000);
+CREATE FOREIGN TABLE p2 PARTITION OF pt FOR VALUES FROM (2000) TO (3000)
+ SERVER loopback OPTIONS (table_name 'base_tbl2');
+CREATE TABLE p3 PARTITION OF pt FOR VALUES FROM (3000) TO
+(4000);
+}
+
+teardown
+{
+ DROP TABLE pt;
+ DROP TABLE base_tbl2;
+ DROP EXTENSION postgres_fdw CASCADE;
+}
+
+session "s1"
+step "s1i" { INSERT INTO pt VALUES (3000); }
+step "s1b" { BEGIN; }
+step "s1u" { UPDATE pt SET a = a; }
+step "s1c" { COMMIT; }
+
+session "s2"
+step "s2d" { DELETE FROM pt RETURNING *; }
+step "s2u" { UPDATE pt SET a = a RETURNING *; }
+
+permutation "s1i" "s1b" "s1u" "s2d" "s1c"
+permutation "s1i" "s1b" "s1u" "s2u" "s1c"