Fix inconsistencies in error messages
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 9 May 2024 11:31:22 +0000 (13:31 +0200)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 9 May 2024 11:31:22 +0000 (13:31 +0200)
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

src/backend/catalog/pg_constraint.c
src/backend/commands/tablecmds.c
src/bin/pg_dump/common.c
src/bin/pg_dump/pg_dump.c
src/test/regress/expected/inherit.out

index 6b8496e0850ff0a7591f48256551c5e0ae07ca7e..12a73d5a30918c541e22041a37de5439fc9d1440 100644 (file)
@@ -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;
index 5bf5e69c5b8a8750f352f07a1e9c2247997ac94d..925978c35b93727f89b32f944a8a45791e86f759 100644 (file)
@@ -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
index c7dd0b11fd272cbc4d7d515f0d0900918cde7fb0..ba53c66098a380db1f1a8449b7f7c12e4de90c1d 100644 (file)
@@ -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
index 379debac24a05c520bb02eb65b6471257e84327b..5f005a2f14057ebc42f5f962bb5d24900141af15 100644 (file)
@@ -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.
     */
index eaa65049c7b1b18724bb5587c0fa42275091e951..a621db0aa3dacca02c9bf82260b39a2735771059 100644 (file)
@@ -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