diff options
author | Neil Conway | 2007-06-22 03:19:57 +0000 |
---|---|---|
committer | Neil Conway | 2007-06-22 03:19:57 +0000 |
commit | 2ccc2ff5506cdb32e451c59c1adc65d9edda47b4 (patch) | |
tree | 6abce207ef6c6a9ab668a1e30ae87aeeee461f44 | |
parent | a7ae9f4f33dbc2e6d44e73cf7556fc738dee7bcf (diff) |
In psql, when running a SELECT query using a cursor, flush the query
output after each FETCH. This ensures that incremental results are
available to clients that are executing long-running SELECT queries
via the FETCH_COUNT feature.
-rw-r--r-- | src/bin/psql/common.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index ebd6aee017..25273ccc99 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1076,6 +1076,12 @@ ExecQueryUsingCursor(const char *query, double *elapsed_msec) printQuery(results, &my_popt, pset.queryFout, pset.logfile); + /* + * Make sure to flush the output stream, so intermediate + * results are visible to the client immediately. + */ + fflush(pset.queryFout); + /* after the first result set, disallow header decoration */ my_popt.topt.start_table = false; my_popt.topt.prior_records += ntuples; |