Re: Postgres 11: Table Partitioning and Primary Keys
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Amit Langote <amitlangote09@gmail.com>,
Michael Paquier <michael@paquier.xyz>,
"David G. Johnston" <david.g.johnston@gmail.com>,
Bruce Momjian <bruce@momjian.us>, phil.bayer@gmail.com,
pgsql-docs@lists.postgresql.org,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-07-09T22:59:59Z
Lists: pgsql-hackers, pgsql-docs
Alvaro Herrera <alvherre@2ndquadrant.com> writes: > That's a mild personal preference only though. Anyway, based on your > proposed wording, I wrote this: > <listitem> > <para> > Unique constraints on partitioned tables (as well as primary keys) > must constrain all the partition key columns. This limitation exists > because <productname>PostgreSQL</productname> can only enforce > uniqueness in each partition individually. > </para> > </listitem> > I'm not really sure about the "must constrain" verbiage. Is that really > comprehensible? I think "must include" might be better. > In CREATE TABLE, we already have this: > <para> > When establishing a unique constraint for a multi-level partition > hierarchy, all the columns in the partition key of the target > partitioned table, as well as those of all its descendant partitioned > tables, must be included in the constraint definition. > </para> > which may not be the pinnacle of clarity, but took some time to craft > and I think is correct. Also it doesn't mention primary keys > explicitly; maybe we should patch it by adding "(as well as a primary > key)" right after "a unique constraint". Thoughts? I'd leave that alone. I don't think the parenthetical comment about primary keys in your new text is adding much either. regards, tom lane
Commits
-
Mention limitation of unique in partitioned tables
- 5918b8261451 11.5 landed
- ec4eaab78b07 13.0 landed
- 220857a87508 12.0 landed