mirror of
https://github.com/postgres/postgres.git
synced 2025-12-22 17:42:17 +03:00
Fix error message for COMMENT/SECURITY LABEL ON COLUMN xxx IS 'yyy'
When the column name is an unqualified name, rather than table.column, the error message complains about too many dotted names, which is wrong. Report by Peter Eisentraut based on examination of the sepgsql regression test output, but the problem also affects COMMENT. New wording as suggested by Tom Lane.
This commit is contained in:
@@ -526,6 +526,10 @@ get_object_address_attribute(ObjectType objtype, List *objname,
|
||||
const char *attname;
|
||||
|
||||
/* Extract relation name and open relation. */
|
||||
if (list_length(objname) < 2)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("column name must be qualified")));
|
||||
attname = strVal(lfirst(list_tail(objname)));
|
||||
relname = list_truncate(list_copy(objname), list_length(objname) - 1);
|
||||
relation = relation_openrv(makeRangeVarFromNameList(relname), lockmode);
|
||||
|
||||
Reference in New Issue
Block a user