1

I have a Supabase's postgres database where a row contains a column called jsonData that has many JSON fields:

{
  "key1": "...",
  "key2": "...",
  "key3": "...",
  "key4": "..."
}

I want to update as an example only the key3 with a new value and leave other properties as they are.

I tried making a new request getting the whole JSON object and manipulating it then updating the entire jsonData column, but this can result in updates with previous values if I have many updates running simultaneously.

I do use the Supabase REST API for this, I just don't know the best solution for updating a nested field directly without any workarounds.

and I want to know if I can do a custom PostgresSQL query for this.

Thank you and I appreciate any kind of help or guidance.

Gwhyyy
  • 7,554
  • 3
  • 8
  • 35
  • I would recommend using an RPC [function](https://stackoverflow.com/questions/74352316/supabase-dynamic-rpc-function/74353089#74353089) for it. – Mansueli Mar 06 '23 at 22:46

0 Answers0