From a45c06b51fbc250f738b320c96d974bf733eb5b3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 17 Jun 2023 00:00:21 +0200 Subject: 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index 3b20b3cc..3afb5d78 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -850,7 +850,7 @@ local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore 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 -- cgit v1.2.3