Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lReEO-0001hv-3r for pgsql-bugs@arkaria.postgresql.org; Wed, 31 Mar 2021 17:02:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lReEN-00030j-1i for pgsql-bugs@arkaria.postgresql.org; Wed, 31 Mar 2021 17:02:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lReEM-00030c-SV for pgsql-bugs@lists.postgresql.org; Wed, 31 Mar 2021 17:02:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lReEG-0000dY-II for pgsql-bugs@postgresql.org; Wed, 31 Mar 2021 17:02:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 12VH213M3228610; Wed, 31 Mar 2021 13:02:01 -0400 From: Tom Lane To: Alexey Bashtanov cc: pgsql-bugs@postgresql.org Subject: Re: should all not-null constraints be inherited? In-reply-to: References: Comments: In-reply-to Alexey Bashtanov message dated "Wed, 31 Mar 2021 16:12:40 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3228608.1617210121.1@sss.pgh.pa.us> Date: Wed, 31 Mar 2021 13:02:01 -0400 Message-ID: <3228609.1617210121@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexey Bashtanov writes: > This is how one can create a parent with a non-nullable column and a > child with the same column nullable: Yeah, that's been on the to-do list for a long time. The current theory about it is that NOT NULL constraints ought to be represented as entries in pg_constraint like CHECKs are, so that the inheritance count and so forth could be managed the same way. We could keep attnotnull for convenience but it'd just mirror the existence of the pg_constraint entry. IIRC Alvaro had a WIP patch for this, but I've not heard anything about it lately. regards, tom lane