Re: Syntax for partitioning - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject Re: Syntax for partitioning
Date
Msg-id 20091125171743.92A1.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Re: Syntax for partitioning  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: Syntax for partitioning
List pgsql-hackers
Here is an updated partitioning syntax patch.
It implements syntax described here:
    http://wiki.postgresql.org/wiki/Table_partitioning#Syntax

Changes:
  * New syntax: ALTER TABLE parent ATTACH/DETACH PARTITION.
  * Partition keys accepts an opclass name instead of an operator.
  * "lo <= key AND key < hi" is used in range check constraints instead of
    "key >= lo AND key < hi".

ToDo items:
  * pg_get_partitiondef(parentOid, in_alter_format) might be ugly.
    It was designed only for psql -d and pg_dump. It might be cleaner
    if we move SQL formatter from the core function to client tools.
      In psql: pg_get_partitiondef(oid, false)
        Partitions: RANGE (sales_date)
        (
            PARTITION sales_2006 VALUES LESS THAN '...',
            ...
            PARTITION sales_max VALUES LESS THAN MAXVALUE
        )
      In pg_dump: pg_get_partitiondef(oid, true)
        ALTER TABLE parent PARTITION BY RANGE (sales_date);
        ALTER TABLE parent ATTACH PARTITION sales_2006 VALUES LESS THAN '...';
        ...
        ALTER TABLE parent ATTACH PARTITION sales_max VALUES LESS THAN MAXVALUE;

  * The patch does not contain the following documentation,
    but I'll start writing them if the syntax is ok.
      - ddl-partitioning.sgml
      - alter-partition.sgml  (new)
      - create-partition.sgml (new)
      - drop-partition.sgml   (new)

Note:
  * In fact, malloc was not a bug because it was the code in pg_dump.

Comments welcome.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Attachment

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION
Next
From: Pavel Stehule
Date:
Subject: Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION