Re: Separate the result of \watch for each query execution (psql)

From: Noboru Saito <noborusai(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Separate the result of \watch for each query execution (psql)
Date: 2022-02-25 04:23:31
Message-ID: CAAM3qnLnrjE5Bn9c96KOGbyezkaPgopj0fU9UM9P8eKvfTca6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> > I strongly agree. It was a lot of work to find a workable solution for pspg. Special chars that starting result and maybe other, that ending result can significantly increase robustness and can reduce code. I think it can be better to use form feed at the end of form - like it is semantic of form feed. You know, at this moment, the result is complete. https://en.wikipedia.org/wiki/Page_break
>
> It's easier to print a form feed before the result, but it's okay at the end.
>
> > I don't think using it by default can be the best. Lot of people don't use specialized pagers, but it can be set by \pset. Form feed should be used on end
> >
> > \pset formfeed [on, off]
>
> I think it's a good idea to be able to switch with \pset.

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.

I think the considerations are as follows.

* Is formfeed output after the result, not before?
* Is the formfeed output only "\f\n"?
* Is the formfeed output only executed by \watch?
* Is the name "formfeed" appropriate?

If the formfeed is output before the query result,
it will be better if the screen is reset when the formfeed is read.

Furthermore, if the terminal clear string can be set instead of the
formfeed character,
the \watch output can be fixedly displayed without a pager.

(I noticed that if I set it in the title, it would behave similarly in
the current version.
# \C '\033[2J;\033[0;0H'
# SELECT now();\watch 1
)

Also, it may be good to output formfeed when outputting a file with
`\o result.txt`
other than \watch.

Attachment Content-Type Size
output-formfeed.patch application/x-patch 7.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Imseih (AWS), Sami 2022-02-25 04:27:19 Re: [BUG] Panic due to incorrect missingContrecPtr after promotion
Previous Message Amit Kapila 2022-02-25 03:57:19 Re: Optionally automatically disable logical replication subscriptions on error