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

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: doesn't recognize "!=-" (not equal to a negative value)
Дата
Msg-id 9e4684ce0607130055g612984easaa0535ce4a68e525@mail.gmail.com
обсуждение исходный текст
Ответ на Re: doesn't recognize "!=-" (not equal to a negative value)  (Paul Tilles <Paul.Tilles@noaa.gov>)
Список pgsql-general
On 7/11/06, Paul Tilles <Paul.Tilles@noaa.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Delete Problem
Следующее
От: Bill Moran
Дата:
Сообщение: Re: db clustering?