space required before negative - Mailing list pgsql-general

From Geoff Winkless
Subject space required before negative
Date
Msg-id CAEzk6fcmZeh4c9zK2PW_MpALX0fhaU9Lt7SNOcDJrv3b84V_Wg@mail.gmail.com
Whole thread Raw
Responses Re: space required before negative  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi

I was surprised to find that whitespace is required between the !=
operator and a negative sign, otherwise postgres believes that I'm
intending !=- as an operator (I get "operator does not exist: integer
!=- integer").

This isn't the case with <>-x.

Is this intentional? I couldn't find reference to it in the
documentation (certainly not in
http://www.postgresql.org/docs/9.5/static/functions-comparison.html).


db=# SELECT 'yes' WHERE 1!=-1;
ERROR:  operator does not exist: integer !=- integer
LINE 1: SELECT 'yes' WHERE 1!=-1;
                            ^
HINT:  No operator matches the given name and argument type(s). You
might need to add explicit type casts.
Time: 0.608 ms

db=# SELECT 'yes' WHERE 1<>-1;
 ?column?
----------
 yes
(1 row)

I get this with fieldnames too, so it's not just a parsing-literal problem...

This is on 9.5, also on 9.5.1.

Geoff


pgsql-general by date:

Previous
From: Rémi Cura
Date:
Subject: Re: bloated postgres data folder, clean up
Next
From: Tom Lane
Date:
Subject: Re: space required before negative