Skip to content

Instantly share code, notes, and snippets.

@camallen
Created September 20, 2019 13:01
Show Gist options
  • Save camallen/1a05914731d548cb4e16ab24f5057ddc to your computer and use it in GitHub Desktop.
Save camallen/1a05914731d548cb4e16ab24f5057ddc to your computer and use it in GitHub Desktop.
Query to find all the 1 task workflows with single question only
select id, tasks --(kv.value -> 'type')
from
workflows w,
jsonb_each(w.tasks) kv
WHERE kv.value -> 'type' = '"single"'
AND id IN (
select id FROM
(SELECT id, (SELECT COUNT(*) FROM jsonb_object_keys(tasks)) as keys FROM workflows)as keys_tuple
WHERE keys = 1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment