v.21.9New Feature

Allow Constant Expressions in Aggregate Function Parameters

Allow using constant expressions from with and select in aggregate function parameters. Close #10945. #27531 (abel-cheng).
Allow constant expressions defined in WITH and SELECT clauses to be used as parameters in aggregate functions.

Why it matters

This feature enables users to simplify queries by using constants defined earlier in the query within aggregate function parameters. It solves the limitation where aggregate functions could not accept constant expressions from WITH or SELECT clauses, enhancing query flexibility and readability.

How to use it

Define constant expressions in the WITH clause or as part of the SELECT list, and then use these constants directly as parameters inside aggregate functions within the same query.