mod_storage_sql: Improve check for old table index on PostgreSQL
authorKim Alvefur <zash@zash.se>
Fri, 16 Jun 2023 23:57:15 +0200
changeset 13159 9a7523ea45cb
parent 13158 6cf5c215825d
child 13160 019cd1db9bec
mod_storage_sql: Improve check for old table index on PostgreSQL The "pg_indexes" view is much simpler to inspect than "pg_class"
plugins/mod_storage_sql.lua
--- a/plugins/mod_storage_sql.lua	Fri Jun 16 13:03:34 2023 +0200
+++ b/plugins/mod_storage_sql.lua	Fri Jun 16 23:57:15 2023 +0200
@@ -854,7 +854,7 @@
 						indices[row[1]] = true;
 					end
 				elseif params.driver == "PostgreSQL" then
-					for row in engine:select [[SELECT "relname" FROM "pg_class" WHERE "relname"='prosody_index';]] do
+					for row in engine:select [[SELECT "relname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do
 						indices[row[1]] = true;
 					end
 				end