Created
February 9, 2017 20:22
-
-
Save JonasHeylen/66b1a9a31dce76682837c3fd4d9a468b to your computer and use it in GitHub Desktop.
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
create table json_test(id int primary key, foo jsonb); | |
insert into json_test values (1, '{"foo": "bar", "xyz": 123}'::jsonb), (2, '{"foo": "qaz", "xyz": 456}'::jsonb); | |
select id, foo->>'foo' as foo, foo->>'xyz' as xyz from json_test; | |
select id, x.foo, x.xyz from json_test, jsonb_to_record(foo) as x(foo text, xyz int); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment