Skip to content

Commit 8398c83

Browse files
committed
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>
1 parent 7ac955b commit 8398c83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -803,10 +803,6 @@ libpqrcv_processTuples(PGresult *pgres, WalRcvExecResult *walres,
803803
MemoryContext rowcontext;
804804
MemoryContext oldcontext;
805805

806-
/* No point in doing anything here if there were no tuples returned. */
807-
if (PQntuples(pgres) == 0)
808-
return;
809-
810806
/* Make sure we got expected number of fields. */
811807
if (nfields != nRetTypes)
812808
ereport(ERROR,
@@ -824,6 +820,10 @@ libpqrcv_processTuples(PGresult *pgres, WalRcvExecResult *walres,
824820
PQfname(pgres, coln), retTypes[coln], -1, 0);
825821
attinmeta = TupleDescGetAttInMetadata(walres->tupledesc);
826822

823+
/* No point in doing more here if there were no tuples returned. */
824+
if (PQntuples(pgres) == 0)
825+
return;
826+
827827
/* Create temporary context for local allocations. */
828828
rowcontext = AllocSetContextCreate(CurrentMemoryContext,
829829
"libpqrcv query result context",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy