Re: Same expression more than once in partition key

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Same expression more than once in partition key
Date: 2017-06-23 13:54:17
Message-ID: 7636.1498226057@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> writes:
> When we create a range partitioned table, we cannot use
> a column more than once in the partition key.

> postgres=# create table t (i int) partition by range(i,i);
> ERROR: column "i" appears more than once in partition key

AFAIK, that's just a simple test for obvious mistakes; it's not a
property that's essential for correctness.

> However, I can use same expression more than once in partition key.

... and so, I can't get excited about extending it to expressions.
Where would you stop --- for example, are i and (i) equal? What
about (i) and (case when true then i else j end)? In principle,
the system could recognize both those identities, but it seems
silly to expend code on it just for nagware purposes.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2017-06-23 14:07:44 Re: Pluggable storage
Previous Message Andrew Gierth 2017-06-23 13:39:48 Re: transition table behavior with inheritance appears broken