Skip to content

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

fix: composite primary key sql generation in table editor (#40942)

Vaibhavdbb5c1bdf575
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
index e1d7821eb73..675c64b1223 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
@@ -61,7 +61,7 @@ const getAddPrimaryKeySQL = ({
table: string
columns: string[]
}) => {
- const primaryKeyColumns = columns.join('","')
+ const primaryKeyColumns = columns.map((col) => `"${col}"`).join(', ')
return `ALTER TABLE "${schema}"."${table}" ADD PRIMARY KEY (${primaryKeyColumns})`
}