Teach partitioning tests not to use DROP TABLE ... CASCADE.

This occasionally causes failures; the order in which the affected
objects are listed is not 100% consistent.

Amit Langote
This commit is contained in:
Robert Haas 2017-01-19 14:15:40 -05:00
parent cc144155f7
commit c397814953
4 changed files with 26 additions and 50 deletions

View File

@ -3330,15 +3330,10 @@ ALTER TABLE list_parted2 DROP COLUMN b;
ERROR: cannot drop column named in partition key ERROR: cannot drop column named in partition key
ALTER TABLE list_parted2 ALTER COLUMN b TYPE text; ALTER TABLE list_parted2 ALTER COLUMN b TYPE text;
ERROR: cannot alter type of column named in partition key ERROR: cannot alter type of column named in partition key
-- cleanup -- cleanup: avoid using CASCADE
DROP TABLE list_parted, list_parted2, range_parted CASCADE; DROP TABLE list_parted, part_1;
NOTICE: drop cascades to 6 other objects DROP TABLE list_parted2, part_2, part_5, part_5_a;
DETAIL: drop cascades to table part1 DROP TABLE range_parted, part1, part2;
drop cascades to table part2
drop cascades to table part_2
drop cascades to table part_5
drop cascades to table part_5_a
drop cascades to table part_1
-- more tests for certain multi-level partitioning scenarios -- more tests for certain multi-level partitioning scenarios
create table p (a int, b int) partition by range (a, b); create table p (a int, b int) partition by range (a, b);
create table p1 (b int, a int not null) partition by range (b); create table p1 (b int, a int not null) partition by range (b);
@ -3367,6 +3362,5 @@ insert into p1 (a, b) values (2, 3);
-- check that partition validation scan correctly detects violating rows -- check that partition validation scan correctly detects violating rows
alter table p attach partition p1 for values from (1, 2) to (1, 10); alter table p attach partition p1 for values from (1, 2) to (1, 10);
ERROR: partition constraint is violated by some row ERROR: partition constraint is violated by some row
-- cleanup -- cleanup: avoid using CASCADE
drop table p, p1 cascade; drop table p, p1, p11;
NOTICE: drop cascades to table p11

View File

@ -651,30 +651,10 @@ Check constraints:
"check_a" CHECK (length(a) > 0) "check_a" CHECK (length(a) > 0)
Number of partitions: 3 (Use \d+ to list them.) Number of partitions: 3 (Use \d+ to list them.)
-- partitions cannot be dropped directly -- cleanup: avoid using CASCADE
DROP TABLE part_a; DROP TABLE parted, part_a, part_b, part_c, part_c_1_10;
-- need to specify CASCADE to drop partitions along with the parent DROP TABLE list_parted, part_1, part_2, part_null;
DROP TABLE parted; DROP TABLE range_parted;
ERROR: cannot drop table parted because other objects depend on it DROP TABLE list_parted2, part_ab, part_null_z;
DETAIL: table part_b depends on table parted DROP TABLE range_parted2, part0, part1, part2, part3;
table part_c depends on table parted DROP TABLE range_parted3, part00, part10, part11, part12;
table part_c_1_10 depends on table part_c
HINT: Use DROP ... CASCADE to drop the dependent objects too.
DROP TABLE parted, list_parted, range_parted, list_parted2, range_parted2, range_parted3 CASCADE;
NOTICE: drop cascades to 16 other objects
DETAIL: drop cascades to table part00
drop cascades to table part10
drop cascades to table part11
drop cascades to table part12
drop cascades to table part0
drop cascades to table part1
drop cascades to table part2
drop cascades to table part3
drop cascades to table part_null_z
drop cascades to table part_ab
drop cascades to table part_1
drop cascades to table part_2
drop cascades to table part_null
drop cascades to table part_b
drop cascades to table part_c
drop cascades to table part_c_1_10

View File

@ -2189,8 +2189,10 @@ ALTER TABLE part_2 INHERIT inh_test;
ALTER TABLE list_parted2 DROP COLUMN b; ALTER TABLE list_parted2 DROP COLUMN b;
ALTER TABLE list_parted2 ALTER COLUMN b TYPE text; ALTER TABLE list_parted2 ALTER COLUMN b TYPE text;
-- cleanup -- cleanup: avoid using CASCADE
DROP TABLE list_parted, list_parted2, range_parted CASCADE; DROP TABLE list_parted, part_1;
DROP TABLE list_parted2, part_2, part_5, part_5_a;
DROP TABLE range_parted, part1, part2;
-- more tests for certain multi-level partitioning scenarios -- more tests for certain multi-level partitioning scenarios
create table p (a int, b int) partition by range (a, b); create table p (a int, b int) partition by range (a, b);
@ -2215,5 +2217,5 @@ insert into p1 (a, b) values (2, 3);
-- check that partition validation scan correctly detects violating rows -- check that partition validation scan correctly detects violating rows
alter table p attach partition p1 for values from (1, 2) to (1, 10); alter table p attach partition p1 for values from (1, 2) to (1, 10);
-- cleanup -- cleanup: avoid using CASCADE
drop table p, p1 cascade; drop table p, p1, p11;

View File

@ -585,10 +585,10 @@ CREATE TABLE part_c_1_10 PARTITION OF part_c FOR VALUES FROM (1) TO (10);
-- returned. -- returned.
\d parted \d parted
-- partitions cannot be dropped directly -- cleanup: avoid using CASCADE
DROP TABLE part_a; DROP TABLE parted, part_a, part_b, part_c, part_c_1_10;
DROP TABLE list_parted, part_1, part_2, part_null;
-- need to specify CASCADE to drop partitions along with the parent DROP TABLE range_parted;
DROP TABLE parted; DROP TABLE list_parted2, part_ab, part_null_z;
DROP TABLE range_parted2, part0, part1, part2, part3;
DROP TABLE parted, list_parted, range_parted, list_parted2, range_parted2, range_parted3 CASCADE; DROP TABLE range_parted3, part00, part10, part11, part12;