summary refs log tree commit diff
path: root/synapse/storage/databases/main/relations.py
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2021-12-14 12:34:30 +0000
committerGitHub <noreply@github.com>2021-12-14 12:34:30 +0000
commita4dce5b53dd460e7c6757648ff4a348b490c6213 (patch)
tree92e9f608c727a246002fffb2ff81b7cc410d6a55 /synapse/storage/databases/main/relations.py
parentAdd missing type hints to synapse.http. (#11571) (diff)
downloadsynapse-a4dce5b53dd460e7c6757648ff4a348b490c6213.tar.xz
Remove redundant `COALESCE()`s around `COUNT()`s in database queries (#11570)
`COUNT()` never returns `NULL`. A `COUNT(*)` over 0 rows is 0 and a
`COUNT(NULL)` is also 0.
Diffstat (limited to 'synapse/storage/databases/main/relations.py')
-rw-r--r--synapse/storage/databases/main/relations.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/relations.py b/synapse/storage/databases/main/relations.py
index 3368a8b084..729ff17e2e 100644
--- a/synapse/storage/databases/main/relations.py
+++ b/synapse/storage/databases/main/relations.py
@@ -390,7 +390,7 @@ class RelationsWorkerStore(SQLBaseStore):
             latest_event_id = row[0]
 
             sql = """
-                SELECT COALESCE(COUNT(event_id), 0)
+                SELECT COUNT(event_id)
                 FROM event_relations
                 INNER JOIN events USING (event_id)
                 WHERE