diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 88f4b159f9..5864a9833f 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1351,10 +1351,9 @@ DescribeQuery(const char *query, double *elapsed_msec) * * Sends query and cycles through PGresult objects. * - * When not under \watch and if our command string contained a COPY FROM STDIN - * or COPY TO STDOUT, the PGresult associated with these commands must be - * processed by providing an input or output stream. In that event, we'll - * marshal data for the COPY. + * If our command string contained a COPY FROM STDIN or COPY TO STDOUT, the + * PGresult associated with these commands must be processed by providing an + * input or output stream. In that event, we'll marshal data for the COPY. * * For other commands, the results are processed normally, depending on their * status. @@ -1491,12 +1490,9 @@ ExecQueryAndProcessResults(const char *query, double *elapsed_msec, bool *svpt_g if (is_watch) { - ClearOrSaveAllResults(); - pg_log_error("\\watch cannot be used with COPY"); - return -1; + copy_stream = printQueryFout ? printQueryFout : pset.queryFout; } - - if (pset.copyStream) /* invoked by \copy */ + else if (pset.copyStream) /* invoked by \copy */ { copy_stream = pset.copyStream; }