Commit 65c21985 authored by Tobias Zeuch's avatar Tobias Zeuch
Browse files

Fix illegal reference in join condition on Exists-subquery



Bug 1571421: In the exists-subquery the join-condition contains a reference to an outer table alias, which is not supported in MySql (though it seems to work in Postgres). This leads to a "site unavailable" e.g. when searching on the "shared with me" page.
The solution is to move the condition into the WHERE-part. This might actually improve performance because it allows the database engine to precalculate the join one single time and reuse it for each Exists-subquery

behatnotneeded

Change-Id: I5097154d939bf7ddba01d5845af7e8cbb42681b8
Signed-off-by: default avatarTobias Zeuch <tobias.zeuch@rwth-aachen.de>
parent 62645f0a
......@@ -4103,7 +4103,6 @@ class View {
{view} v2
INNER JOIN {collection_view} cv2
ON v2.id=cv2.view
AND cv2.collection = cv.collection
INNER JOIN {collection} c2
ON c2.id = cv2.collection
LEFT OUTER JOIN {view_tag} vt
......@@ -4111,12 +4110,15 @@ class View {
LEFT OUTER JOIN {collection_tag} ct
ON (ct.collection = cv2.collection AND ct.tag = ?)
WHERE
v2.title $like '%' || ? || '%'
OR v2.description $like '%' || ? || '%'
OR c2.name $like '%' || ? || '%'
OR c2.description $like '%' || ? || '%'
OR vt.tag = ?
OR ct.tag = ?
cv2.collection = cv.collection
AND (
v2.title $like '%' || ? || '%'
OR v2.description $like '%' || ? || '%'
OR c2.name $like '%' || ? || '%'
OR c2.description $like '%' || ? || '%'
OR vt.tag = ?
OR ct.tag = ?
)
)";
array_push(
$whereparams,
......
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