Union with array types

From: Juhan-Peep Ernits <juhan(at)cc(dot)ioc(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: Union with array types
Date: 2001-03-14 06:47:56
Message-ID: Pine.GSO.4.21.0103131409020.28773-100000@suhkur.cc.ioc.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hello!

The example is the following:

create table arraytest ( id int, mystuff varchar(40)[][]);
insert into arraytest values (1,'{{"a","b"}}');
insert into arraytest values (2,'{{"c","d"}}');

(select id, mystuff from arraytest where id=1) union (select id, mystuf
f from arraytest where id=2);

ERROR: Unable to identify an ordering operator '<' for type '_varchar'
Use an explicit ordering operator or modify the query

PG version is CVS from Feb 26, 2001.

What kind of explicit ordering operator would one need? Since the array
type seems to remember only the fact that it is an array of a particular
type, not the dimension (ie if one creates a field of type
varchar(40)[][] the result is the same as creating a field of type
varchar(40)[] and it is possible to store stuff in the form
varchar(40)[][][] also in that field), it is up to the person who
creates the union to ensure that the types actually match.
Is it necessary to require the explicit ordering operator in this
case? What am I missing?

Best regards,

Juhan Ernits

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2001-03-14 06:47:59 Re: Fw: Please Help
Previous Message Oliver Elphick 2001-03-14 06:40:44 Re: Porting Data from RedHat Linux to Sun Solaris