Copy name when cloning FKs recurses to partitions

We were passing a string owned by a syscache entry, which was released
before recursing.  Fix by pstrdup'ing the string.

Per buildfarm member prion.
This commit is contained in:
Alvaro Herrera 2019-04-03 15:32:53 -03:00
parent f56f8f8da6
commit 5f6fc34af5
1 changed files with 1 additions and 1 deletions

View File

@ -8619,7 +8619,7 @@ CloneFkReferencing(List **wqueue, Relation parentRel, Relation partRel)
"fkey",
RelationGetNamespace(partRel), NIL);
else
fkconstraint->conname = NameStr(constrForm->conname);
fkconstraint->conname = pstrdup(NameStr(constrForm->conname));
fkconstraint->fk_upd_action = constrForm->confupdtype;
fkconstraint->fk_del_action = constrForm->confdeltype;
fkconstraint->deferrable = constrForm->condeferrable;