Crash or wrong results with table operator with LIMIT where first operand has a LIMIT clause
Details
| Detail name | Value |
|---|---|
| Changelog Number | 27499 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 7.1.0, Exasol 8.0.0, Exasol 8.29.0, Exasol 2025.1.0, Exasol 2025.2.0 |
| Fix Versions | Exasol 2026.1.0, Exasol 2025.2.1 |
| Resolution Date | 2026-03-20 |
Description
If a table operator such as UNION or EXCEPT has a LIMIT clause and its first operand is not a query expression (i.e. is not "SELECT ..."), then the database can crash or give wrong results.
Example
-- Setup create table A (A1 int); insert into A values (5), (6); -- Expected: 3 rows -- Observed: internal server error values between 1 and 5 union select * from A limit 3; -- Expected: 3 rows -- Observed: internal server error (explain query graph select 1) union all select null, null, null, null, null, null, null, null, null, null limit 1; -- Expected: 3 rows -- Observed: 5 rows values between 1 and 5 except select * from B limit 3;
Workaround
Wrapping the first operand of the UNION or EXCEPT in a SELECT fixes the problem.
select * from (values between 1 and 5) union all select * from B limit 3; select * from (explain query graph select 1) union all select null, null, null, null, null, null, null, null, null, null limit 1; select * from (values between 1 and 5) except select * from B limit 3;
Fix
Query doesn’t crash in these scenarios and gives the correct answer.