mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
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
This commit is contained in:
parent
e305f71565
commit
21ac38f498
@ -758,7 +758,7 @@ AdjustNotNullInheritance1(Oid relid, AttrNumber attnum, int count,
|
|||||||
if (!allow_noinherit_change)
|
if (!allow_noinherit_change)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
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)));
|
NameStr(conform->conname), get_rel_name(relid)));
|
||||||
|
|
||||||
conform->connoinherit = false;
|
conform->connoinherit = false;
|
||||||
|
@ -7905,11 +7905,10 @@ ATExecSetNotNull(List **wqueue, Relation rel, char *conName, char *colName,
|
|||||||
if (conForm->connoinherit && recurse)
|
if (conForm->connoinherit && recurse)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
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),
|
NameStr(conForm->conname),
|
||||||
RelationGetRelationName(rel)));
|
RelationGetRelationName(rel)));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we find an appropriate constraint, we're almost done, but just
|
* If we find an appropriate constraint, we're almost done, but just
|
||||||
* need to change some properties on it: if we're recursing, increment
|
* need to change some properties on it: if we're recursing, increment
|
||||||
|
@ -478,7 +478,7 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
|
|||||||
* What we need to do here is:
|
* What we need to do here is:
|
||||||
*
|
*
|
||||||
* - Detect child columns that inherit NOT NULL bits from their parents, so
|
* - 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.)
|
* longer need this.)
|
||||||
*
|
*
|
||||||
* - Detect child columns that have DEFAULT NULL when their parents had some
|
* - Detect child columns that have DEFAULT NULL when their parents had some
|
||||||
|
@ -8864,7 +8864,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables)
|
|||||||
tbloids->data);
|
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
|
* entries. Also, we need to know if the NOT NULL for each column is
|
||||||
* backing a primary key.
|
* backing a primary key.
|
||||||
*/
|
*/
|
||||||
|
@ -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_parent (a int, NOT NULL a NO INHERIT);
|
||||||
CREATE TABLE inh_nn_child() INHERITS (inh_nn_parent);
|
CREATE TABLE inh_nn_child() INHERITS (inh_nn_parent);
|
||||||
ALTER TABLE inh_nn_parent ADD CONSTRAINT nna NOT NULL a;
|
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;
|
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;
|
DROP TABLE inh_nn_parent cascade;
|
||||||
NOTICE: drop cascades to table inh_nn_child
|
NOTICE: drop cascades to table inh_nn_child
|
||||||
-- Adding a PK at the top level of a hierarchy should cause all descendants
|
-- Adding a PK at the top level of a hierarchy should cause all descendants
|
||||||
|
Loading…
x
Reference in New Issue
Block a user