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

From: Bruno Wolff III <bruno(at)wolff(dot)to>
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-12 02:54:38
Message-ID: 20060712025438.GB15900@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 11, 2006 at 13:11:16 -0400,
Paul Tilles <Paul(dot)Tilles(at)noaa(dot)gov> wrote:
> Version postgres 7.4.7:
>
> Following sql
>
> UPDATE tablename SET value = 0.0 where value!=-9.4;
>
> results in the error message
>
> 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.
>
> Seems that postgres has a problem parsing a "not equal negative value".
>
> Anybody know if this is fixed in later versions?

I don't think this is a bug. Postgres allows for user defined operators and
!=- looks like one operator rather than two. Putting a space between = and -
will fix the problem. For example:
bruno=> select 1 != -1;
?column?
----------
t
(1 row)

bruno=> select 1 !=-1;
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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2006-07-12 03:46:05 Re: having indexes when clearing tables
Previous Message Bruno Wolff III 2006-07-12 02:48:07 Re: Dynamic table with variable number of columns