From: Tom Lane Date: Thu, 8 Nov 2012 16:34:32 +0000 (-0500) Subject: Don't trash input list structure in does_not_exist_skipping(). X-Git-Tag: REL9_3_BETA1~732 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75af5ae9c017d70531bd49178adfd3103cd40a76;p=postgresql Don't trash input list structure in does_not_exist_skipping(). The trigger and rule cases need to split up the input name list, but they mustn't corrupt the passed-in data structure, since it could be part of a cached utility-statement parsetree. Per bug #7641. --- diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmds.c index 25c127b252..e4c17bd2bc 100644 --- a/src/backend/commands/dropcmds.c +++ b/src/backend/commands/dropcmds.c @@ -203,7 +203,7 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs) case OBJECT_TRIGGER: msg = gettext_noop("trigger \"%s\" for table \"%s\" does not exist, skipping"); name = strVal(llast(objname)); - args = NameListToString(list_truncate(objname, + args = NameListToString(list_truncate(list_copy(objname), list_length(objname) - 1)); break; case OBJECT_EVENT_TRIGGER: @@ -213,7 +213,7 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs) case OBJECT_RULE: msg = gettext_noop("rule \"%s\" for relation \"%s\" does not exist, skipping"); name = strVal(llast(objname)); - args = NameListToString(list_truncate(objname, + args = NameListToString(list_truncate(list_copy(objname), list_length(objname) - 1)); break; case OBJECT_FDW: