An exception about comparison operators

From: 张元超 <chaoge145(at)163(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: An exception about comparison operators
Date: 2021-05-26 09:15:00
Message-ID: 32742bcd.ad58.179a7f4adff.Coremail.chaoge145@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,everyone,
I encountered a problem when using PostgreSQL's comparison operators. The problem is as follows:
Problem Description:
When I use the comparison operator "!=" as the query condition, such as "select * from t1 where c1 !=-1", the database returns an error: "!=-operator does not exist". Because there is no space between ‘=’ and ‘-’, if you enter a space between them, the sql can be executed normally. Therefore, although we can make sql execute normally by adding spaces, its behavior is different from other comparison operators (such as ">,<,>=,<=,=,<>"). Other comparisons Operators will not have such problems.

I guess that this should be because the database did not correctly handle the "!=" operator during sql parsing, so I think this should be a bug. This problem exists in the 11, 12, and 13 versions of PostgreSQL.

At the same time, I tried other databases, such as Oracle, but did not find the same problem.
Looking forward to your reply.

Thans very much!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2021-05-26 10:42:59 Re: An exception about comparison operators
Previous Message Magnus Hagander 2021-05-26 07:51:51 Re: Null database entry in pg_stat_database on pg-12 version