Re: Creating a partition table - Mailing list pgsql-admin

From Tom Lane
Subject Re: Creating a partition table
Date
Msg-id 101520.1604081342@sss.pgh.pa.us
Whole thread Raw
In response to Re: Creating a partition table  (John Scalia <jayknowsunix@gmail.com>)
List pgsql-admin
John Scalia <jayknowsunix@gmail.com> writes:
> Ok I tried what Laurent had suggested and now the error is:
> Insufficient columns in PRIMARY KEY constraint definition.

> Now, the attribute the devs want is not a key value in the original table, but if it were that wouldn’t make a great
dealof sense for a partition. So, now why did it gripe? 

FWIW, we recently rephrased that message as "unique constraint on
partitioned table must include all partitioning columns", because
people were finding it confusing.

The reason for the restriction is that a partitioned index is really
just a collection of separate indexes on the individual leaf partitions
(just as the partitioned table is a collection of plain tables).
So it can't enforce uniqueness across partitions unless such uniqueness
is guaranteed by the partitioning scheme.

Yeah, this is an implementation restriction, but I don't foresee it
ever going away.  If the indexes weren't independent then you'd lose
the scalability benefits that partitioning is meant to provide.

            regards, tom lane



pgsql-admin by date:

Previous
From: John Scalia
Date:
Subject: Re: Creating a partition table
Next
From: Magnus Hagander
Date:
Subject: Re: free(): invalid pointer , when to dumping data to a new server