Skip to content

Instantly share code, notes, and snippets.

@justinvanwinkle
Last active August 29, 2015 14:03
Show Gist options
  • Save justinvanwinkle/508e881eeba59a22fbfd to your computer and use it in GitHub Desktop.
Save justinvanwinkle/508e881eeba59a22fbfd to your computer and use it in GitHub Desktop.
cramdb=# select d->'isbn_10' from bub where d ? 'isbn_10' limit 5;
?column?
------------------------------
["0521641985", "0521645719"]
["039455583X"]
["0738706884"]
["1603200495"]
["0665890753"]
(20 rows)
so I would want:
"0521641985"
"0521645719"
"039455583X"
"0738706884"
"1603200495"
"0665890753"
BUT this does this:
cramdb=# select json_array_elements(d->'isbn_10') from bub where d ? 'isbn_10' limit 5;
ERROR: function json_array_elements(jsonb) does not exist
LINE 1: select json_array_elements(d->'isbn_10') from bub where d ? ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment