dbTalk Databases Forums  

[BUGS] PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Scott Eade
 
Posts: n/a

Default [BUGS] PostgreSQL 8.0 Beta 4 - Qualified ORDER BY column name not working - 10-29-2004 , 12:54 PM






I am running PostgreSQL 8.0 Beta 4 (Windows installer) on Windows XP Pro
SP2.

The query below has three ORDER BY clauses. When I execute it with the
uncommented clause an error results. Some further commentary is
included in the comments below. I would expect the uncommented clause
to produce the same result as the other two commented out clauses.


-- Qualified ORDER BY column name not working on UNION query (simple
example).
SELECT TURBINE_USER.USER_ID FROM TURBINE_USER WHERE TURBINE_USER.USER_ID = 1
UNION
SELECT TURBINE_USER.USER_ID FROM TURBINE_USER WHERE TURBINE_USER.USER_ID = 2
-- The following works.
--ORDER BY 1 ASC
-- The following does not work when I would perhaps expect it to (it
certainly works when a non-UNION query is used).
ORDER BY TURBINE_USER.USER_ID ASC
-- The following also works as I would expect it to unless more than one
USER_ID column appears in the column list.
--ORDER BY USER_ID ASC

-- For the case that does not work the message is:
--
-- NOTICE: adding missing FROM-clause entry for table "turbine_user"
--
-- ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT result must be on one of
the result columns


-- I haven't tried a case where the sort column (in this case USER_ID)
appears more than once in the column list.

I will not be surprised at all if the above is expected behaviour, in
which case I apologise for wasting your time.

Incidentally, the error message that occurs if I EXPLAIN the above query
is as above but with an additional line that seems out of place to me:
Query inserted one rows with OID 0.

Also, if I EXPLAIN this query with one of the working ORDER BY clauses
it produces a result, but if I select the ANALYSE option (I am using the
pgAdmin III that comes bundled with the Beta 4 Windows installer) I get
something completely nonsensical:
ERROR: syntax error at or near "ROLLBACK" at character 897


Thanks,

Scott

--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.