mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix parse tree of DROP TRANSFORM and COMMENT ON TRANSFORM
The plain C string language name needs to be wrapped in makeString() so that the parse tree is copyable. This is detectable by -DCOPY_PARSE_PLAN_TREES. Add a test case for the COMMENT case. Also make the quoting in the error messages more consistent. discovered by Tom Lane
This commit is contained in:
@ -770,7 +770,7 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
|
||||
case OBJECT_TRANSFORM:
|
||||
{
|
||||
TypeName *typename = (TypeName *) linitial(objname);
|
||||
char *langname = (char *) linitial(objargs);
|
||||
char *langname = strVal(linitial(objargs));
|
||||
Oid type_id = LookupTypeNameOid(NULL, typename, missing_ok);
|
||||
Oid lang_id = get_language_oid(langname, missing_ok);
|
||||
|
||||
|
@ -369,9 +369,9 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs)
|
||||
case OBJECT_TRANSFORM:
|
||||
if (!type_in_list_does_not_exist_skipping(objname, &msg, &name))
|
||||
{
|
||||
msg = gettext_noop("transform for type %s language %s does not exist, skipping");
|
||||
msg = gettext_noop("transform for type %s language \"%s\" does not exist, skipping");
|
||||
name = TypeNameToString((TypeName *) linitial(objname));
|
||||
args = (char *) linitial(objargs);
|
||||
args = strVal(linitial(objargs));
|
||||
}
|
||||
break;
|
||||
case OBJECT_TRIGGER:
|
||||
|
@ -1867,7 +1867,7 @@ CreateTransform(CreateTransformStmt *stmt)
|
||||
if (!stmt->replace)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
||||
errmsg("transform for type %s language %s already exists",
|
||||
errmsg("transform for type %s language \"%s\" already exists",
|
||||
format_type_be(typeid),
|
||||
stmt->lang)));
|
||||
|
||||
|
@ -4112,7 +4112,7 @@ AlterExtensionContentsStmt:
|
||||
n->action = $4;
|
||||
n->objtype = OBJECT_TRANSFORM;
|
||||
n->objname = list_make1($7);
|
||||
n->objargs = list_make1($9);
|
||||
n->objargs = list_make1(makeString($9));
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| ALTER EXTENSION name add_drop TYPE_P Typename
|
||||
@ -5773,7 +5773,7 @@ CommentStmt:
|
||||
CommentStmt *n = makeNode(CommentStmt);
|
||||
n->objtype = OBJECT_TRANSFORM;
|
||||
n->objname = list_make1($5);
|
||||
n->objargs = list_make1($7);
|
||||
n->objargs = list_make1(makeString($7));
|
||||
n->comment = $9;
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
@ -7389,7 +7389,7 @@ DropTransformStmt: DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_d
|
||||
DropStmt *n = makeNode(DropStmt);
|
||||
n->removeType = OBJECT_TRANSFORM;
|
||||
n->objects = list_make1(list_make1($5));
|
||||
n->arguments = list_make1(list_make1($7));
|
||||
n->arguments = list_make1(list_make1(makeString($7)));
|
||||
n->behavior = $8;
|
||||
n->missing_ok = $3;
|
||||
$$ = (Node *)n;
|
||||
|
Reference in New Issue
Block a user