Fix Drawing Status SQL query for Postgres