Re: space required before negative

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: space required before negative
Дата
Msg-id 13082.1457026233@sss.pgh.pa.us
обсуждение исходный текст
Ответ на space required before negative  (Geoff Winkless <pgsqladmin@geoff.dj>)
Ответы Re: space required before negative  (Geoff Winkless <pgsqladmin@geoff.dj>)
Список pgsql-general
Geoff Winkless <pgsqladmin@geoff.dj> writes:
> 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).

That's a syntax issue, so the place to look is
http://www.postgresql.org/docs/9.5/static/sql-syntax-lexical.html#SQL-SYNTAX-OPERATORS

In general you need whitespace between adjacent operator names, but
we hacked the lexer enough so that you can get away without it
in the single case of a prefix "+" or "-", so long as the previous
operator name contains only characters used in SQL operator names.

It would likely have been cleaner to just disallow operator names
ending in "+" or "-", but we had several long-established names that
failed to conform to that, so this was the best compromise we could
come up with between flexibility and SQL standard compliance.

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Geoff Winkless
Дата:
Сообщение: space required before negative
Следующее
От: Rémi Cura
Дата:
Сообщение: PLPythonu for production server