Amos
05/16/2022, 6:44 PMjsonb
column when upserting with Supabase?
For example if I have a table on Postgres with a jsonb
column containing {"a": 1, "b": 2}
and I want to upsert a record with the same id and {"b": 10, "c": 20}
as the jsonb
column value. Without Supabase this looks like
sql
insert into the_table (id, json_column)
values (1, '{"b": 10, "c": 20}'::jsonb)
on conflict (id) do update
set json_column = table_name.json_column || excluded.json_column;
With Supabase it doesn't seem you can provide do something like
typescript
await supabase
.from('the_table')
.upsert({ id: 1, json_column: {"b": 10, "c": 20} }, { onConflict: 'json_column <something here?>' })
Needle
05/16/2022, 6:44 PMgaryaustin
05/16/2022, 10:39 PMNeedle
05/16/2022, 10:39 PM