Skip to content

Commit 704a15d

Browse files
committed
Added/Updated tests\bugs\gh_7993_test.py: Checked on 6.0.0.249. NB: 5.x is also affected and it looks a regression since 5.0.0.1292
1 parent 85b4add commit 704a15d

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/bugs/gh_7993_test.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-7993
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7993
6+
TITLE: Unexpected results when using CASE WHEN with RIGHT JOIN
7+
NOTES:
8+
[06.02.2024] pzotov
9+
Confirmed bug on 6.0.0.247
10+
Checked on 6.0.0.249 -- all OK.
11+
NB: 5.x is also affected and it looks a regression since 5.0.0.1292 (date of build: 04-dec-2023)
12+
"""
13+
14+
import pytest
15+
from firebird.qa import *
16+
17+
db = db_factory()
18+
19+
test_script = """
20+
recreate table t0(c0 boolean);
21+
recreate table t1(c1 boolean);
22+
23+
insert into t0 (c0) values (true);
24+
insert into t1 (c1) values (false);
25+
26+
set count on;
27+
set list on;
28+
select t1.c1 as q1_c1, t0.c0 as q1_c0 from t1 right join t0 on t0.c0; -- false true
29+
select t1.c1 as q2_c1, t0.c0 as q2_c0 from t1 right join t0 on t0.c0 where (case t1.c1 when t1.c1 then null else true end); -- null true (unexpected)
30+
select (case t1.c1 when t1.c1 then null else true end ) as q3_result from t1 right join t0 on t0.c0; -- null
31+
"""
32+
33+
act = isql_act('db', test_script, substitutions = [('[ \t]+', ' ')])
34+
35+
expected_stdout = """
36+
Q1_C1 <false>
37+
Q1_C0 <true>
38+
Records affected: 1
39+
40+
Records affected: 0
41+
42+
Q3_RESULT <null>
43+
Records affected: 1
44+
"""
45+
46+
@pytest.mark.version('>=6.0')
47+
def test_1(act: Action):
48+
act.expected_stdout = expected_stdout
49+
act.execute(combine_output = True)
50+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)