Search Postgresql Archives

Re: space required before negative

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Geoff Winkless <pgsqladmin@xxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux