Hi folks ! Quick question : Is it okey to have a ...
# supabase-kt
m
Hi folks ! Quick question : Is it okey to have a UPSERT operation and if the UNIQUE key already exists, ignore it, and do a select to obtain the information of the existing row ? It is not posible to automatically return the existing row in the UPSERT operation ? I don't know if its very optimal Thank you in advance ! ❤️
j
So you mean either insert information or select if it already exists?
m
Yeah, it should be a upsert followed by a select if it doesn’t exists? I couldn’t find another way to
j
I don't think there is built-in way to do that, however a database function might do the job. Apart from that, select and than upsert should also work.
m
Hi Jan, finally I made a database function and worked perfectly ! thank you very much
👍 1