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
Jan
07/13/2024, 1:17 PM
So you mean either insert information or select if it already exists?
m
Marc Planas
07/13/2024, 1:20 PM
Yeah, it should be a upsert followed by a select if it doesn’t exists? I couldn’t find another way to
j
Jan
07/13/2024, 8:15 PM
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
Marc Planas
07/17/2024, 10:12 AM
Hi Jan, finally I made a database function and worked perfectly ! thank you very much