Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6c6e05c

Browse files
committed
pathman_inserts: test a gap case
1 parentc0854eb commit6c6e05c

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

‎expected/pathman_inserts.out

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,21 @@ NOTICE: AFTER INSERTION TRIGGER ON TABLE storage_14 HAS EXPIRED. INSERTED ROW:
856856
256 | 128 | test_inserts.storage_14
857857
(27 rows)
858858

859+
/* test gap case (missing partition in between) */
860+
CREATE TABLE test_inserts.test_gap(val INT NOT NULL);
861+
INSERT INTO test_inserts.test_gap SELECT generate_series(1, 30);
862+
SELECT create_range_partitions('test_inserts.test_gap', 'val', 1, 10);
863+
NOTICE: sequence "test_gap_seq" does not exist, skipping
864+
create_range_partitions
865+
-------------------------
866+
3
867+
(1 row)
868+
869+
DROP TABLE test_inserts.test_gap_2; /* make a gap */
870+
INSERT INTO test_inserts.test_gap VALUES(15); /* not ok */
871+
ERROR: cannot spawn a partition
872+
DROP TABLE test_inserts.test_gap CASCADE;
873+
NOTICE: drop cascades to 2 other objects
859874
DROP SCHEMA test_inserts CASCADE;
860-
NOTICE: drop cascades to19 other objects
875+
NOTICE: drop cascades to20 other objects
861876
DROP EXTENSION pg_pathman CASCADE;

‎sql/pathman_inserts.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ FROM generate_series(-2, 130, 5) i
165165
RETURNING e*2, b, tableoid::regclass;
166166

167167

168+
/* test gap case (missing partition in between)*/
169+
CREATETABLEtest_inserts.test_gap(valINTNOT NULL);
170+
INSERT INTOtest_inserts.test_gapSELECT generate_series(1,30);
171+
SELECT create_range_partitions('test_inserts.test_gap','val',1,10);
172+
DROPTABLEtest_inserts.test_gap_2;/* make a gap*/
173+
INSERT INTOtest_inserts.test_gapVALUES(15);/* not ok*/
174+
DROPTABLEtest_inserts.test_gap CASCADE;
175+
168176

169177
DROPSCHEMA test_inserts CASCADE;
170178
DROP EXTENSION pg_pathman CASCADE;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp