Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u1xu6-00ArWA-4v for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Apr 2025 01:37:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u1xu4-0057ss-Ku for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Apr 2025 01:37:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u1xqt-0054yF-Sy for pgsql-hackers@lists.postgresql.org; Tue, 08 Apr 2025 01:34:12 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u1xqr-003a1S-06 for pgsql-hackers@lists.postgresql.org; Tue, 08 Apr 2025 01:34:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2025010100; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=ENxR8eZ2gOBeBGf7Z8f7u4RJ/7T1vN+VIkY4QLrK7UI=; b=lPMbO sWXL/4kMlPsIrGLDenoiY6RYtIkMxP9YpwHN8RVjtkCNL56ka5yC9UHTTAm7lH3AeXUPD9MsM8PgL 0zywalsd0WU3G3roiy/KdFZqVJjGX6pwt88uuDiuq/pkHIA2/aMN/PGkCgAD/e0cQXJMREwIJuXN8 yEPVEAsO/MXKlBEvOdogu3ymw/b1ksxDVFjVwN6gUNzghP55J97kECs3Q+0DbsbvrCo6G8H6NbS2H SUDqNCdl2RdOuv3gHzpIXBlvQkQqtPbe2zeokR8sBFuw0RyjVtklEy9mq1VDgtcMV3/lHuG3EfPCk qpqLE1I7yOeu3ejcUd4wXjHltTb+g==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1u1xqo-00Bg5H-2Z; Mon, 07 Apr 2025 21:34:06 -0400 Date: Mon, 7 Apr 2025 21:34:06 -0400 From: Bruce Momjian To: Tom Lane Cc: jbe-mlist@magnetkern.de, PostgreSQL-development Subject: Re: Parameter NOT NULL to CREATE DOMAIN not the same as CHECK (VALUE IS NOT NULL) Message-ID: References: <173591158454.714.7664064332419606037@wrigleys.postgresql.org> <1694911.1736371474@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jan 30, 2025 at 08:26:54AM -0500, Bruce Momjian wrote: > On Wed, Jan 8, 2025 at 04:24:34PM -0500, Tom Lane wrote: > > Bruce Momjian writes: > > > I think this needs some serious research. > > > > We've discussed this topic before. The spec's definition of IS [NOT] > > NULL for composite values is bizarre to say the least. I think > > there's been an intentional choice to keep most NOT NULL checks > > "simple", that is we look at the overall value's isnull bit and > > don't probe any deeper than that. > > > > If the optimizations added in v17 changed existing behavior, > > I agree that's bad. We should probably fix it so that those > > are only applied when argisrow is false. > > I have developed the attached patch using your argisrow suggestion which > fixes the test I posted. Is this something we should backpatch? Patch applied. This fix will appear in the next minor PG 17 release. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.