fix(executor): include arguments in aggregate column names
Issue #6: getSelectColumns() produced count() for count(*) and max() for max(id). Now uses exprToSql() on funcArgs to generate consistent names matching the actual SQL expression. Before: columns: @[count()], rows: @[{count(*): 2}] After: columns: @[count(*)], rows: @[{count(*): 2}]
This commit is contained in:
@@ -2678,7 +2678,10 @@ proc getSelectColumns(stmt: Node): seq[string] =
|
|||||||
elif e.kind == nkPath and e.pathParts.len > 0:
|
elif e.kind == nkPath and e.pathParts.len > 0:
|
||||||
result.add(e.pathParts[^1])
|
result.add(e.pathParts[^1])
|
||||||
elif e.kind == nkFuncCall:
|
elif e.kind == nkFuncCall:
|
||||||
result.add(e.funcName & "()")
|
var aliasArgs: seq[string] = @[]
|
||||||
|
for arg in e.funcArgs:
|
||||||
|
aliasArgs.add(exprToSql(arg))
|
||||||
|
result.add(e.funcName & "(" & aliasArgs.join(", ") & ")")
|
||||||
elif e.kind == nkStar:
|
elif e.kind == nkStar:
|
||||||
result.add("*")
|
result.add("*")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user