Re: [HACKERS] Bug: aliasing in ORDER BY when UNIONing

2001-02-19 Thread Marko Kreen
On Mon, Feb 19, 2001 at 12:26:44AM -0500, Tom Lane wrote: > Marko Kreen <[EMAIL PROTECTED]> writes: > > Anyway such stuff should be documented I guess. From current > > docs I read that it should work. > > Where? And ofcourse, you are right :) I was confused of result columns vs. table columns

Re: [HACKERS] Bug: aliasing in ORDER BY when UNIONing

2001-02-18 Thread Tom Lane
Marko Kreen <[EMAIL PROTECTED]> writes: > # select o.id from op o union all SELECT -1 order by o.id; > ERROR: Relation 'o' does not exist >> >> This is not valid SQL. For one thing, the table alias "o" is not >> visible outside the first component SELECT. >> >> Yes, I know 7.0 took it... but i

Re: [HACKERS] Bug: aliasing in ORDER BY when UNIONing

2001-02-18 Thread Marko Kreen
On Sun, Feb 18, 2001 at 08:24:20PM -0500, Tom Lane wrote: > Marko Kreen <[EMAIL PROTECTED]> writes: > > What works: > > # select o.id from op o union all SELECT -1 order by id; > > This is valid SQL. > > > # select o.id from op o union all SELECT -1 order by o.id; > > ERROR: Relation 'o' does n

Re: [HACKERS] Bug: aliasing in ORDER BY when UNIONing

2001-02-18 Thread Tom Lane
Marko Kreen <[EMAIL PROTECTED]> writes: > What works: > # select o.id from op o union all SELECT -1 order by id; This is valid SQL. > # select o.id from op o union all SELECT -1 order by o.id; > ERROR: Relation 'o' does not exist This is not valid SQL. For one thing, the table alias "o" is no

[HACKERS] Bug: aliasing in ORDER BY when UNIONing

2001-02-18 Thread Marko Kreen
What works: # select o.id from op o order by o.id; # select o.id from op o union all SELECT -1 order by id; Does not work: # select o.id from op o union all SELECT -1 order by o.id; ERROR: Relation 'o' does not exist # select o.id from op o union all SELECT -1 from op o order by o.id; ERROR: