I’m having an issue when I try to insert a new row to a Supabase table from WeWeb workflows.
One of my Supabase tables has 1521 records, which are imported from a different database.
The id (primary key) of records are not completely consistent, some numbers are lost as some data were deleted before. (e.g., the first row starts with id 79, the last row has id 2032)
When I try to insert a new row to the table from WeWeb using “Insert” type action in the Workflow, it tries to add a new row with id “1”. As I also already added an entry with id 1 for testing, it generates an error. "duplicate key value violates unique constraint "[tableName]_pkey""
My question is, how can I add a new row with an autoincremented id based on my Supabase table?
I thought of getting the whole rows + checking the id of the last row, but since I added RLS policy on Supabase to limit users to get only the user’s own data, I can’t get the whole table data as a user.
Sorry if my question is confusing, please let me know if anything is unclear.
Hoping any help.
Do you have the auto increment set up in your Supabase table? Or where does the ID, that is conflicting coming from? Could you show us the setup of your Supabase Action? Just to be sure we get the context.
I’m not sure about this one. But I did something similar with triggers for mixed values in Supabase upsert. What I did was, I set up a trigger before insert that would generate the id (if it was null).