Обсуждение: starne error from select 1!=-1

Поиск
Список
Период
Сортировка

starne error from select 1!=-1

От
"Andrus"
Дата:
select 1!=-1

causes

ERROR:  operator does not exist: integer !=- integer
HINT:  No operator matches the given name and argument type(s). You may need
to add explicit type casts.


Isn't this a bit stange ?
If I add space before -1 error does not appear.



Re: starne error from select 1!=-1

От
Tom Lane
Дата:
"Andrus" <eetasoft@online.ee> writes:
> select 1!=-1
> ERROR:  operator does not exist: integer !=- integer

> Isn't this a bit stange ?

No.  We couldn't really parse this any other way without disallowing -
(and +) altogether in multi-character operator names.  There's a special
hack for SQL-spec compatibility, but it doesn't trigger in this case;
see

http://www.postgresql.org/docs/8.1/static/sql-syntax.html#SQL-SYNTAX-OPERATORS

            regards, tom lane