Added PostgreSQL query code