Re: proposal - psql - use pager for \watch command - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: proposal - psql - use pager for \watch command
Date
Msg-id CA+hUKGK+j0_6SWwzPk0fiXwwAa7rMcx0dS-OdpyfdM=P4e+UUQ@mail.gmail.com
Whole thread Raw
In response to Re: proposal - psql - use pager for \watch command  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal - psql - use pager for \watch command  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Here's a rebase, due to a conflict with 3a513067 "psql: Show all query
results by default" which moved a few things around making it harder
to use the pager for the right scope.  Lacking time, I came up with
this change to PSQLexecWatch():

+       if (printQueryFout)
+       {
+               restoreQueryFout = pset.queryFout;
+               pset.queryFout = printQueryFout;
+       }
+
        SetCancelConn(pset.db);
        res = SendQueryAndProcessResults(query, &elapsed_msec, true);
        ResetCancelConn();

        fflush(pset.queryFout);

+       if (restoreQueryFout)
+               pset.queryFout = restoreQueryFout;
+

If someone has a tidier way to factor this, I'm keen to hear it.  I'd
like to push this today.

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql \df choose functions by their arguments
Next
From: Bruce Momjian
Date:
Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?