Postgres Query To Check If Table Has Rows