Skip to content

Commit 12c86af

Browse files
committed
add a few more tests regarding #134
1 parent feb4463 commit 12c86af

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

Diff for: expected/pathman_inserts.out

+30
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,36 @@ INSERT INTO test_inserts.test_gap VALUES(15); /* not ok */
10321032
ERROR: cannot spawn a partition
10331033
DROP TABLE test_inserts.test_gap CASCADE;
10341034
NOTICE: drop cascades to 3 other objects
1035+
/* test a few "special" ONLY queries used in pg_repack */
1036+
CREATE TABLE test_inserts.test_special_only(val INT NOT NULL);
1037+
INSERT INTO test_inserts.test_special_only SELECT generate_series(1, 30);
1038+
SELECT create_hash_partitions('test_inserts.test_special_only', 'val', 4);
1039+
create_hash_partitions
1040+
------------------------
1041+
4
1042+
(1 row)
1043+
1044+
/* create table as select only */
1045+
CREATE TABLE test_inserts.special_1 AS SELECT * FROM ONLY test_inserts.test_special_only;
1046+
SELECT count(*) FROM test_inserts.special_1;
1047+
count
1048+
-------
1049+
0
1050+
(1 row)
1051+
1052+
DROP TABLE test_inserts.special_1;
1053+
/* insert into ... select only */
1054+
CREATE TABLE test_inserts.special_2 AS SELECT * FROM ONLY test_inserts.test_special_only WITH NO DATA;
1055+
INSERT INTO test_inserts.special_2 SELECT * FROM ONLY test_inserts.test_special_only;
1056+
SELECT count(*) FROM test_inserts.special_2;
1057+
count
1058+
-------
1059+
0
1060+
(1 row)
1061+
1062+
DROP TABLE test_inserts.special_2;
1063+
DROP TABLE test_inserts.test_special_only CASCADE;
1064+
NOTICE: drop cascades to 4 other objects
10351065
DROP SCHEMA test_inserts CASCADE;
10361066
NOTICE: drop cascades to 19 other objects
10371067
DROP EXTENSION pg_pathman CASCADE;

Diff for: expected/pathman_inserts_1.out

+30
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,36 @@ INSERT INTO test_inserts.test_gap VALUES(15); /* not ok */
10321032
ERROR: cannot spawn a partition
10331033
DROP TABLE test_inserts.test_gap CASCADE;
10341034
NOTICE: drop cascades to 3 other objects
1035+
/* test a few "special" ONLY queries used in pg_repack */
1036+
CREATE TABLE test_inserts.test_special_only(val INT NOT NULL);
1037+
INSERT INTO test_inserts.test_special_only SELECT generate_series(1, 30);
1038+
SELECT create_hash_partitions('test_inserts.test_special_only', 'val', 4);
1039+
create_hash_partitions
1040+
------------------------
1041+
4
1042+
(1 row)
1043+
1044+
/* create table as select only */
1045+
CREATE TABLE test_inserts.special_1 AS SELECT * FROM ONLY test_inserts.test_special_only;
1046+
SELECT count(*) FROM test_inserts.special_1;
1047+
count
1048+
-------
1049+
0
1050+
(1 row)
1051+
1052+
DROP TABLE test_inserts.special_1;
1053+
/* insert into ... select only */
1054+
CREATE TABLE test_inserts.special_2 AS SELECT * FROM ONLY test_inserts.test_special_only WITH NO DATA;
1055+
INSERT INTO test_inserts.special_2 SELECT * FROM ONLY test_inserts.test_special_only;
1056+
SELECT count(*) FROM test_inserts.special_2;
1057+
count
1058+
-------
1059+
0
1060+
(1 row)
1061+
1062+
DROP TABLE test_inserts.special_2;
1063+
DROP TABLE test_inserts.test_special_only CASCADE;
1064+
NOTICE: drop cascades to 4 other objects
10351065
DROP SCHEMA test_inserts CASCADE;
10361066
NOTICE: drop cascades to 19 other objects
10371067
DROP EXTENSION pg_pathman CASCADE;

Diff for: sql/pathman_inserts.sql

+19
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,24 @@ INSERT INTO test_inserts.test_gap VALUES(15); /* not ok */
199199
DROP TABLE test_inserts.test_gap CASCADE;
200200

201201

202+
/* test a few "special" ONLY queries used in pg_repack */
203+
CREATE TABLE test_inserts.test_special_only(val INT NOT NULL);
204+
INSERT INTO test_inserts.test_special_only SELECT generate_series(1, 30);
205+
SELECT create_hash_partitions('test_inserts.test_special_only', 'val', 4);
206+
207+
/* create table as select only */
208+
CREATE TABLE test_inserts.special_1 AS SELECT * FROM ONLY test_inserts.test_special_only;
209+
SELECT count(*) FROM test_inserts.special_1;
210+
DROP TABLE test_inserts.special_1;
211+
212+
/* insert into ... select only */
213+
CREATE TABLE test_inserts.special_2 AS SELECT * FROM ONLY test_inserts.test_special_only WITH NO DATA;
214+
INSERT INTO test_inserts.special_2 SELECT * FROM ONLY test_inserts.test_special_only;
215+
SELECT count(*) FROM test_inserts.special_2;
216+
DROP TABLE test_inserts.special_2;
217+
218+
DROP TABLE test_inserts.test_special_only CASCADE;
219+
220+
202221
DROP SCHEMA test_inserts CASCADE;
203222
DROP EXTENSION pg_pathman CASCADE;

0 commit comments

Comments
 (0)