aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/typecmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-09-29 17:18:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-09-29 17:18:58 +0000
commit34b44c3ba29a3d3b3e33322118a01b76e6fd2cfd (patch)
treea913a47f85c7864ec56ec4639b92f0485e4f6c58 /src/backend/commands/typecmds.c
parente6022e7470775be7129b2c4d1e5c05aa88eede5d (diff)
downloadpostgresql-34b44c3ba29a3d3b3e33322118a01b76e6fd2cfd.tar.gz
postgresql-34b44c3ba29a3d3b3e33322118a01b76e6fd2cfd.zip
Improve consistency of the error messages generated when you try to use
ALTER TABLE on a composite type or ALTER TYPE on a table's rowtype. We already rejected these cases, but the error messages were a bit random and didn't always provide a HINT to use the other command type.
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r--src/backend/commands/typecmds.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 3550d00f078..75a8b7530e8 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.107 2007/09/04 16:41:42 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.108 2007/09/29 17:18:58 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -2355,8 +2355,9 @@ AlterTypeOwner(List *names, Oid newOwnerId)
get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("\"%s\" is a table's row type",
- TypeNameToString(typename))));
+ errmsg("%s is a table's row type",
+ format_type_be(typeOid)),
+ errhint("Use ALTER TABLE instead.")));
/* don't allow direct alteration of array types, either */
if (OidIsValid(typTup->typelem) &&
@@ -2592,7 +2593,7 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("%s is a table's row type",
format_type_be(typeOid)),
- errhint("Use ALTER TABLE SET SCHEMA instead.")));
+ errhint("Use ALTER TABLE instead.")));
/* OK, modify the pg_type row */