to_timestamp(column,'YYYY-MM-DD HH24:MI:SS') as time gives "Data points outside time range" in the time series graph

I am creating time series graph using postgres data source. I don’t have column in timestamp data type the columns are character varying type. I type casted the column using to_timestamp() and used the column keeping its alias as time though getting “Data points outside time range” on the graph.

I couldn’t use $__time as it doesn’t support to_timestamp or CAST() and gives an error.
Could someone suggest what would be the work around for this problem?

Solved it by adding another time column in where clause