© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3mo ago•
2 replies
skumlesen

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
user_integrations
,
users
users
): Have UUID as PRIMARY KEY and a separate
id
id
column defined as int8 with UNIQUE constraint and GENERATED ALWAYS AS IDENTITY
- Child tables (e.g.,
user_integrations
user_integrations
): Have foreign key columns (e.g.,
user_id
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
user_id
(int8) and
id
id
()"

Note: The
id
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
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Foreign Key Fails on Trigger
SupabaseSSupabase / help-and-questions
4y ago
generated typescript types do not match --local with same schema
SupabaseSSupabase / help-and-questions
3y ago
Composite key foreign key issue
SupabaseSSupabase / help-and-questions
6mo ago
Persistent Schema Cache Error: "Could not find a relationship" despite correct Foreign Key
SupabaseSSupabase / help-and-questions
5mo ago