]> granicus.if.org Git - postgresql/commitdiff
Don't trash input list structure in does_not_exist_skipping().
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Nov 2012 16:34:37 +0000 (11:34 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Nov 2012 16:34:37 +0000 (11:34 -0500)
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.

src/backend/commands/dropcmds.c

index 1b8529ed84312620ba6cc174574ccc59a1aec17c..36b09ca4b8164a5c5a433b2b2a62151afe7d255a 100644 (file)
@@ -203,13 +203,13 @@ 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_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: