Postgres-specific solution for question 5