in reply to DBI:CSV SQL parsing problem

The syntax that DBD::CSV supports is documented in SQL::Statement::Syntax. It clearly states that the supported argument for set functions is a column name, not a numeric expression:
set function ::= COUNT ( [DISTINCT|ALL] * ) | COUNT | MIN | MAX | AVG | SUM ( [DISTINCT|ALL] col_name )
So the short answer is, no, sorry, you can't currently do that like that in DBD::CSV. Depending on what you want to do, you may be able to build your own UDF (User-Defined-Function) to use here. See SQL::Statement::Function for details of building UDFs.