Re: Problem with ROWs and UNION

From: elein(at)varlena(dot)com (elein)
To: Alvaro Herrera <alvherre(at)surnet(dot)cl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem with ROWs and UNION
Date: 2005-05-12 20:00:53
Message-ID: 20050512200053.GU23283@varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, May 12, 2005 at 03:57:18PM -0400, Alvaro Herrera wrote:
> 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)

This makes sense because the UNION needs to have the ordering/
comparative operators to eliminate duplicates.

It is a work around, but I think there needs to be a ROW
ordering operator added.

>
>
> 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.
>

--elein
elein(at)varlena(dot)com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-05-12 20:13:00 Re: Problem with ROWs and UNION
Previous Message Alvaro Herrera 2005-05-12 19:57:18 Re: Problem with ROWs and UNION