USING in subselect in combination with LOCAL leads to an internal server error

Details

Detail name Value
Changelog Number 4681
Type Bug
Status Open
Affected Versions EXASOL 6.0.x, EXASOL 6.0.1, Exasol 6.2.0, Exasol 7.0.0, Exasol 7.1.0, Exasol 8.0.0, Exasol 8.29.0, Exasol 2025.1.0, Exasol 2025.2.0

If a query contains a subselect with several USING clauses and the surrounding SELECT contains LOCAL the execution aborts with an internal server error.

Reproducibility:

CREATE SCHEMA TEST;
CREATE OR REPLACE TABLE t1 (c INT);
SELECT (
  SELECT sum(1)
  FROM t1
  JOIN t1 USING(c)
  JOIN t1 USING(c)
) AS c1
FROM t1
HAVING local.c1 = 1;

Workaround:
Use inner joins instead of using. For example:

SELECT (
  SELECT sum(1)
  FROM t1 as x
  JOIN t1 as y on x.c = y.c
  JOIN t1 as z on y.c = z.c
) AS c1
FROM t1
HAVING local.c1 = 1;