dbTalk Databases Forums  

[BUGS] BUG #2851: Error in documentation or in code?

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2851: Error in documentation or in code? in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gurjeet Singh
 
Posts: n/a

Default [BUGS] BUG #2851: Error in documentation or in code? - 12-21-2006 , 06:38 AM







The following bug has been logged online:

Bug reference: 2851
Logged by: Gurjeet Singh
Email address: singh.gurjeet (AT) gmail (DOT) com
PostgreSQL version: 8.2.0
Operating system: Windows XP Professional
Description: Error in documentation or in code?
Details:

The documentation at
http://www.postgresql.org/docs/8.2/i...g-setting.html states
that:

Boolean values may be written as ON, OFF, TRUE, FALSE, YES, NO, 1, 0 (all
case-insensitive) or any unambiguous prefix of these.

But the following doesn't work:

postgres=# set enable_seqscan = of;
ERROR: parameter "enable_seqscan" requires a Boolean value
postgres=#

'of' is an unambiguous prefix of OFF, but it clearly doesn't work. Is it the
documentation that needs fix or is it the code?

I tried the following too:

set enable_seqscan = "of"; -- doesn't work
set enable_seqscan = "off"; -- works

BTW, I tried TR, TRU, FA, FAL, FALS, YE. They all work fine.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote
  #2  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] BUG #2851: Error in documentation or in code? - 12-22-2006 , 06:53 PM







--ELM1166835173-28574-1_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"


Interesting. The bug was caused because 'on' and 'off' both start with
'o', so the code didn't do tests for partial matches.

The attached, applied patch will do the right thing, checking for at
least two characters for 'on' and 'off'. The fix will appear in 8.3.

---------------------------------------------------------------------------

Gurjeet Singh wrote:
Quote:
The following bug has been logged online:

Bug reference: 2851
Logged by: Gurjeet Singh
Email address: singh.gurjeet (AT) gmail (DOT) com
PostgreSQL version: 8.2.0
Operating system: Windows XP Professional
Description: Error in documentation or in code?
Details:

The documentation at
http://www.postgresql.org/docs/8.2/i...g-setting.html states
that:

Boolean values may be written as ON, OFF, TRUE, FALSE, YES, NO, 1, 0 (all
case-insensitive) or any unambiguous prefix of these.

But the following doesn't work:

postgres=# set enable_seqscan = of;
ERROR: parameter "enable_seqscan" requires a Boolean value
postgres=#

'of' is an unambiguous prefix of OFF, but it clearly doesn't work. Is it the
documentation that needs fix or is it the code?

I tried the following too:

set enable_seqscan = "of"; -- doesn't work
set enable_seqscan = "off"; -- works

BTW, I tried TR, TRU, FA, FAL, FALS, YE. They all work fine.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq
--
Bruce Momjian bruce (AT) momjian (DOT) us
EnterpriseDB http://www.enterprisedb.com

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

--ELM1166835173-28574-1_
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff
Content-Disposition: inline; filename="/rtmp/diff"

Index: src/backend/utils/misc/guc.c
================================================== =================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.362
diff -c -c -r1.362 guc.c
*** src/backend/utils/misc/guc.c 13 Dec 2006 05:54:48 -0000 1.362
--- src/backend/utils/misc/guc.c 23 Dec 2006 00:50:18 -0000
***************
*** 3575,3586 ****
*result = false;
}

! else if (pg_strcasecmp(value, "on") == 0)
{
if (result)
*result = true;
}
! else if (pg_strcasecmp(value, "off") == 0)
{
if (result)
*result = false;
--- 3575,3587 ----
*result = false;
}

! /* 'o' is not unique enough */
! else if (pg_strncasecmp(value, "on", (len > 2 ? len : 2)) == 0)
{
if (result)
*result = true;
}
! else if (pg_strncasecmp(value, "off", (len > 2 ? len : 2)) == 0)
{
if (result)
*result = false;

--ELM1166835173-28574-1_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

--ELM1166835173-28574-1_--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.