Skip to content

Commit c397814

Browse files
committed
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
1 parent cc14415 commit c397814

File tree

4 files changed

+26
-50
lines changed

4 files changed

+26
-50
lines changed

src/test/regress/expected/alter_table.out

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3330,15 +3330,10 @@ ALTER TABLE list_parted2 DROP COLUMN b;
33303330
ERROR: cannot drop column named in partition key
33313331
ALTER TABLE list_parted2 ALTER COLUMN b TYPE text;
33323332
ERROR: cannot alter type of column named in partition key
3333-
-- cleanup
3334-
DROP TABLE list_parted, list_parted2, range_parted CASCADE;
3335-
NOTICE: drop cascades to 6 other objects
3336-
DETAIL: drop cascades to table part1
3337-
drop cascades to table part2
3338-
drop cascades to table part_2
3339-
drop cascades to table part_5
3340-
drop cascades to table part_5_a
3341-
drop cascades to table part_1
3333+
-- cleanup: avoid using CASCADE
3334+
DROP TABLE list_parted, part_1;
3335+
DROP TABLE list_parted2, part_2, part_5, part_5_a;
3336+
DROP TABLE range_parted, part1, part2;
33423337
-- more tests for certain multi-level partitioning scenarios
33433338
create table p (a int, b int) partition by range (a, b);
33443339
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);
33673362
-- check that partition validation scan correctly detects violating rows
33683363
alter table p attach partition p1 for values from (1, 2) to (1, 10);
33693364
ERROR: partition constraint is violated by some row
3370-
-- cleanup
3371-
drop table p, p1 cascade;
3372-
NOTICE: drop cascades to table p11
3365+
-- cleanup: avoid using CASCADE
3366+
drop table p, p1, p11;

src/test/regress/expected/create_table.out

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -651,30 +651,10 @@ Check constraints:
651651
"check_a" CHECK (length(a) > 0)
652652
Number of partitions: 3 (Use \d+ to list them.)
653653

654-
-- partitions cannot be dropped directly
655-
DROP TABLE part_a;
656-
-- need to specify CASCADE to drop partitions along with the parent
657-
DROP TABLE parted;
658-
ERROR: cannot drop table parted because other objects depend on it
659-
DETAIL: table part_b depends on table parted
660-
table part_c depends on table parted
661-
table part_c_1_10 depends on table part_c
662-
HINT: Use DROP ... CASCADE to drop the dependent objects too.
663-
DROP TABLE parted, list_parted, range_parted, list_parted2, range_parted2, range_parted3 CASCADE;
664-
NOTICE: drop cascades to 16 other objects
665-
DETAIL: drop cascades to table part00
666-
drop cascades to table part10
667-
drop cascades to table part11
668-
drop cascades to table part12
669-
drop cascades to table part0
670-
drop cascades to table part1
671-
drop cascades to table part2
672-
drop cascades to table part3
673-
drop cascades to table part_null_z
674-
drop cascades to table part_ab
675-
drop cascades to table part_1
676-
drop cascades to table part_2
677-
drop cascades to table part_null
678-
drop cascades to table part_b
679-
drop cascades to table part_c
680-
drop cascades to table part_c_1_10
654+
-- cleanup: avoid using CASCADE
655+
DROP TABLE parted, part_a, part_b, part_c, part_c_1_10;
656+
DROP TABLE list_parted, part_1, part_2, part_null;
657+
DROP TABLE range_parted;
658+
DROP TABLE list_parted2, part_ab, part_null_z;
659+
DROP TABLE range_parted2, part0, part1, part2, part3;
660+
DROP TABLE range_parted3, part00, part10, part11, part12;

src/test/regress/sql/alter_table.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,8 +2189,10 @@ ALTER TABLE part_2 INHERIT inh_test;
21892189
ALTER TABLE list_parted2 DROP COLUMN b;
21902190
ALTER TABLE list_parted2 ALTER COLUMN b TYPE text;
21912191

2192-
-- cleanup
2193-
DROP TABLE list_parted, list_parted2, range_parted CASCADE;
2192+
-- cleanup: avoid using CASCADE
2193+
DROP TABLE list_parted, part_1;
2194+
DROP TABLE list_parted2, part_2, part_5, part_5_a;
2195+
DROP TABLE range_parted, part1, part2;
21942196

21952197
-- more tests for certain multi-level partitioning scenarios
21962198
create table p (a int, b int) partition by range (a, b);
@@ -2215,5 +2217,5 @@ insert into p1 (a, b) values (2, 3);
22152217
-- check that partition validation scan correctly detects violating rows
22162218
alter table p attach partition p1 for values from (1, 2) to (1, 10);
22172219

2218-
-- cleanup
2219-
drop table p, p1 cascade;
2220+
-- cleanup: avoid using CASCADE
2221+
drop table p, p1, p11;

src/test/regress/sql/create_table.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,10 @@ CREATE TABLE part_c_1_10 PARTITION OF part_c FOR VALUES FROM (1) TO (10);
585585
-- returned.
586586
\d parted
587587

588-
-- partitions cannot be dropped directly
589-
DROP TABLE part_a;
590-
591-
-- need to specify CASCADE to drop partitions along with the parent
592-
DROP TABLE parted;
593-
594-
DROP TABLE parted, list_parted, range_parted, list_parted2, range_parted2, range_parted3 CASCADE;
588+
-- cleanup: avoid using CASCADE
589+
DROP TABLE parted, part_a, part_b, part_c, part_c_1_10;
590+
DROP TABLE list_parted, part_1, part_2, part_null;
591+
DROP TABLE range_parted;
592+
DROP TABLE list_parted2, part_ab, part_null_z;
593+
DROP TABLE range_parted2, part0, part1, part2, part3;
594+
DROP TABLE range_parted3, part00, part10, part11, part12;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy