mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Use TypeName to represent type names in certain commands
In COMMENT, DROP, SECURITY LABEL, and the new pg_get_object_address
function, we were representing types as a list of names, same as other
objects; but types are special objects that require their own
representation to be totally accurate. In the original COMMENT code we
had a note about fixing it which was lost in the course of c10575ff00
.
Change all those places to use TypeName instead, as suggested by that
comment.
Right now the original coding doesn't cause any bugs, so no backpatch.
It is more problematic for proposed future code that operate with object
addresses from the SQL interface; type details such as array-ness are
lost when working with the degraded representation.
Thanks to Petr Jelínek and Dimitri Fontaine for offlist help on finding
a solution to a shift/reduce grammar conflict.
This commit is contained in:
@ -264,10 +264,14 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs)
|
||||
{
|
||||
case OBJECT_TYPE:
|
||||
case OBJECT_DOMAIN:
|
||||
if (!schema_does_not_exist_skipping(objname, &msg, &name))
|
||||
{
|
||||
msg = gettext_noop("type \"%s\" does not exist, skipping");
|
||||
name = TypeNameToString(makeTypeNameFromNameList(objname));
|
||||
TypeName *typ = linitial(objname);
|
||||
|
||||
if (!schema_does_not_exist_skipping(typ->names, &msg, &name))
|
||||
{
|
||||
msg = gettext_noop("type \"%s\" does not exist, skipping");
|
||||
name = TypeNameToString(typ);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OBJECT_COLLATION:
|
||||
|
Reference in New Issue
Block a user