psql \pset pager

Поиск
Список
Период
Сортировка
Искать

psql \pset pager

От:
Steve Crawford <scrawford@pinpointresearch.com>
Дата:
My fingers sometimes run on "autoappend semicolon" mode and I end up 
typing "\pset pager always;" instead of "\pset pager always". No error 
is returned, short (but wide) output is not routed to the pager, and I 
have to back up and correct the \pset pager command. After some 
experimentation, I found that any unrecognized string sets the pager to 
be used for long output:

steve=> \pset pager on;
Pager is used for long output.

steve=> \pset pager off;
Pager is used for long output.

steve=> \pset pager always;
Pager is used for long output.

steve=> \pset pager occasionally
Pager is used for long output.

steve=> \pset pager at random
Pager is used for long output.
\pset: extra argument "random" ignored

The above commands set the pager to be used for long output regardless 
of the prior setting. Bad input doesn't generate errors except in the 
case where there are too many parameters.

I didn't find this documented. Is the acceptance of bad input by design 
or an oversight?

Also, what would be the feasibility of having psql route output to the 
pager if the output is too long or too _wide_? I end up with too wide at 
least as often as too long.

Cheers,
Steve

Re: psql \pset pager

От:
Bruce Momjian <bruce@momjian.us>
Дата:
Steve Crawford wrote:
> My fingers sometimes run on "autoappend semicolon" mode and I end up 
> typing "\pset pager always;" instead of "\pset pager always". No error 
> is returned, short (but wide) output is not routed to the pager, and I 
> have to back up and correct the \pset pager command. After some 
> experimentation, I found that any unrecognized string sets the pager to 
> be used for long output:
> 
> steve=> \pset pager on;
> Pager is used for long output.
> 
> steve=> \pset pager off;
> Pager is used for long output.
> 
> steve=> \pset pager always;
> Pager is used for long output.
> 
> steve=> \pset pager occasionally
> Pager is used for long output.
> 
> steve=> \pset pager at random
> Pager is used for long output.
> \pset: extra argument "random" ignored
> 
> The above commands set the pager to be used for long output regardless 
> of the prior setting. Bad input doesn't generate errors except in the 
> case where there are too many parameters.
> 
> I didn't find this documented. Is the acceptance of bad input by design 
> or an oversight?

Will be fixed in 8.4.

> Also, what would be the feasibility of having psql route output to the 
> pager if the output is too long or too _wide_? I end up with too wide at 
> least as often as too long.

Also done for 8.4.

-- 
  Bruce Momjian          http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: psql \pset pager

От:
Gregory Stark <stark@enterprisedb.com>
Дата:
"Bruce Momjian"  writes:

> Steve Crawford wrote:
>> My fingers sometimes run on "autoappend semicolon" mode and I end up 
>> typing "\pset pager always;" instead of "\pset pager always". 

FWIW I get bitten by this all the time with \set AUTOCOMMIT. 

>> I didn't find this documented. Is the acceptance of bad input by design 
>> or an oversight?
>
> Will be fixed in 8.4.

I expect there'll be some screams from people with scripts which start
failing. I wonder whether we won't have second thoughts by then.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's Slony Replication support!
FAQ