Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parts of RDB$DB_KEY of views may be inverted when using outer joins [CORE2075] #2510

Closed
firebird-automations opened this issue Sep 10, 2008 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @asfernandes

Is related to QA366

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

Commits: 78484df

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5 Beta 1 [ 10251 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA366 [ QA366 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

QA test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test => Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment