using expression syntax for partition bounds (was: Re: Booleanpartitions syntax) - Mailing list pgsql-hackers

From Amit Langote
Subject using expression syntax for partition bounds (was: Re: Booleanpartitions syntax)
Date
Msg-id 9f88b5e0-6da2-5227-20d0-0d7012beaa1c@lab.ntt.co.jp
Whole thread Raw
Responses Re: using expression syntax for partition bounds (was: Re: Booleanpartitions syntax)
List pgsql-hackers
(patch and discussion for PG 12)

On 2018/04/22 1:28, Tom Lane wrote:
> Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
>> [ v8-0001-Allow-generalized-expression-syntax-for-partition.patch ]
>
> I find what you did to a_expr here to be pretty horrid.

Thanks for the review.

> I think what you should do is lose the partbound_datum and
> PartitionRangeDatum productions altogether, replacing those with just
> a_expr, as in the attached grammar-only patch.  This would result in
> needing to identify MINVALUE and MAXVALUE during parse analysis, since
> the grammar would just treat them as ColId expressions.  But since we're
> not intending to ever allow any actual column references in partition
> expressions, I don't see any harm in allowing parse analysis to treat
> ColumnRefs containing those names as meaning the special items.

I have to agree this is better.

> This is a little bit grotty, in that both MINVALUE and "minvalue" would
> be recognized as the keyword, but it's sure a lot less messy than what's
> there now.  And IIRC there are some other places where we're a bit
> squishy about the difference between identifiers and keywords, too.

Hmm, yes.

I tried to update the patch to do things that way.  I'm going to create a
new entry in the next CF titled "generalized expression syntax for
partition bounds" and add the patch there.

Thanks,
Amit

Attachment

pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Toast issues with OldestXmin going backwards
Next
From: Amit Langote
Date:
Subject: Re: using expression syntax for partition bounds (was: Re: Booleanpartitions syntax)