UNIQUE from Group By Key Reduction in IF/ENDIF causes internal server error

Details

Detail name Value
Changelog Number 30917
Type Bug
Status Resolved
Affected Versions Exasol 2026.1.0, Exasol 2025.1.11
Fix Versions Exasol 2026.1.1, Exasol 2025.1.13
Resolution Date 2026-07-15

Description

A valid query with GROUP BY and an IF/ENDIF operator, which the Group By Key Reduction optimization transforms, can cause an internal server error.

-- Setup
CREATE OR REPLACE TABLE t1 ( c1 INT );
CREATE OR REPLACE TABLE t2 ( c1 INT, c2 VARCHAR(10));
ENFORCE GLOBAL INDEX ON t2( c1 );
ENFORCE GLOBAL INDEX ON t2( c2 );

-- Expected: Success
-- Observed: Error "Successfully reconnected after internal server error, transaction was rolled back"
SELECT IF t1.c1 THEN 1 ENDIF AS c
FROM t1 JOIN t2 ON t1.c1 = t2.c1
GROUP BY local.c, t2.c2;

Workaround

  1. Use CASE instead of IF/ENDIF.
  2. Reduce or disable Group By Key Reduction using the DB parameter to -groupByKeyReductionLevel=2, -groupByKeyReductionLevel=1 or -groupByKeyReductionLevel=0 (see Add database parameters).
-- Expected/Observed: Success
SELECT case when t1.c1 THEN 1 END AS c
FROM t1 JOIN t2 ON t1.c1 = t2.c1
GROUP BY local.c, t2.c2;

Fix

The query succeeds as expected.