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

From: "Eric B(dot) Ridge" <ebr(at)tcdi(dot)com>
To: Paul Tilles <Paul(dot)Tilles(at)noaa(dot)gov>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: doesn't recognize "!=-" (not equal to a negative value)
Date: 2006-07-11 21:32:22
Message-ID: F9A2B1CB-3FC1-43E8-B171-44F03B156580@tcdi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carl M. Nasal II 2006-07-11 21:43:48 PostgreSQL Server Crash using plPHP or PL/Perl
Previous Message Tom Lane 2006-07-11 21:16:32 Re: troubleshooting 8.1.2