mod_storage_sql: Enable UPSERT with PostgreSQL
authorKim Alvefur <zash@zash.se>
Fri, 16 Jun 2023 13:03:34 +0200
changeset 13158 6cf5c215825d
parent 13157 88879f83b5b4
child 13159 9a7523ea45cb
mod_storage_sql: Enable UPSERT with PostgreSQL Tested. Works.
plugins/mod_storage_sql.lua
--- a/plugins/mod_storage_sql.lua	Fri Jun 16 13:02:35 2023 +0200
+++ b/plugins/mod_storage_sql.lua	Fri Jun 16 13:03:34 2023 +0200
@@ -218,7 +218,7 @@
 		]];
 		for key, data in pairs(keydatas) do
 			-- TODO Test UPSERT in PostgreSQL before enabling it.
-			if type(key) == "string" and key ~= "" and engine.params.driver == "SQLite3" and data ~= self.remove then
+			if type(key) == "string" and key ~= "" and engine.params.driver ~= "MySQL" and data ~= self.remove then
 				local t, value = assert(serialize(data));
 				engine:insert(upsert_sql, host, username or "", self.store, key, t, value, t, value);
 			elseif type(key) == "string" and key ~= "" then