Re: UNION bug in 7.1.3?

From: Herbert Liechti <Herbert(dot)Liechti(at)thinx(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: UNION bug in 7.1.3?
Date: 2001-10-23 06:55:23
Message-ID: 3BD5145B.6000701@thinx.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 22 Oct 2001, Keary Suska wrote:

> The following syntax, which works fine in 7.0.3, fails in 7.1.3:
>
> SELECT t1.col1, t2.col2 FROM table1 t1, table2 t2
> WHERE t1.col3 = t2.col4
> UNION
> SELECT t1.col1, NULL FROM table1 t1
> WHERE t1.col3 NOT IN (SELECT t2.col2 FROM table2 t2)
> ORDER BY t1.col1
>
>
> The above error goes away, but is replaced by "ERROR: ORDER BY on a
> UNION/INTERSECT/EXCEPT result must be on one of the result columns".
Is this
> a bug? It doesn't even work when using full table names instead of
aliases.

This is not a bug. Use aliases instaed or use the position number of the
column in the order by clause. Ex. ORDER BY 1

Regards
Herbie
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herbert Liechti http://www.thinx.ch
ThinX networked business services Adlergasse 5, CH-4500 Solothurn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Browse pgsql-general by date

  From Date Subject
Next Message Johnny Jørgensen 2001-10-23 07:11:25 Database design?
Previous Message midde sirisha 2001-10-23 06:52:12 how to filter pipe symbol