Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boQfe-0007yU-MN for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Sep 2016 07:49:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1boQfe-0002bU-3y for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Sep 2016 07:49:50 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1boQfc-0002Z7-LV for pgsql-hackers@postgresql.org; Mon, 26 Sep 2016 07:49:48 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boQfV-00016Z-C7 for pgsql-hackers@postgresql.org; Mon, 26 Sep 2016 07:49:48 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id u8Q7nakS017451; Mon, 26 Sep 2016 16:49:36 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 9BE4C5F611; Mon, 26 Sep 2016 16:49:36 +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 8CF465F58A; Mon, 26 Sep 2016 16:49:36 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTP id 83CFB400B3C; Mon, 26 Sep 2016 16:49:36 +0900 (JST) Subject: Re: Declarative partitioning - another take References: <169708f6-6e5a-18d1-707b-1b323e4a6baf@lab.ntt.co.jp> <4f7108cb-7185-e956-d746-ad756b52431a@lab.ntt.co.jp> <28ee345c-1278-700e-39a7-36a71f9a3b43@lab.ntt.co.jp> From: Amit Langote Message-ID: Date: Mon, 26 Sep 2016 16:49:27 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Ashutosh Bapat Cc: Amit Langote , Rajkumar Raghuwanshi , Robert Haas , Pg Hackers X-TM-AS-MML: disable X-Pg-Spam-Score: -5.6 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi Ashutosh, On 2016/09/22 14:42, Ashutosh Bapat wrote: > Hi Amit, > Following sequence of DDLs gets an error > -- > -- multi-leveled partitions > -- > CREATE TABLE prt1_l (a int, b int, c varchar) PARTITION BY RANGE(a); > CREATE TABLE prt1_l_p1 PARTITION OF prt1_l FOR VALUES START (0) END > (250) PARTITION BY RANGE (b); > CREATE TABLE prt1_l_p1_p1 PARTITION OF prt1_l_p1 FOR VALUES START (0) END (100); > CREATE TABLE prt1_l_p1_p2 PARTITION OF prt1_l_p1 FOR VALUES START > (100) END (250); > CREATE TABLE prt1_l_p2 PARTITION OF prt1_l FOR VALUES START (250) END > (500) PARTITION BY RANGE (c); > CREATE TABLE prt1_l_p2_p1 PARTITION OF prt1_l_p2 FOR VALUES START > ('0250') END ('0400'); > CREATE TABLE prt1_l_p2_p2 PARTITION OF prt1_l_p2 FOR VALUES START > ('0400') END ('0500'); > CREATE TABLE prt1_l_p3 PARTITION OF prt1_l FOR VALUES START (500) END > (600) PARTITION BY RANGE ((b + a)); > ERROR: cannot use column or expression from ancestor partition key > > The last statement is trying create subpartitions by range (b + a), > which contains a partition key from ancestor partition key but is not > exactly same as that. In fact it contains some extra columns other > than the ancestor partition key columns. Why do we want to prohibit > such cases? Per discussion [1], I am going to remove this ill-considered restriction. Thanks, Amit [1] https://www.postgresql.org/message-id/CA%2BHiwqEXAU_m%2BV%3Db-VGmsDNjoqc-Z_9KQdyPuOGbiQGzNObmVg%40mail.gmail.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers