Re: psql additions

Lists: pgsql-hackers
From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: psql additions
Date: 2011-09-11 18:58:57
Message-ID: 4E6D04F1.5010405@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Here's a couple of ideas I had recently about making psql a bit more
user friendly.

First, it would be useful to be able to set pager options and possibly
other settings, so my suggestion is for a \setenv command that could be
put in a .psqlrc file, something like:

\setenv PAGER='less'
\setenv LESS='-imFX4'

Probably other people can think of more uses for such a gadget.

Second, I'd like to be able to set a minimum number of lines below which
the pager would not be used, something like:

\pset pagerminlines 200

Thoughts?

cheers

andrew


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql additions
Date: 2011-09-12 03:43:47
Message-ID: CA+TgmoYVNog_tGcG0JnVz9d2ZdrwomtNecdcS3ZOBW9DEHT9Xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 11, 2011 at 2:58 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> Here's a couple of ideas I had recently about making psql a bit more user
> friendly.
>
> First, it would be useful to be able to set pager options and possibly other
> settings, so my suggestion is for a \setenv command that could be put in a
> .psqlrc file, something like:
>
>   \setenv PAGER='less'
>   \setenv LESS='-imFX4'

Seems useful.

> Second, I'd like to be able to set a minimum number of lines below which the
> pager would not be used, something like:
>
>   \pset pagerminlines 200
>
> Thoughts?

Gee, why do I feel like we have something like this already?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql additions
Date: 2011-09-12 09:26:07
Message-ID: 4E6DD02F.5090906@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 09/11/2011 11:43 PM, Robert Haas wrote:
>
>
>> Second, I'd like to be able to set a minimum number of lines below which the
>> pager would not be used, something like:
>>
>> \pset pagerminlines 200
>>
>> Thoughts?
> Gee, why do I feel like we have something like this already?

We do? We control columns, but not lines AFAIK.

cheers

andrew


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql additions
Date: 2011-09-12 12:39:42
Message-ID: 1315831182.5351.3.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On mån, 2011-09-12 at 05:26 -0400, Andrew Dunstan wrote:
>
> On 09/11/2011 11:43 PM, Robert Haas wrote:
> >
> >
> >> Second, I'd like to be able to set a minimum number of lines below which the
> >> pager would not be used, something like:
> >>
> >> \pset pagerminlines 200
> >>
> >> Thoughts?
> > Gee, why do I feel like we have something like this already?
>
> We do? We control columns, but not lines AFAIK.

We check the lines and columns in the terminal window. Oddly enough,
that code is in two separate places, so I don't know if they have
consistent effects.


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql additions
Date: 2011-09-12 13:01:07
Message-ID: 4E6E0293.8000609@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 09/12/2011 08:39 AM, Peter Eisentraut wrote:
> On mån, 2011-09-12 at 05:26 -0400, Andrew Dunstan wrote:
>> On 09/11/2011 11:43 PM, Robert Haas wrote:
>>>
>>>> Second, I'd like to be able to set a minimum number of lines below which the
>>>> pager would not be used, something like:
>>>>
>>>> \pset pagerminlines 200
>>>>
>>>> Thoughts?
>>> Gee, why do I feel like we have something like this already?
>> We do? We control columns, but not lines AFAIK.
> We check the lines and columns in the terminal window. Oddly enough,
> that code is in two separate places, so I don't know if they have
> consistent effects.
>
>

Yes, but what I want is to be able to control it. So even if my terminal
is 50 lines long I want to be able to say "Don't use the pager unless
there are 200 or more lines."

cheers

andrew


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql additions
Date: 2011-09-12 18:14:44
Message-ID: 1315851285.19706.4.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On mån, 2011-09-12 at 09:01 -0400, Andrew Dunstan wrote:
>
> On 09/12/2011 08:39 AM, Peter Eisentraut wrote:
> > On mån, 2011-09-12 at 05:26 -0400, Andrew Dunstan wrote:
> >> On 09/11/2011 11:43 PM, Robert Haas wrote:
> >>>
> >>>> Second, I'd like to be able to set a minimum number of lines below which the
> >>>> pager would not be used, something like:
> >>>>
> >>>> \pset pagerminlines 200
> >>>>
> >>>> Thoughts?
> >>> Gee, why do I feel like we have something like this already?
> >> We do? We control columns, but not lines AFAIK.
> > We check the lines and columns in the terminal window. Oddly enough,
> > that code is in two separate places, so I don't know if they have
> > consistent effects.
> >
> >
>
> Yes, but what I want is to be able to control it. So even if my terminal
> is 50 lines long I want to be able to say "Don't use the pager unless
> there are 200 or more lines."

Right. Actually, if you implemented the \setenv idea, you could set the
environment variable LINES to get that effect. Except that you will
then also have to implement the part that looks at the LINES variable,
but we have code elsewhere that looks at COLUMNS, so that would only be
consistent. Again, see comment above that the lines and columns
checking might be a bit inconsistent at the moment.