Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Chore/index crash (#29258)

Terry Suttone4c2643bc456
diff --git a/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx b/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx
index 9e8c08577fd..dd527130d09 100644
--- a/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx
+++ b/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx
@@ -93,10 +93,16 @@ const CreateIndexSidePanel = ({ visible, onClose }: CreateIndexSidePanelProps) =
() => entities?.pages.flatMap((page) => page.data.entities) || [],
[entities?.pages]
)
+
const columns = tableColumns?.result[0]?.columns ?? []
- const columnOptions: MultiSelectOption[] = columns.map((column) => {
- return { id: column.attname, value: column.attname, name: column.attname, disabled: false }
- })
+ const columnOptions: MultiSelectOption[] = columns
+ .filter((column): column is NonNullable<typeof column> => column !== null)
+ .map((column) => ({
+ id: column.attname,
+ value: column.attname,
+ name: column.attname,
+ disabled: false,
+ }))
const generatedSQL = `
CREATE INDEX ON "${selectedSchema}"."${selectedEntity}" USING ${selectedIndexType} (${selectedColumns