diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-29 16:30:25 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-29 16:30:25 +0100 |
commit | d76c058eea60ffc63ff7427e1de1e142a4b5b188 (patch) | |
tree | b918dfbf99d14bc2406ba603bb4dddd783db39a6 | |
parent | Accept camelcase + underscores in binding too (diff) | |
download | synapse-d76c058eea60ffc63ff7427e1de1e142a4b5b188.tar.xz |
Fix invalid SQL to work in postgres land
-rw-r--r-- | synapse/storage/appservice.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/storage/appservice.py b/synapse/storage/appservice.py index 63d1af4e86..bd285a6699 100644 --- a/synapse/storage/appservice.py +++ b/synapse/storage/appservice.py @@ -442,14 +442,16 @@ class ApplicationServiceTransactionStore(SQLBaseStore): # Monotonically increasing txn ids, so just select the smallest # one in the txns table (we delete them when they are sent) result = txn.execute( - "SELECT MIN(txn_id), * FROM application_services_txns WHERE as_id=?", + "SELECT * FROM application_services_txns WHERE as_id=?" + " ORDER BY txn_id ASC LIMIT 1", (service.id,) ) - entry = self.cursor_to_dict(result)[0] - if not entry or entry["txn_id"] is None: - # the min(txn_id) part will force a row, so entry may not be None + rows = self.cursor_to_dict(result) + if not rows: return None + entry = rows[0] + event_ids = json.loads(entry["event_ids"]) events = self._get_events_txn(txn, event_ids) |