Agreed. Aliases-in-where (enabled by a compliance flag) is a valid feature request but you’d have to fully define the semantics.
Julian > On Aug 19, 2022, at 22:46, Jiajun Xie <jiajunbernou...@gmail.com> wrote: > > Hi, Broeder: > There's a tricky situation: alias may be the same as column name. Some > users often make mistakes in company that I worked, so I have to point out > their problems. > > If you want to support alias in the WHERE clause, I hope you can consider > how to handle this situation. > >> On Sat, 20 Aug 2022 at 07:31, Sean Broeder <s...@dremio.com> wrote: >> >> >> >>>> On Aug 19, 2022, at 3:57 PM, Sean Broeder <s...@dremio.com> wrote: >>> >>> Thanks for the clarification >>> >>>> On Aug 19, 2022, at 3:23 PM, Julian Hyde <jhyde.apa...@gmail.com >> <mailto:jhyde.apa...@gmail.com>> wrote: >>>> >>>> Column aliases are only available in the ORDER BY clause. In some >> dialect-compliance settings, they are also available in the GROUP BY and >> HAVING clauses. But not in the WHERE clause. >>> >> Hi Julian, >> It looks like some databases do support column aliasing in where clauses, >> for example, Terradata documentation indicates it does. >> >> https://docs.teradata.com/r/Teradata-Database-SQL-Fundamentals/June-2017/Basic-SQL-Syntax/Referencing-Object-Names-in-a-Request/Using-a-Column-Alias >> >> I am interested in this feature and would contribute an enhancement to >> Calcite if it’s possible. >> >> Do you happen to know if the current lack of support is due to technical >> difficulties/limitations or it simply hasn’t been implemented yet? >> >> Also, if the latter, do you have a pointer to where I might start looking? >> >> Thanks, >> Sen