Re: On partitioning

Amit Langote <langote_amit_f8@lab.ntt.co.jp>

From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Claudio Freire <klaussfreire@gmail.com>, Josh Berkus <josh@agliodbs.com>, Tom Lane <tgl@sss.pgh.pa.us>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2014-12-17T01:13:16Z
Lists: pgsql-hackers
On 17-12-2014 AM 12:15, Robert Haas wrote:
> On Mon, Dec 15, 2014 at 6:55 PM, Amit Langote
> <Langote_Amit_f8@lab.ntt.co.jp> wrote:
>> Robert wrote:
>>> I would expect that to fail, just as it would fail if you tried to
>>> build an index using a volatile expression.
>>
>> Oops, wrong example, sorry. In case of an otherwise good expression?
> 
> I'm not really sure what you are getting here.  An "otherwise-good
> expression" basically means a constant.  Index expressions have to be
> things that always produce the same result given the same input,
> because otherwise you might get a different result when searching the
> index than you did when building it, and then you would fail to find
> keys that are actually present.  In the same way, partition boundaries
> also need to be constants.  Maybe you could allow expressions that can
> be constant-folded, but that's about it.  

Yeah, this is what I meant. Expressions that can be constant-folded.
Sorry, the example I chose was pretty lame. I was just thinking about
kind of stuff that something like pg_node_tree would be a good choice
for as on-disk representation of partition values. Though definitely it
wouldn't be to store arbitrary expressions that evaluate to different
values at different times.

Thanks,
Amit