Quick question about Upsert, as documented <here>:...
# supabase-kt
b
Quick question about Upsert, as documented here: • Does the Upsert automatically do a Select and return all new/updated rows? If not, how could that be achieved? • Does the comment ("_If you need to insert new data and update existing data at the same time, use Postgres triggers._") still hold true as the referenced ticket is closed and commented with "Once PostgREST/postgrest#1567 is cleared out then the library will allow this out-of-the-box."
j
Does the Upsert automatically do a Select and return all new/updated rows? If not, how could that be achieved?
Like all other operations (except select of course), you have to use
select()
within your request builder:
Copy code
val res = supabase.from("table").upsert(data) {
   select()
}
Does the comment ("_If you need to insert new data and update existing data at the same time, use Postgres triggers._") still hold true as the referenced ticket is closed and commented with "Once PostgREST/postgrest#1567 is cleared out then the library will allow this out-of-the-box."
As of #611, this is possible.
b
Perfect and thank you. 👌🏼 Great to see to this working for both Insert and Upsert.