Am I reading the documentation wrong? UPSERT isn't...
# help
l
Am I reading the documentation wrong? UPSERT isn't that update if exists or insert new?
n
Hello @Lars! 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.
l
const { data, error } = await supabase .from('users') .upsert({ username: 'supabot' }, { onConflict: 'username' })
^always gives the error "{message: "there is no unique or exclusion constraint matching the ON CONFLICT specification", code: "42P10", details: null, hint: null}"
no matter if "users" has a row where username === 'supabot'
or not
l
Upsert is basically insert, but update on conflicts https://wiki.postgresql.org/wiki/UPSERT
n
Lars (2022-04-21)
l
is your username column definied as UNIQUE?
l
Sorry, it DOES work - the fault was hanging cloudflare workers preview
Awesome