Created
June 26, 2017 16:41
-
-
Save AlxGolubev/61498b2f74a5b9b572803e2dd5bd55a6 to your computer and use it in GitHub Desktop.
How to create a new key in existing record with JSONB field in Postgres
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 users SET preferences = jsonb_set(to_jsonb(preferences), '{some_preference}'::text[], 'true'::jsonb, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment