Foreign Key Creation Fails with "Column types do not match" Despite Matching int8/bigint Types

I'm unable to create foreign key relationships in my Supabase project, getting a "Column types do not match" error, even when both columns are confirmed to be int8/bigint.

Table Structure:
  • Parent tables (e.g., user_integrations, users): Have UUID as PRIMARY KEY and a separate id column defined as int8 with UNIQUE constraint and GENERATED ALWAYS AS IDENTITY
  • Child tables (e.g., user_integrations): Have foreign key columns (e.g., user_id) defined as int8
Error Message:
When creating FK's via supabase built-in UI or SQL, I get:
"Column types do not match. The following columns cannot be referenced as they are not of the same type: user_id (int8) and id()"

Note: The id column shows empty parentheses with no type listed in the error.

Verification Queries Run:
Results of SQL-queries show: constraint_type: "UNIQUE" for the id column, but confirm that BOTH columns are data_type: "bigint", udt_name: "int8"

Is Supabase's FK creation limited to PK references only? PostgreSQL should support FK references to UNIQUE constraints, but this doesn't seem to work for me. This affects ALL foreign key relationships across my database, since I have the same setup across all my tables.

Is this a known limitation, or am I missing something in my setup? Any additional information I can provide? Please LMK
Was this page helpful?