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: Michael Banck <michael.banck@credativ.de>
This commit is contained in:
parent
7ac955b347
commit
8398c83689
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue