Skip to content

Commit cbfa183

Browse files
committed
Added/Updated tests\bugs\gh_7997_test.py: Checked 6.0.0.276 -- all fine
1 parent 813b26b commit cbfa183

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

tests/bugs/gh_7997_test.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-7997
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7997
6+
TITLE: Unexpected results when comparing integer with string containing value out of range of that integer datatype
7+
NOTES:
8+
[11.03.2024] pzotov
9+
Confirmed problem in 6.0.0.274: some expressions fail with "SQLSTATE = 22003 / ... / -numeric value is out of range".
10+
Checked 6.0.0.276 -- all fine.
11+
"""
12+
13+
import pytest
14+
from firebird.qa import *
15+
16+
db = db_factory()
17+
18+
test_script = """
19+
set list on;
20+
21+
recreate table t_sml(x smallint, primary key(x) using index sml_pk); -- pk is needed
22+
recreate table t_int(x integer, primary key(x) using index int_pk); -- pk is needed
23+
recreate table t_bigint(x bigint, primary key(x) using index bigint_pk); -- pk is needed
24+
recreate table t_int128(x int128, primary key(x) using index int128_pk); -- pk is needed
25+
26+
insert into t_sml(x) values (-1);
27+
insert into t_int(x) values (-1);
28+
insert into t_bigint(x) values (-1);
29+
insert into t_int128(x) values (-1);
30+
31+
set count on;
32+
33+
-- ########################################## check-1 ####################################################
34+
35+
select t.x as sml_r6 from t_sml t where t.x = -1 and t.x <= ( (-170141183460469231731687303715884105728) || 1 );
36+
select t.x as int_r6 from t_int t where t.x = -1 and t.x <= ( (-170141183460469231731687303715884105728) || 1 );
37+
select t.x as bigint_r6 from t_bigint t where t.x = -1 and t.x <= ( (-170141183460469231731687303715884105728) || 1 );
38+
select t.x as int128_r6 from t_int128 t where t.x = -1 and t.x <= ( (-170141183460469231731687303715884105728) || 1 );
39+
select t.x as sml_r6 from t_sml t where t.x <= ( (-170141183460469231731687303715884105728) || 1 );
40+
select t.x as int_r6 from t_int t where t.x <= ( (-170141183460469231731687303715884105728) || 1 );
41+
select t.x as bigint_r6 from t_bigint t where t.x <= ( (-170141183460469231731687303715884105728) || 1 );
42+
select t.x as int128_r6 from t_int128 t where t.x <= ( (-170141183460469231731687303715884105728) || 1 );
43+
set count off;
44+
45+
delete from t_sml;
46+
delete from t_int;
47+
delete from t_bigint;
48+
delete from t_int128;
49+
50+
insert into t_sml(x) values (1);
51+
insert into t_int(x) values (1);
52+
insert into t_bigint(x) values (1);
53+
insert into t_int128(x) values (1);
54+
55+
-- ########################################## check-2 ####################################################
56+
set count on;
57+
select t.x as sml_r6 from t_sml t where t.x = 1 and t.x >= ( (170141183460469231731687303715884105727) || 1 );
58+
select t.x as int_r6 from t_int t where t.x = 1 and t.x >= ( (170141183460469231731687303715884105727) || 1 );
59+
select t.x as bigint_r6 from t_bigint t where t.x = 1 and t.x >= ( (170141183460469231731687303715884105727) || 1 );
60+
select t.x as int128_r6 from t_int128 t where t.x = 1 and t.x >= ( (170141183460469231731687303715884105727) || 1 );
61+
select t.x as sml_r6 from t_sml t where t.x >= ( (170141183460469231731687303715884105727) || 1 );
62+
select t.x as int_r6 from t_int t where t.x >= ( (170141183460469231731687303715884105727) || 1 );
63+
select t.x as bigint_r6 from t_bigint t where t.x >= ( (170141183460469231731687303715884105727) || 1 );
64+
select t.x as int128_r6 from t_int128 t where t.x >= ( (170141183460469231731687303715884105727) || 1 );
65+
"""
66+
67+
act = isql_act('db', test_script, substitutions = [('[ \t]+', ' ')])
68+
69+
expected_stdout = """
70+
Records affected: 0
71+
Records affected: 0
72+
Records affected: 0
73+
Records affected: 0
74+
Records affected: 0
75+
Records affected: 0
76+
Records affected: 0
77+
Records affected: 0
78+
Records affected: 0
79+
Records affected: 0
80+
Records affected: 0
81+
Records affected: 0
82+
Records affected: 0
83+
Records affected: 0
84+
Records affected: 0
85+
Records affected: 0
86+
"""
87+
88+
@pytest.mark.version('>=6.0')
89+
def test_1(act: Action):
90+
act.expected_stdout = expected_stdout
91+
act.execute(combine_output = True)
92+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)