Skip to content

Instantly share code, notes, and snippets.

@vbilopav
Last active July 6, 2020 12:48
Show Gist options
  • Save vbilopav/337855fd058387ecacb77659d5b484cd to your computer and use it in GitHub Desktop.
Save vbilopav/337855fd058387ecacb77659d5b484cd to your computer and use it in GitHub Desktop.
select
keys.key, data->>keys.key as value
from (
select distinct jsonb_object_keys(data) as key from table
) keys cross join table
where data->>keys.key is not null
group by keys.key, data->>keys.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment