-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes 5032 column adjacency for PostgreSql UPDATE FROM statement (#5035)
* Fixes column adjacency for Update statement Same fix for Sqlite * Add Integration tests * fix from spotless whitespace --------- Co-authored-by: Alec Kazakova <1675456+AlecKazakova@users.noreply.github.com>
- Loading branch information
1 parent
aa41c0b
commit b5d9d3f
Showing
4 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...tion-postgresql/src/main/sqldelight/app/cash/sqldelight/postgresql/integration/Updates.sq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE test( | ||
id SERIAL PRIMARY KEY, | ||
id2 INTEGER | ||
); | ||
|
||
CREATE TABLE test2( | ||
id2 SERIAL PRIMARY KEY, | ||
other TEXT | ||
); | ||
|
||
insertTest: | ||
INSERT INTO test (id2) VALUES(?); | ||
|
||
insertTest2: | ||
INSERT INTO test2 (other) VALUES(?); | ||
|
||
updateTestId: | ||
UPDATE test | ||
SET id = t2.id2 | ||
FROM ( | ||
SELECT | ||
id2 | ||
FROM test2 | ||
) AS t2 RETURNING test.id; | ||
|
||
updateTestId2: | ||
UPDATE test | ||
SET id2 = t2.id2 | ||
FROM test2 t2 | ||
WHERE other = ? RETURNING test.id2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters