mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-01-16 16:37:09 -05:00
Correct SQL statement for postgres
In standard sql, join binds tighter than comma, so we were joining on the wrong table. Postgres follows the standard (apparently).
This commit is contained in:
parent
8cc82aad87
commit
80be396464
@ -120,14 +120,15 @@ class EventPushActionsStore(SQLBaseStore):
|
|||||||
sql = (
|
sql = (
|
||||||
"SELECT ep.event_id, ep.room_id, ep.stream_ordering, ep.actions, "
|
"SELECT ep.event_id, ep.room_id, ep.stream_ordering, ep.actions, "
|
||||||
"e.received_ts "
|
"e.received_ts "
|
||||||
"FROM event_push_actions AS ep, ("
|
"FROM ("
|
||||||
" SELECT room_id, user_id, "
|
" SELECT room_id, user_id, "
|
||||||
" max(topological_ordering) as topological_ordering, "
|
" max(topological_ordering) as topological_ordering, "
|
||||||
" max(stream_ordering) as stream_ordering "
|
" max(stream_ordering) as stream_ordering "
|
||||||
" FROM events"
|
" FROM events"
|
||||||
" NATURAL JOIN receipts_linearized WHERE receipt_type = 'm.read'"
|
" NATURAL JOIN receipts_linearized WHERE receipt_type = 'm.read'"
|
||||||
" GROUP BY room_id, user_id"
|
" GROUP BY room_id, user_id"
|
||||||
") AS rl"
|
") AS rl,"
|
||||||
|
" event_push_actions AS ep"
|
||||||
" INNER JOIN events AS e USING (room_id, event_id)"
|
" INNER JOIN events AS e USING (room_id, event_id)"
|
||||||
" WHERE"
|
" WHERE"
|
||||||
" ep.room_id = rl.room_id"
|
" ep.room_id = rl.room_id"
|
||||||
|
Loading…
Reference in New Issue
Block a user