Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.4
-
Fix Version/s: 1.9.3
-
Component/s: Zend_Db_Select
-
Labels:None
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
ORDER BY <column_name | position > [ASC|DESC] is a valid syntax in ANSI Sql:
http://savage.net.au/SQL/sql-92.bnf.html#order%20by%20clause
For all the Databases see:
Mysql http://dev.mysql.com/doc/refman/5.1/de/select.html
Oracle http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10002.htm
Postgres http://www.postgresql.org/docs/8.4/static/sql-select.html#SQL-GROUPBY
Sqlite http://www.sqlite.org/lang_select.html
Mssql http://doc.ddart.net/mssql/sql70/sa-ses_3.htm#_order_by_clause
Order by should allow specifying positive integers.