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 1jds8i-0004ZH-Gr for pgsql-bugs@arkaria.postgresql.org; Wed, 27 May 2020 09:14:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jds8h-0001tV-AT for pgsql-bugs@arkaria.postgresql.org; Wed, 27 May 2020 09:14:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jds8h-0001tO-4Z for pgsql-bugs@lists.postgresql.org; Wed, 27 May 2020 09:14:19 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jds8e-00012g-Mv for pgsql-bugs@lists.postgresql.org; Wed, 27 May 2020 09:14:18 +0000 X-Originating-IP: 93.10.30.82 Received: from [172.16.255.146] (82.30.10.93.rev.sfr.net [93.10.30.82]) (Authenticated sender: vik@postgresfriends.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 19F7C6000B; Wed, 27 May 2020 09:14:13 +0000 (UTC) Subject: Re: BUG #16465: Inconsistent results from comparison of row value expressions To: lukas.eder@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form References: <16465-0ec89f0382fd00db@postgresql.org> From: Vik Fearing Message-ID: <5270dee7-0622-3e59-9bba-0f51bd0a4660@postgresfriends.org> Date: Wed, 27 May 2020 11:14:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <16465-0ec89f0382fd00db@postgresql.org> 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 5/27/20 10:00 AM, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 16465 > Logged by: Lukas Eder > Email address: lukas.eder@gmail.com > PostgreSQL version: 12.2 > Operating system: Debian 12.2-2.pgdg100+1 (Docker) > Description: > > Consider this query: > > --------------------------------------------------- > SELECT (1, NULL::INT) = (1, NULL::INT), A = B > FROM (SELECT (1, NULL::INT) A, (1, NULL::INT) B) T; > --------------------------------------------------- > > The result is: > > ?column?|?column?| > --------|--------| > |true | > > It seems the comparison of row value expressions with respect to NULLs is > inconsistent depending on whether the expressions are compared directly > (first column), or indirectly from derived tables (second column). My > reading of the SQL standard is that the second one is incorrect. I concur. The second one appears to be wrong; it should also return NULL. -- Vik Fearing