On 2016/12/20 12:59, Robert Haas wrote: > On Sun, Dec 18, 2016 at 10:00 PM, Amit Langote > <langote_amit...@lab.ntt.co.jp> wrote: >> Here are updated patches including the additional information. > > Thanks. Committed 0001. Will have to review the others when I'm less tired.
Thanks! > BTW, elog() is only supposed to be used for can't happen error > messages; when it is used, no translation is done. So this is wrong: > > if (skip_validate) > elog(NOTICE, "skipping scan to validate partition constraint"); You're right. I was using it for debugging when I first wrote that code, but then thought it would be better to eventually turn that into ereport(INFO/NOTICE) for the final submission, which I missed to do. Sorry about that. Here's a patch. Thanks, Amit
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 1c219b03dd..6a179596ce 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -13297,8 +13297,10 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd) } } + /* It's safe to skip the validation scan after all */ if (skip_validate) - elog(NOTICE, "skipping scan to validate partition constraint"); + ereport(INFO, + (errmsg("skipping scan to validate partition constraint"))); /* * Set up to have the table to be scanned to validate the partition diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 99e20eb922..2a324c0b49 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -3179,7 +3179,7 @@ ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4); ALTER TABLE list_parted2 DETACH PARTITION part_3_4; ALTER TABLE part_3_4 ALTER a SET NOT NULL; ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4); -NOTICE: skipping scan to validate partition constraint +INFO: skipping scan to validate partition constraint -- check validation when attaching range partitions CREATE TABLE range_parted ( a int, @@ -3204,7 +3204,7 @@ CREATE TABLE part2 ( b int NOT NULL CHECK (b >= 10 AND b < 18) ); ALTER TABLE range_parted ATTACH PARTITION part2 FOR VALUES FROM (1, 10) TO (1, 20); -NOTICE: skipping scan to validate partition constraint +INFO: skipping scan to validate partition constraint -- check that leaf partitions are scanned when attaching a partitioned -- table CREATE TABLE part_5 ( @@ -3219,7 +3219,7 @@ ERROR: partition constraint is violated by some row DELETE FROM part_5_a WHERE a NOT IN (3); ALTER TABLE part_5 ADD CONSTRAINT check_a CHECK (a IN (5)), ALTER a SET NOT NULL; ALTER TABLE list_parted2 ATTACH PARTITION part_5 FOR VALUES IN (5); -NOTICE: skipping scan to validate partition constraint +INFO: skipping scan to validate partition constraint -- check that the table being attached is not already a partition ALTER TABLE list_parted2 ATTACH PARTITION part_2 FOR VALUES IN (2); ERROR: "part_2" is already a partition
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers