Skip to content

Commit dc49c1d

Browse files
committed
isolation tests for transaction abortion case (issue #20)
1 parent 9a57913 commit dc49c1d

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif
2727
$(EXTENSION)--$(EXTVERSION).sql: init.sql hash.sql range.sql
2828
cat $^ > $@
2929

30-
ISOLATIONCHECKS=insert_trigger
30+
ISOLATIONCHECKS=insert_trigger rollback_on_create_partitions
3131

3232
submake-isolation:
3333
$(MAKE) -C $(top_builddir)/src/test/isolation all

Diff for: expected/rollback_on_create_partitions.out

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Parsed test spec with 1 sessions
2+
3+
starting permutation: begin insert_data create_partitions rollback show_me_what_you_got
4+
step begin: BEGIN;
5+
step insert_data: INSERT INTO range_rel SELECT generate_series(1, 10000);
6+
step create_partitions: SELECT create_range_partitions('range_rel', 'id', 1, 1000);
7+
create_range_partitions
8+
9+
10
10+
WARNING: Removing 'range_rel' partitions from pg_pathman's cache
11+
step rollback: ROLLBACK;
12+
step show_me_what_you_got: EXPLAIN (COSTS OFF) SELECT * FROM range_rel;
13+
QUERY PLAN
14+
15+
Seq Scan on range_rel
16+
17+
starting permutation: begin insert_data create_partitions commit show_me_what_you_got
18+
step begin: BEGIN;
19+
step insert_data: INSERT INTO range_rel SELECT generate_series(1, 10000);
20+
step create_partitions: SELECT create_range_partitions('range_rel', 'id', 1, 1000);
21+
create_range_partitions
22+
23+
10
24+
step commit: COMMIT;
25+
step show_me_what_you_got: EXPLAIN (COSTS OFF) SELECT * FROM range_rel;
26+
QUERY PLAN
27+
28+
Append
29+
-> Seq Scan on range_rel_1
30+
-> Seq Scan on range_rel_2
31+
-> Seq Scan on range_rel_3
32+
-> Seq Scan on range_rel_4
33+
-> Seq Scan on range_rel_5
34+
-> Seq Scan on range_rel_6
35+
-> Seq Scan on range_rel_7
36+
-> Seq Scan on range_rel_8
37+
-> Seq Scan on range_rel_9
38+
-> Seq Scan on range_rel_10

Diff for: specs/rollback_on_create_partitions.spec

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
setup
2+
{
3+
CREATE EXTENSION pg_pathman;
4+
CREATE TABLE range_rel(id serial primary key);
5+
}
6+
7+
teardown
8+
{
9+
SELECT drop_range_partitions('range_rel');
10+
DROP TABLE range_rel CASCADE;
11+
DROP EXTENSION pg_pathman;
12+
}
13+
14+
session "s1"
15+
step "begin" { BEGIN; }
16+
step "rollback" { ROLLBACK; }
17+
step "commit" { COMMIT; }
18+
step "insert_data" { INSERT INTO range_rel SELECT generate_series(1, 10000); }
19+
step "create_partitions" { SELECT create_range_partitions('range_rel', 'id', 1, 1000); }
20+
step "show_me_what_you_got" { EXPLAIN (COSTS OFF) SELECT * FROM range_rel; }
21+
22+
permutation "begin" "insert_data" "create_partitions" "rollback" "show_me_what_you_got"
23+
permutation "begin" "insert_data" "create_partitions" "commit" "show_me_what_you_got"

0 commit comments

Comments
 (0)