Skip to content

Commit

Permalink
Fixes column adjacency for Update statement
Browse files Browse the repository at this point in the history
Same fix for Sqlite
  • Loading branch information
griffio committed Mar 20, 2024
1 parent be82f84 commit 51f9fbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ internal abstract class UpdateStmtLimitedMixin(
FromQuery {
override fun queryAvailable(child: PsiElement): Collection<QueryElement.QueryResult> {
if (child != joinClause && joinClause != null) {
return super.queryAvailable(child) + joinClause!!.queryExposed()
return super.queryAvailable(child) +
joinClause!!.queryExposed().map { it.copy(adjacent = true) }
}

return super.queryAvailable(child)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
CREATE TABLE test(
id SERIAL PRIMARY KEY
id SERIAL PRIMARY KEY,
id2 INTEGER
);

CREATE TABLE test2(
id2 SERIAL PRIMARY KEY
id2 SERIAL PRIMARY KEY,
other TEXT
);

UPDATE test
Expand Down Expand Up @@ -40,4 +42,8 @@ FROM (
ON otherTest.id = test2.id2
);

UPDATE test
SET id2 = t2.id2
FROM test2 t2
WHERE other = 'x';

0 comments on commit 51f9fbd

Please sign in to comment.