Scalar subselects that contain both a SELECT list and a PARTITION BY throw Internal Server Error

Details

Detail name Value
Changelog Number 27097
Type Bug
Status Resolved
Affected Versions Exasol 8.32.0, Exasol 2025.1.0
Fix Versions Exasol 2026.1.0, Exasol 2025.1.11
Resolution Date 2026-05-15

Description

Execution of an analytic function may fail during evaluation of the PARTITION BY clause due to an invalid column reference. This occurs under the following conditions:

  • The column is defined using a scalar subselect.
  • The same scalar subselect is used both in the SELECT list and in the PARTITION BY clause.
  • The query includes an analytic function (e.g., ROW_NUMBER).

In such cases, query execution may fail with an internal server error.

Example

CREATE VIEW v1 AS
(
  SELECT (SELECT 1 FROM dual) AS x
);
-- Expected: 1 row (1, 1)
-- Observed: Internal server error
SELECT
  v1.x,
  ROW_NUMBER() OVER (PARTITION BY v1.x)
FROM v1;

Workaround

Materialize the scalar subselect in the compiler to avoid reuse of the same expression:

CREATE VIEW v1 AS
(
  SELECT (SELECT 1 FROM dual) AS x ORDER BY FALSE
);

-- Observed: 1 row (1, 1)
SELECT
  v1.x,
  ROW_NUMBER() OVER (PARTITION BY v1.x)
FROM v1;

Fix

The query now executes as intended.