I wonder if the following error detail text could say more than it does
currently for the following rather artificial example case:
CREATE TABLE p1(a char(3));
CREATE TABLE p2(a char(2));
CREATE TABLE c(d int) INHERITS (p1, p2);
NOTICE: merging multiple inherited definitions of column "a"
ERROR: inherited column "a" has a type conflict
DETAIL: character versus character
Any specific reason why it doesn't spell out typmods in the above detail
message?
I managed to get the following with the attached:
CREATE TABLE c(a int) INHERITS (p1, p2);
NOTICE: merging multiple inherited definitions of column "a"
ERROR: inherited column "a" has a type conflict
DETAIL: character(3) versus character(2)
CREATE TABLE c(a int) INHERITS (p1);
NOTICE: merging column "a" with inherited definition
ERROR: column "a" has a type conflict
DETAIL: character(3) versus integer
Thoughts?
Thanks,
Amit
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 56fed4d..99aa759 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -1613,8 +1613,9 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
errmsg("inherited column \"%s\" has a type conflict",
attributeName),
errdetail("%s versus %s",
- TypeNameToString(def->typeName),
- format_type_be(attribute->atttypid))));
+ format_type_with_typemod(defTypeId, deftypmod),
+ format_type_with_typemod(attribute->atttypid,
+ attribute->atttypmod))));
defCollId = GetColumnDefCollation(NULL, def, defTypeId);
if (defCollId != attribute->attcollation)
ereport(ERROR,
@@ -1832,8 +1833,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
errmsg("column \"%s\" has a type conflict",
attributeName),
errdetail("%s versus %s",
- TypeNameToString(def->typeName),
- TypeNameToString(newdef->typeName))));
+ format_type_with_typemod(defTypeId, deftypmod),
+ format_type_with_typemod(newTypeId, newtypmod))));
defcollid = GetColumnDefCollation(NULL, def, defTypeId);
newcollid = GetColumnDefCollation(NULL, newdef, newTypeId);
if (defcollid != newcollid)
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers