Fix PostgreSQL backend key iteration