From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: David Hunnisett <david.hunnisett@probit.io>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: differences between <> and != when using signed values on the right hand side
Date: Thu, 16 May 2024 12:34:50 -0400
Message-ID: <2111156.1715877290@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwaUT_9i+ni=CVsnxWjzWyOOkv35AmttVR_d-N9zM3e6yw@mail.gmail.com>
References: <B9C40FC5-5FA1-40DF-BC91-114493622F61@probit.io>
<CAKFQuwaUT_9i+ni=CVsnxWjzWyOOkv35AmttVR_d-N9zM3e6yw@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, May 16, 2024, David Hunnisett <david.hunnisett@probit.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, david.hunnisett@probit.io, pgsql-bugs@lists.postgresql.org
Subject: Re: differences between <> and != when using signed values on the right hand side
In-Reply-To: <2111156.1715877290@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox