Issue Details (XML | Word | Printable)

Key: CORE-2075
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Adriano dos Santos Fernandes
Votes: 0
Watchers: 0
Operations

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

Parts of RDB$DB_KEY of views may be inverted when using outer joins

Created: 10/Sep/08 11:00 AM   Updated: 27/Apr/11 10:45 AM
Component/s: Engine
Affects Version/s: 2.1.0, 2.5 Alpha 1, 2.1.1
Fix Version/s: 2.5 Beta 1

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
RDB$DB_KEY of view is concatenation of dbkey of tables used.

Since v2.1, when using outer joins, parts of streams in invalid position are concatenated as empty string to not make whole view dbkey null.
To fix it, invalid dbkeys should be changed to eight zeros, instead of empty string (that caused zeros to be concatenated always in the right).

Test case:

create table t1 (n integer);
create table t2 (n integer);

insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
insert into t1 values (4);
insert into t1 values (5);
insert into t1 values (6);

insert into t2 values (2);
insert into t2 values (4);
insert into t2 values (5);
insert into t2 values (8);

create view v (t1, t2) as
  select t1.rdb$db_key, t2.rdb$db_key
    from t1
    full join t2
      on t2.n = t1.n;

select v.rdb$db_key, v.*
  from v;

Incorrect:
DB_KEY T1 T2
================================ ================ ================
81000000010000008000000002000000 8000000002000000 8100000001000000
81000000020000008000000004000000 8000000004000000 8100000002000000
81000000030000008000000005000000 8000000005000000 8100000003000000
81000000040000000000000000000000 <null> 8100000004000000
80000000010000000000000000000000 8000000001000000 <null> <-- zeros in the right
80000000030000000000000000000000 8000000003000000 <null> <-- zeros in the right
80000000060000000000000000000000 8000000006000000 <null> <-- zeros in the right

Correct:
DB_KEY T1 T2
================================ ================ ================
81000000010000008000000002000000 8000000002000000 8100000001000000
81000000020000008000000004000000 8000000004000000 8100000002000000
81000000030000008000000005000000 8000000005000000 8100000003000000
81000000040000000000000000000000 <null> 8100000004000000
00000000000000008000000001000000 8000000001000000 <null> <-- zeros in the left
00000000000000008000000003000000 8000000003000000 <null> <-- zeros in the left
00000000000000008000000006000000 8000000006000000 <null> <-- zeros in the left

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Pavel Cisar added a comment - 27/Apr/11 10:45 AM
QA test added.