You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delete marker => Only use on within JOINS instead of appending to the global WHERE. This ensures we dont transform the LEFT into an INNER and the full query can run.
Copy file name to clipboardExpand all lines: tests/legacy_convert/test_legacy_with_softdelete2.nim
+3-6
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ suite "legacy - sqlSelect(converter) - with new functionality to avoid regressio
30
30
31
31
test"existing delete in left join (double) - delete marker from left join":
32
32
33
-
let test =sqlSelect("tasks AS t", ["t.id", "t.name", "p.id"], ["invoice AS p ON p.id = t.invoice_id", "persons ON persons.id = tasks.person_id AND persons.is_deleted IS NULL"], ["t.id ="], "2,4,6,7", "p.id", "ORDER BY t.name")
33
+
let test =sqlSelect("tasks AS t", ["t.id", "t.name", "p.id"], ["invoice AS p ON p.id = t.invoice_id", "persons ON persons.id = tasks.person_id"], ["t.id ="], "2,4,6,7", "p.id", "ORDER BY t.name")
34
34
35
35
checkquerycompare(test, sql("""
36
36
SELECT
@@ -47,7 +47,6 @@ suite "legacy - sqlSelect(converter) - with new functionality to avoid regressio
47
47
t.id = ?
48
48
AND p.id in (2,4,6,7)
49
49
AND t.is_deleted IS NULL
50
-
AND persons.is_deleted IS NULL
51
50
ORDER BY
52
51
t.name
53
52
"""))
@@ -67,12 +66,11 @@ suite "legacy - sqlSelect(converter) - with new functionality to avoid regressio
67
66
LEFT JOIN invoice AS p ON
68
67
(p.id = t.invoice_id)
69
68
LEFT JOIN persons ON
70
-
(persons.id = tasks.person_id)
69
+
(persons.id = tasks.person_id AND persons.is_deleted IS NULL)
71
70
WHERE
72
71
t.id = ?
73
72
AND p.id in (2,4,6,7)
74
73
AND t.is_deleted IS NULL
75
-
AND persons.is_deleted IS NULL
76
74
ORDER BY
77
75
t.name
78
76
"""))
@@ -90,12 +88,11 @@ suite "legacy - sqlSelect(converter) - with new functionality to avoid regressio
90
88
FROM
91
89
tasks
92
90
LEFT JOIN persons ON
93
-
(persons.id = t.persons_id)
91
+
(persons.id = t.persons_id AND persons.is_deleted IS NULL)
0 commit comments