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 1s1vcz-00G4fz-1w for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Apr 2024 22:07:08 +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 1s1vcw-008x1a-EL for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Apr 2024 22:07:07 +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 1s1vcw-008wxK-5W for pgsql-bugs@lists.postgresql.org; Tue, 30 Apr 2024 22:07:07 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1vct-000pwT-99 for pgsql-bugs@lists.postgresql.org; Tue, 30 Apr 2024 22:07:05 +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 43UM71lW1822026; Tue, 30 Apr 2024 18:07:01 -0400 From: Tom Lane To: Darryl Dixon cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18451: NULL fails to coerce to string when performing string comparison In-reply-to: References: <18451-dc130ad59b7bd7c9@postgresql.org> Comments: In-reply-to Darryl Dixon message dated "Wed, 01 May 2024 09:38:56 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1822024.1714514821.1@sss.pgh.pa.us> Date: Tue, 30 Apr 2024 18:07:01 -0400 Message-ID: <1822025.1714514821@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Darryl Dixon writes: > The bug is that: > 1) The concatenation is not producing NULL, but rather Text, and yet the > comparison fails regardless, and > 2) The explicit CAST of NULL -> Text fails to remedy this. I wonder what you think NULL means. You certainly don't appear to understand its semantics at all. Every SQL data type allows NULL as a value, so "casting NULL to text" doesn't change the value, only what type the parser deems it to have. > Further examples below: Every one of these looks as-expected to me. regards, tom lane