2 ms·
In PostgreSQL, the grammar does not permit unquoted identifiers to start with a digit. So this is a syntax error: SELECT 'val' AS 2 Instead you must escap
by benesch 6y ago
In PostgreSQL, the grammar does not permit unquoted identifiers to start with a digit. So this is a syntax error:
SELECT 'val' AS 2
Instead you must escape the identifier with double quotes:
SELECT 'val' AS "2"
So there is no ambiguity on that front in the ORDER BY clause. Either you have `ORDER BY 2`, which means order by the second column, or you have `ORDER BY "2"`, which means order by the column named "2".