Skip to content

Commit 36591fa

Browse files
committed
Fixed insert not being able to return a single column
1 parent c71961f commit 36591fa

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

Sources/Compiler/Sema/StmtTypeChecker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ extension StmtTypeChecker {
543543
return .empty
544544
}
545545

546-
usedTableNames.insert(table.name.name)
546+
importTable(table)
547547

548548
// If there is an error upstream that will cause unification to fail for sure
549549
// we can just skip it so the real error does not get hidden by all the other errors

Tests/CompilerTests/Compiler/CompileInsert.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,12 @@ INSERT INTO user (id, name) VALUES (?, ?)
158158
ON CONFLICT (id) DO UPDATE
159159
SET name = excluded.name
160160
WHERE excluded.name = 'bob';
161+
162+
-- CHECK: SIGNATURE
163+
-- CHECK: OUTPUT_CHUNKS
164+
-- CHECK: CHUNK
165+
-- CHECK: OUTPUT
166+
-- CHECK: id INTEGER
167+
-- CHECK: TABLES
168+
-- CHECK: user
169+
INSERT INTO user (name) VALUES ('joe') RETURNING id;

Tests/CompilerTests/CompilerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CompilerTests: XCTestCase {
1919
}
2020

2121
func testInsert() throws {
22-
try checkQueries(compile: "CompileInsert")
22+
try checkQueries(compile: "CompileInsert", dump: true)
2323
}
2424

2525
func testUpdate() throws {

0 commit comments

Comments
 (0)