Issues

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

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.

Patch plus 3 tests

Fixed in trunk and merged into 1.9 release branch