Hello,
I found following bug, using SQLite version 3.27.2 on windows...
Using field from left joined table in ifnull when first row contains null
value causes in following rows value to be empty string instead of correct
value...
To reproduce:
create table test (a text);
insert into test values(null);
insert into test values('test');
create table test2 (b text);
select a, test2.b, ifnull(test2.b,test.a) from test left join test2 on (1=
0) order by a desc;
returns:
"test",null,"test"
null,null,null
It is OK...
select a, test2.b, ifnull(test2.b,test.a) from test left join test2 on (1=
0) order by a;
returns:
null,null,null
"test",null,""
It is wrong, should return:
null,null,null
"test",null,"test"
It also happens when ifnull(test2.b,test.a) is replaced by
COALESCE(test2.b,test.a)
or
CASE WHEN test2.b IS NULL THEN test.a ELSE test2.b END
Thank you
Marek Srom
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users