Prevent using cast column from alias `__ctx_query`
Prevent using cast column from alias `__ctx_query`

Fixes #1160 by keep the original name of the column and using it if the
column type is date.

CartoDB/Windshaft-cartodb,CartoDB/Windshaft-cartodb,CartoDB/Windshaft-cartodb,CartoDB/Windshaft-cartodb