From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | nat(at)makarevitch(dot)org |
Subject: | BUG #18730: Inequality comparison operators and SMALLINT negative immediate value |
Date: | 2024-12-03 01:31:44 |
Message-ID: | 18730-0410c43cdb0229d8@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 18730
Logged by: Nat Makarevitch
Email address: nat(at)makarevitch(dot)org
PostgreSQL version: 17.2
Operating system: Linux
Description:
Hi!
create table test_smallint(smint smallint);
insert into test_smallint values (-1);
select * from test_smallint where smint<>-2;
smint
═══════
-1
(1 row)
BEWARE: there is a space between '=' and '-':
select * from test_smallint where smint!= -2;
smint
═══════
-1
(1 row)
So far, so good.
BEWARE: there isn't any space between '=' and '-':
select * from test_smallint where smint!=-2;
ERROR: operator does not exist: smallint !=- integer
LINE 1: select * from test_smallint where smint!=-2;
^
HINT: No operator matches the given name and argument types. You might need
to add explicit type casts.
Isn't the operator "!=" theoritically "an alias, which is converted to <> at
a very early stage of parsing" (as per
https://www.postgresql.org/docs/17/functions-comparison.html )?
AFAIK there is no "=-" alias/macro, and I can't see any reason to implicitly
cast "-2" to INTEGER while "2" type stays inferred.
Thank you!
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-12-03 01:41:01 | Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails |
Previous Message | Bruce Momjian | 2024-12-02 23:37:47 | Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails |