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 1hAq2H-0005lq-1G for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Apr 2019 06:03:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hAq2D-0008PZ-Oa for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Apr 2019 06:03:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAq2D-0008M2-HD for pgsql-bugs@lists.postgresql.org; Mon, 01 Apr 2019 06:03:05 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hAq28-00028X-Fa for pgsql-bugs@lists.postgresql.org; Mon, 01 Apr 2019 06:03:04 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x3162uQm001113; Mon, 1 Apr 2019 15:02:56 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id DB91AEA7E1D; Mon, 1 Apr 2019 15:02:56 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id D0998EA7C87; Mon, 1 Apr 2019 15:02:56 +0900 (JST) Received: from [IPv6:::1] (unknown [129.60.241.75]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id CA5DF40028E; Mon, 1 Apr 2019 15:02:56 +0900 (JST) Message-ID: <5CA1A94E.1070002@lab.ntt.co.jp> Date: Mon, 01 Apr 2019 15:01:50 +0900 From: Etsuro Fujita User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Subject: Re: BUG #15724: Can't create foreign table as partition References: <21389.1553868091@sss.pgh.pa.us> <20190329141050.GA22336@alvherre.pgsql> <1553869152.858391073.5f8m3n0x@frv53.fwdcdn.com> In-Reply-To: <1553869152.858391073.5f8m3n0x@frv53.fwdcdn.com> Content-Type: multipart/mixed; boundary="------------040304000205090704050205" X-CC-Mail-RelayStamp: 1 To: Stepan Yankevych Cc: Alvaro Herrera , Tom Lane , pgsql-bugs@lists.postgresql.org X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------040304000205090704050205 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit (2019/03/29 23:21), Stepan Yankevych wrote: > I think we need at least to mention it in the doc > https://www.postgresql.org/docs/11/ddl-partitioning.html > >> > Partitions can also be foreign tables, although they have some > limitations that normal tables do not; see CREATE FOREIGN TABLE > for more > information > For example > Partitions can also be foreign tables*only in case main table is non > indexed and doesn't contain PK,*although they have some limitations that > normal tables do not; see CREATE FOREIGN TABLE > for more > information +1 for adding such notes, but I'm not sure if it's a good idea to put it there because I think that would make the introductory documentation a bit verbose. How about adding it to the reference pages of CREATE FOREIGN TABLE and ALTER TABLE like the attached? Best regards, Etsuro Fujita --------------040304000205090704050205 Content-Type: text/x-patch; name="doc-foreign-partition.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="doc-foreign-partition.patch" *** a/doc/src/sgml/ref/alter_table.sgml --- b/doc/src/sgml/ref/alter_table.sgml *************** *** 842,847 **** WITH ( MODULUS numeric_literal, REM --- 842,851 ---- one will be created in the attached table; or, if an equivalent index already exists, will be attached to the target table's index, as if ALTER INDEX ATTACH PARTITION had been executed. + Note that if the existing table is a foreign table, it is currently not + allowed to attach the table as a partition of the target table if there + are indexes on the target table. (See also + .) *** a/doc/src/sgml/ref/create_foreign_table.sgml --- b/doc/src/sgml/ref/create_foreign_table.sgml *************** *** 169,174 **** CHECK ( expression ) [ NO INHERIT ] --- 169,178 ---- the given parent table with specified partition bound values. See the similar form of for more details. + Note that it is currently not allowed to create the foreign table as a + partition of the parent table if there are indexes on the parent table. + (See also + ALTER TABLE ATTACH PARTITION.) --------------040304000205090704050205--