Postgresql Cannot Cast Type Boolean To Integer