Custom types and array equality

Поиск
Список
Период
Сортировка
От Morgan Kita
Тема Custom types and array equality
Дата
Msg-id 1161393388.11296.4.camel@localhost.localdomain
обсуждение исходный текст
Ответы Re: Custom types and array equality  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

This should be a relatively simple question... I just made a custom type
in C, which I will use to build an array in one of my tables. I defined
an equality function in C, and declared an operator = on my custom type
that calls my equality operator.

Along the lines of:
CREATE OPERATOR = (
   leftarg = mytype, rightarg = mytype, procedure = mytype_equal,
   commutator = =
);

However, I cant seem to add a useful unique constraint on the table that
includes a column of type mytype[]. When I insert a new record it
complains that it can't find a comparison operator for the type. I did a
bit of digging and found in array.c that error message is produced when
calling array_cmp and the type has no defined comparison operator...
However, should array_eq be called for unique constraints? What am I
missing here to get this system working? The operator itself works when
I call it explicitly on two arrays of mytype.

Thanks for any help ahead of time!


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

Предыдущее
От: "Gregory S. Williamson"
Дата:
Сообщение: Re: Question with tsearch2 (or it might be a general one too)
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: c (lowercase) privilege