From f503fc935baf77477f36f7e4c3543e8e0f87ad1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 11 May 2026 13:42:06 +0200 Subject: [PATCH] fix(catalog-backend): scope pg_class lookups to relkind='i' in migration helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents a false match if any non-index object (table, sequence, view) shares a name with one of the search indices. Signed-off-by: Fredrik Adelöw Co-authored-by: Cursor --- .../migrations/20260510000000_search_indices_and_dedup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-backend/migrations/20260510000000_search_indices_and_dedup.js b/plugins/catalog-backend/migrations/20260510000000_search_indices_and_dedup.js index f49b36d731..bdf36d7a3f 100644 --- a/plugins/catalog-backend/migrations/20260510000000_search_indices_and_dedup.js +++ b/plugins/catalog-backend/migrations/20260510000000_search_indices_and_dedup.js @@ -188,7 +188,7 @@ async function ensurePgIndex(knex, opts) { SELECT indisunique, indisvalid FROM pg_index WHERE indexrelid = ( - SELECT oid FROM pg_class WHERE relname = ? + SELECT oid FROM pg_class WHERE relname = ? AND relkind = 'i' ) `, [name], @@ -217,7 +217,7 @@ async function ensurePgIndex(knex, opts) { async function dropPgIndexIfExists(knex, name) { const result = await knex.raw( ` - SELECT 1 FROM pg_class WHERE relname = ? + SELECT 1 FROM pg_class WHERE relname = ? AND relkind = 'i' `, [name], );