fix(executor): handle subqueries in comparisons and per-row UPDATE expressions
- Add missing nkSubquery case in lowerExpr so scalar subqueries (e.g. budget > (SELECT AVG(budget) FROM projects)) are lowered correctly instead of being treated as NULL literals. - Move UPDATE SET expression evaluation inside the row loop so column references (e.g. salary + 5000) are resolved against the current row, fixing type validation failures. - Make irAdd/irSub/irMul/irDiv return integer strings when the result is a whole number, avoiding spurious float output for INT columns (e.g. MERGE UPDATE qty = 100 + 50 now yields 150). These fix regressions introduced by switching NULL representation from empty string to \N, which exposed the pre-existing bugs above. Refs: issue #9, issue #10
This commit is contained in:
+1
-1
@@ -2997,7 +2997,7 @@ suite "MERGE Statement":
|
||||
check r.success
|
||||
check r.affectedRows == 1
|
||||
let verify = qexec.executeQuery(ctx, parse("SELECT * FROM inventory WHERE sku = 'SKU001'"))
|
||||
check verify.rows[0]["qty"] == "150.0"
|
||||
check verify.rows[0]["qty"] == "150"
|
||||
|
||||
test "MERGE WHEN NOT MATCHED INSERT":
|
||||
let r = qexec.executeQuery(ctx, parse("""
|
||||
|
||||
Reference in New Issue
Block a user