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 1jNHX6-00058R-7z for pgsql-bugs@arkaria.postgresql.org; Sat, 11 Apr 2020 14:54:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNHX2-00066p-Oc for pgsql-bugs@arkaria.postgresql.org; Sat, 11 Apr 2020 14:54:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNHX2-00066i-9g for pgsql-bugs@lists.postgresql.org; Sat, 11 Apr 2020 14:54:52 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jNHWv-0003U3-OK for pgsql-bugs@lists.postgresql.org; Sat, 11 Apr 2020 14:54:50 +0000 Received: by mail-pj1-x102a.google.com with SMTP id cl8so703000pjb.3 for ; Sat, 11 Apr 2020 07:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=a3NChDH+trQGDViV3D/nE9ttJBmncgVsICkFVp9MxcA=; b=sv4VZ3+JW44MwdcOBHH6OCcq0wMc336aCH6FvkMCGX3j9DrIi2A5Ed2eB9tDEsr+or ECz1jx1Lp7c64kKbA3TKV90ryYAy16q1uJrAKxoLu/F/AMlrJfGPKLrABk9LTbqoojw2 c6Jd30azv8N/gC9QW1A6odRgp0g7qA0eBu2lOC95RWx8Vqf7jAbVwgvcztW6/PtZIMfo sYv0nI88ZhZ9ILf9DmVxYsvaMlHnaCAOO5LRRGJxIDXE8mJCjCY4HRszx6XjCQBYNFXe E6160luHaOvycsLEGhrIiu/47ArRZUyJzSaWh4s/1eLR1NPE4Aku/d0OENuqwdCvbk63 EVqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=a3NChDH+trQGDViV3D/nE9ttJBmncgVsICkFVp9MxcA=; b=nE98El5Hi54xSg2ws71F0ubNIjoHj1KzIMRXZu91XjZU6T9fPqtOGPX6XNwNfa3NrK 54wXaG9pyoNK1U7XT7Z5LPLHRgjJRrCBNQeYy83DbDLLB5GqGJZ1B5MeAyjZczS8+7AI OFlv0QSkaGgE/U54h/aWcDVjR2c0S/oSs/c+gD3r4+7OWvFhCwQK7DGZYVgS0clvv8Qv jW8bzWutaK6/dqkQJXPj11djXmW0LZ/GCeVO5Y4BFO0JLplCRQjRFkw2leqxa7NLtLUg LfKdvmwLxFYp3/g1YzL2L3/J6jUks1/b7YII3VVBl1crRImmECw3GXWa2HyYPCtBJHNm CUeQ== X-Gm-Message-State: AGi0PubSq6fVgQgBfZkH6sxi1rb0xKSFUQhfby8fFuq7lpkSct5N4eB9 kqqX17lV7/KkDzwigBFFHaM= X-Google-Smtp-Source: APiQypLHDs0AIgxhhn6cf/S5wS8wZlrOXPLuaqwv9h3HBRCQ3s2R6s/lsQV89CYEma39Ypq5d8q+7Q== X-Received: by 2002:a17:90a:de0e:: with SMTP id m14mr11498775pjv.54.1586616884461; Sat, 11 Apr 2020 07:54:44 -0700 (PDT) Received: from [127.0.0.1] ([20.188.0.188]) by smtp.gmail.com with ESMTPSA id d77sm3397903pfd.145.2020.04.11.07.54.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Apr 2020 07:54:43 -0700 (PDT) From: wenjing Message-Id: <03D702AD-6499-4FBD-B2F3-34872AC979D3@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_7CEC37D1-EEF1-4D3E-9A16-83DEE2EA1C15" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [bug] Wrong bool value parameter Date: Sat, 11 Apr 2020 22:54:38 +0800 In-Reply-To: <3414.1586353518@sss.pgh.pa.us> Cc: pgsql-bugs@lists.postgresql.org, tushar , Prabhat Sahu To: Tom Lane , Masahiko Sawada , Euler Taveira References: <3414.1586353518@sss.pgh.pa.us> 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=_7CEC37D1-EEF1-4D3E-9A16-83DEE2EA1C15 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 2020=E5=B9=B44=E6=9C=888=E6=97=A5 21:45=EF=BC=8CTom Lane = =E5=86=99=E9=81=93=EF=BC=9A >=20 > Masahiko Sawada writes: >> On Wed, 8 Apr 2020 at 16:00, wenjing wrote: >>> Why do table parameters of a bool type have different rules than = data types of a Boolean type? >>> postgres=3D# insert into test_bool_type values('fals'); >>> ERROR: invalid input syntax for type boolean: "fals" >>> LINE 1: insert into test_bool_type values('fals'); >=20 >> Hmm that seems strange. In my environment, both 'tr' and 'fa' are >> accepted at least with the current HEAD >=20 > Yeah, it works for me too: >=20 > regression=3D# select 'fa'::bool; > bool=20 > ------ > f > (1 row) >=20 > regression=3D# select 'fals'::bool; > bool=20 > ------ > f > (1 row) >=20 >> IIUC both bool of SQL data type and bool of GUC parameter type are >> using the same function parse_bool_with_len() to parse the input >> value. The behavior can vary depending on the environment? >=20 > parse_bool_with_len is not locale-sensitive for ASCII input. > Conceivably its case folding could vary for non-ASCII, but that's > not relevant here. >=20 > I am suspicious that the OP is not using community Postgres. > This seems like the kind of thing that EDB might've hacked > for better Oracle compatibility, for example. Sorry, you're right. I used the modified code and got the wrong result. >=20 > regards, tom lane --Apple-Mail=_7CEC37D1-EEF1-4D3E-9A16-83DEE2EA1C15 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

2020=E5=B9=B44=E6=9C=888=E6=97=A5 21:45=EF=BC=8CTom Lane = <tgl@sss.pgh.pa.us> =E5=86=99=E9=81=93=EF=BC=9A

Masahiko Sawada <masahiko.sawada@2ndquadrant.com> writes:
On Wed, 8 Apr 2020 at = 16:00, wenjing <wjzeng2012@gmail.com> wrote:
Why do table parameters of a bool type have = different rules than data types of a Boolean type?
postgres=3D# insert into test_bool_type values('fals');
ERROR:  invalid input syntax for type boolean: "fals"
LINE 1: insert into test_bool_type values('fals');

Hmm that seems strange. In my environment, both = 'tr' and 'fa' are
accepted at least with the current = HEAD

Yeah, it works for me = too:

regression=3D# select 'fa'::bool;
bool
------
f
(1 = row)

regression=3D# select 'fals'::bool;
bool
------
f
(1 = row)

IIUC both bool of SQL data type and bool of GUC parameter = type are
using the same function parse_bool_with_len() to = parse the input
value. The behavior can vary depending on = the = environment?

parse_bool_with_len is not locale-sensitive for ASCII = input.
Conceivably its case folding could vary for = non-ASCII, but that's
not relevant here.

I am suspicious that the OP is not using community = Postgres.
This seems like the kind of thing that EDB = might've hacked
for better Oracle compatibility, for = example.
Sorry, you're right. I used the modified code and got the = wrong result.


regards, tom lane

= --Apple-Mail=_7CEC37D1-EEF1-4D3E-9A16-83DEE2EA1C15--