User defined type - analyze problem

Started by Carsten Kropfalmost 16 years ago3 messagesgeneral
Jump to latest
#1Carsten Kropf
ckropf2@fh-hof.de

Hi *,
I have a little problem with a user defined type:
I constructed a type called "pointnd" which represents a multi-dimensional point. This point is subsequently used as an array type in another user defined type, like the following:
CREATE TYPE document AS (words tsvector, points _pointnd);

After some time, I have some problems with this type, obviously. The postgres process keeps on reporting the following line:
ERROR: could not identify a comparison function for type pointnd
CONTEXT: automatic analyze of table "test.public.documents"

I read somewhere, that this can be solved by preparing a operator class for btree and passing a comparison function for equality there. I did this with the following lines:
CREATE OPERATOR CLASS pointnd_btree_class
DEFAULT FOR TYPE pointnd USING btree AS
OPERATOR 3 =(pointnd, pointnd)
;

However, the postges process still reports the same errors after having set up the btree operator class.
How can I solve this issue?

Best regards
Carsten Kropf

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Carsten Kropf (#1)
Re: User defined type - analyze problem

Carsten Kropf <ckropf2@fh-hof.de> writes:

I read somewhere, that this can be solved by preparing a operator class for btree and passing a comparison function for equality there. I did this with the following lines:
CREATE OPERATOR CLASS pointnd_btree_class
DEFAULT FOR TYPE pointnd USING btree AS
OPERATOR 3 =(pointnd, pointnd)
;

You need an actual, usable btree operator class, not one-sixth of one ...
this is lacking the other four operators and the support function.

regards, tom lane

#3Carsten Kropf
ckropf2@fh-hof.de
In reply to: Tom Lane (#2)
Re: User defined type - analyze problem

Thanks a lot, this helped me with the messages. I thought, I would only have to define a operator class that fullfills at least the equals strategy. I didn't know, that I would have to provide a "full" btree operator class.

Best regards
Carsten Kropf
Am 03.05.2010 um 15:56 schrieb Tom Lane:

Show quoted text

Carsten Kropf <ckropf2@fh-hof.de> writes:

I read somewhere, that this can be solved by preparing a operator class for btree and passing a comparison function for equality there. I did this with the following lines:
CREATE OPERATOR CLASS pointnd_btree_class
DEFAULT FOR TYPE pointnd USING btree AS
OPERATOR 3 =(pointnd, pointnd)
;

You need an actual, usable btree operator class, not one-sixth of one ...
this is lacking the other four operators and the support function.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general