Created
February 14, 2016 03:18
-
-
Save badri/d9e4708b08661a7525d8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
WITH data AS( | |
select array_to_json(array_agg(row_to_json(t))) as data | |
from ( | |
SELECT id, name, COALESCE(get_children(id), '[]') as children from genres | |
) t | |
) SELECT get_tree(data) from data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment