diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2024-05-09 13:31:22 +0200 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2024-05-09 13:31:22 +0200 |
commit | 21ac38f498b33f0231842238b83847ec63dfe07b (patch) | |
tree | bb65b9e4b3cc879aa976615f5217fcfeb76ccd53 | |
parent | e305f71565e203e08e47d7094082188f5737317f (diff) | |
download | postgresql-21ac38f498b33f0231842238b83847ec63dfe07b.tar.gz postgresql-21ac38f498b33f0231842238b83847ec63dfe07b.zip |
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/20240507.171724.750916195320223609.horikyota.ntt@gmail.com
Discussion: https://postgr.es/m/Zh0aAH7tbZb-9HbC@pryzbyj2023
-rw-r--r-- | src/backend/catalog/pg_constraint.c | 2 | ||||
-rw-r--r-- | src/backend/commands/tablecmds.c | 3 | ||||
-rw-r--r-- | src/bin/pg_dump/common.c | 2 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 2 | ||||
-rw-r--r-- | src/test/regress/expected/inherit.out | 4 |
5 files changed, 6 insertions, 7 deletions
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c index 6b8496e0850..12a73d5a309 100644 --- a/src/backend/catalog/pg_constraint.c +++ b/src/backend/catalog/pg_constraint.c @@ -758,7 +758,7 @@ AdjustNotNullInheritance1(Oid relid, AttrNumber attnum, int count, if (!allow_noinherit_change) ereport(ERROR, errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" in relation \"%s\"", + errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" on relation \"%s\"", NameStr(conform->conname), get_rel_name(relid))); conform->connoinherit = false; diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 5bf5e69c5b8..925978c35b9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -7905,11 +7905,10 @@ ATExecSetNotNull(List **wqueue, Relation rel, char *conName, char *colName, if (conForm->connoinherit && recurse) ereport(ERROR, errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" in relation \"%s\"", + errmsg("cannot change NO INHERIT status of NOT NULL constraint \"%s\" on relation \"%s\"", NameStr(conForm->conname), RelationGetRelationName(rel))); - /* * If we find an appropriate constraint, we're almost done, but just * need to change some properties on it: if we're recursing, increment diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index c7dd0b11fd2..ba53c66098a 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -478,7 +478,7 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) * What we need to do here is: * * - Detect child columns that inherit NOT NULL bits from their parents, so - * that we needn't specify that again for the child. (Versions >= 16 no + * that we needn't specify that again for the child. (Versions >= 17 no * longer need this.) * * - Detect child columns that have DEFAULT NULL when their parents had some diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 379debac24a..5f005a2f140 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -8864,7 +8864,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) tbloids->data); /* - * In versions 16 and up, we need pg_constraint for explicit NOT NULL + * In versions 17 and up, we need pg_constraint for explicit NOT NULL * entries. Also, we need to know if the NOT NULL for each column is * backing a primary key. */ diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index eaa65049c7b..a621db0aa3d 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -2280,9 +2280,9 @@ drop table inh_nn_parent, inh_nn_child, inh_nn_child2; CREATE TABLE inh_nn_parent (a int, NOT NULL a NO INHERIT); CREATE TABLE inh_nn_child() INHERITS (inh_nn_parent); ALTER TABLE inh_nn_parent ADD CONSTRAINT nna NOT NULL a; -ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" in relation "inh_nn_parent" +ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" on relation "inh_nn_parent" ALTER TABLE inh_nn_parent ALTER a SET NOT NULL; -ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" in relation "inh_nn_parent" +ERROR: cannot change NO INHERIT status of NOT NULL constraint "inh_nn_parent_a_not_null" on relation "inh_nn_parent" DROP TABLE inh_nn_parent cascade; NOTICE: drop cascades to table inh_nn_child -- Adding a PK at the top level of a hierarchy should cause all descendants |