Skip to content

Commit 1f17adc

Browse files
authored
Ensure multiple null tables all get their values in the exposed query (#676)
1 parent fcc8da0 commit 1f17adc

File tree

2 files changed

+12
-1
lines changed
  • core/src
    • main/kotlin/com/alecstrong/sql/psi/core/psi/mixins
    • testFixtures/resources/fixtures/multiple-inner-joins

2 files changed

+12
-1
lines changed

core/src/main/kotlin/com/alecstrong/sql/psi/core/psi/mixins/JoinClauseMixin.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ internal abstract class JoinClauseMixin(
7575
rightColumns = rightColumns.map { it.copy(nullable = true) }
7676
rightSynthesizedColumns = rightSynthesizedColumns.map { it.copy(nullable = true) }
7777

78+
queryAvailable -= rightQuery
7879
queryAvailable += QueryResult(
7980
table = rightQuery.first().table,
8081
columns = rightColumns,
@@ -103,7 +104,7 @@ internal abstract class JoinClauseMixin(
103104
)
104105
}
105106

106-
return@ModifiableFileLazy queryAvailable.associateBy { it.table }.values
107+
return@ModifiableFileLazy queryAvailable
107108
}
108109

109110
private fun leftJoinOperator(operator: SqlJoinOperator): Boolean {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATE TABLE testTable(
2+
testColumn INTEGER
3+
);
4+
5+
SELECT test_column IS NOT NULL
6+
FROM (
7+
SELECT testColumn AS test_column
8+
FROM testTable
9+
)
10+
LEFT JOIN (SELECT 1);

0 commit comments

Comments
 (0)