Last active
March 19, 2018 15:45
-
-
Save eliashussary/d45d7fb9c22a98e34a482edccc9f1559 to your computer and use it in GitHub Desktop.
Postgres Example of adding and removing keys from json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update "listingSubscriptions" | |
set criteria = (jsonb_set(criteria::jsonb, '{moveInDateParsed}', '["",""]')); | |
update "listingSubscriptions" | |
set "criteria" = (criteria::jsonb - 'moveInDate')::json; | |
update "listingSubscriptions" | |
set criteria = (jsonb_set(criteria::jsonb, '{listPrice}', to_jsonb('{0,6000}'::int[]))) | |
where (criteria->'listPrice')::jsonb = '["",""]'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment