mod_storage_sql: Be more specific when checking for old index in SQLite3
authorKim Alvefur <zash@zash.se>
Sat, 17 Jun 2023 00:00:21 +0200
changeset 13160 019cd1db9bec
parent 13159 9a7523ea45cb
child 13161 841276d0cc25
mod_storage_sql: Be more specific when checking for old index in SQLite3 Prevents false positives in the odd case where something other than an index with this name might exist.
plugins/mod_storage_sql.lua
--- a/plugins/mod_storage_sql.lua	Fri Jun 16 23:57:15 2023 +0200
+++ b/plugins/mod_storage_sql.lua	Sat Jun 17 00:00:21 2023 +0200
@@ -850,7 +850,7 @@
 			local indices = {};
 			engine:transaction(function ()
 				if params.driver == "SQLite3" then
-					for row in engine:select [[SELECT "name" from "sqlite_schema" WHERE "name"='prosody_index';]] do
+					for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do
 						indices[row[1]] = true;
 					end
 				elseif params.driver == "PostgreSQL" then