Invalid error "not a valid GROUP BY expression" for prepared parameter with LOCAL column alias
Details
| Detail name | Value |
|---|---|
| Changelog Number | 31180 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 2026.1.0, Exasol 2025.2.1, Exasol 2025.1.10 |
| Fix Versions | Exasol 2025.1.15 |
| Resolution Date | 2026-08-13 |
Description
A prepared statement can incorrectly return the error “not a valid GROUP BY expression” when all of the following conditions are met:
- A select-list expression contains a prepared parameter.
- The expression is assigned a column alias.
- The GROUP BY clause refers to that alias with LOCAL.
Example
-- Expected: one row -- Observed: not a valid GROUP BY expression SELECT c + ? AS c FROM VALUES 1 t(c) GROUP BY LOCAL.c;
Workaround
Remove LOCAL by moving the aliased expression into a sub-query, then group by the resulting column:
SELECT c
FROM (
SELECT c + ? AS c
FROM VALUES 1 t(c)
)
GROUP BY c;
Fix
Prepared parameters are now correctly recognized when resolving LOCAL column aliases in GROUP BY clauses. The query succeeds and returns the expected result.