... and the very same bug in publicationListToArray().

Sigh.
This commit is contained in:
Tom Lane 2017-09-23 15:16:48 -04:00
parent 737639017c
commit 24541ffd78
1 changed files with 5 additions and 3 deletions

View 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);