select a.name ... union select a.name ... order by a.name fails in 7.1

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: select a.name ... union select a.name ... order by a.name fails in 7.1
Date: 2001-04-23 01:08:14
Message-ID: 200104230108.f3N18El10823@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Palle Girgensohn (girgen(at)partitur(dot)se) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
select a.name ... union select a.name ... order by a.name fails in 7.1

Long Description
Hi!

I'm not certain this is correct SQL, and I know the rewrite is
easy, but here is a difference I found between 7.0.3 and 7.1:

select a.name from users a
union
select a.name from oldusers a
order by a.userid;

ERROR: Relation 'a' does not exist

This works fine in postgres 7.0.x

the simple rewrite is of course 'order by userid', but it is
tedious to find all places in our system where this happens. It
seems some programmers have used the above syntax a lot :(

Is it a bug, or was it a feature in 7.0?

/Palle

Sample Code
fails on 7.1, work on 7.0.3:

select a.name from users a
union
select a.name from oldusers a
order by a.userid;

modifying last line ot look like 'order by userid' fixes the problem.

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-04-23 02:11:22 Re: select a.name ... union select a.name ... order by a.name fails in 7.1
Previous Message Rainer Mager 2001-04-22 23:48:18 RE: 7.0.3 dumps aren't accessible via JDBC in 7.1