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 1s7e4K-006clt-E7 for pgsql-bugs@arkaria.postgresql.org; Thu, 16 May 2024 16:35:01 +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 1s7e4K-00Bjtz-C8 for pgsql-bugs@arkaria.postgresql.org; Thu, 16 May 2024 16:35:00 +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.94.2) (envelope-from ) id 1s7e4K-00Bjtq-46 for pgsql-bugs@lists.postgresql.org; Thu, 16 May 2024 16:35:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s7e4C-000ZG2-8L for pgsql-bugs@lists.postgresql.org; Thu, 16 May 2024 16:34:59 +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 44GGYoBV2111157; Thu, 16 May 2024 12:34:50 -0400 From: Tom Lane To: "David G. Johnston" cc: David Hunnisett , "pgsql-bugs@lists.postgresql.org" Subject: Re: differences between <> and != when using signed values on the right hand side In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Thu, 16 May 2024 07:39:43 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2111155.1715877290.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 16 May 2024 12:34:50 -0400 Message-ID: <2111156.1715877290@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Thursday, May 16, 2024, David Hunnisett > wrote: >> When using a signed comparison !=3D does not behave like <> if the righ= t >> hand side comparator is signed and there is no space between the compar= ator >> and the sign > This is not a bug. You are seeing practical examples of the behavior > documented here: > https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNT= AX-OPERATORS Yeah, it would probably have been better to forbid multicharacter operator names that end in '+' or '-'. But that ship sailed a long time ago, so we have this kluge to (effectively) allow it only if the operator can't be a SQL-standard one. Thus, in the example "!=3D-" is being read as a single operator name. regards, tom lane