Re: Syntax for partitioning

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Syntax for partitioning
Date: 2009-11-25 08:17:43
Message-ID: 20091125171743.92A1.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
partitioning_20091125.patch application/octet-stream 145.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2009-11-25 08:23:13 Re: operator exclusion constraints
Previous Message Jeff Davis 2009-11-25 07:15:15 Re: [PATCH 4/4] Add tests to dblink covering use of COPY TO FUNCTION