Is there a way to ensure WHERE clause happens after DISTINCT? Is there a way to ensure WHERE clause happens after DISTINCT? postgresql postgresql