Re: [bug] Wrong bool value parameter

From: wenjing <wjzeng2012(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>, Euler Taveira <euler(dot)taveira(at)2ndquadrant(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
Subject: Re: [bug] Wrong bool value parameter
Date: 2020-04-11 14:54:38
Message-ID: 03D702AD-6499-4FBD-B2F3-34872AC979D3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> 2020年4月8日 21:45,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 写道:
>
> Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com> writes:
>> On Wed, 8 Apr 2020 at 16:00, wenjing <wjzeng2012(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message wenjing 2020-04-11 15:05:17 Re: [bug] Wrong bool value parameter
Previous Message PG Bug reporting form 2020-04-11 06:01:49 BUG #16357: Incorrect rounding for negative arguments in to_timestamp()

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-04-11 14:54:49 Re: relcache leak warnings vs. errors
Previous Message Julien Rouhaud 2020-04-11 13:38:18 Re: pgsql: Support FETCH FIRST WITH TIES