summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2019-03-12 00:35:31 +1100
committerAmber Brown <hawkowl@atleastfornow.net>2019-03-12 00:35:31 +1100
commit5ba8ceab4cd7062d9f1b23a19d43f8a9ef7c5d60 (patch)
tree4211360bb8a8da013f2cc1383c42c94e86c954d9 /synapse/storage/_base.py
parentsetup master (diff)
downloadsynapse-5ba8ceab4cd7062d9f1b23a19d43f8a9ef7c5d60.tar.xz
fixes
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index a0333d5309..7e3903859b 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -767,18 +767,25 @@ class SQLBaseStore(object):
         """
         allvalues = {}
         allvalues.update(keyvalues)
-        allvalues.update(values)
         allvalues.update(insertion_values)
 
+        if not values:
+            latter = "NOTHING"
+        else:
+            allvalues.update(values)
+            latter = (
+                "UPDATE SET " + ", ".join(k + "=EXCLUDED." + k for k in values)
+            )
+
         sql = (
             "INSERT INTO %s (%s) VALUES (%s) "
-            "ON CONFLICT (%s) DO UPDATE SET %s"
+            "ON CONFLICT (%s) DO %s"
         ) % (
             table,
             ", ".join(k for k in allvalues),
             ", ".join("?" for _ in allvalues),
             ", ".join(k for k in keyvalues),
-            ", ".join(k + "=EXCLUDED." + k for k in values),
+            latter
         )
         txn.execute(sql, list(allvalues.values()))