Alvaro Herrera wrote:
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
Tom Lane wrote:
Michael Glaesemann [EMAIL PROTECTED] writes:
On Dec 26, 2006, at 18:39 , Mike Benoit wrote:
ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
the result columns
Even though state is a column in both tables, the order by is using
an expression,
On Thu, 2007-01-11 at 13:44 -0500, Bruce Momjian wrote:
Tom Lane wrote:
Michael Glaesemann [EMAIL PROTECTED] writes:
On Dec 26, 2006, at 18:39 , Mike Benoit wrote:
ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
the result columns
Even though state is a
Mike Benoit wrote:
That helps some, but I'm sure it could be even more clear.
The main issue is that you can't order by an expression computed by
unions, correct? So couldn't the error message by something like:
ORDER BY on a UNION/INTERSECT/EXCEPT result must match existing result
Bruce Momjian [EMAIL PROTECTED] writes:
Well, it can be an expression _if_ the expression _matches_ an existing
UNION column.
You're mistaken. It has to be *an output column name*. Not anything else.
regards, tom lane
---(end of
Tom Lane wrote:
Bruce Momjian [EMAIL PROTECTED] writes:
Well, it can be an expression _if_ the expression _matches_ an existing
UNION column.
You're mistaken. It has to be *an output column name*. Not anything else.
Yea, I was thinking of this:
SELECT *, state IS NULL AS
Bruce Momjian [EMAIL PROTECTED] writes:
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 does not meet the style guidelines.
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
Tom Lane wrote:
Bruce Momjian [EMAIL PROTECTED] writes:
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 does not meet the style
Bruce Momjian [EMAIL PROTECTED] writes:
Where are the style guidelines? I looked before but can't find them.
http://developer.postgresql.org/pgdocs/postgres/error-style-guide.html
regards, tom lane
---(end of
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
On Dec 26, 2006, at 18:39 , Mike Benoit wrote:
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
Even though state is a column
Michael Glaesemann [EMAIL PROTECTED] writes:
On Dec 26, 2006, at 18:39 , Mike Benoit wrote:
ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
the result columns
Even though state is a column in both tables, the order by is using
an expression, rather than a column.
...
13 matches
Mail list logo