Search Postgresql Archives

Re: Comparing arrays of composite types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alban Hertroys <dalroi@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
> I defined a type:
> CREATE TYPE unit_token AS (
> 	base_unit	TEXT,
> 	unit_base	INT
> );

> If I try to join on tokens or try to create an index over that column  
> I get: "ERROR:  could not identify a comparison function for type  
> unit_token".

As noted, there is a built-in solution as of 8.4.

> I have created operators on unit_token for =, <, <=, > and >=, but  
> either I did something wrong defining my operators or the error is  
> pointing to some other problem.

The mere fact that the operator is named '=' means nothing to Postgres.
You need to create an operator class or family that shows the operator
is equality in a btree opclass.  Array comparison looks for the default
btree opclass for the element data type to decide what to do.

			regards, tom lane

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux