Re: controlling psql's use of the pager a bit more

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: controlling psql's use of the pager a bit more
Date: 2015-03-26 13:35:31
Message-ID: 55140B23.3060604@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 12/21/2014 02:22 PM, Andrew Dunstan wrote:
>
> On 11/15/2014 05:56 PM, Andrew Dunstan wrote:
>>
>> On 11/13/2014 11:41 AM, Andrew Dunstan wrote:
>>>
>>> On 11/13/2014 11:09 AM, Tom Lane wrote:
>>>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>>>> I often get annoyed because psql is a bit too aggressive when it
>>>>> decides
>>>>> whether to put output through the pager, and the only way to avoid
>>>>> this
>>>>> is to turn the pager off (in which case your next query might dump
>>>>> many
>>>>> thousands of lines to the screen). I'd like a way to be able to
>>>>> specify
>>>>> a minumum number of lines of output before psql would invoke the
>>>>> pager,
>>>>> rather than just always using the terminal window size.
>>>> Are you saying you'd want to set the threshold to *more* than the
>>>> window
>>>> height? Why?
>>>
>>>
>>> Because I might be quite happy with 100 or 200 lines I can just
>>> scroll in my terminal's scroll buffer, but want to use the pager for
>>> more than that. This is useful especially if I want to scroll back
>>> and see the results from a query or two ago.
>>>
>>>
>>>
>>>
>>
>>
>> This patch shows more or less what I had in mind.
>>
>> However, there is more work to do. As Tom noted upthread, psql's
>> calculation of the number of lines is pretty bad. For example, if I do:
>>
>> \pset pager_min_lines 100
>> select * from generate_series(1,50);
>>
>> the pager still gets invoked, which is unfortunate to say the least.
>>
>> So I'm going to take a peek at that.
>>
>
>
> The over-eager invocation of the pager due to double counting of lines
> got fixed recently, so here's a slightly updated patch for a
> pager_min_lines setting, including docco.
>
>

The assigned reviewer hasn't done a review and hasn't responded to
email. If there are no other comments I propose to commit this shortly.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-03-26 13:43:09 Re: controlling psql's use of the pager a bit more
Previous Message Andres Freund 2015-03-26 13:19:55 Re: [COMMITTERS] pgsql: Add macros wrapping all usage of gcc's __attribute__.