diff --git a/syncapi/storage/current_room_state_table.go b/syncapi/storage/current_room_state_table.go index 88e7a76c3..6dc761292 100644 --- a/syncapi/storage/current_room_state_table.go +++ b/syncapi/storage/current_room_state_table.go @@ -84,7 +84,10 @@ const selectStateEventSQL = "" + "SELECT event_json FROM syncapi_current_room_state WHERE room_id = $1 AND type = $2 AND state_key = $3" const selectEventsWithEventIDsSQL = "" + - "SELECT added_at, event_json FROM syncapi_current_room_state WHERE event_id = ANY($1)" + // TODO: The session_id and transaction_id blanks are here because otherwise the rowsToStreamEvents + // expects there to be exactly four columns. We need a better solution to this long term. + // - neilalexander, 2 Jan 2020 + "SELECT added_at, event_json, 0 AS session_id, '' AS transaction_id FROM syncapi_current_room_state WHERE event_id = ANY($1)" type currentRoomStateStatements struct { upsertRoomStateStmt *sql.Stmt diff --git a/syncapi/storage/output_room_events_table.go b/syncapi/storage/output_room_events_table.go index 2df2a96a1..c98dcc785 100644 --- a/syncapi/storage/output_room_events_table.go +++ b/syncapi/storage/output_room_events_table.go @@ -21,6 +21,7 @@ import ( "sort" "github.com/matrix-org/dendrite/roomserver/api" + "github.com/matrix-org/gomatrix" "github.com/lib/pq" "github.com/matrix-org/dendrite/common" @@ -67,7 +68,7 @@ const insertEventSQL = "" + ") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING id" const selectEventsSQL = "" + - "SELECT id, event_json FROM syncapi_output_room_events WHERE event_id = ANY($1)" + "SELECT id, event_json, session_id, transaction_id FROM syncapi_output_room_events WHERE event_id = ANY($1)" const selectRecentEventsSQL = "" + "SELECT id, event_json, session_id, transaction_id FROM syncapi_output_room_events" + @@ -126,7 +127,7 @@ func (s *outputRoomEventsStatements) prepare(db *sql.DB) (err error) { // two positions, only the most recent state is returned. func (s *outputRoomEventsStatements) selectStateInRange( ctx context.Context, txn *sql.Tx, oldPos, newPos int64, - stateFilterPart *gomatrixserverlib.FilterPart, + stateFilterPart *gomatrix.FilterPart, ) (map[string]map[string]bool, map[string]streamEvent, error) { stmt := common.TxStmt(txn, s.selectStateInRangeStmt)