10 | | Also, I'm not sure how it is sorting with `ORDER BY 0` if a number is referencing the [https://oracle-base.com/articles/misc/sql-for-beginners-the-order-by-clause#:~:text=column%20position column position]. I wonder if it uses a default column that is different from the default column in Django. |
| 12 | Without casting, the query is, |
| 13 | |
| 14 | {{{ |
| 15 | SELECT "ORDERING_ARTICLE"."ID", "ORDERING_ARTICLE"."AUTHOR_ID", "ORDERING_ARTICLE"."SECOND_AUTHOR_ID", "ORDERING_ARTICLE"."HEADLINE", "ORDERING_ARTICLE"."PUB_DATE" FROM "ORDERING_ARTICLE" ORDER BY 0 DESC |
| 16 | }}} |
| 17 | |
| 18 | I'm not sure how it is sorting with `ORDER BY 0` if a number is referencing the [https://oracle-base.com/articles/misc/sql-for-beginners-the-order-by-clause#:~:text=column%20position column position]. I wonder if it uses a default column that is different from the default column in Django. Running a small SQL [https://sqlfiddle.com/oracle/online-compiler?&id=f43e92f2-df6f-4b4a-a6b3-7ae436bd9bc6 example] directly on the database gives an error as expected |
| 19 | |
| 20 | {{{ |
| 21 | SELECT id, first_name, dob FROM person ORDER BY 0 |
| 22 | * |
| 23 | ERROR at line 1: |
| 24 | ORA-01785: ORDER BY item must be the number of a SELECT-list expression |
| 25 | }}} |
| 26 | |
| 27 | but it raising an error in Django. |