Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKz5G-0007jm-Tn for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Nov 2018 05:11:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gKz5F-0004ex-9h for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Nov 2018 05:11:53 +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.89) (envelope-from ) id 1gKz5F-0004eq-2L for pgsql-hackers@lists.postgresql.org; Fri, 09 Nov 2018 05:11:53 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gKz58-0003yg-Oi for pgsql-hackers@lists.postgresql.org; Fri, 09 Nov 2018 05:11:52 +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 wA95BaLZ001590; Fri, 9 Nov 2018 14:11:38 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 61FCBEA71F9; Fri, 9 Nov 2018 14:11: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 55BE6EA715F; Fri, 9 Nov 2018 14:11:36 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 4D9A24009C9; Fri, 9 Nov 2018 14:11:36 +0900 (JST) Subject: Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation From: Amit Langote References: <20181108193940.2uam7tz6femqrd64@alvherre.pgsql> Message-ID: <7d42123a-2d60-2829-8d6b-0c28e3e32376@lab.ntt.co.jp> Date: Fri, 9 Nov 2018 14:11:24 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CC-Mail-RelayStamp: 1 To: Alvaro Herrera , Amit Langote Cc: Ashutosh Bapat , PostgreSQL Hackers , =?UTF-8?Q?J=c3=bcrgen_Strobel?= X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018/11/09 14:04, Amit Langote wrote: > On 2018/11/09 4:39, Alvaro Herrera wrote: >> and if somebody has it, a change to how defaults are applied >> when routing tuples. > > I haven't written such a patch yet. Do we want such a feature? Or is it a *bug* of tuple-routing that it doesn't substitute default values that may be defined for partitions? It kind of looks like one if you see an example like this. create table p (a int, b int) partition by list (a); create table p1 partition of p (b not null default 1) for values in (1); insert into p1 values (1); table p; a │ b ───┼─── 1 │ 1 (1 row) insert into p values (1); ERROR: null value in column "b" violates not-null constraint DETAIL: Failing row contains (1, null). Thanks, Amit