Skip to content

Instantly share code, notes, and snippets.

@chumakoff
Created July 12, 2018 12:25
Show Gist options
  • Save chumakoff/24623e3d18a11d3b835abf4a1024efa3 to your computer and use it in GitHub Desktop.
Save chumakoff/24623e3d18a11d3b835abf4a1024efa3 to your computer and use it in GitHub Desktop.
postgres_update_json.sql
update table_name set data = (jsonb_set(to_jsonb(data), '{foo,bar,baz}', '1', false))::json where data->'foo'->'bar'->>'baz' = '0';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment