Re: Separate the result of \watch for each query execution (psql) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Separate the result of \watch for each query execution (psql)
Date
Msg-id 2746657.1646088403@sss.pgh.pa.us
Whole thread Raw
In response to Re: Separate the result of \watch for each query execution (psql)  (Noboru Saito <noborusai@gmail.com>)
Responses Re: Separate the result of \watch for each query execution (psql)  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Separate the result of \watch for each query execution (psql)  (Noboru Saito <noborusai@gmail.com>)
List pgsql-hackers
Noboru Saito <noborusai@gmail.com> writes:
> I have created a patch that allows you to turn it on and off in \pset.
> The attached patch adds the following features.
> Formfeed can be turned on with the command line option or \pset.
> Formfeed (\f\n) is output after the query execution result by \watch.

Hmm ... I grant your use-case for this, but I think the patch
is too narrow-minded, because it supposes that the only string
anybody could wish to output between \watch commands is "\f\n".
Once you open the floodgates of inserting formatting there,
ISTM that people might want other things.

Also, I'm not that thrilled with treating this as a \pset option,
because it has nothing to do with formatting of normal query
results.  (IMV anyway, perhaps others will disagree.)

How about instead of defining fixed semantics, we invent a psql
special variable that can contain a string to be output between
\watch commands?  It looks like you could then set it through
a command like

\set WATCH_SEPARATOR '\f\n'

(not wedded to that variable name, it's just the first idea
that came to mind)

Personally I'd not bother with inventing a specialized command-line
option to set it, either.  There's already -v and friends.

> * Is formfeed output after the result, not before?

Or we could invent WATCH_BEFORE and WATCH_AFTER ...

            regards, tom lane



pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: Re: real/float example for testlibpq3
Next
From: Tom Lane
Date:
Subject: Re: real/float example for testlibpq3