WITH-clause for SELECT INTO crashes

Details

Detail name Value
Changelog Number 8756
Type Bug
Status Resolved
Affected Versions Exasol 6.1.0, Exasol 6.2.0
Fix Versions Exasol 7.0.0, Exasol 6.2.3, Exasol 6.1.8, Exasol 7.0.0-alpha1
Resolution Date 2019-10-02

Description

A WITH-Clause usually can be used before a SELECT statement to define named subqueries valid for the complete context of the SELECT statement. However, for the statement SELECT INTO TABLE this does not work, it causes the process crash as shown by the error 'Successfully reconnected after internal server error, transaction was rolled back.'. The statement SELECT INTO TABLE is an alternative syntax for CREATE TABLE AS.

Example

-- crash if WITH is used before SELECT INTO TABLE
with v_source as (select * from t_source)
select * into table t_target from v_source;

-- if the WITH is put into a normal (sub)select, everything works
select * into table t_target from
(with v_source as (select * from t_source) select * from v_source);

Expected Behavior

Since this is valid behavior according to the SQL standard this query should just work. The feature will be implemented.

Workaround

The query works just fine if the WITH-clause is put from directly before SELECT INTO TABLE to a subselect with a normal select as shown in the example above.