Re: Howto sort the result of UNION (without modifying its type)?

From: Clemens Eisserer <linuxhippy(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Howto sort the result of UNION (without modifying its type)?
Date: 2011-04-09 09:58:03
Message-ID: BANLkTinBXpmWwafrHmTnPutkgD9VJZAPYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Robert,

> does this work for you?
>        select u.id from (your unions) as u order by u.id

Unfourtunatly not, it converts my union-results from INTEGER to RECORD.
However, it seems to be possible to order the unions directly:
> result1 UNION result2 ORDER BY u.id

Hmm, the query plan looks really insane for this ... wonder how it
will perform when the tables will not be mostly empty ;)

Thanks, Clemens

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Mennens 2011-04-09 16:22:37 Re: Rename or Re-Create Constraints?
Previous Message quickinfo 2011-04-09 06:40:46 searchable database