diff options
author | Neil Conway <neilc@samurai.com> | 2007-06-22 01:09:28 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2007-06-22 01:09:28 +0000 |
commit | 2128e5c39237f16586fde86e4aabc0087303cdc2 (patch) | |
tree | 3d6d1bcf6496d2fbf6b9cf751ddaae7630b69c14 | |
parent | ba826299e0c536b86d0429afe71cb9a64eb63572 (diff) | |
download | postgresql-2128e5c39237f16586fde86e4aabc0087303cdc2.tar.gz postgresql-2128e5c39237f16586fde86e4aabc0087303cdc2.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.
-rw-r--r-- | src/bin/psql/common.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 1db1391a4b9..a19739dca13 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.134 2007/04/16 20:15:38 mha Exp $ + * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.135 2007/06/22 01:09:28 neilc Exp $ */ #include "postgres_fe.h" #include "common.h" @@ -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; |