From 53aaa4b69a4f6c48b8f2672b649c31d308644a79 Mon Sep 17 00:00:00 2001 From: CharlesKWON Date: Fri, 17 Apr 2026 06:20:45 +0900 Subject: [PATCH] perf: qualify hidden aggregate columns for JOIN FetchRow cache Co-Authored-By: Claude Opus 4.6 (1M context) --- _FiveSql2/src/TSqlExecutor.prg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_FiveSql2/src/TSqlExecutor.prg b/_FiveSql2/src/TSqlExecutor.prg index b5c486f..1d1483b 100644 --- a/_FiveSql2/src/TSqlExecutor.prg +++ b/_FiveSql2/src/TSqlExecutor.prg @@ -1297,7 +1297,11 @@ METHOD RunSelect() CLASS TSqlExecutor IF aCols[ i ][ 1 ][ 1 ] == ND_FN .AND. Len( aCols[ i ][ 1 ][ 3 ] ) > 0 xArgExpr := aCols[ i ][ 1 ][ 3 ][ 1 ] IF xArgExpr[ 1 ] == ND_COL .AND. xArgExpr[ 2 ] != "*" - cBare := SqlExprName( xArgExpr ) + /* Use the FULL qualified name (e.g. "o.amount") so + * FetchRow → FindWA resolves to the right workarea + * in JOIN contexts. Bare "amount" would fall through + * to aTables[1] which may be a different table. */ + cBare := xArgExpr[ 2 ] lFound := .F. FOR j := 1 TO Len( aResultExprs ) IF Upper( aResultExprs[ j ][ 2 ] ) == Upper( cBare )