https://supabase.com/ logo
#off-topic
Title
# off-topic
a

assistattow

10/06/2021, 8:48 PM
when doing an update to a row how does supabase know which row to change?
g

garyaustin

10/06/2021, 9:20 PM
You are doing update which requires a filter like .match() operator to specify the row. (upsert() does not need a match as you must provide the primary key)
a

assistattow

10/06/2021, 9:22 PM
when providing the primary key without RLS it says that I am violating unique-constraints on the primary key
with RLS it seems to be fine for now but its an odd one
g

garyaustin

10/06/2021, 9:23 PM
.update() and .upsert() work differently. Your example code used .update() which also needs a .match()
a

assistattow

10/06/2021, 9:31 PM
ahh alright that makes sense
I assume the reason it works with the RLS without using .match() is because there is only one entry per user in that table so it can't change anything else so there is no issue on duplicate keys
g

garyaustin

10/06/2021, 9:32 PM
yes
a

assistattow

10/06/2021, 9:35 PM
alright, thank you so much