ZF-7221: Zend_Db_Select::_renderOrder() incorrectly converts integers to quoted identifiers
Description
This is a perfectly valid SQL query (in Oracle anyway)
SELECT * FROM TABLE ORDER BY 1 ASC
however, setting the order clause using $select->order(1) causes the query to be assembled as
SELECT "TABLE".* FROM "TABLE" ORDER BY "1" ASC
which fails with Zend_Db_Statement_Oracle_Exception: 904 ORA-00904: "1": invalid identifier
Comments
Posted by Benjamin Eberlei (beberlei) on 2009-09-18T13:27:11.000+0000
ORDER BY [ASC|DESC] is a valid syntax in ANSI Sql:
http://savage.net.au/SQL/sql-92.bnf.html/…
For all the Databases see: Mysql http://dev.mysql.com/doc/refman/5.1/de/select.html Oracle http://download.oracle.com/docs/cd/… Postgres http://postgresql.org/docs/8.4/… Sqlite http://www.sqlite.org/lang_select.html Mssql http://doc.ddart.net/mssql/sql70/…
Order by should allow specifying positive integers.
Posted by Benjamin Eberlei (beberlei) on 2009-09-18T14:33:17.000+0000
Patch plus 3 tests
Posted by Benjamin Eberlei (beberlei) on 2009-09-18T15:44:05.000+0000
Fixed in trunk and merged into 1.9 release branch