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

From: "hubert depesz lubaczewski" <depesz(at)gmail(dot)com>
To: "Paul Tilles" <Paul(dot)Tilles(at)noaa(dot)gov>
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: doesn't recognize "!=-" (not equal to a negative value)
Date: 2006-07-13 07:55:03
Message-ID: 9e4684ce0607130055g612984easaa0535ce4a68e525@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/11/06, Paul Tilles <Paul(dot)Tilles(at)noaa(dot)gov> wrote:
>
> Yes. That works. I think that the parser should work properly either
> way.
>

it works properly. just the proper way of functioning is not the one you
would like to have.
you can simply add this operator:

CREATE FUNCTION not_equals_minus(int8, int8) RETURNS bool AS $BODY$
SELECT $1 <> -$2;
$BODY$ LANGUAGE SQL IMMUTABLE STRICT;

CREATE OPERATOR !=- (
leftarg = int8,
rightarg = int8,
procedure = not_equals_minus,
commutator = !=-
);

and then:
> select 1!=-2;
?column?
----------
t
(1 row)

depesz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Spendius 2006-07-13 09:37:08 Physical block structure in PostgreSQL
Previous Message Michael Fuhr 2006-07-13 07:49:07 Re: Delete Problem