© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
5 replies
NuggetPirate

Can't delete without CASCADE

Hi, simple problem but can't figure it out - I have two tables connected via foreign keys. Deleting a person causes this error:
message: 'update or delete on table "persons" violates foreign key constraint "training_jobs_person_pk_fkey" on table "training_jobs"'
}
message: 'update or delete on table "persons" violates foreign key constraint "training_jobs_person_pk_fkey" on table "training_jobs"'
}


I tried running this to fix:
ALTER TABLE public.training_jobs
DROP CONSTRAINT training_jobs_person_pk_fke,
ADD CONSTRAINT training_jobs_person_pk_fke
    FOREIGN KEY (person_pk)
    REFERENCES persons(person_pk)
    ON DELETE CASCADE;
ALTER TABLE public.training_jobs
DROP CONSTRAINT training_jobs_person_pk_fke,
ADD CONSTRAINT training_jobs_person_pk_fke
    FOREIGN KEY (person_pk)
    REFERENCES persons(person_pk)
    ON DELETE CASCADE;


but it errors out.
Failed to run sql query: constraint "training_jobs_person_pk_fke" of relation "training_jobs" does not exist
Failed to run sql query: constraint "training_jobs_person_pk_fke" of relation "training_jobs" does not exist


Help?
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

On Delete Cascade
SupabaseSSupabase / help-and-questions
4y ago
We have cascade delete but do we have cascade create?
SupabaseSSupabase / help-and-questions
13mo ago
Cascade delete on auth.users not working
SupabaseSSupabase / help-and-questions
4y ago
Can't delete storage folders
SupabaseSSupabase / help-and-questions
4y ago