Re: Adding support for Default partition in partitioning
Sven R. Kunze <srkunze@mail.de>
From: "Sven R. Kunze" <srkunze@mail.de>
To: Rahila Syed <rahilasyed90@gmail.com>, Robert Haas <robertmhaas@gmail.com>
Cc: amul sul <sulamul@gmail.com>, Keith Fiske <keith@omniti.com>,
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>,
Rushabh Lathia <rushabh.lathia@gmail.com>, David Steele
<david@pgmasters.net>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-05-10T14:59:58Z
Lists: pgsql-hackers
On 09.05.2017 09:19, Rahila Syed wrote: > +1 for AS DEFAULT syntax if it helps in improving readability > specially in following case > > CREATE TABLE p1 PARTITION OF test AS DEFAULT PARTITION BY LIST(a); > > Thank you, > Rahila Syed > > On Tue, May 9, 2017 at 1:13 AM, Robert Haas <robertmhaas@gmail.com > <mailto:robertmhaas@gmail.com>> wrote: > > On Thu, May 4, 2017 at 4:40 PM, Sven R. Kunze <srkunze@mail.de > <mailto:srkunze@mail.de>> wrote: > > It yields > > > > CREATE TABLE p1 PARTITION OF test DEFAULT PARTITION BY LIST(b); > > > > This reads to me like "DEFAULT PARTITION". > > > > I can imagine a lot of confusion when those queries are > encountered in the > > wild. I know this thread is about creating a default partition > but I were to > > propose a minor change in the following direction, I think > confusion would > > be greatly avoided: > > > > CREATE TABLE p1 PARTITION OF test AS DEFAULT PARTITIONED BY LIST(b); > > > > I know it's a bit longer but I think those 4 characters might serve > > readability in the long term. It was especially confusing to see > PARTITION > > in two positions serving two different functions. > > Well, we certainly can't make that change just for default partitions. > I mean, that would be non-orthogonal, right? You can't say that the > way to subpartition is to write "PARTITION BY strategy" when the table > unpartitioned or is a non-default partition but "PARTITIONED BY > strategy" when it is a default partition. That would certainly not be > a good way of confusing users less, and would probably result in a > variety of special cases in places like ruleutils.c or pg_dump, plus > some weasel-wording in the documentation. We COULD do a general > change from "CREATE TABLE table_name PARTITION BY strategy" to "CREATE > TABLE table_name PARTITIONED BY strategy". I don't have any > particular arguments against that except that the current syntax is > more like Oracle, which might count for something, and maybe the fact > that we're a month after feature freeze. Still, if we want to change > that, now would be the time; but I favor leaving it alone. > You are definitely right. Changing it here would require to change it everywhere AND thus to loose syntax parity with Oracle. I am not in a position to judge this properly whether this would be a huge problem. Personally, I don't have an issue with that. But don't count me as most important opion on this. > > So I guess I'm still in favor of the CREATE TABLE p1 PARTITION OF test > DEFAULT syntax, but if it ends up being AS DEFAULT instead, I can live > with that. > Is to make it optional an option? Sven
Commits
-
Allow a partitioned table to have a default partition.
- 6f6b99d1335b 11.0 landed
-
Adjust min/max values when changing sequence type
- 60a0b2ec8943 10.0 cited
-
BRIN auto-summarization
- 7526e10224f0 10.0 cited