fixed casting of CAST timestamp sql error due to change to mysql db from postgres