Commit 25371a72 authored by Peter Eisentraut's avatar Peter Eisentraut

Remove pstrdup of TextDatumGetCString

The result of TextDatumGetCString is already palloc'ed.
parent 0c22327f
...@@ -75,7 +75,7 @@ GetSubscription(Oid subid, bool missing_ok) ...@@ -75,7 +75,7 @@ GetSubscription(Oid subid, bool missing_ok)
Anum_pg_subscription_subconninfo, Anum_pg_subscription_subconninfo,
&isnull); &isnull);
Assert(!isnull); Assert(!isnull);
sub->conninfo = pstrdup(TextDatumGetCString(datum)); sub->conninfo = TextDatumGetCString(datum);
/* Get slotname */ /* Get slotname */
datum = SysCacheGetAttr(SUBSCRIPTIONOID, datum = SysCacheGetAttr(SUBSCRIPTIONOID,
...@@ -207,7 +207,7 @@ textarray_to_stringlist(ArrayType *textarray) ...@@ -207,7 +207,7 @@ textarray_to_stringlist(ArrayType *textarray)
return NIL; return NIL;
for (i = 0; i < nelems; i++) for (i = 0; i < nelems; i++)
res = lappend(res, makeString(pstrdup(TextDatumGetCString(elems[i])))); res = lappend(res, makeString(TextDatumGetCString(elems[i])));
return res; return res;
} }
......
...@@ -767,7 +767,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel) ...@@ -767,7 +767,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup, datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
Anum_pg_subscription_subconninfo, &isnull); Anum_pg_subscription_subconninfo, &isnull);
Assert(!isnull); Assert(!isnull);
conninfo = pstrdup(TextDatumGetCString(datum)); conninfo = TextDatumGetCString(datum);
/* Get slotname */ /* Get slotname */
datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup, datum = SysCacheGetAttr(SUBSCRIPTIONOID, tup,
......
...@@ -612,7 +612,7 @@ fetch_remote_table_info(char *nspname, char *relname, ...@@ -612,7 +612,7 @@ fetch_remote_table_info(char *nspname, char *relname,
while (tuplestore_gettupleslot(res->tuplestore, true, false, slot)) while (tuplestore_gettupleslot(res->tuplestore, true, false, slot))
{ {
lrel->attnames[natt] = lrel->attnames[natt] =
pstrdup(TextDatumGetCString(slot_getattr(slot, 1, &isnull))); TextDatumGetCString(slot_getattr(slot, 1, &isnull));
Assert(!isnull); Assert(!isnull);
lrel->atttyps[natt] = DatumGetObjectId(slot_getattr(slot, 2, &isnull)); lrel->atttyps[natt] = DatumGetObjectId(slot_getattr(slot, 2, &isnull));
Assert(!isnull); Assert(!isnull);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment