]> granicus.if.org Git - postgresql/commitdiff
... and the very same bug in publicationListToArray().
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 23 Sep 2017 19:16:48 +0000 (15:16 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 23 Sep 2017 19:16:48 +0000 (15:16 -0400)
Sigh.

src/backend/commands/subscriptioncmds.c

index 372fa1b63449cb3eb9876a174f445a62d12369ba..086a6ef85ea8b0d87d7bb18e1b8a98bd77c41f74 100644 (file)
@@ -244,7 +244,7 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
 }
 
 /*
- * Auxiliary function to return a text array out of a list of String nodes.
+ * Auxiliary function to build a text array out of a list of String nodes.
  */
 static Datum
 publicationListToArray(List *publist)
@@ -264,7 +264,8 @@ publicationListToArray(List *publist)
                                                                   ALLOCSET_DEFAULT_MAXSIZE);
        oldcxt = MemoryContextSwitchTo(memcxt);
 
-       datums = palloc(sizeof(text *) * list_length(publist));
+       datums = (Datum *) palloc(sizeof(Datum) * list_length(publist));
+
        foreach(cell, publist)
        {
                char       *name = strVal(lfirst(cell));
@@ -275,7 +276,7 @@ publicationListToArray(List *publist)
                {
                        char       *pname = strVal(lfirst(pcell));
 
-                       if (name == pname)
+                       if (pcell == cell)
                                break;
 
                        if (strcmp(name, pname) == 0)
@@ -292,6 +293,7 @@ publicationListToArray(List *publist)
 
        arr = construct_array(datums, list_length(publist),
                                                  TEXTOID, -1, false, 'i');
+
        MemoryContextDelete(memcxt);
 
        return PointerGetDatum(arr);