Hey guys, are there any docs on inserting and upda...
# help
m
Hey guys, are there any docs on inserting and updating many-to-many relationships?
g
Although the api supports joins when selecting from the database, for writing multiple tables it is best done by an rpc call to a postgres function. The function then carries out the various insert/updates. The rpc function also is wrapped in a transaction so if any operation fails they all fail and are backed off as long as they issue an exception.
m
@User - thank you for your reply. Do you have any docs that you can recommend on this?
cc @User
g
Not really, but just "googling" "supabase rpc function multiple inserts" finds many topics, including this one that recommends just doing the separate api calls in the beginning... https://stackoverflow.com/questions/69595895/how-to-insert-in-multiple-tables-with-a-single-api-call-in-supabase and this one on transaction: https://github.com/supabase/supabase/discussions/3732 If you are just learning relational databases and postgres it might make sense to just do the client calls for now.
m
Thank you!