Query update

This commit is contained in:
Neil Alexander 2020-12-18 18:26:09 +00:00
parent 44c53e32f8
commit fdb65e52b7
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 2 additions and 2 deletions

View file

@ -103,7 +103,7 @@ const updateEventJSONSQL = "" +
"UPDATE syncapi_output_room_events SET headered_event_json=$1 WHERE event_id=$2" "UPDATE syncapi_output_room_events SET headered_event_json=$1 WHERE event_id=$2"
const selectCountStateChangesInRangeSQL = "" + const selectCountStateChangesInRangeSQL = "" +
"SELECT COUNT(*), MIN(id), MAX(id) FROM syncapi_output_room_events" + "SELECT COUNT(id), COALESCE(MIN(id), 0) AS min, COALESCE(MAX(id), 0) AS max FROM syncapi_output_room_events" +
" WHERE (id > $1 AND id <= $2) AND (cardinality (add_state_ids) > 0 OR cardinality (remove_state_ids) > 0)" " WHERE (id > $1 AND id <= $2) AND (cardinality (add_state_ids) > 0 OR cardinality (remove_state_ids) > 0)"
// In order for us to apply the state updates correctly, rows need to be ordered in the order they were received (id). // In order for us to apply the state updates correctly, rows need to be ordered in the order they were received (id).

View file

@ -92,7 +92,7 @@ const updateEventJSONSQL = "" +
*/ */
const selectCountStateChangesInRangeSQL = "" + const selectCountStateChangesInRangeSQL = "" +
"SELECT COUNT(*), coalesce(MIN(id), 0) AS min, coalesce(MAX(id), 0) AS max FROM syncapi_output_room_events" + "SELECT COUNT(*), MIN(id), MAX(id) AS max FROM syncapi_output_room_events" +
" WHERE (id > $1 AND id <= $2) AND ((add_state_ids IS NULL OR add_state_ids = '') OR (remove_state_ids IS NULL OR remove_state_ids = ''))" " WHERE (id > $1 AND id <= $2) AND ((add_state_ids IS NULL OR add_state_ids = '') OR (remove_state_ids IS NULL OR remove_state_ids = ''))"
const selectStateInRangeSQL = "" + const selectStateInRangeSQL = "" +