Re: ORDER BY col is NULL in UNION causes error?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Mike Benoit <ipso(at)snappymail(dot)ca>, Michael Glaesemann <grzm(at)seespotcode(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: ORDER BY col is NULL in UNION causes error?
Date: 2007-01-11 20:21:50
Message-ID: 20070111202150.GF10464@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian wrote:

> Here the column result is an expression, and you reference that.
> Updated wording:
>
> test=> select * from test union select * from test order by x is null;
> ERROR: A UNION/INTERSECT/EXCEPT ORDER BY cannot use expressions or functions, only result column names

This seems at odds with our message style guidelines. I'd suggest
putting the actual error message in errmsg() and the rest as a errhint,
maybe

(errmsg("invalid UNION/INTERSECT/EXCEPT ORDER BY clause"),
errhint("You may specify only output result column names in the ORDER BY clauses."))

or something like that.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2007-01-11 20:26:30 Re: TRIGGER BEFORE INSERT
Previous Message Jeanna Geier 2007-01-11 20:19:49 Re: Problems With VIEWS