mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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
This commit is contained in:
		@@ -13297,8 +13297,11 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* It's safe to skip the validation scan after all */
 | 
				
			||||||
	if (skip_validate)
 | 
						if (skip_validate)
 | 
				
			||||||
		elog(NOTICE, "skipping scan to validate partition constraint");
 | 
							ereport(INFO,
 | 
				
			||||||
 | 
									(errmsg("partition constraint for table \"%s\" is implied by existing constraints",
 | 
				
			||||||
 | 
											RelationGetRelationName(attachRel))));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Set up to have the table to be scanned to validate the partition
 | 
						 * Set up to have the table to be scanned to validate the partition
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 list_parted2 DETACH PARTITION part_3_4;
 | 
				
			||||||
ALTER TABLE part_3_4 ALTER a SET NOT NULL;
 | 
					ALTER TABLE part_3_4 ALTER a SET NOT NULL;
 | 
				
			||||||
ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4);
 | 
					ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4);
 | 
				
			||||||
NOTICE:  skipping scan to validate partition constraint
 | 
					INFO:  partition constraint for table "part_3_4" is implied by existing constraints
 | 
				
			||||||
-- check validation when attaching range partitions
 | 
					-- check validation when attaching range partitions
 | 
				
			||||||
CREATE TABLE range_parted (
 | 
					CREATE TABLE range_parted (
 | 
				
			||||||
	a int,
 | 
						a int,
 | 
				
			||||||
@@ -3204,7 +3204,7 @@ CREATE TABLE part2 (
 | 
				
			|||||||
	b int NOT NULL CHECK (b >= 10 AND b < 18)
 | 
						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);
 | 
					ALTER TABLE range_parted ATTACH PARTITION part2 FOR VALUES FROM (1, 10) TO (1, 20);
 | 
				
			||||||
NOTICE:  skipping scan to validate partition constraint
 | 
					INFO:  partition constraint for table "part2" is implied by existing constraints
 | 
				
			||||||
-- check that leaf partitions are scanned when attaching a partitioned
 | 
					-- check that leaf partitions are scanned when attaching a partitioned
 | 
				
			||||||
-- table
 | 
					-- table
 | 
				
			||||||
CREATE TABLE part_5 (
 | 
					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);
 | 
					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 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);
 | 
					ALTER TABLE list_parted2 ATTACH PARTITION part_5 FOR VALUES IN (5);
 | 
				
			||||||
NOTICE:  skipping scan to validate partition constraint
 | 
					INFO:  partition constraint for table "part_5" is implied by existing constraints
 | 
				
			||||||
-- check that the table being attached is not already a partition
 | 
					-- check that the table being attached is not already a partition
 | 
				
			||||||
ALTER TABLE list_parted2 ATTACH PARTITION part_2 FOR VALUES IN (2);
 | 
					ALTER TABLE list_parted2 ATTACH PARTITION part_2 FOR VALUES IN (2);
 | 
				
			||||||
ERROR:  "part_2" is already a partition
 | 
					ERROR:  "part_2" is already a partition
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user