Internal server error for some queries combining UNION ALL, EXISTS, and outer joins

Details

Detail name Value
Changelog Number 30001
Type Bug
Status Resolved
Affected Versions Exasol 2025.1.3, Exasol 2025.2.0, Exasol 2026.1.0
Fix Versions Exasol 2025.1.13
Resolution Date 2026-07-15

Description

In some cases an internal server error happens when following conditions are met:

  • There are multiple instances of a view v.
  • There is a correlated EXISTS subselect referencing this view v.
  • DB is running on several nodes.

Example

-- Preparation
CREATE TABLE t1(s varchar(128));
INSERT INTO t1 VALUES 'a', 'a', 'a', 'a';
CREATE TABLE t2(s varchar(128));
INSERT INTO t2 VALUES 'a', 'a';

CREATE VIEW v_t2 AS ( SELECT * FROM t2 ORDER BY FALSE);
CREATE VIEW v_join AS
        (   SELECT
                NULL AS dummy
            FROM
                t1
            CROSS JOIN
                v_t2
        );
CREATE VIEW v_exists AS
        (   SELECT
                NULL AS dummy
            FROM
                t1
            WHERE
                EXISTS (
                        SELECT
                            1
                        FROM
                            v_t2 t2
                        WHERE
                            t2.s = t1.s
                       )
        );

-- Observed: Internal server error. Please report this. Transaction has been rolled back. 
-- Expected: query runs without errors.
SELECT * FROM 
   v_join
     LEFT JOIN
   v_exists
     ON TRUE
    cross join
  (v_exists
     LEFT JOIN
   v_join
     ON TRUE)
;

Workaround

Materialize in a temporary table the subselect or, as in this example, the view containing the correlated exists:

CREATE TABLE tmp_mat_t AS SELECT * FROM v_exists;

-- Works as expected.
SELECT * FROM 
   v_join
     LEFT JOIN
   tmp_mat_t
     ON TRUE
    cross join
  (tmp_mat_t
     LEFT JOIN
   v_join
     ON TRUE)
;

Fix

Query runs as expected.