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.92) (envelope-from ) id 1j8ppm-00082x-Uo for pgsql-general@arkaria.postgresql.org; Mon, 02 Mar 2020 18:30:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j8ppl-0006y9-Mi for pgsql-general@arkaria.postgresql.org; Mon, 02 Mar 2020 18:30:29 +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 1j8ppl-0006y2-DR for pgsql-general@lists.postgresql.org; Mon, 02 Mar 2020 18:30:29 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j8ppj-00011k-1g for pgsql-general@postgresql.org; Mon, 02 Mar 2020 18:30:29 +0000 X-Originating-IP: 185.94.189.189 Received: from [10.8.8.2] (unknown [185.94.189.189]) (Authenticated sender: vik@postgresfriends.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 8062C240002; Mon, 2 Mar 2020 18:30:24 +0000 (UTC) Subject: Re: Not Null Constraint vs Query Planning To: Don Seiler , Postgres General References: From: Vik Fearing Message-ID: <85a9f663-a198-9fe2-96d3-6e2d5d74b22c@postgresfriends.org> Date: Mon, 2 Mar 2020 19:30:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 02/03/2020 18:09, Don Seiler wrote: > The REAL reason for this is that I'm wondering if I created a NOT NULL > check constraint with "NOT VALID" would that then NOT be considered in such > a "short-circuit" case until I ran the VALIDATE CONSTRAINT on it? Perhaps I > should have just asked this in its own thread but I started diving into the > query plan thing. You cannot do this because NOT NULL isn't a real constraint (meaning it does not appear in pg_constraint). There have been several attempts to make it a real constraint over the years but so far nothing has come of them. -- Vik Fearing