FoundationDB/sql-layer — pull request #1144 by MMcM (2013-12-31 22:42:23+00:00)
Title: Add a flag to control how broadly aliases are available in GROUP BY / ORDER BY / HAVING

By default, this is off, which means that the alias alone may be used in GROUP or ORDER BY, just where a column ordinal literal may be used.

If turned on, get something closer to MySQL behavior, in that aliases are allowed in HAVING an in expressions in the others. But it is not fully compatible in the ambiguous cases (alias has same name as real column), where it may choose something illegal or prefer the alias. But it is no worse than it was before.