Commit 8398c836 authored by Peter Eisentraut's avatar Peter Eisentraut

Handle empty result set in libpqrcv_exec

Always return tupleslot and tupledesc from libpqrcv_exec.  This avoids
requiring callers to handle that separately.

Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Reported-by: default avatarMichael Banck <michael.banck@credativ.de>
parent 7ac955b3
......@@ -803,10 +803,6 @@ libpqrcv_processTuples(PGresult *pgres, WalRcvExecResult *walres,
MemoryContext rowcontext;
MemoryContext oldcontext;
/* No point in doing anything here if there were no tuples returned. */
if (PQntuples(pgres) == 0)
return;
/* Make sure we got expected number of fields. */
if (nfields != nRetTypes)
ereport(ERROR,
......@@ -824,6 +820,10 @@ libpqrcv_processTuples(PGresult *pgres, WalRcvExecResult *walres,
PQfname(pgres, coln), retTypes[coln], -1, 0);
attinmeta = TupleDescGetAttInMetadata(walres->tupledesc);
/* No point in doing more here if there were no tuples returned. */
if (PQntuples(pgres) == 0)
return;
/* Create temporary context for local allocations. */
rowcontext = AllocSetContextCreate(CurrentMemoryContext,
"libpqrcv query result context",
......
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