From: wenjing <wjzeng2012@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
To: Euler Taveira <euler.taveira@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org, tushar <tushar.ahuja@enterprisedb.com>
Cc: Prabhat Sahu <prabhat.sahu@enterprisedb.com>
Subject: Re: [bug] Wrong bool value parameter
Date: Sat, 11 Apr 2020 22:54:38 +0800
Message-ID: <03D702AD-6499-4FBD-B2F3-34872AC979D3@gmail.com> (raw)
In-Reply-To: <3414.1586353518@sss.pgh.pa.us>
References: <C6E8C2E7-1906-4F6E-BCC8-7D9FC2FC5CFE@gmail.com>
<CAH503wA1_burFuRPQkBfMdHXQoc_13R6wmQ06LkjfKN1SHQpSQ@mail.gmail.com>
<CA+fd4k7zmTWzmZP6xPey=KZ2EtBOY+T6mnrLewjL4XV=n0s+og@mail.gmail.com>
<C930FB4B-E89A-4608-B30C-2434EBF1FBC3@gmail.com>
<CA+fd4k6rYwr33+Hf4aWmAdMDUT4iWjDmQV9aM6-o5AB5CScmsQ@mail.gmail.com>
<3414.1586353518@sss.pgh.pa.us>
> 2020年4月8日 21:45,Tom Lane <tgl@sss.pgh.pa.us> 写道:
>
> 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=# 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=# select 'fa'::bool;
> bool
> ------
> f
> (1 row)
>
> regression=# 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
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: wjzeng2012@gmail.com, tgl@sss.pgh.pa.us, masahiko.sawada@2ndquadrant.com, euler.taveira@2ndquadrant.com, tushar.ahuja@enterprisedb.com, prabhat.sahu@enterprisedb.com
Subject: Re: [bug] Wrong bool value parameter
In-Reply-To: <03D702AD-6499-4FBD-B2F3-34872AC979D3@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