diff --git a/src/test/regress/expected/multi_real_time_transaction.out b/src/test/regress/expected/multi_real_time_transaction.out index 795ce8464..663d8c8d2 100644 --- a/src/test/regress/expected/multi_real_time_transaction.out +++ b/src/test/regress/expected/multi_real_time_transaction.out @@ -29,6 +29,54 @@ SELECT create_reference_table('ref_test_table'); (1 row) \COPY ref_test_table FROM stdin delimiter ','; +-- Test two reference table joins, will both run in parallel +BEGIN; +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); + count +--------------------------------------------------------------------- + 4 +(1 row) + +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); + count +--------------------------------------------------------------------- + 4 +(1 row) + +ROLLBACK; +-- Test two reference table joins, second one will be serialized +BEGIN; +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); + count +--------------------------------------------------------------------- + 4 +(1 row) + +INSERT INTO ref_test_table VALUES(1,2,'da'); +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); + count +--------------------------------------------------------------------- + 5 +(1 row) + +ROLLBACK; +-- this does not work because the inserts into shards go over different connections +-- and the insert into the reference table goes over a single connection, and the +-- final SELECT cannot see both +BEGIN; +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); + count +--------------------------------------------------------------------- + 4 +(1 row) + +INSERT INTO test_table VALUES(1,2,'da'); +INSERT INTO test_table VALUES(2,2,'da'); +INSERT INTO test_table VALUES(3,3,'da'); +INSERT INTO ref_test_table VALUES(1,2,'da'); +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); +ERROR: cannot perform query with placements that were modified over multiple connections +ROLLBACK; -- Test with select and router insert BEGIN; SELECT COUNT(*) FROM test_table; diff --git a/src/test/regress/sql/multi_real_time_transaction.sql b/src/test/regress/sql/multi_real_time_transaction.sql index ffbf1a43a..f2d77e801 100644 --- a/src/test/regress/sql/multi_real_time_transaction.sql +++ b/src/test/regress/sql/multi_real_time_transaction.sql @@ -40,6 +40,31 @@ SELECT create_reference_table('ref_test_table'); 4,5,'rr4' \. +-- Test two reference table joins, will both run in parallel +BEGIN; +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); +ROLLBACK; + +-- Test two reference table joins, second one will be serialized +BEGIN; +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); +INSERT INTO ref_test_table VALUES(1,2,'da'); +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); +ROLLBACK; + +-- this does not work because the inserts into shards go over different connections +-- and the insert into the reference table goes over a single connection, and the +-- final SELECT cannot see both +BEGIN; +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); +INSERT INTO test_table VALUES(1,2,'da'); +INSERT INTO test_table VALUES(2,2,'da'); +INSERT INTO test_table VALUES(3,3,'da'); +INSERT INTO ref_test_table VALUES(1,2,'da'); +SELECT COUNT(*) FROM test_table JOIN ref_test_table USING (id); +ROLLBACK; + -- Test with select and router insert BEGIN; SELECT COUNT(*) FROM test_table;