2010/1/21 Grzegorz Jaśkiewicz <gryzman@gmail.com>:
> http://www.pubbs.net/pgsql/201001/16503/
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
Grzegorz,
Thanks for the reference, which officially is here:
http://archives.postgresql.org/pgsql-general/2010-01/msg00331.php
I confirm it wasn't easy to find that out. Maybe you can add the
snippet into the Postgresql Wiki.
One thing to add here is that I would advise against the CREATE
TABLE...INHERITS.
I find much more useful:
-- code
CREATE TABLE <partition> (
LIKE <master>
INCLUDING INDEXES,
CHECK( <the condition> )
);
ALTER TABLE <partition> INHERIT <master>;
-- end code
because very often I still need the indexes in the partitions.
And in case you need the (other) constraints and the defaults, uyou
can ask for it with the INCLUDING clause.
And, BTW:
EXECUTE 'INSERT INTO '||partition-table-name||' SELECT $1.*' USING NEW;
--
Vincenzo Romano
NotOrAnd Information Technologies
NON QVIETIS MARIBVS NAVTA PERITVS