SQL: Use ANY() with arrays, not IN
This commit is contained in:
parent
5c153b0294
commit
1c2e5f86af
4 changed files with 8 additions and 8 deletions
|
@ -132,7 +132,7 @@ xcyclicn' follow filter minitials proxy = do
|
|||
Just initials -> mconcat
|
||||
[ " FROM ", dbname $ entityDB tNode
|
||||
, " WHERE ", entityDB tNode ^* fieldDB (entityId tNode)
|
||||
, " IN ?"
|
||||
, " = ANY(?)"
|
||||
]
|
||||
]
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ xmpathm' follow filter msource mdest mlen mlim proxy = do
|
|||
Just _ -> mconcat
|
||||
[ " FROM ", dbname $ entityDB tNode
|
||||
, " WHERE ", entityDB tNode ^* fieldDB (entityId tNode)
|
||||
, " IN ?"
|
||||
, " = ANY(?)"
|
||||
]
|
||||
, " UNION ALL "
|
||||
, case follow of
|
||||
|
@ -174,10 +174,10 @@ xmpathm' follow filter msource mdest mlen mlim proxy = do
|
|||
, " FROM ", dbname temp
|
||||
, case mdest of
|
||||
Nothing -> ""
|
||||
Just _ -> " WHERE ", temp ^* tid, " IN ?"
|
||||
Just _ -> " WHERE " <> temp ^* tid <> " = ANY(?)"
|
||||
, case mlen of
|
||||
Nothing -> ""
|
||||
Just _ -> " AND array_length(", temp ^* tpath, ", 1) <= ?"
|
||||
Just _ -> " AND array_length(" <> temp ^* tpath <> ", 1) <= ?"
|
||||
, " ORDER BY array_length(", temp ^* tpath, ", 1)"
|
||||
, case mlim of
|
||||
Nothing -> ""
|
||||
|
|
|
@ -127,7 +127,7 @@ xreachable' follow filter initials mlen proxy = do
|
|||
, "FALSE"
|
||||
, " FROM ", dbname $ entityDB tNode
|
||||
, " WHERE ", entityDB tNode ^* fieldDB (entityId tNode)
|
||||
, " IN ?"
|
||||
, " = ANY(?)"
|
||||
, " UNION ALL "
|
||||
, case follow of
|
||||
FollowForward -> sqlStep fwd bwd
|
||||
|
@ -144,7 +144,7 @@ xreachable' follow filter initials mlen proxy = do
|
|||
, " WHERE NOT ", temp ^* tcycle
|
||||
, case mlen of
|
||||
Nothing -> ""
|
||||
Just _ -> " AND array_length(", temp ^* tpath, ", 1) <= ?"
|
||||
Just _ -> " AND array_length(" <> temp ^* tpath <> ", 1) <= ?"
|
||||
]
|
||||
toP = fmap toPersistValue
|
||||
toPL = PersistList . map toPersistValue
|
||||
|
|
|
@ -114,7 +114,7 @@ trrSelect proxy = do
|
|||
, "FALSE"
|
||||
, " FROM ", dbname $ entityDB tNode
|
||||
, " WHERE ", entityDB tNode ^* fieldDB (entityId tNode)
|
||||
, " IN ?"
|
||||
, " = ANY(?)"
|
||||
, " UNION ALL "
|
||||
, sqlStep fwd bwd
|
||||
, " )"
|
||||
|
@ -198,7 +198,7 @@ trrApply proxy = do
|
|||
, "FALSE"
|
||||
, " FROM ", dbname $ entityDB tNode
|
||||
, " WHERE ", entityDB tNode ^* fieldDB (entityId tNode)
|
||||
, " IN ?"
|
||||
, " = ANY(?)"
|
||||
, " UNION ALL "
|
||||
, sqlStep fwd bwd
|
||||
, " ) DELETE FROM ", dbname $ entityDB tEdge
|
||||
|
|
Loading…
Reference in a new issue