Re: Problem with ROWs and UNION - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: Problem with ROWs and UNION
Date
Msg-id 20050512195718.GA10035@surnet.cl
Whole thread Raw
In response to Problem with ROWs and UNION  (elein@varlena.com (elein))
Responses Re: Problem with ROWs and UNION  (elein@varlena.com (elein))
Re: Problem with ROWs and UNION  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, May 12, 2005 at 12:32:48PM -0700, elein wrote:

> --
> -- UNION of ROWS doesn't work (simply wrong)
> --
> select ROW('4514 Cherry St','Oakland','CA','94666')::addrs
> UNION
> select ROW('4515 Cherry St','Oakland','CA','94666')::addrs;
> -- ERROR:  could not identify an ordering operator for type addrs
> -- HINT:  Use an explicit ordering operator or modify the query.

UNION ALL does work:

alvherre=# select ROW('4514 Cherry St','Oakland','CA','94666')::addrs
UNION ALL
select ROW('4515 Cherry St','Oakland','CA','94666')::addrs;
                 row
-------------------------------------
 ("4514 Cherry St",Oakland,CA,94666)
 ("4515 Cherry St",Oakland,CA,94666)
(2 filas)


I think the error message is misleading though, because the user has no
way to specify the ordering operator to UNION.

I think you could create a btree operator class to make it all work.

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"And as an added bonus, now my computer goes to the toilet for me, leaving me
free to spend time on more useful activities! yay slug codefests!" (C. Parker)

pgsql-bugs by date:

Previous
From: elein@varlena.com (elein)
Date:
Subject: Problem with ROWs and UNION
Next
From: elein@varlena.com (elein)
Date:
Subject: Re: Problem with ROWs and UNION