Re: differences between <> and != when using signed values on the right hand side

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: David Hunnisett <david(dot)hunnisett(at)probit(dot)io>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: differences between <> and != when using signed values on the right hand side
Date: 2024-05-16 16:34:50
Message-ID: 2111156.1715877290@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Thursday, May 16, 2024, David Hunnisett <david(dot)hunnisett(at)probit(dot)io>
> wrote:
>> When using a signed comparison != does not behave like <> if the right
>> hand side comparator is signed and there is no space between the comparator
>> 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-SYNTAX-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
"!=-" is being read as a single operator name.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2024-05-16 16:38:10 Re: relfrozenxid may disagree with row XIDs after 1ccc1e05ae
Previous Message Japin Li 2024-05-16 16:29:47 Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption