fix: irNeg (unary minus) evaluation in query executor

- Added missing irNeg case in evalExpr (query/executor.nim)
- Unary minus previously fell through to else: return 'false'
- Added 2 tests: SELECT expression and WHERE condition
This commit is contained in:
2026-05-13 14:23:28 +03:00
parent 42c675224c
commit 6665ee7e0a
2 changed files with 21 additions and 0 deletions
+12
View File
@@ -2564,6 +2564,18 @@ suite "Parameterized queries":
check r.success
check r.rows.len >= 2
test "Unary minus in SELECT expression":
let r = qexec.executeQuery(ctx, parse("SELECT -age AS neg_age FROM users WHERE id = 1"))
check r.success
check r.rows.len == 1
check r.rows[0]["neg_age"] == "-30"
test "Unary minus in WHERE condition":
let r = qexec.executeQuery(ctx, parse("SELECT name FROM users WHERE id = 2 AND -age = -25"))
check r.success
check r.rows.len == 1
check r.rows[0]["name"] == "Bob"
# JOIN tests
include "join_tests"