Duplicate Key Violation in Supabase Due to Orphaned Records in pgsodium Schema #30603
-
Hello community, I am currently facing a challenge with Supabase related to duplicate key violations when trying to insert records into a specific table. After executing a delete operation on several entries (which I did from the supabase dashboard manually), I discovered that the corresponding records still exist in the pgsodium schema, which is affecting my ability to perform new inserts. I found lingering entries in the following tables within pgsodium: key The insertion logic in my application utilizes an RPC function that generates keys in the pgsodium schema. However, because those deleted entries still have remnants within this read-only schema, I am encountering duplicate key violations for my new insertions. I would like to know: Is there a recommended approach to manage or clean up orphaned records in the pgsodium schema when they persist after a delete operation? Thank you for any insights or guidance you can provide! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The schema and tables would still be accessible with the SQL editor. I don't know enough about those tables and risks of deleting rows directly but you can certainly do it with the SQL editor. pgsodium though is pending deprecation and not recommended. You might want to make sure you understand https://supabase.com/docs/guides/database/extensions/pgsodium rational behind that. You would also need to sort out why deleting in your main table is not cleaning up pgsodium tables if you plan to keep using it. |
Beta Was this translation helpful? Give feedback.
The schema and tables would still be accessible with the SQL editor. I don't know enough about those tables and risks of deleting rows directly but you can certainly do it with the SQL editor.
pgsodium though is pending deprecation and not recommended. You might want to make sure you understand https://supabase.com/docs/guides/database/extensions/pgsodium rational behind that.
You would also need to sort out why deleting in your main table is not cleaning up pgsodium tables if you plan to keep using it.