summary refs log tree commit diff
path: root/synapse/storage/event_push_actions.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-05-04 13:19:59 +0100
committerDavid Baker <dave@matrix.org>2016-05-04 13:19:59 +0100
commit80be39646467c46a52530cd0839746810ad32b62 (patch)
tree941df7b8a4bfec00f05dbfbd9fe7797e0b993616 /synapse/storage/event_push_actions.py
parentAdd db functions used for email to the pusher app (diff)
downloadsynapse-80be39646467c46a52530cd0839746810ad32b62.tar.xz
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).
Diffstat (limited to 'synapse/storage/event_push_actions.py')
-rw-r--r--synapse/storage/event_push_actions.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index 85290d2a90..6f316f7d24 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -120,14 +120,15 @@ class EventPushActionsStore(SQLBaseStore):
             sql = (
                 "SELECT ep.event_id, ep.room_id, ep.stream_ordering, ep.actions, "
                 "e.received_ts "
-                "FROM event_push_actions AS ep, ("
+                "FROM ("
                 "   SELECT room_id, user_id, "
                 "       max(topological_ordering) as topological_ordering, "
                 "       max(stream_ordering) as stream_ordering "
                 "       FROM events"
                 "   NATURAL JOIN receipts_linearized WHERE receipt_type = 'm.read'"
                 "   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)"
                 " WHERE"
                 "   ep.room_id = rl.room_id"