Query may fail due to constant folding and propagation
Details
| Detail name | Value |
|---|---|
| Changelog Number | 12463 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 6.2.0, Exasol 7.0.0, Exasol 7.1.0 |
| Fix Versions | Exasol 6.2.16, Exasol 7.0.11 |
| Resolution Date | 2021-07-15 |
Background
In very rare cases, the constant folding and propagation algorithm in Exasol can lead to access of invalid memory. This invalid memory access can either cause an internal server error or an incorrect data exception.
Description
Only if the constant folding algorithm affects a query in a certain way this issue can occur. Thus, it is not possible to provide a list with all scenarios. Currently, this is the only known scenario:
- Use of LAG/LEAD in a common table expression.
- Use of a constant as argument of LAG/LEAD (e.g., CURRENT_TIMESTAMP).
Preparation:
CREATE OR REPLACE TABLE T1 ("MEASURE_TIME" TIMESTAMP);
Example
WITH
utimes AS
( SELECT
LEAD(measure_time, 1, CURRENT_TIMESTAMP) over (ORDER BY measure_time) AS shutdown_time FROM T1
)
SELECT * FROM utimes;
Workaround
This depends on the query and is difficult to do as it is necessary to influence the constant folding algorithm. Please contact our support if this issue occurs.
For the above scenario, a cast is sufficient:
WITH
utimes AS
( SELECT
LEAD(measure_time, 1, CAST(CURRENT_TIMESTAMP AS TIMESTAMP)) over (ORDER BY measure_time) AS shutdown_time FROM T1
)
SELECT * FROM utimes;
Fix
The affected queries work without error.