When attempting to delete a row in the Supabase Table Editor that is referenced by foreign key constraints, the current experience surfaces a generic error message. This makes it difficult for developers to understand why the deletion failed and what actions are required to resolve it.
This feature request proposes enhancing the error UI to:
Currently, when a user tries to delete a row that is referenced by a foreign key:
update or delete on table "users" violates foreign key constraint "orders_user_id_fkey" on table "orders"
Enhance the Table Editor delete flow to surface a structured and actionable error modal.
⚠️ Cannot delete this row due to foreign key constraints
This row is referenced by:
- orders → 12 rows
- payments → 3 rows
Total affected rows: 15
Provide a ready-to-use SQL query that resolves the constraint by deleting dependent rows in the correct order:
DELETE FROM payments WHERE user_id = 1;
DELETE FROM orders WHERE user_id = 1;
DELETE FROM users WHERE id = 1;
Note: This query is generated for developer convenience and should be explicitly reviewed before execution.
This proposal focuses only on:
Out of scope for now:
ON DELETE CASCADE)I’d be happy to work on this feature and collaborate on the implementation if it aligns with the project direction.
Lakshya Paliwal suggests enhancing the Supabase Table Editor's error handling for foreign key constraint violations. The current error message is generic, making it difficult for developers to understand and resolve issues. The proposal includes displaying all referencing tables, providing actionable insights, and generating SQL queries to resolve constraints.