Re: Boolean partitions syntax - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Boolean partitions syntax
Date
Msg-id a6111de5-a69c-8754-8c88-1a112836cce2@lab.ntt.co.jp
Whole thread Raw
In response to Re: Boolean partitions syntax  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Responses Re: Boolean partitions syntax  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers
On 2017/12/12 18:12, Ashutosh Bapat wrote:
> On Tue, Dec 12, 2017 at 7:19 AM, Amit Langote wrote:
>> Horiguchi-san pointed out [1] on a nearby thread that the partitioning
>> syntax (the FOR VALUES clause) doesn't accept true and false as valid
>> partition bound datums, which seems to me like an oversight.  Attached a
>> patch to fix that.
>
> May be you should use opt_boolean_or_string instead of TRUE_P and
> FALSE_P. It also supports ON and OFF, which will be bonus.

Thanks for the suggestion.  I tried that but NonReservedWord_or_Sconst
conflicts with Sconst that partbound_datum itself has a rule for,
resulting in the following error:

gram.y: conflicts: 6 reduce/reduce
gram.y: expected 0 reduce/reduce conflicts
gram.y:2769.25-81: warning: rule useless in parser due to conflicts:
partbound_datum: Sconst

Moreover, it seems like on/off are not being accepted as valid Boolean
values like true/false are.

insert into rp values (true);
INSERT 0 1
insert into rp values (on);
ERROR:  syntax error at or near "on"
LINE 1: insert into rp values (on);
                               ^
What's going on with that?   Maybe on/off values work only with SET
statements?

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Haribabu Kommi
Date:
Subject: Re: [HACKERS] pg_stat_wal_write statistics view
Next
From: Thomas Munro
Date:
Subject: Re: [HACKERS] Parallel Hash take II