Skip to content

Commit c31e9d4

Browse files
committed
Improve error message when skipping scan of default partition.
It seems like a good idea to clearly distinguish between skipping the scan of the new partition itself and skipping the scan of the default partition. Amit Langote Discussion: http://postgr.es/m/1f08b844-0078-aa8d-452e-7af3bf77d05f@lab.ntt.co.jp
1 parent e9baa5e commit c31e9d4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/backend/commands/tablecmds.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13635,9 +13635,14 @@ ValidatePartitionConstraints(List **wqueue, Relation scanrel,
1363513635
*/
1363613636
if (PartConstraintImpliedByRelConstraint(scanrel, partConstraint))
1363713637
{
13638-
ereport(INFO,
13639-
(errmsg("partition constraint for table \"%s\" is implied by existing constraints",
13640-
RelationGetRelationName(scanrel))));
13638+
if (!validate_default)
13639+
ereport(INFO,
13640+
(errmsg("partition constraint for table \"%s\" is implied by existing constraints",
13641+
RelationGetRelationName(scanrel))));
13642+
else
13643+
ereport(INFO,
13644+
(errmsg("updated partition constraint for default partition \"%s\" is implied by existing constraints",
13645+
RelationGetRelationName(scanrel))));
1364113646
return;
1364213647
}
1364313648

src/test/regress/expected/alter_table.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3436,7 +3436,7 @@ ALTER TABLE part_7 ATTACH PARTITION part_7_a_null FOR VALUES IN ('a', null);
34363436
INFO: partition constraint for table "part_7_a_null" is implied by existing constraints
34373437
ALTER TABLE list_parted2 ATTACH PARTITION part_7 FOR VALUES IN (7);
34383438
INFO: partition constraint for table "part_7" is implied by existing constraints
3439-
INFO: partition constraint for table "list_parted2_def" is implied by existing constraints
3439+
INFO: updated partition constraint for default partition "list_parted2_def" is implied by existing constraints
34403440
-- Same example, but check this time that the constraint correctly detects
34413441
-- violating rows
34423442
ALTER TABLE list_parted2 DETACH PARTITION part_7;
@@ -3450,7 +3450,7 @@ SELECT tableoid::regclass, a, b FROM part_7 order by a;
34503450
(2 rows)
34513451

34523452
ALTER TABLE list_parted2 ATTACH PARTITION part_7 FOR VALUES IN (7);
3453-
INFO: partition constraint for table "list_parted2_def" is implied by existing constraints
3453+
INFO: updated partition constraint for default partition "list_parted2_def" is implied by existing constraints
34543454
ERROR: partition constraint is violated by some row
34553455
-- check that leaf partitions of default partition are scanned when
34563456
-- attaching a partitioned table.

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