aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2007-06-22 03:19:57 +0000
committerNeil Conway <neilc@samurai.com>2007-06-22 03:19:57 +0000
commitee9796e44809ec11316f9271ee2e5d604f7d1319 (patch)
tree1963cf276890814a091eb3937540c2e636a06a1b /src
parent65e67e2bb2e241e1bec0b4519c0dd8bfa1f9c30f (diff)
downloadpostgresql-ee9796e44809ec11316f9271ee2e5d604f7d1319.tar.gz
postgresql-ee9796e44809ec11316f9271ee2e5d604f7d1319.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index e56823c667d..0a22d205c93 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.130.2.1 2007/04/16 20:16:11 mha Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.130.2.2 2007/06/22 03:19:57 neilc Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -1100,6 +1100,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;