ORDER BY col is NULL in UNION causes error? - Mailing list pgsql-general

From Mike Benoit
Subject ORDER BY col is NULL in UNION causes error?
Date
Msg-id 1167179943.4732.9.camel@ipso.snappymail.ca
Whole thread Raw
Responses Re: ORDER BY col is NULL in UNION causes error?  (Michael Glaesemann <grzm@seespotcode.net>)
List 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@snappymail.ca>

Attachment

pgsql-general by date:

Previous
From: Marc Evans
Date:
Subject: Re: Clustering & Load Balancing & Replication
Next
From: Michael Glaesemann
Date:
Subject: Re: ORDER BY col is NULL in UNION causes error?