Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkz5k-0004po-0S for pgsql-docs@arkaria.postgresql.org; Tue, 09 Jul 2019 23:00:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkz5i-0001MK-Pf for pgsql-docs@arkaria.postgresql.org; Tue, 09 Jul 2019 23:00:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkz5i-0001JD-Eh for pgsql-docs@lists.postgresql.org; Tue, 09 Jul 2019 23:00:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkz5g-0002fh-5c for pgsql-docs@lists.postgresql.org; Tue, 09 Jul 2019 23:00:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x69MxxB3001342; Tue, 9 Jul 2019 18:59:59 -0400 From: Tom Lane To: Alvaro Herrera cc: Amit Langote , Michael Paquier , "David G. Johnston" , Bruce Momjian , phil.bayer@gmail.com, pgsql-docs@lists.postgresql.org, PostgreSQL-development Subject: Re: Postgres 11: Table Partitioning and Primary Keys In-reply-to: <20190709225333.GA18051@alvherre.pgsql> References: <20190709225333.GA18051@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 09 Jul 2019 18:53:33 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1340.1562713199.1@sss.pgh.pa.us> Date: Tue, 09 Jul 2019 18:59:59 -0400 Message-ID: <1341.1562713199@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > That's a mild personal preference only though. Anyway, based on your > proposed wording, I wrote this: > > > Unique constraints on partitioned tables (as well as primary keys) > must constrain all the partition key columns. This limitation exists > because PostgreSQL can only enforce > uniqueness in each partition individually. > > > 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: > > 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. > > 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