Help forum

PATCH without overwriting with null an existing value

  • unicodes

    1 year ago

    How do you update a table without overwriting with null an existing value?
    I would like to avoid functions for this. Thank you!
  • needtheanswers

    1 year ago

    what backend are you using? xano?
  • unicodes

    1 year ago

    Supabase
  • Erik Beuschau

    1 year ago

    You make sure only to specify the columns you want to update. Supabase/postgrest will leave everything else intact https://postgrest.org/en/stable/references/api/tables_views.html#update
  • unicodes

    1 year ago

    In case the update is made two times, and first time was everything added (any column) and in the second update is missing avatar, it will update it with null. ps: consider arrays as variables
    1330913034700324974-Screenshot_2025-01-20_at_16.49.50.png
  • I do not find any Prefer to let the existing avatar in db and ignore the new avatar if null.
  • Erik Beuschau

    1 year ago

    If you want to exclude the avatar from your Object, you could use the Delete formula. You must ensure to only send the relevant data - either in your API definition, in a variable or as an input to your API
  • unicodes

    1 year ago

    Ahhh, you are right! I was looking to build object dynamic but you are right, it could be edited after!
  • Thank you Erik!
    👍1