https://supabase.com/ logo
#help
Title
# help
s

STILLWATER;

04/07/2022, 1:18 PM
for onConflict parameter in upsert, what if we want to check on composite unique columns?
n

Needle

04/07/2022, 1:18 PM
Hello @STILLWATER;! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
s

STILLWATER;

04/07/2022, 1:19 PM
Copy code
js
const { data, error } = await supabase
  .from('users')
  .upsert({ username: 'supabot' }, { onConflict: 'username' })
can we pass array of colums there?
f

fernandolguevara

04/07/2022, 2:03 PM
can u try with
{ onConflict: 'col1,col2' }
?
n

Needle

04/07/2022, 2:03 PM
STILLWATER; (2022-04-07)
s

STILLWATER;

04/07/2022, 2:12 PM
ill check that out
s

Steve

04/07/2022, 3:51 PM
Yes, you can specify a comma-separated list of columns on on_conflict: https://postgrest.org/en/stable/api.html#on-conflict
s

STILLWATER;

04/08/2022, 4:30 AM
Thanks
n

Needle

04/09/2022, 11:39 AM
Thread was archived by @STILLWATER;. Anyone can send a message to unarchive it.