update queries after migration to PostgreSQL