From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Geoff Winkless <pgsqladmin(at)geoff(dot)dj> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: space required before negative |
Date: | 2016-03-03 17:30:33 |
Message-ID: | 13082.1457026233@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Geoff Winkless <pgsqladmin(at)geoff(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Rémi Cura | 2016-03-03 18:09:30 | PLPythonu for production server |
Previous Message | Geoff Winkless | 2016-03-03 17:16:24 | space required before negative |