]> Git — Sourcephile - gargantext.git/blob - devops/postgres/upgrade/0.0.6.9.9.6.4_check.sql
[MERGE] Phylo
[gargantext.git] / devops / postgres / upgrade / 0.0.6.9.9.6.4_check.sql
1
2 with child_ngrams as
3 (select jsonb_array_elements_text(ngrams_repo_element->'children') as term
4 from node_stories),
5 parent_ngrams as
6 (select ngrams_repo_element->>'root' as term
7 from node_stories)
8
9 (select child_ngrams.term, ngrams.terms
10 from child_ngrams
11 left join ngrams on child_ngrams.term = ngrams.terms
12 where ngrams.terms is null
13
14 union
15
16 select parent_ngrams.term, ngrams.terms
17 from parent_ngrams
18 left join ngrams on parent_ngrams.term = ngrams.terms
19 where ngrams.terms is null
20 and parent_ngrams.term is not null)
21
22 order by term;
23