From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | jonathan(dot)katz(at)excoventures(dot)com, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, David Steele <david(at)pgmasters(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Mark Dilger <hornschnorter(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Boolean partitions syntax |
Date: | 2018-04-11 02:33:54 |
Message-ID: | 67fcb9fb-ca57-5a8f-32b9-009aa5aaa1dc@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2018/04/10 23:37, David Rowley wrote:
> On 10 April 2018 at 23:13, Kyotaro HORIGUCHI
> <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>> Note: This is not intended to be committed this time but just for
>> information.
>>
>> At Tue, 10 Apr 2018 10:34:27 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI wrote:
>>> Just adding negation would work as a_expr is doing.
>>>
>>>> | '-' a_expr %prec UMINUS
>>>> { $$ = doNegate($2, @1); }
>>
>> a_expr fits partbound_datum_list as is but it cannot sit
>> side-by-side with MAX/MINVALUE at all. However c_expr can if
>> columnref is not excluded. The attached patch does that and
>> partition bound accepts the following syntax. (I didn't see the
>> transform side at all)
>>
>> create table p2c1 partition of p2 for values from (log(1000),0+1,0/1) to (10, 10, ('1'||'0')::int);
>
> I imagined this would have had a check for volatile functions and some
> user-friendly error message to say partition bounds must be immutable,
> but instead, it does:
>
> postgres=# create table d_p1 partition of d for values in (Random());
> ERROR: specified value cannot be cast to type double precision for column "d"
> LINE 1: create table d_p1 partition of d for values in (Random());
> ^
> DETAIL: The cast requires a non-immutable conversion.
> HINT: Try putting the literal value in single quotes.
>
> For inspiration, maybe you could follow the lead of CREATE INDEX:
>
> postgres=# create index on d ((random()));
> ERROR: functions in index expression must be marked IMMUTABLE
Hmm, I think we do already check that the *partition key* expression is
IMMUTABLE.
create table foo (a int) partition by list (random());
ERROR: functions in partition key expression must be marked IMMUTABLE
This sounds to not apply to what we'd want to do with a partition bound
expression.
Thanks,
Amit
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2018-04-11 03:13:35 | Re: power() function in Windows: "value out of range: underflow" |
Previous Message | Amit Langote | 2018-04-11 02:27:17 | Re: Boolean partitions syntax |