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.96) (envelope-from ) id 1vsJyf-00GTD4-16 for pgsql-bugs@arkaria.postgresql.org; Tue, 17 Feb 2026 12:14:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vsJyc-00A8B3-3C for pgsql-bugs@arkaria.postgresql.org; Tue, 17 Feb 2026 12:14:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vsJyc-00A8Av-1p for pgsql-bugs@lists.postgresql.org; Tue, 17 Feb 2026 12:14:50 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vsJyZ-00000001BxK-3wx0 for pgsql-bugs@lists.postgresql.org; Tue, 17 Feb 2026 12:14:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1771330486; bh=NXd02i1FSapO9k4H7GXmcByDyxzjDff1oaym/RrMxAs=; h=Message-ID:Date:User-Agent:Subject:To:References:From:In-Reply-To: From; b=i+jKAN2Rf/NCljWcgnFb83sS88XrvmwvSmLqDHDpkLRjHP4WPvz86JjfiqPIm9u7i ouRaF0OniKbAj5bYDoxaVMd2OHZ2DrtIvQ30M6eCfruQnTlMGySLHBwCS3uhU7jiBl S1/IPiF5Tn4wmaTVXmZ6/r7JgNk2h6pGsCqat+o/kFxbZzlRMO51x08jK3TNfAHaP3 fMaXbL7ho0c9nd80Enrcb+ov4NVegL7RHBq40Cg+GV5LXG3ghMQDIx8KDo25w482Hj Kj/inQ2u8z7q/IaZ6vSXbZDWH4/TAcBYNKtvSjgyjPh0TkhvN/BB1fNykmOjWGyUI4 wi9sJl0PUO3qg== Received: from [172.30.51.78] (debian11-template.l.postgrespro.ru [192.168.2.254]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.fadeev@postgrespro.ru) by mail.postgrespro.ru (Postfix/465) with ESMTPSA id D94AE608AE for ; Tue, 17 Feb 2026 15:14:45 +0300 (MSK) Message-ID: <2b555957-2754-43ec-9b53-6dc7737f3135@postgrespro.ru> Date: Tue, 17 Feb 2026 15:14:40 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #19412: Wrong query result with not null constraint To: pgsql-bugs@lists.postgresql.org References: <19412-1d0318089b86859e@postgresql.org> Content-Language: en-US From: Artem Fadeev In-Reply-To: <19412-1d0318089b86859e@postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-KSMG-AntiPhishing: NotDetected, bases: 2026/02/17 11:08:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2026/02/17 11:37:00 #28196498 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/17/26 14:19, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 19412 > Logged by: Sergey Shinderuk > Email address: s.shinderuk@postgrespro.ru > PostgreSQL version: 17.8 > Operating system: Ubuntu 24.04 > Description: git bisect shows the bug was introduced by commit 3af7040985b [0] I suppose presence of UNION ALL subquery is important for the reproduction because the commit uses RangeTblEntry->inh, which has the following remark in the comment in src/include/nodes/parsenodes.h * inh is true for relation references that should be expanded to include * inheritance children, if the rel has any. In the parser, this will * only be true for RTE_RELATION entries. The planner also uses this * field to mark RTE_SUBQUERY entries that contain UNION ALL queries that * it has flattened into pulled-up subqueries (creating a structure much * like the effects of inheritance). [0] https://github.com/postgres/postgres/commit/3af7040985b6df504a72cd307aad5d69ac5f5384 Regards, Artem Fadeev. https://postgrespro.com