News for hackers. Stuff that matters.
Re:PostgreSQL Exercises by hungerstrike on Wednesday December 06, 2017 @11:57AM (#15862637)
It's because the WHERE clause is evaluated before the SELECT. The reason that SQLite allows you to do that is because SQLite is much, much simpler than PgSQL, MySQL and SQL Server (all of which don't allow you to do this).

http://tinman.cs.gsu.edu/~raj/sql/node22.html

Re:PostgreSQL Exercises by combatentropy on Wednesday December 06, 2017 @05:33PM (#15865709)
Yes. I wish SQL select-statements put the select-clause last:

   from people
   where name = 'Joe'
   select upper(name) as bigname
1. It would mirror the other clauses (insert, update, and delete) which all begin with the table name.

2. It would be easier on my head. I skip the select-clause anyway when reading SQL, then come back up to it at the end, when I know the columns' source.

3. It would show that using column aliases in the where-clause would fail (unless the database did some kind of two-pass processing).

Re:PostgreSQL Exercises by Volrath89 on Thursday December 07, 2017 @01:13PM (#15872489)
You just described LINQ
Re:PostgreSQL Exercises by tux1968 on Wednesday December 06, 2017 @03:53PM (#15864881)
You would think that an initial pass of SELECT could be made only to note any aliases. It would be a much appreciated nod to usability.
Re:PostgreSQL Exercises by danso on Wednesday December 06, 2017 @12:10PM (#15862767)
That seems straightforward enough, don't know why I assumed SQLite's implementation of it was a feature as opposed to a consequence of its overall simplified model. I think I assumed/hoped that aliasing worked as a kind of function definition which WHERE could magically understand and evaluate.
Re:PostgreSQL Exercises by stats_n_trends on Wednesday December 06, 2017 @01:52PM (#15863785)
As a counter point teradata (a ridiculously expensive closed source but fairly complex database) supports this feature. So it is definitely possible for this feature to be supported.