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

From Pavel Stehule
Subject Re: proposal - psql - use pager for \watch command
Date
Msg-id CAFj8pRDZJQRUF5u=_MfaRCBQ+VB9NF+XNYv+0x=3GkryCFb8=w@mail.gmail.com
Whole thread Raw
In response to Re: proposal - psql - use pager for \watch command  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: proposal - psql - use pager for \watch command
List pgsql-hackers
Hi

čt 8. 4. 2021 v 1:38 odesílatel Thomas Munro <thomas.munro@gmail.com> napsal:
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.

here is an rebase of Thomas's implementation

Regards

Pavel

Attachment

pgsql-hackers by date:

Previous
From: Ondřej Žižka
Date:
Subject: Re: Synchronous commit behavior during network outage
Next
From: Peter Smith
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions