SAP Knowledge Base Article - Preview

2292265 - In SAP IQ all versions, incorrect result of a query with LEFT OUTER JOIN and constant value is returned

Symptom

User Query will use the LEFT OUTER JOIN and the constant value.
In this case, returns the result of SAP IQ is unexpected.
This problem was confirmed to be reproduced in all later versions of Sybase IQ 12.4.3.

Query1: Query should be NULL as val2, but val2 is returned as '2'
--------------------------------------------------------------
(DBA)> select main.val1,sub.val2 from (select 1 as val1 from iq_dummy where 0=0) main left outer join ( select 2 as val2 from iq_dummy where 1=0 ) sub on 0=0;
  val1   val2
-------------
     1      2 <---- Correct Value is NULL

(1 rows)


Query2: Query should return one row, but it returns no row.
--------------------------------------------------------------
(DBA)> select main.val1,sub.val2 from (select 1 as val1 from iq_dummy where 0=0) main left outer join ( select 2 as val2 from iq_dummy where 1=0 group by val2) sub on 0=0;
  val1   val2
-------------

(0 rows)     <---- Correct Value is 1 row


This problem will reproduce when using the IQ engine.
For example, when you use a dummy table, the problem does not reproduce.


Using dummy table(use a SQLA engine)
--------------------------------------------------------------
(DBA)> select main.val1,sub.val2 from (select 1 as val1 from dummy where 0=0) main left outer join ( select 2 as val2 from dummy where 1=0 ) sub on 0=0;
  val1   val2
-------------
     1 (NULL)

(1 rows)

Execution time: 0.004 seconds
(DBA)> select main.val1,sub.val2 from (select 1 as val1 from dummy where 0=0) main left outer join ( select 2 as val2 from dummy where 1=0 group by val2) sub on 0=0;
  val1   val2
-------------
     1 (NULL)

(1 rows)


Read more...

Environment

  • Sybase IQ 12.7
  • SAP IQ 15.x or later
  • SAP IQ 16.0

Product

SAP IQ 16.0 ; SAP Sybase IQ 15.2 ; SAP Sybase IQ 15.4 ; Sybase IQ 12.7

Keywords

KBA , BC-SYB-IQ , Sybase IQ , Bug Filed

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP ONE Support launchpad (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.