cancel
Showing results for 
Search instead for 
Did you mean: 

Select command with HAVING 0 IN (FIELD, 1) crashes engine

11-11-2014 5:39 AM
Chris26 Participant
3268 views 2 comments Go to solution
SAP Managed Tags
Subscribe

Not a real question here, just reporting a bug in version 16.0.0.2003.
When upgrading from version 11 to 16 I ran into a problem with a query that crashed the asa 16 engine. I managed to pinpoint the problem to a "having 0 in (field, 1)" construct.

Depending on how complex the query is you will either get an assertion failed error (106104) or it will crash the engine. The following queries will reproduce this behaviour:

SQL:

select max(count) as max_count, table_type  
  from sys.systable 
 group by table_type  
having 0 in (max_count, 1)


Error:

Could not execute statement.
Run time SQL error -- ERROR Assertion failed: 106104
(16.0.0.2003)
Field unexpected during compilation
SQLCODE=-300, ODBC 3 State="HY000"
Line 1, column 1

SQL:

select max(c.width) as max_width, t.table_type  
  from sys.systable as t  
       left outer join sys.syscolumn as c  
                    on c.table_id = t.table_id  
 group by t.table_type  
having 0 in (max_width, 1)


Error:

dbeng16 has encountered a serious error and needs to close

The workaround for this problem is simpel. Just replace the having clause with "0 = field or 0 = 1".

And in case you're wondering: the actual query we used looked like this "having 0 in (field, :param)" where we use the param value to optionally apply the having clause.

Accepted Solutions (1)

Accepted Solutions (1)

regdomaratzki
Product and Topic Expert
Product and Topic Expert

Thanks for the simple repro Christian. I've opened QTS 774060 to address the issue.

VolkerBarth
Contributor
0 Likes

FWIW, according to the CR note this has been fixed with 12.0.1.4197 and 16.0.0.2052.

Answers (0)