Bug #26549 Table aliases for constants return an error when using a function in order by cl
Submitted: 22 Feb 2007 0:39 Modified: 22 Feb 2007 8:21
Reporter: Soren Heitmann Email Updates:
Status: Unsupported Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.11 OS:
Assigned to: CPU Architecture:Any

[22 Feb 2007 0:39] Soren Heitmann
Selecting a constant value and using a table alias and attempting to use a function in order by clause returns an unknown column error.

How to repeat:
The following statements work as expected:
select 'bug' as `foo` order by `foo` asc
select 'bug' as `foo` order by length(1) asc
select 'bug' as `foo` order by `foo` asc

The following statement returns "Unknown column `foo` in order by clause"
select 'bug' as `foo` order by length(`foo`) asc
[22 Feb 2007 8:21] Hartmut Holzgraefe
Thank you for taking the time to report a problem.  Unfortunately you are not using a current version of the product you reported a problem with -- the problem might already be fixed (i couldn't reproduce it with current 5.0 source). Please download a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions, please change the version on this bug report to the version you tested and change the status back to "Open".  Again, thank you for your continued support of MySQL.