Thread: Table Partition

Table Partition

From
"Dinesh Pandey"
Date:

How to create this table  (with partition) in Postgres.

 

--ORACLE

CREATE TABLE A (col1         NUMBER         NOT NULL,

                   col2              DATE            NOT NULL,

                   col3              VARCHAR2(500)

          )

          PARTITION BY RANGE (col2) (

                   PARTITION partition_one VALUES LESS THAN (TO_DATE('01/04/2001', 'DD/MM/YYYY')) TABLESPACE MYTABSPACE

          );

 

 

 

 

 

Thanks

 

Re: Table Partition

From
Scott Marlowe
Date:
On Fri, 2005-04-22 at 05:51, Dinesh Pandey wrote:
> How to create this table  (with partition) in Postgres.
>
>
>
> --ORACLE
>
> CREATE TABLE A (col1         NUMBER         NOT NULL,
>
>                    col2              DATE            NOT NULL,
>
>                    col3              VARCHAR2(500)
>
>           )
>
>           PARTITION BY RANGE (col2) (
>
>                    PARTITION partition_one VALUES LESS THAN
> (TO_DATE('01/04/2001', 'DD/MM/YYYY')) TABLESPACE MYTABSPACE
>
>           );

Unfortunately, postgresql does not currently support partitioning.

If you want this, you'll have to "roll your own" so to speak.  You'll
need to create two different tables in two different tablespaces, create
a view on top of them, and then create on update triggers to put the
data into the right table when it comes in.

it's a pain, but it works.