Internal Server Error for UNION in Prepared Statement

Details

Detail name Value
Changelog Number 8316
Type Bug
Status Resolved
Affected Versions EXASOL 6.0.0, Exasol 6.1.0, Exasol 6.2.0, Exasol 7.0.0
Fix Versions Exasol 7.0.3, Exasol 6.2.11
Resolution Date 2020-10-01

Problem Description

Executing a prepared SELECT statement containing UNION causes an internal server error if the statement fulfills all of the following conditions:

  1. The outermost SELECT is not preceded by a WITH clause.
  2. The FROM clause contains a WITH clause.
  3. The WITH clause contains a UNION.
  4. There is a prepared statement parameter in the subqueries combined by the UNION.

Example

SELECT * FROM -- (1)
(
    WITH -- (2)
        v AS
        (
            SELECT * FROM dual WHERE dummy = ? -- (4)
            UNION -- (3)
            SELECT * FROM dual
        )
    SELECT * FROM v
);

Workaround

Rephrase the statement so that it doesn't fulfill all of the four conditions listed above. E.g. add this line in front of the statement:

WITH workaround AS (SELECT 0 workaround)