You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
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
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
The text was updated successfully, but these errors were encountered: