Lists: | pgsql-hackers |
---|
From: | Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Parsing bool type value |
Date: | 2013-08-20 07:41:06 |
Message-ID: | CAD21AoDWG3car9gFd5n-cqUbAp33gxWzbGuyj4DWDYswdZR79g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi all,
Taking a look at PostgreSQL HEAD today, I noticed that currently
PostgreSQL allows "of" value as bool type value.
So user can execute the following SQL.
=# SET enbale_seqscan TO of;
And I read the source code related to parsing bool value.
It compare TWO characters "off" and the setting value in
parse_bool_with_len() function.
Should we deny the "of" value as bool type value?
Regards,
-------
Sawada Masahiko
Attachment | Content-Type | Size |
---|---|---|
parse_bool_with_len.patch | application/octet-stream | 486 bytes |
From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Parsing bool type value |
Date: | 2013-08-20 14:53:53 |
Message-ID: | CAA4eK1K=jLmN8j13HVQ9ppewL7+rGMs=-2mX99UAyuYoP2DOXA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Aug 20, 2013 at 1:11 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
> Hi all,
>
> Taking a look at PostgreSQL HEAD today, I noticed that currently
> PostgreSQL allows "of" value as bool type value.
> So user can execute the following SQL.
>
> =# SET enbale_seqscan TO of;
>
> And I read the source code related to parsing bool value.
> It compare TWO characters "off" and the setting value in
> parse_bool_with_len() function.
> Should we deny the "of" value as bool type value?
When I checked the manual for values of bool types, it says as follows:
" Boolean values can be written as on, off, true, false, yes, no, 1,
0 (all case-insensitive) or any unambiguous prefix of these."
Now "of" can be considered as unambiguous prefix of "off", so it
might be intentional.
Please refer below link for more detailed description:
http://www.postgresql.org/docs/devel/static/config-setting.html#CONFIG-SETTING-NAMES-VALUES
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From: | Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Parsing bool type value |
Date: | 2013-08-20 15:15:39 |
Message-ID: | CAD21AoBB2cdeyYcfAWJFd4Hc2p9XpxnWZCuppkNqfJt5eQv3Hg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Aug 20, 2013 at 11:53 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Tue, Aug 20, 2013 at 1:11 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
>> Hi all,
>>
>> Taking a look at PostgreSQL HEAD today, I noticed that currently
>> PostgreSQL allows "of" value as bool type value.
>> So user can execute the following SQL.
>>
>> =# SET enbale_seqscan TO of;
>>
>> And I read the source code related to parsing bool value.
>> It compare TWO characters "off" and the setting value in
>> parse_bool_with_len() function.
>> Should we deny the "of" value as bool type value?
>
> When I checked the manual for values of bool types, it says as follows:
> " Boolean values can be written as on, off, true, false, yes, no, 1,
> 0 (all case-insensitive) or any unambiguous prefix of these."
> Now "of" can be considered as unambiguous prefix of "off", so it
> might be intentional.
> Please refer below link for more detailed description:
> http://www.postgresql.org/docs/devel/static/config-setting.html#CONFIG-SETTING-NAMES-VALUES
Thank you for replay.
I have confirmed manual and understood.
And I have understood the comment which is written at
parse_bool_with_len() function.
Thanks!
Regards,
-------
Sawada Masahiko