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>, amul sul <sulamul@gmail.com>
Cc: Robert Haas <robertmhaas@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-04T20:40:17Z
Lists: pgsql-hackers
Hi Rahila,

still thinking about the syntax (sorry):


On 04.05.2017 13:44, Rahila Syed wrote:
> [...] The syntax implemented in this patch is as follows,
>
> CREATE TABLE p11 PARTITION OF p1 DEFAULT;

Rewriting the following:

> On Thu, May 4, 2017 at 4:02 PM, amul sul <sulamul@gmail.com 
> <mailto:sulamul@gmail.com>> wrote:
>
>     [...] CREATE TABLE p1 PARTITION OF test FOR VALUES IN  (DEFAULT)
>     PARTITION BY LIST(b); [...]
>

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 PARTITION*ED* 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.

Sven

Commits

  1. Allow a partitioned table to have a default partition.

  2. Adjust min/max values when changing sequence type

  3. BRIN auto-summarization