diff options
author | Peter Eisentraut | 2017-03-24 12:41:32 +0000 |
---|---|---|
committer | Peter Eisentraut | 2017-03-24 12:41:32 +0000 |
commit | 8398c836892fde2b99139cc4711e57b7e59582b6 (patch) | |
tree | 2e8eb1851293bebada5a5e4bad6f751ce415d7d5 | |
parent | 7ac955b34791500069179e1ea986f46d510126d9 (diff) |
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 <[email protected]>
Reported-by: Michael Banck <[email protected]>
-rw-r--r-- | src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c index 4dd8eef1f9..9d7bb25d39 100644 --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c @@ -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", |