Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
d309c8c3
Commit
d309c8c3
authored
Oct 03, 2023
by
Fabien Manière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get recursive parents query: invert sql results
parent
8425e355
Pipeline
#5203
failed with stages
in 18 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
Tree.hs
src/Gargantext/Database/Query/Tree.hs
+10
-9
No files found.
src/Gargantext/Database/Query/Tree.hs
View file @
d309c8c3
...
...
@@ -397,15 +397,16 @@ recursiveParents :: NodeId
->
Cmd
err
[
DbTreeNode
]
recursiveParents
nodeId
nodeTypes
=
map
(
\
(
nId
,
tId
,
pId
,
n
)
->
DbTreeNode
nId
tId
pId
n
)
<$>
runPGSQuery
[
sql
|
WITH RECURSIVE recursiveParents AS(
SELECT id, typename, parent_id, name
FROM public.nodes WHERE id = ?
UNION ALL
SELECT n.id, n.typename, n.parent_id, n.name
FROM public.nodes n
INNER JOIN recursiveParents rp ON n.id = rp.parent_id
WHERE n.typename IN ?
) SELECT * FROM recursiveParents;
WITH RECURSIVE recursiveParents AS
(
SELECT id, typename, parent_id, name, 1 as original_order
FROM public.nodes WHERE id = ?
UNION ALL
SELECT n.id, n.typename, n.parent_id, n.name, rp.original_order+1
FROM public.nodes n
INNER JOIN recursiveParents rp ON n.id = rp.parent_id
WHERE n.typename IN ?
) SELECT id, typename, parent_id, name FROM recursiveParents ORDER BY original_order DESC;
|]
(
nodeId
,
In
typename
)
where
typename
=
map
nodeTypeId
ns
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment