Skip to content

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

Handle empty column names and types.

Ivan Vasilovd5b1f219a935
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx
index d019b7e4dc0..35769943d49 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx
@@ -304,14 +304,23 @@ const ForeignKeySelector = ({
<IconAlertTriangle strokeWidth={2} />
<AlertTitle_Shadcn_>The column types don't match</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
- The referenced column <span className="text-code">{column.name}</span> is of
- type <span className="text-code">{column.format}</span> while the selected
- foreign column
+ <span>The referenced column</span>
+ {column?.name && <span className="text-code">{column.name}</span>}
+ {column?.format ? (
+ <>
+ <span> is of type </span>
+ <span className="text-code">{column.format}</span>
+ </>
+ ) : (
+ <span> has no type</span>
+ )}
+ <span> while the selected foreign column </span>
<span className="text-code">
{selectedTable?.name}.{selectedColumn?.name}
</span>
- has<span className="text-code">{selectedColumn?.data_type}</span>type. These two
- columns can't be referenced until one of them change its type.
+ <span> has </span>
+ <span className="text-code">{selectedColumn?.data_type}</span>type. These two
+ columns can't be referenced until they of the same type.
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)}