summary refs log tree commit diff
path: root/synapse/storage/stream.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-18 16:25:18 +0100
committerErik Johnston <erik@matrix.org>2014-08-18 16:25:18 +0100
commit1422a22970e4ab3f7a37fe672af2f1d1de901c10 (patch)
tree8c8960d3073b96097ec9d165f38df2c707614d43 /synapse/storage/stream.py
parentMake snapshot_all_rooms return results in the correct form, including start a... (diff)
downloadsynapse-1422a22970e4ab3f7a37fe672af2f1d1de901c10.tar.xz
Fix typos in SQL and where we still had rowid's (which no longer exist)
Diffstat (limited to 'synapse/storage/stream.py')
-rw-r--r--synapse/storage/stream.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 6728a4b5ea..c03c983e14 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -74,13 +74,13 @@ class StreamStore(SQLBaseStore):
         if from_key < to_key:
             sql += (
                 "AND e.token_ordering > ? AND e.token_ordering < ? "
-                "ORDER BY token_ordering, rowid ASC LIMIT %(limit)d "
+                "ORDER BY token_ordering ASC LIMIT %(limit)d "
             ) % {"limit": limit}
         else:
             sql += (
                 "AND e.token_ordering < ? "
                 "AND e.token_ordering > ? "
-                "ORDER BY e.token_ordering, rowid DESC LIMIT %(limit)d "
+                "ORDER BY e.token_ordering DESC LIMIT %(limit)d "
             ) % {"limit": int(limit)}
 
         rows = yield self._execute_and_decode(
@@ -107,9 +107,9 @@ class StreamStore(SQLBaseStore):
         end_token = yield self.get_room_events_max_id()
 
         sql = (
-            "SELECT * FROM events WHERE "
+            "SELECT * FROM events "
             "WHERE room_id = ? AND token_ordering <= ? "
-            "ORDER BY topological_ordering, rowid DESC LIMIT ? "
+            "ORDER BY topological_ordering, token_ordering DESC LIMIT ? "
         )
 
         rows = yield self._execute_and_decode(
@@ -121,8 +121,8 @@ class StreamStore(SQLBaseStore):
 
         if rows:
             topo = rows[0]["topological_ordering"]
-            row_id = rows[0]["rowid"]
-            start_token = "p%s-%s" % (topo, row_id)
+            toke = rows[0]["token_ordering"]
+            start_token = "p%s-%s" % (topo, toke)
 
             token = (start_token, end_token)
         else: