From 704a15d535641e6f8c3a2f5a22abb861fcbb52b0 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Tue, 6 Feb 2024 09:36:19 +0300 Subject: [PATCH] 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 --- tests/bugs/gh_7993_test.py | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/bugs/gh_7993_test.py diff --git a/tests/bugs/gh_7993_test.py b/tests/bugs/gh_7993_test.py new file mode 100644 index 00000000..73de7b8b --- /dev/null +++ b/tests/bugs/gh_7993_test.py @@ -0,0 +1,50 @@ +#coding:utf-8 + +""" +ID: issue-7993 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/7993 +TITLE: Unexpected results when using CASE WHEN with RIGHT JOIN +NOTES: + [06.02.2024] pzotov + Confirmed bug on 6.0.0.247 + Checked on 6.0.0.249 -- all OK. + NB: 5.x is also affected and it looks a regression since 5.0.0.1292 (date of build: 04-dec-2023) +""" + +import pytest +from firebird.qa import * + +db = db_factory() + +test_script = """ + recreate table t0(c0 boolean); + recreate table t1(c1 boolean); + + insert into t0 (c0) values (true); + insert into t1 (c1) values (false); + + set count on; + set list on; + select t1.c1 as q1_c1, t0.c0 as q1_c0 from t1 right join t0 on t0.c0; -- false true + 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) + select (case t1.c1 when t1.c1 then null else true end ) as q3_result from t1 right join t0 on t0.c0; -- null +""" + +act = isql_act('db', test_script, substitutions = [('[ \t]+', ' ')]) + +expected_stdout = """ + Q1_C1 + Q1_C0 + Records affected: 1 + + Records affected: 0 + + Q3_RESULT + Records affected: 1 +""" + +@pytest.mark.version('>=6.0') +def test_1(act: Action): + act.expected_stdout = expected_stdout + act.execute(combine_output = True) + assert act.clean_stdout == act.clean_expected_stdout