Re: doesn't recognize "!=-" (not equal to a negative value) - Mailing list pgsql-general

From Eric B. Ridge
Subject Re: doesn't recognize "!=-" (not equal to a negative value)
Date
Msg-id F9A2B1CB-3FC1-43E8-B171-44F03B156580@tcdi.com
Whole thread Raw
In response to doesn't recognize "!=-" (not equal to a negative value)  (Paul Tilles <Paul.Tilles@noaa.gov>)
List pgsql-general
On Jul 11, 2006, at 1:11 PM, Paul Tilles wrote:
> ERROR:  operator does not exist: smallint !=- integer
> HINT:  No operator matches the given name and argument type(s). You
> may need to add explicit type casts.

I'm pretty sure the SQL-standard spelling of "not equals" is "<>".
Postgres supporting "!=" is just a nicety.  In fact, the
documentation for comparison operators states that "The != operator
is converted to <> in the parser stage.".  http://www.postgresql.org/
docs/8.1/static/functions-comparison.html

Alternatively, you can put a space before the minus sign:

    UPDATE tablename SET value = 0.0 where value!= -9.4;

I think the reason for what seems like a mis-parsing is due to
Postgres' extensible operator system.  Postgres can't disambiguate
what you mean by "!=-" because those three characters are also valid
in custom operators.  See http://www.postgresql.org/docs/8.1/static/
sql-createoperator.html for the complete list of valid characters.

eric

pgsql-general by date:

Previous
From: "Carl M. Nasal II"
Date:
Subject: PostgreSQL Server Crash using plPHP or PL/Perl
Next
From: Douglas McNaught
Date:
Subject: Re: troubleshooting 8.1.2