Re: Postgres 11: Table Partitioning and Primary Keys

Michael Paquier <[email protected]> Tue, 9 Jul 2019 15:34:48 +0900
Newsgroups gmane.comp.db.postgresql.devel.documentation,gmane.comp.db.postgresql.devel.general
Message-ID <[email protected]>
--TRYliJ5NKNqkz5bu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 08, 2019 at 08:12:18PM -0700, David G. Johnston wrote:
> Reads a bit backward.  How about:
>=20
> "As uniqueness can only be enforced within an individual partition when
> defining a primary key on a partitioned table all columns present in the
> partition key must also exist in the primary key."

Yes, I was not really inspired on this one.

Looking closely at the code in DefineIndex() (and as Rajkumar has
mentioned upthread for unique constraints) this can happen for primary
keys, unique constraints and exclusion constraints.  So we had better
mention all three of them.  I am not sure that we need to be explicit
about the uniqueness part though, let's say the following:
"When defining a primary key, a unique constraint or an exclusion
constraint on a partitioned table, all the columns present in the
constraint definition must be included in the partition key."
--
Michael

--TRYliJ5NKNqkz5bu
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl0kNYgACgkQnvQgOdby
QH2+9Q//WJnB5VQj3X23bkYOtzoVdAX7Q8X7DKw44PjnZ66AijvNYiFV7/ZjTCT5
j4LEVgSltGEj62ZGSWcvHdJ1oyFY5j71TyNcU4V4BOWoohAoXS8lJ0hXWtICO74e
FltQjnfBuDi6owPsLrgr0qiT607nEnirX2s2CWEWlUi1SXVZenxzkMp6uAsi9ASh
JI6k4BDHLO7OXyzqAe/G1iqYtT8byIBlowiTOPhj0Ei9+oqd6jJLTajYrdPuDcXX
d5mXJ5ORDY/UWKeTWh8NQxRqa0uDYSG8x67x68EcnJE0/PayUi0yTMd3eRUT9EGh
T3opWb5UNxMFtp9mNQIwqD29KXp590x1kJOHy6ShHOgjB8b/F12jwET0Xq7wBKhd
WS3E2cPv3zFdWv9xS63hTyluig7+V+r13ZC/uTmywZqalRGBKRupjLZEUupuYG+N
hhDZPzhbzSR/BS7akn572X6e8HpgyftoHgRydYo1QLJTGHK3//hGTgobqFTH0KcA
nWLff6kgbgvtGL/1tSZH8Rs2ARcDt8fvUGnlOZ7O5zD7X/GPGBjDqM9nAStFYyn1
EAOrR/LjvsvQl+Wh2zTHhFrUWFnssYdnDsBHj6AdoBffl6rIdulD8NOESSpDS+PV
mjSeAfDSOHHCTM0QdfdVOFJM5Ufvpn+7Bg9C6qvGQc5Sczlvg3E=
=CNMS
-----END PGP SIGNATURE-----

--TRYliJ5NKNqkz5bu--