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

From: Noboru Saito <noborusai(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: Separate the result of \watch for each query execution (psql)
Date: 2022-02-27 21:05:44
Message-ID: CAAM3qnK3LNhBbm-2CTXAschXNk+z9UfTCCbqfn7EKeFMOYFDiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

2022年2月25日(金) 13:42 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>
>
>
> pá 25. 2. 2022 v 5:23 odesílatel Noboru Saito <noborusai(at)gmail(dot)com> napsal:
>>
>> 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?
>
>
> We are talking about the first iteration. In the second and other iteration this question has no sense. You know the starting point. You don't know the endpoint. So I think so using formfeed on the end is good idea.

Yes. However, as you know, in the case of \ watch, there is a
difference in waiting before and after the specified time.

>> * Is the formfeed output only "\f\n"?
>
>
> yes
>
>>
>> * Is the formfeed output only executed by \watch?
>
>
> This is a good question. I think the implementation for \watch is a good start. But it can help with normal results too. In pspg it can be very useful for incremental load or for streaming mode. But if it will be used everywhere, then it should be used just for some specified pagers.
>
>
>>
>> * Is the name "formfeed" appropriate?
>
>
> If it will do work of formfeed, then the formfeed is good name.
>
>>
>>
>> If the formfeed is output before the query result,
>> it will be better if the screen is reset when the formfeed is read.
>
>
> I think, so you propose another feature - reset terminal sequence - it can be a good idea. Not for pspg, but generally, why not.

Yes, it is. I was wondering if I could just add formfeed or add more features.

Thank you.
Following your advice, I will register this for the commitfest
(I am registering for the commitfest for the first time. Thank you
for your cooperation).

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-02-27 22:24:48 Re: Missed condition-variable wakeups on FreeBSD
Previous Message Daniel Gustafsson 2022-02-27 20:17:13 Re: support for MERGE