We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 87d1075 + 22328e1 commit bf4cbd9Copy full SHA for bf4cbd9
src/postgres_text_reader.cpp
@@ -365,7 +365,14 @@ PostgresReadResult PostgresTextReader::Read(DataChunk &output) {
365
}
366
367
output.SetCardinality(scan_chunk.size());
368
- return row_offset < result->Count() ? PostgresReadResult::HAVE_MORE_TUPLES : PostgresReadResult::FINISHED;
+
369
+ bool finished = row_offset >= result->Count();
370
+ if (finished) {
371
+ // The result set is fully consumed. Reset immediately to free the PGresult.
372
+ Reset();
373
+ return PostgresReadResult::FINISHED;
374
+ }
375
+ return PostgresReadResult::HAVE_MORE_TUPLES;
376
377
378
void PostgresTextReader::Reset() {
0 commit comments