Re: proposal - psql - use pager for \watch command

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal - psql - use pager for \watch command
Date: 2021-04-07 23:37:36
Message-ID: CA+hUKGK+j0_6SWwzPk0fiXwwAa7rMcx0dS-OdpyfdM=P4e+UUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v5-0001-Add-PSQL_WATCH_PAGER-for-psql-s-watch-command.patch text/x-patch 12.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-04-07 23:38:35 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Previous Message Tom Lane 2021-04-07 23:34:26 Re: psql \df choose functions by their arguments