pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: 曾文旌 <wjzeng2012@gmail.com>
To: pgsql-hackers@lists.postgresql.org
To: pgsql-bugs@lists.postgresql.org
Cc: tushar <tushar.ahuja@enterprisedb.com>
Cc: Prabhat Sahu <prabhat.sahu@enterprisedb.com>
Subject: [bug] Wrong bool value parameter
Date: Tue, 7 Apr 2020 17:30:03 +0800
Message-ID: <C6E8C2E7-1906-4F6E-BCC8-7D9FC2FC5CFE@gmail.com> (raw)

Do we allow such a bool parameter value? This seems puzzling to me.


postgres=# create table t1(c1 int) with(autovacuum_enabled ='tr');
CREATE TABLE
postgres=# create table t2(c1 int) with(autovacuum_enabled ='fa');
CREATE TABLE
postgres=# \d+ t1
                                    Table "public.t1"
 Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description 
--------+---------+-----------+----------+---------+---------+--------------+-------------
 c1     | integer |           |          |         | plain   |              | 
Access method: heap
Options: autovacuum_enabled=tr

postgres=# \d+ t2
                                    Table "public.t2"
 Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description 
--------+---------+-----------+----------+---------+---------+--------------+-------------
 c1     | integer |           |          |         | plain   |              | 
Access method: heap
Options: autovacuum_enabled=fa


I am try to fix in bug_boolrelopt.patch


Wenjing

Attachments:

bug_boolrelopt.patch (application/octet-stream, 1.0K) download diff --git a/src/backend/utils/adt/bool.c b/src/backend/utils/adt/bool.c index 340607f..6e7368d 100644 --- a/src/backend/utils/adt/bool.c +++ b/src/backend/utils/adt/bool.c @@ -39,7 +39,7 @@ parse_bool_with_len(const char *value, size_t len, bool *result) { case 't': case 'T': - if (pg_strncasecmp(value, "true", len) == 0) + if (len == 1 || (len == 4 && pg_strncasecmp(value, "true", len) == 0)) { if (result) *result = true; @@ -48,7 +48,7 @@ parse_bool_with_len(const char *value, size_t len, bool *result) break; case 'f': case 'F': - if (pg_strncasecmp(value, "false", len) == 0) + if (len == 1 || (len == 5 && pg_strncasecmp(value, "false", len) == 0)) { if (result) *result = false; @@ -57,7 +57,7 @@ parse_bool_with_len(const char *value, size_t len, bool *result) break; case 'y': case 'Y': - if (pg_strncasecmp(value, "yes", len) == 0) + if (len == 1 || (len == 3 && pg_strncasecmp(value, "yes", len) == 0)) { if (result) *result = true;

view thread (9+ messages)  latest in thread

Message-ID: <C6E8C2E7-1906-4F6E-BCC8-7D9FC2FC5CFE@gmail.com>
Permalink:  ../C6E8C2E7-1906-4F6E-BCC8-7D9FC2FC5CFE@gmail.com/
Also on:    postgresql.org/message-id/C6E8C2E7-1906-4F6E-BCC8-7D9FC2FC5CFE@gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: wjzeng2012@gmail.com, pgsql-hackers@lists.postgresql.org, tushar.ahuja@enterprisedb.com, prabhat.sahu@enterprisedb.com
  Subject: Re: [bug] Wrong bool value parameter
  In-Reply-To: <C6E8C2E7-1906-4F6E-BCC8-7D9FC2FC5CFE@gmail.com>
  References: <C6E8C2E7-1906-4F6E-BCC8-7D9FC2FC5CFE@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox