Summary
This blog post explores the complexities of SQL's ORDER BY clause in PostgreSQL, highlighting how different types of identifiers and expressions affect the sorting of query results. Through specific examples, the author, Radim Marek, explains the subtle differences in how the parser interprets column names, aliases, and expressions, revealing common pitfalls that developers may encounter. The conclusion emphasizes the importance of understanding these distinctions to avoid unexpected results in SQL queries.