space required before negative

Поиск
Список
Период
Сортировка
От Geoff Winkless
Тема space required before negative
Дата
Msg-id CAEzk6fcmZeh4c9zK2PW_MpALX0fhaU9Lt7SNOcDJrv3b84V_Wg@mail.gmail.com
обсуждение исходный текст
Ответы Re: space required before negative  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Rémi Cura
Дата:
Сообщение: Re: bloated postgres data folder, clean up
Следующее
От: Tom Lane
Дата:
Сообщение: Re: space required before negative