6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_2697_test.py

72 lines
1.6 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-3097
ISSUE: 3097
TITLE: Support the "? in (SELECT some_col FROM some_table)" subqueries
DESCRIPTION:
JIRA: CORE-2697
FBTEST: bugs.core_2697
2022-01-21 18:49:26 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
recreate table t1(id int, x int);
commit;
recreate table t2(id int, t1_id int, y int);
commit;
insert into t1 values(1, 100);
insert into t1 values(2, 200);
insert into t1 values(3, 300);
2022-01-21 18:49:26 +01:00
2021-04-26 20:07:00 +02:00
insert into t2 values(11, 1, 111);
insert into t2 values(12, 1, 112);
insert into t2 values(13, 1, 113);
insert into t2 values(33, 3, 333);
insert into t2 values(34, 3, 334);
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set list on;
set term ^;
execute block returns(x_in_t2 int) as
declare v_stt varchar(255);
begin
v_stt =
'select t1.x '
|| 'from t1 '
|| 'where t1.x > 0 '
|| 'and ( ? in ( select mod(t2.id, 2) from t2 where t1.id = t2.t1_id ) )';
for
execute statement ( v_stt ) ( 0 ) into x_in_t2
do
suspend;
end
^
set term ;^
-- Output in 2.5:
-- Statement failed, SQLSTATE = HY004
-- Dynamic SQL Error
-- -SQL error code = -804
-- -Data type unknown
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-21 18:49:26 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
X_IN_T2 100
X_IN_T2 300
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-21 18:49:26 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00