"onConflictDoUpdate" fails with error in Array.flatMap
I am trying to run an upsert function, and update the values if it already exists. Now I might be completely in the wrong with the code.
I have made a base "repository" class that has the upsert function simplified as follows:
now I have tried the upsert in a loop for the array is the data happens to be an array, did not do anything, getting the same error.
2 Replies
Update:
A simple update function fails with the same
This piece of code to update works (I know there's lots of duplicates)
The idea here is that it's taking a looooooong time to do a select for the ID, check if it's undefined or not then insert/update based on that.
you can do it with some raw sql
this is for postgres probably would be similar/same on others
had same problem