@@ -3,6 +3,7 @@ CREATE EXTENSION pg_pathman;
33CREATE SCHEMA copy_stmt_hooking;
44CREATE TABLE copy_stmt_hooking.test(val int not null, comment text);
55INSERT INTO copy_stmt_hooking.test SELECT generate_series(1, 20), 'comment';
6+ CREATE INDEX ON copy_stmt_hooking.test(val);
67/* test for RANGE partitioning */
78SELECT create_range_partitions('copy_stmt_hooking.test', 'val', 1, 5);
89NOTICE: sequence "test_seq" does not exist, skipping
@@ -12,6 +13,7 @@ NOTICE: sequence "test_seq" does not exist, skipping
1213(1 row)
1314
1415/* perform VACUUM */
16+ VACUUM FULL copy_stmt_hooking.test;
1517VACUUM FULL copy_stmt_hooking.test_1;
1618VACUUM FULL copy_stmt_hooking.test_2;
1719VACUUM FULL copy_stmt_hooking.test_3;
@@ -99,17 +101,33 @@ SELECT *, tableoid::REGCLASS FROM copy_stmt_hooking.test ORDER BY val;
99101 16 | test_4 | copy_stmt_hooking.test_4
100102(5 rows)
101103
102- /* COPY TO (partition does not exist) */
104+ /* COPY TO (partition does not exist, NOT allowed to create partitions) */
105+ SET pg_pathman.enable_auto_partition = OFF;
103106COPY copy_stmt_hooking.test FROM stdin;
104107ERROR: no suitable partition for key '21'
108+ SELECT * FROM copy_stmt_hooking.test WHERE val > 20;
109+ val | comment
110+ -----+---------
111+ (0 rows)
112+
113+ /* COPY TO (partition does not exist, allowed to create partitions) */
114+ SET pg_pathman.enable_auto_partition = ON;
115+ COPY copy_stmt_hooking.test FROM stdin;
116+ SELECT * FROM copy_stmt_hooking.test WHERE val > 20;
117+ val | comment
118+ -----+--------------
119+ 21 | test_no_part
120+ (1 row)
121+
122+ /* COPY TO (partitioned column is not specified) */
105123COPY copy_stmt_hooking.test(comment) FROM stdin;
106124ERROR: partitioned column's value should not be NULL
107125/* delete all data */
108126SELECT drop_partitions('copy_stmt_hooking.test', true);
109127NOTICE: function copy_stmt_hooking.test_upd_trig_func() does not exist, skipping
110128 drop_partitions
111129-----------------
112- 4
130+ 5
113131(1 row)
114132
115133/* test for HASH partitioning */
0 commit comments