Joins with import statements and constant WHERE FALSE condition might not terminate

Details

Detail name Value
Changelog Number 4926
Type Bug
Status Resolved
Affected Versions EXASolution 5.0.20, EXASOL 6.0.2
Fix Versions Exasol 6.2.13, Exasol 7.0.7
Resolution Date 2021-02-12

Queries that use joins and IMPORT statements and that contain the condition WHERE FALSE (or constant expressions that can be simplified to FALSE, e.g., TRUE AND FALSE) might not terminate. For instance, the query

CREATE SCHEMA TEST;

CREATE OR REPLACE CONNECTION MY_CONNECTION 
       TO 'jdbc:exa:localhost:[port]' 
       USER 'sys' 
       IDENTIFIED BY [password];

SELECT *
  FROM (IMPORT FROM JDBC AT MY_CONNECTION STATEMENT 'SELECT 2 FROM DUAL')
  INNER JOIN DUAL ON TRUE
WHERE FALSE;

does not terminate.

As a workaround, the WHERE condition can be applied to the join with the help of a subselect, i.e., the query from the example can be rewritten as

SELECT * FROM 
  (
	SELECT *
	FROM (IMPORT FROM JDBC AT MY_CONNECTION STATEMENT 'SELECT 2 FROM DUAL')
		INNER JOIN DUAL	ON TRUE
  )
WHERE FALSE;