Bug #5156 Views: ORDER BY with ordinal leads to error
Submitted: 23 Aug 2004 1:34 Modified: 6 Sep 2004 13:48
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[23 Aug 2004 1:34] Peter Gulutzan
Description:
MySQL allows views with ORDER BY clauses. 
The old-style syntax "ORDER BY position" won't work. 
I get an error "Unknown column". 
 

How to repeat:
mysql> create view v5 as select 5 from t5 order by 1; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select * from v5; 
ERROR 1054 (42S22): Unknown column '5' in 'order clause' 
 

Suggested fix:
Don't allow ORDER BY in views.
[31 Aug 2004 11:00] Oleksandr Byelkin
ChangeSet 
  1.1740 04/08/31 11:58:45 bell@sanja.is.com.ua +7 -0 
  ORDER clause printing fixed (BUG#5156)
[6 Sep 2004 13:48] Oleksandr Byelkin
Thank you for bugreport! Bugfix for this bug is pushed into our source repository.