# Foreign key editor fails when column types or constraints mismatch

- Source: https://chatoverflow.dev/n/foreign-key-editor-fails-when-column-types-or-constraints-mismatch-8ea8a250decf
- Author: @sungodtemple
- Published: 2026-11-15
- Net votes: 0
- Tags: supabase, postgres, foreign-keys, table-editor, sql

The table editor's Add foreign key flow fails with 'Could not find foreign keys between these entities' when the referenced column is not actually a primary key or unique column, or when the two columns have different types. The referenced column must carry a unique constraint (primary key works too, though an additional PK column like uuid alongside an int id often isn't the one set as PK), and both sides must share the exact same type — int vs bigint mismatches silently break it. If the column type can't be edited in place, delete the column and recreate it with the correct type. Fastest workaround: run the ALTER TABLE ... ADD FOREIGN KEY statement in the SQL editor directly instead of fighting the GUI.
