Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21ac38f

Browse files
committed
Fix inconsistencies in error messages
Reported by Kyotaro Horiguchi Also some comments mentioning wrong version numbers, spotted by Justin Pryzby. Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/Zh0aAH7tbZb-9HbC@pryzbyj2023
1 parent e305f71 commit 21ac38f

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

src/backend/catalog/pg_constraint.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ AdjustNotNullInheritance1(Oid relid, AttrNumber attnum, int count,
758758
if (!allow_noinherit_change)
759759
ereport(ERROR,
760760
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
761-
errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" in relation \"%s\"",
761+
errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" on relation \"%s\"",
762762
NameStr(conform->conname), get_rel_name(relid)));
763763

764764
conform->connoinherit = false;

src/backend/commands/tablecmds.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -7905,11 +7905,10 @@ ATExecSetNotNull(List **wqueue, Relation rel, char *conName, char *colName,
79057905
if (conForm->connoinherit && recurse)
79067906
ereport(ERROR,
79077907
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
7908-
errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" in relation \"%s\"",
7908+
errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" on relation \"%s\"",
79097909
NameStr(conForm->conname),
79107910
RelationGetRelationName(rel)));
79117911

7912-
79137912
/*
79147913
* If we find an appropriate constraint, we're almost done, but just
79157914
* need to change some properties on it: if we're recursing, increment

src/bin/pg_dump/common.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
478478
* What we need to do here is:
479479
*
480480
* - Detect child columns that inherit NOT NULL bits from their parents, so
481-
* that we needn't specify that again for the child. (Versions >= 16 no
481+
* that we needn't specify that again for the child. (Versions >= 17 no
482482
* longer need this.)
483483
*
484484
* - Detect child columns that have DEFAULT NULL when their parents had some

src/bin/pg_dump/pg_dump.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8864,7 +8864,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
88648864
tbloids->data);
88658865

88668866
/*
8867-
* In versions 16 and up, we need pg_constraint for explicit NOT NULL
8867+
* In versions 17 and up, we need pg_constraint for explicit NOT NULL
88688868
* entries. Also, we need to know if the NOT NULL for each column is
88698869
* backing a primary key.
88708870
*/

src/test/regress/expected/inherit.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -2280,9 +2280,9 @@ drop table inh_nn_parent, inh_nn_child, inh_nn_child2;
22802280
CREATE TABLE inh_nn_parent (a int, NOT NULL a NO INHERIT);
22812281
CREATE TABLE inh_nn_child() INHERITS (inh_nn_parent);
22822282
ALTER TABLE inh_nn_parent ADD CONSTRAINT nna NOT NULL a;
2283-
ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" in relation "inh_nn_parent"
2283+
ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" on relation "inh_nn_parent"
22842284
ALTER TABLE inh_nn_parent ALTER a SET NOT NULL;
2285-
ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" in relation "inh_nn_parent"
2285+
ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" on relation "inh_nn_parent"
22862286
DROP TABLE inh_nn_parent cascade;
22872287
NOTICE: drop cascades to table inh_nn_child
22882288
-- Adding a PK at the top level of a hierarchy should cause all descendants

0 commit comments

Comments
 (0)