Issue Details (XML | Word | Printable)

Key: CORE-3090
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Smirnoff Serg
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Incorrect LEFT JOIN result using table and derived constant subquery

Created: 30/Jul/10 09:27 AM   Updated: 20/Jun/11 08:34 AM
Component/s: Engine
Affects Version/s: 2.5 RC2
Fix Version/s: 2.5.0, 3.0 Alpha 1

Time Tracking:
Not Specified

Issue Links:
Relate

Planning Status: Unspecified


 Description  « Hide
Test case:

recreate table test_err (id int);
insert into test_err (ID) values (1);
insert into test_err (ID) values (2);

select *
  from test_err t
       left join (select 1 id from rdb$database) a on a.id = t.id;

Result must be
          ID ID
============ ============
           1 1
           2 <null>

But, result is
          ID ID
============ ============
           1 <null>
           2 <null>

However, the second LEFT JOIN works fine
select *
  from test_err t
       left join (select 1 id from rdb$database) a on a.id = t.id
       left join (select 2 id from rdb$database) b on b.id = t.id;

          ID ID ID
============ ============ ============
           1 <null> <null>
           2 <null> 2

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Thomas Beckmann added a comment - 06/Aug/10 08:45 AM
This might be due to the same reason:

"select
  RESULT
from (select
    'Well' as RESULT
  from (select
      'Works' as D
    from RDB$DATABASE d) i
  left join RDB$DATABASE on 1=0) j
left join RDB$DATABASE on 1=0"

returns 'well' - which is fine with me.

But

"select
  RESULT
from (select
    'Well' as RESULT
  from (select
      (select 'Does not work' from RDB$DATABASE) as D
    from RDB$DATABASE d) i
  left join RDB$DATABASE on 1=0) j
left join RDB$DATABASE on 1=0"

returns nothing - which I am pretty sure, is a bug...

Adriano dos Santos Fernandes added a comment - 07/Aug/10 02:10 AM
Please test the next 2.5 snapshot build.