Crash with window function with partition or order on NULL-sensitive expression from outer join
Details
| Detail name | Value |
|---|---|
| Changelog Number | 32909 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 2026.1.1, Exasol 2025.1.13 |
| Fix Versions | Exasol 2025.1.17 |
| Resolution Date | 2026-11-12 |
Description
In rare cases, queries with the following structure can crash:
- The query contains an outer join.
- The outer join has a derived table or view on a NULL-generating side.
- The derived table or view projects an expression that needs special NULL handling when the join finds no match. For example,
IS NULLor a scalar subquery (especially if it is correlated). - The query contains window functions.
- A window function uses that expression in `PARTITION BY` or `ORDER BY`.
Examples
-- Q1
-- Expected: 1 row, values (true, 1, 1)
-- Observed: Error "Successfully reconnected after internal server error, transaction was rolled back."
select S.X,
S.RN,
row_number() over (partition by S.X)
from values (1) as A(A1)
left join (
select Q.B1,
Q.B2 is null as X,
Q.RN
from (
select B.B1,
B.B2,
row_number() over (order by B.B1) as RN
from values (1, cast(null as int)) as B(B1, B2)
) as Q
) as S
on A.A1 = S.B1;-- Setup
create or replace table A (A1 int);
create or replace table B (B1 int, B2 int);
insert into B values (1, 2);
create or replace view V2 as
with W1 as (select B2, sum(B1) over () as SB1 from B)
select B2,
(select coalesce(LOCALREF.B2, 3)
from W1 as LOCALREF
where LOCALREF.SB1 = W1.SB1 + 1) as SUBQCOL,
row_number() over (order by local.SUBQCOL) as RN
from W1;
create view V1 as select B2 from V2 where RN = 1;
-- Q2
-- Expected: Success
-- Observed: Error "Successfully reconnected after internal server error, transaction was rolled back."
select 1 from A left join V1 Y on true left join V1 X on true;
Workaround
Add order by false in an affected subquery:
-- Workaround for Q1
-- Expected/Observed: 1 row, values (true, 1, 1)
select S.X,
S.RN,
row_number() over (partition by S.X)
from values (1) as A(A1)
left join (
select Q.B1,
Q.B2 is null as X,
Q.RN
from (
select B.B1,
B.B2,
row_number() over (order by B.B1) as RN
from values (1, cast(null as int)) as B(B1, B2)
order by false -- Add ORDER BY FALSE here
) as Q
) as S
on A.A1 = S.B1;
-- Workaround for Q2
create or replace view V2 as
with W1 as (select B2, sum(B1) over () as SB1 from B
order by false) -- Add ORDER BY FALSE here
select B2,
(select coalesce(LOCALREF.B2, 3)
from W1 as LOCALREF
where LOCALREF.SB1 = W1.SB1 + 1) as SUBQCOL,
row_number() over (order by local.SUBQCOL) as RN
from W1;
-- Expected/Observed: Success
select 1 from A left join V1 Y on true left join V1 X on true;
Fix
The query behaves as expected.