Skip to content

Commit cd510f0

Browse files
committed
Convert elog() to ereport() and do some wordsmithing.
It's not entirely clear that we should log a message here at all, but it's certainly wrong to use elog() for a message that should clearly be translatable. Amit Langote
1 parent 1fc5c49 commit cd510f0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/backend/commands/tablecmds.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -13297,8 +13297,11 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
1329713297
}
1329813298
}
1329913299

13300+
/* It's safe to skip the validation scan after all */
1330013301
if (skip_validate)
13301-
elog(NOTICE, "skipping scan to validate partition constraint");
13302+
ereport(INFO,
13303+
(errmsg("partition constraint for table \"%s\" is implied by existing constraints",
13304+
RelationGetRelationName(attachRel))));
1330213305

1330313306
/*
1330413307
* Set up to have the table to be scanned to validate the partition

src/test/regress/expected/alter_table.out

+3-3
Original file line numberDiff line numberDiff line change
@@ -3179,7 +3179,7 @@ ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4);
31793179
ALTER TABLE list_parted2 DETACH PARTITION part_3_4;
31803180
ALTER TABLE part_3_4 ALTER a SET NOT NULL;
31813181
ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4);
3182-
NOTICE: skipping scan to validate partition constraint
3182+
INFO: partition constraint for table "part_3_4" is implied by existing constraints
31833183
-- check validation when attaching range partitions
31843184
CREATE TABLE range_parted (
31853185
a int,
@@ -3204,7 +3204,7 @@ CREATE TABLE part2 (
32043204
b int NOT NULL CHECK (b >= 10 AND b < 18)
32053205
);
32063206
ALTER TABLE range_parted ATTACH PARTITION part2 FOR VALUES FROM (1, 10) TO (1, 20);
3207-
NOTICE: skipping scan to validate partition constraint
3207+
INFO: partition constraint for table "part2" is implied by existing constraints
32083208
-- check that leaf partitions are scanned when attaching a partitioned
32093209
-- table
32103210
CREATE TABLE part_5 (
@@ -3219,7 +3219,7 @@ ERROR: partition constraint is violated by some row
32193219
DELETE FROM part_5_a WHERE a NOT IN (3);
32203220
ALTER TABLE part_5 ADD CONSTRAINT check_a CHECK (a IN (5)), ALTER a SET NOT NULL;
32213221
ALTER TABLE list_parted2 ATTACH PARTITION part_5 FOR VALUES IN (5);
3222-
NOTICE: skipping scan to validate partition constraint
3222+
INFO: partition constraint for table "part_5" is implied by existing constraints
32233223
-- check that the table being attached is not already a partition
32243224
ALTER TABLE list_parted2 ATTACH PARTITION part_2 FOR VALUES IN (2);
32253225
ERROR: "part_2" is already a partition

0 commit comments

Comments
 (0)