Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > Re: [GENERAL] p...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 9305 of 9638
Post > Topic >>

Re: [GENERAL] psql \pset pager

by bruce@[EMAIL PROTECTED] (Bruce Momjian) May 6, 2008 at 11:37 AM

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?
> 
> 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.

[ moved to hackers list]

I looked at the psql code and found:

	bool
	ParseVariableBool(const char *val)
	{
	    if (val == NULL)
	        return false;           /* not set -> assume "off" */
	    if (pg_strcasecmp(val, "off") == 0)
	        return false;           /* accept "off" or "OFF" as true */
	
	    /*
	     * for backwards compatibility, anything except "off" or "OFF" is
	     *  taken as "true"
	     */
	    return true;
	}

So, I think the answer is that we have the current behavior because of
backward compatibility.  Perhaps we should be more strict in
ParseVariableBool(), perhaps only allowing true/false and on/off.

-- 
  Bruce Momjian  <bruce@[EMAIL PROTECTED]
>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 4 Posts in Topic:
Re: [GENERAL] psql \pset pager
bruce@[EMAIL PROTECTED]   2008-05-06 11:37:57 
Re: [GENERAL] psql \pset pager
tgl@[EMAIL PROTECTED] (T  2008-05-06 11:56:42 
Re: [GENERAL] psql \pset pager
bruce@[EMAIL PROTECTED]   2008-05-06 17:34:49 
Re: [GENERAL] psql \pset pager
tgl@[EMAIL PROTECTED] (T  2008-05-06 18:19:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 18:37:02 CDT 2008.