diff --git a/roomserver/storage/postgres/events_table.go b/roomserver/storage/postgres/events_table.go index cc1422e0..42110bbf 100644 --- a/roomserver/storage/postgres/events_table.go +++ b/roomserver/storage/postgres/events_table.go @@ -92,10 +92,8 @@ const bulkSelectStateEventByIDSQL = "" + const bulkSelectStateEventByNIDSQL = "" + "SELECT event_type_nid, event_state_key_nid, event_nid FROM roomserver_events" + " WHERE event_nid = ANY($1)" + - //" AND event_type_nid = ANY($2)" + - //" AND event_state_key_nid = ANY($3)" + - " AND ($2::bigint[] IS NULL OR event_type_nid = ANY($2))" + - " AND ($3::bigint[] IS NULL OR event_state_key_nid = ANY($3))" + + " AND (CARDINALITY($2) = 0 OR event_type_nid = ANY($2))" + + " AND (CARDINALITY($3) = 0 OR event_state_key_nid = ANY($3))" + " ORDER BY event_type_nid, event_state_key_nid ASC" const bulkSelectStateAtEventByIDSQL = "" +