Re: version issue?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dan Wilson" <phpPgAdmin(at)acucore(dot)com>
Cc: "pgsql general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: version issue?
Date: 2001-02-26 16:06:29
Message-ID: 26330.983203589@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Dan Wilson" <phpPgAdmin(at)acucore(dot)com> writes:
> I have the following query running on two different servers. It works on
> 7.0.3 and gives the following error on 7.1beta4.

> ERROR: Attribute 'last_name' not found

> Your SQL statement:
> SELECT first_name, last_name, middle_name, u.uid, end_year
> FROM user_info u, auth a
> WHERE u.uid = pri_key AND a.auth_table = 'user_info' AND live = 't'
> AND site_id IN ('214') AND u.end_year > date_part('year', date 'today') - 2
> UNION
> SELECT first_name, last_name, middle_name, u.uid, end_year
> FROM user_info u, current c
> WHERE u.uid = c.uid
> ORDER BY UPPER(last_name)

7.0.3 does not really work in this example (didn't you ever eyeball the
resulting sort order closely??). 7.1 does not support the example at
all. The error message from beta4 is not very good, but beta5 says the
right thing:

ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of the result columns

Possibly some future release will actually do the right thing with ORDER
BY of an expression on the output columns, but right now it has to be an
output column, period.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-02-26 16:28:48 Re: A couple of funny things happening?
Previous Message Mark, Terry 2001-02-26 15:54:52 RE: copying tables