I'm trying to create an RPC I can call to duplicate a row in my database while duplicating the relations aswell. Here is a dbfiddle where you can see where I'm at currently. (This functionality is basically just to have a week of exercises that you can copy again so you don't have to add everything again manually)
It is working exactly how I want it except I can't figure out how to create new copies of the suggested_loads linked on the exercise_sets table.
I only have basic knowledge of SQL and while I could make a series of queries, basically a query for each day and exercise, it would take a long time and I want to do it faster. ( Tried it before, took a lot longer than I would wait for an app to load ).
Based on the dbfiddle the expected result at the end would be to have load_id 1 in the first row and load_id 2 in the middle where the new week is added.
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.