Re: BUG #4767: create operator - negator doesn't work

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: BUG #4767: create operator - negator doesn't work
Дата
Msg-id 200904211505.32682.peter_e@gmx.net
обсуждение исходный текст
Ответ на BUG #4767: create operator - negator doesn't work  ("fduerr" <fduerr@gmx.de>)
Список pgsql-bugs
On Tuesday 21 April 2009 14:04:01 fduerr wrote:
> CREATE OR REPLACE FUNCTION eq_int_bool(INTEGER, BOOLEAN) RETURNS BOOLEAN AS
>  'SELECT CAST($1 AS BOOLEAN)=$2;' LANGUAGE SQL IMMUTABLE;
> CREATE OPERATOR = (
>  LEFTARG=INTEGER,
>  RIGHTARG=BOOLEAN,
>  PROCEDURE=eq_int_bool,
>  COMMUTATOR= = ,
>  NEGATOR= <>
> );
>
> And thats, what i got:
>
> SELECT 1=false;
>  ?column?
> ----------
>  f
> (1 row)
>
> SELECT 1<>false;
> 8.3.x: ERROR: cache lookup failed for function 0
> 8.4b1: ERROR: operator is only a shell: integer <> boolean
>
> The workaround is, of course, to define an operator with '<>' as commutator
> that returns the negated result. Still i wonder: is it me, the
> documentation or pg?

What you did above is to specify which operator is the negator of =.  But you
still need to create that operator; it is not created automatically.

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

Предыдущее
От: "grouvi"
Дата:
Сообщение: BUG #4768: FATAL:could not reattach to shared memory:487
Следующее
От: "Arjen Nienhuis"
Дата:
Сообщение: BUG #4769: xmlconcat produces invalid xml values -> data corruption