Comparison

plugins/mod_storage_sql.lua @ 13155:9a7523ea45cb

mod_storage_sql: Improve check for old table index on PostgreSQL The "pg_indexes" view is much simpler to inspect than "pg_class"
author Kim Alvefur <zash@zash.se>
date Fri, 16 Jun 2023 23:57:15 +0200
parent 13154:6cf5c215825d
child 13156:019cd1db9bec
comparison
equal deleted inserted replaced
13154:6cf5c215825d 13155:9a7523ea45cb
852 if params.driver == "SQLite3" then 852 if params.driver == "SQLite3" then
853 for row in engine:select [[SELECT "name" from "sqlite_schema" WHERE "name"='prosody_index';]] do 853 for row in engine:select [[SELECT "name" from "sqlite_schema" WHERE "name"='prosody_index';]] do
854 indices[row[1]] = true; 854 indices[row[1]] = true;
855 end 855 end
856 elseif params.driver == "PostgreSQL" then 856 elseif params.driver == "PostgreSQL" then
857 for row in engine:select [[SELECT "relname" FROM "pg_class" WHERE "relname"='prosody_index';]] do 857 for row in engine:select [[SELECT "relname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do
858 indices[row[1]] = true; 858 indices[row[1]] = true;
859 end 859 end
860 end 860 end
861 end) 861 end)
862 if apply_changes then 862 if apply_changes then