MERGE with faulty ON clause crashes instead of returning proper error message
Details
| Detail name | Value |
|---|---|
| Changelog Number | 7062 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 6.1.0, EXASolution 5.0.22, Exasol 6.0.12 |
| Fix Versions | Exasol 7.0.0 |
| Resolution Date | 2020-09-11 |
Problem
Within a MERGE statement, when the ON condition contains an expression that is not a predicate, the query crashes instead of returning a proper error message.
In this case, the usual error
40005: Successfully reconnected after internal server error, transaction was rolled back.
is returned.
Example
create table dst(a int, b int);
create table src(a int, b int);
insert into src values (1,1);
insert into dst values (1,1);
merge into dst
using src
on dst.a = src.a
and dst.b --<-- problem
when matched then update
set dst.b=src.b+1;
Workaround / Fix
Rewriting the problematic condition into a predicate (boolean expression) fixes the problem:
merge into dst
using src
on dst.a = src.a
and dst.b > 0 --> fixed it
when matched then update
set dst.b=src.b+1;