Skip to content

Commit 78a295a

Browse files
committed
Add more tests related with #87 issue
1 parent 9a354ad commit 78a295a

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

expected/pathman_utility_stmt.out

+26-1
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,33 @@ SELECT * FROM copy_stmt_hooking.test ORDER BY val;
256256
6 | hash_2 | 0 | 0
257257
(2 rows)
258258

259+
/* Check dropped colums before partitioning */
260+
CREATE TABLE copy_stmt_hooking.test2 (
261+
a varchar(50),
262+
b varchar(50),
263+
t timestamp without time zone not null
264+
);
265+
ALTER TABLE copy_stmt_hooking.test2 DROP COLUMN a;
266+
SELECT create_range_partitions('copy_stmt_hooking.test2',
267+
't',
268+
'2017-01-01 00:00:00'::timestamp,
269+
interval '1 hour', 5, false
270+
);
271+
NOTICE: sequence "test2_seq" does not exist, skipping
272+
create_range_partitions
273+
-------------------------
274+
5
275+
(1 row)
276+
277+
COPY copy_stmt_hooking.test2(t) FROM stdin;
278+
SELECT COUNT(*) FROM copy_stmt_hooking.test2;
279+
count
280+
-------
281+
1
282+
(1 row)
283+
259284
DROP SCHEMA copy_stmt_hooking CASCADE;
260-
NOTICE: drop cascades to 7 other objects
285+
NOTICE: drop cascades to 798 other objects
261286
/*
262287
* Test auto check constraint renaming
263288
*/

sql/pathman_utility_stmt.sql

+17
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,23 @@ COPY copy_stmt_hooking.test FROM stdin;
139139
SELECT count(*) FROM ONLY copy_stmt_hooking.test;
140140
SELECT * FROM copy_stmt_hooking.test ORDER BY val;
141141

142+
/* Check dropped colums before partitioning */
143+
CREATE TABLE copy_stmt_hooking.test2 (
144+
a varchar(50),
145+
b varchar(50),
146+
t timestamp without time zone not null
147+
);
148+
ALTER TABLE copy_stmt_hooking.test2 DROP COLUMN a;
149+
SELECT create_range_partitions('copy_stmt_hooking.test2',
150+
't',
151+
'2017-01-01 00:00:00'::timestamp,
152+
interval '1 hour', 5, false
153+
);
154+
COPY copy_stmt_hooking.test2(t) FROM stdin;
155+
2017-02-02 20:00:00
156+
\.
157+
SELECT COUNT(*) FROM copy_stmt_hooking.test2;
158+
142159
DROP SCHEMA copy_stmt_hooking CASCADE;
143160

144161

0 commit comments

Comments
 (0)