LIKE expressions do not match constant strings in subselects
Details
| Detail name | Value |
|---|---|
| Changelog Number | 7306 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 6.1.0 |
| Fix Versions | Exasol 6.1.1 |
| Resolution Date | 2019-01-07 |
How to reproduce
Given this table
create or replace table t(a varchar(100)); insert into t values 'Test123';
This query gives NULL instead of true:
SELECT A LIKE 'Test123' as should_be_true, A FROM (select 'Test123' as a from t group by a);
while this query works:
SELECT A LIKE 'Test123' as should_be_true, A FROM (select a from t group by a);
Workaround
Add a cast to VARCHAR for the constant expression in the sub-select:
SELECT A LIKE 'Test123' as should_be_true, A FROM
(select cast('Test123' as varchar(100)) as a from t group by a);