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 1hkgLS-0004g1-Ma for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jul 2019 02:59:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkgLR-0002dG-1z for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jul 2019 02:59:05 +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 1hkgLQ-0002d8-Mt for pgsql-hackers@lists.postgresql.org; Tue, 09 Jul 2019 02:59:04 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkgLN-00080U-Vo for pgsql-hackers@postgresql.org; Tue, 09 Jul 2019 02:59:03 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 43E4221C57; Mon, 8 Jul 2019 22:59:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 08 Jul 2019 22:59:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=srJNgwMbyZDwqbXK8ZbwWK3twue Sp94TlSbp/PiPODo=; b=kaKTm2epr1/ZedJiOIPNxZom2DIcNLzY4ofnZtKa14D 8Wl1dSv503BfYAdc8fYYEpwwG5tMlSd0iCha3aPdmEFZUrclLKqBbSKfHV+iRoR8 Vg1o3eI3qBX0YBgAl+lRv45L++ixi4DQ6frS0SaQu3buMYh62TPyn8bCKKkzHzEL QuL31Qm13CrQVGDXgCS0CxGo4B7grHQT1lriUvqMbYUYuEymGYQo37u44fkxiZHX pOS6rtDntWkyhqYVWHjW/Ruy7uzzC3xpIFAMKv2nymPdfW6k23VfXLz8p60a3h7F +ZbkoLCTsswgdmB3Y/OP2PloEA3RkXNCj5IFbvClojQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=srJNgw MbyZDwqbXK8ZbwWK3twueSp94TlSbp/PiPODo=; b=pZXAEiolV9oAxQln50sB2b uMGvXIP7mr83C0ae3TXi8hkvPjfvTBqp4eNo+XKjmDPRFsJEwjSAW8WojQTL6rqu Wrzh1wqeykhkMHpi0R6Hs3GIee90iTkeq5ouohDdHVlCbVS0+9TUqMTjucppEIg+ iYEFDkVvn8PvYMFdcVCPsBgq8UTxlo+BJlwAFVZrNKLdaUXvoTIPLE3jYT/JD2dX 4d/FAkQ+nXwdIYTllmaqGwEBiPc0k3eCpIuRqB9ggbYCXDS/O+J+GjfbIRKha5wE vuN8gjjJyPo8qJCN3vlFkDXmEIq1TrwfmKpKvOTRD2XGEu1sdEstIE/KAPeBOSYA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgedugdeihecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecukfhppeduuddurddutddvrddukedtrddukeehnecurfgrrhgr mhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluh hsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 44B2280059; Mon, 8 Jul 2019 22:58:59 -0400 (EDT) Date: Tue, 9 Jul 2019 11:58:56 +0900 From: Michael Paquier To: Bruce Momjian Cc: phil.bayer@gmail.com, pgsql-docs@lists.postgresql.org, PostgreSQL-development Subject: Re: Postgres 11: Table Partitioning and Primary Keys Message-ID: <20190709025856.GC1345@paquier.xyz> References: <156236160709.1192.4498528196556144085@wrigleys.postgresql.org> <20190709023737.vhrd4pxe4hgnd3ks@momjian.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fOHHtNG4YXGJ0yqR" Content-Disposition: inline In-Reply-To: <20190709023737.vhrd4pxe4hgnd3ks@momjian.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --fOHHtNG4YXGJ0yqR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 08, 2019 at 10:37:37PM -0400, Bruce Momjian wrote: > On Fri, Jul 5, 2019 at 09:20:07PM +0000, PG Doc comments form wrote: >> In the documentation for Postgres 11 table partitioning, there is no men= tion >> of the requirement that the Primary Key of a partitioned table must cont= ain >> the partition key. >> In fact the documentation on primary keys is so light that I am not even >> 100% sure the above is correct. If the following table is not possible = in >> Postgres 11, the documentation should find some way to make that clear. = =20 >>=20 >> I believe this should be documented in section "5.10.2.3. Limitations" >=20 > Can someone comment on this? CC to hackers. Yep, that's the case: =3D# CREATE TABLE parent_tab (id int, id2 int primary key) PARTITION BY RANGE (id); ERROR: 0A000: insufficient columns in PRIMARY KEY constraint definition DETAIL: PRIMARY KEY constraint on table "parent_tab" lacks column "id" which is part of the partition key. LOCATION: DefineIndex, indexcmds.c:894 I agree with the report here that adding one sentence to 5.10.2.3 which is for the limitations of declarative partitioning would be a good idea. We don't mention the limitation in CREATE TABLE either (which would be rather incorrect IMO). Attached is an idea of patch for the documentation, using this wording: + + + When defining a primary key on a partitioned table, the primary + key column must be included in the partition key. + + If somebody has any better idea for that paragraph, please feel free. -- Michael --fOHHtNG4YXGJ0yqR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl0kAvAACgkQnvQgOdby QH1/EA//SRf94LhSzzavfTNyp2Nn+lHv/fkRK0Mzrxo1ld2w0Ow0c9tde1hk5mPT J6zu2LDlOq4U/NkxaTp6RNvs+uh/8x9/TWBRW3rVUqgFC+Vmqwbt6YLvrkkE23E6 fNc3zWcdXx/YeNZdWyqptEMuu/FrmGUBBIC+Xl/Zq/RC/NCmgpQhjSLKP7uy69sR OK9OaMoSZB9PumpNG3MVt7tEes5asuPDVZl0zcPk4ga7cImzxb5Wn+5UDqNl2+wL qVnXKbqLnHdhQ2vbtpKeYELRuUvmUqy22UdRBD/1a44gYNybp2qQ1dD4xIRynaha WiWCUu06zYgYd/H8k9TFJelrwAg1fam/RP1h7jN6pVF0FDgO2awlp0iaZOgacD/i mmGh/653d58ighfzjqEMQLfJWP4NUHk1rTrBAeN/UCuRm1y/rUfUQYu4kQ0OGlHj 2EwpRr0+Y7x+fr3Whjf4XhdTB8aLO2m8ewRnrF0I160ecwcz6UTiqGCQ3HHOtwKN 6xju0GTSpQN9yarL8F3YVwAGk8Pu2zmscu21kVdqHLNtSVc3gHmR/vwDQjlgv7kz UH6vSsAv4/dNNdGpAVWJqHop0qQEVcL8GL733WofmOk+pheyxgZsbKutTozC7jVI aUmqQTYMNZ0NcPHrY1P+Q1uq9AjXw1NgdoYQXSeVB++by3r7ay8= =fHOU -----END PGP SIGNATURE----- --fOHHtNG4YXGJ0yqR--