ORDER BY col is NULL in UNION causes error?

From: Mike Benoit <ipso(at)snappymail(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: ORDER BY col is NULL in UNION causes error?
Date: 2006-12-27 00:39:03
Message-ID: 1167179943.4732.9.camel@ipso.snappymail.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I asked about this on IRC and the helpful people online at the time
didn't seem to have an explanation.

Works
---------------------
select * from income_tax_rate_us order by state is null;

Works
---------------------
select * from income_tax_rate_us UNION select * from income_tax_rate_us
order by state;

Fails
---------------------
select * from income_tax_rate_us UNION select * from income_tax_rate_us
order by state is null;
ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
the result columns

I'm running: PostgreSQL 8.1.5 on x86_64-mandriva-linux-gnu, compiled by
GCC x86_64-mandriva-linux-gnu-gcc (GCC) 4.1.1 20060724 (prerelease)
(4.1.1-3mdk)

--
Mike Benoit <ipso(at)snappymail(dot)ca>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sandip G 2006-12-27 01:26:21 Re: NEED URGENT HELP....
Previous Message Marc Evans 2006-12-27 00:34:19 Re: Clustering & Load Balancing & Replication