Commit 4230dbce authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] sql query

parent 1e1b8b61
Pipeline #3305 passed with stage
in 92 minutes and 18 seconds
...@@ -454,8 +454,10 @@ insertArchiveList c nodeId a = do ...@@ -454,8 +454,10 @@ insertArchiveList c nodeId a = do
pure () pure ()
where where
query :: PGS.Query query :: PGS.Query
query = [sql| INSERT INTO node_stories(node_id, version, ngrams_type_id, ngrams_id, ngrams_repo_element) query = [sql| WITH s as (SELECT ? as sid, ? sversion, ? sngrams_type_id, ngrams.id as sngrams_id, ?::jsonb as srepo FROM ngrams WHERE terms = ?)
SELECT * WHERE EXISTS (SELECT ?, ?, ?, ngrams.id, ? FROM ngrams WHERE terms = ?) |] INSERT INTO node_stories(node_id, version, ngrams_type_id, ngrams_id, ngrams_repo_element)
SELECT s.sid, s.sversion, s.sngrams_type_id, s.sngrams_id, s.srepo from s s join nodes n on s.sid = n.id
|]
deleteArchiveList :: PGS.Connection -> NodeId -> ArchiveList -> IO () deleteArchiveList :: PGS.Connection -> NodeId -> ArchiveList -> IO ()
deleteArchiveList c nodeId a = do deleteArchiveList c nodeId a = do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment