Composite key foreign key issue
I created a table where the primary key is a composite key from :
I created another table:
I want to reference the lab_members as a FK in my resources table:
but when i do so and view my table as an SQL format, it shows the image #1. I also got the create table SQL from "Copy from SQL", and it shows image#2 for my resources table. For some reason, it deals with foreign keys as single-key foreign keys rather than composite. It created a reference between labs and members, which should not happen.


2 Replies
I can’t look at this right now but the UI could be struggling with it. I would check with Postgres in the SQL editor or test it to see if it is working.
Example https://github.com/supabase/supabase/issues/3583
GitHub
The table editor shows an incorrect foreign key relation with compo...
Bug report Describe the bug The table editor shows an incorrect foreign key relation when a table has a composite foreign key. To Reproduce Create sample tables: drop table if exists sample2; drop ...
Also make sure to flush the browser cache if you had single FKs before. Was just reading a PR about invalidating the UI cache after running SQL. Not sure though it applies to more than the current page as it is AI related.