Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jLkYg-0006oP-I8 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2020 09:30:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLkYe-0000RC-O5 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2020 09:30:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jLkYe-0000R1-De; Tue, 07 Apr 2020 09:30:12 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jLkYc-0003TM-Un; Tue, 07 Apr 2020 09:30:12 +0000 Received: by mail-oi1-x22e.google.com with SMTP id q204so879328oia.13; Tue, 07 Apr 2020 02:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:cc:to; bh=3MYHxglMvvyqyCmcCSS12Gpsjs5v6Q9BKVlEiHCnqZE=; b=df1j2CsAb+k/V+RtIxddFFuQweAA5dz4W1/JsedqQPd/gQn2ewwVenSri1/2dGp9J5 6IW9hXIrmgYO3GeGqmPc+A2g7mxlnOzPbhB9G40v7U0qJC5D3EAqqO5YJyNKmG3Ji3+O Tttj1RMhueiv0FgkW7OPhAvhJo1vRj1cek0TkPuMY1xfDeaqr0CKixZ+jqV1atnHYm7y btQFKyPdO0s3FfrfWOUJBpeiCHozUo4r5WnMAOapBGUnmPt0BBwoN7zEn7uhNmcfEH0T +pnDjDHNVQh+Euvlh4pvf+/yfNeO+h6CM5oHIu3vPtqSIdlAied/meZJnvgNaZ6HaaY7 Ozbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:cc:to; bh=3MYHxglMvvyqyCmcCSS12Gpsjs5v6Q9BKVlEiHCnqZE=; b=DSJ5zoeADlPAixFhSkJEnRJe6iTuZDo6AdrKMrO8tZR/p6n3656D5MpVoUkN1iemJE lsCqdFSrYRh971fCPRv741JgVMwcSlm2YYbB2832Mt6eEOTiLiZJbhEmcZ1dw1o8enMV gPvIaa0VyZyIZFOrnkQbSwYPd5sA+v8w6hmNlp2sxM3ce5WcP4TS6FwDpEhA66flx5MB tGPsj4vZSikoDZDR70FuNuPFxeuZnNmVU3LSWS7cRVyXeIHIzMF+kH7xMMeh0RejWOW4 XJDZzruLOf9NU5bvc8uXLagEx9RLTO2Vmgjm982m2eKfmuiUpxC+J6rZr1PfirCa0Xq1 g1+w== X-Gm-Message-State: AGi0PuaxkWz9CW3NnG6Ksk9wor7tww3rQQMac+TFSWnGLL2jwS7A9ZUi xEheR0fRije2PFPIAPCuuakTf4KKoT2awg== X-Google-Smtp-Source: APiQypJpBt9RlldwV4b4hbBqTa2O5HHu6nRBFlD8qprhM9gQMQ8nWidhYIPZihpMwRFu3rziYwu9OA== X-Received: by 2002:aca:b803:: with SMTP id i3mr939737oif.92.1586251807953; Tue, 07 Apr 2020 02:30:07 -0700 (PDT) Received: from [30.5.98.11] ([205.204.117.15]) by smtp.gmail.com with ESMTPSA id a23sm5199094otl.47.2020.04.07.02.30.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2020 02:30:07 -0700 (PDT) From: =?utf-8?B?5pu+5paH5peM?= Content-Type: multipart/alternative; boundary="Apple-Mail=_C61E4E6D-4DEB-4FFF-B76D-D63FA7E671C8" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: [bug] Wrong bool value parameter Message-Id: Date: Tue, 7 Apr 2020 17:30:03 +0800 Cc: tushar , Prabhat Sahu To: pgsql-hackers@lists.postgresql.org, pgsql-bugs@lists.postgresql.org X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_C61E4E6D-4DEB-4FFF-B76D-D63FA7E671C8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Do we allow such a bool parameter value? This seems puzzling to me. postgres=3D# create table t1(c1 int) with(autovacuum_enabled =3D'tr'); CREATE TABLE postgres=3D# create table t2(c1 int) with(autovacuum_enabled =3D'fa'); CREATE TABLE postgres=3D# \d+ t1 Table "public.t1" Column | Type | Collation | Nullable | Default | Storage | Stats = target | Description=20 = --------+---------+-----------+----------+---------+---------+------------= --+------------- c1 | integer | | | | plain | = |=20 Access method: heap Options: autovacuum_enabled=3Dtr postgres=3D# \d+ t2 Table "public.t2" Column | Type | Collation | Nullable | Default | Storage | Stats = target | Description=20 = --------+---------+-----------+----------+---------+---------+------------= --+------------- c1 | integer | | | | plain | = |=20 Access method: heap Options: autovacuum_enabled=3Dfa I am try to fix in bug_boolrelopt.patch Wenjing --Apple-Mail=_C61E4E6D-4DEB-4FFF-B76D-D63FA7E671C8 Content-Type: multipart/mixed; boundary="Apple-Mail=_BAF10BA6-46D4-40B3-AB04-A8312D41901D" --Apple-Mail=_BAF10BA6-46D4-40B3-AB04-A8312D41901D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Do = we allow such a bool parameter value? This seems puzzling to me.


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

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


I am try to fix = in bug_boolrelopt.patch


Wenjing



= --Apple-Mail=_BAF10BA6-46D4-40B3-AB04-A8312D41901D Content-Disposition: attachment; filename=bug_boolrelopt.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="bug_boolrelopt.patch" Content-Transfer-Encoding: 7bit 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; --Apple-Mail=_BAF10BA6-46D4-40B3-AB04-A8312D41901D Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
--Apple-Mail=_BAF10BA6-46D4-40B3-AB04-A8312D41901D-- --Apple-Mail=_C61E4E6D-4DEB-4FFF-B76D-D63FA7E671C8--