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_3311_test.py

68 lines
1.7 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3678
ISSUE: 3678
TITLE: Error "data type unknown" while preparing UPDATE/DELETE statements with the parameterized ROWS clause
DESCRIPTION:
JIRA: CORE-3311
FBTEST: bugs.core_3311
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
recreate table test(id int);
commit;
insert into test select rand()*1000 from rdb$types,(select 1 i from rdb$types rows 10);
commit;
create index test_id on test(id);
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set planonly;
select * from test rows ?;
select * from test where id between ? and ? order by id rows ? to ?;
update test set id=id rows ? to ?;
update test set id=id where id between ? and ? order by id rows ? to ?;
delete from test rows ? to ?;
delete from test where id between ? and ? order by id rows ? to ?;
2022-01-22 21:59:15 +01:00
merge into test t
using(
2021-04-26 20:07:00 +02:00
select id from test where id between ? and ? rows ?
2022-01-22 21:59:15 +01:00
) s
on t.id=s.id
2021-04-26 20:07:00 +02:00
when matched then update set t.id=s.id;
2022-01-22 21:59:15 +01:00
merge into test t
using(
select id from test where id between ? and ? order by id rows ?
) s
on t.id=s.id
2021-04-26 20:07:00 +02:00
when matched then update set t.id=s.id;
set planonly;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PLAN (TEST NATURAL)
PLAN (TEST ORDER TEST_ID)
PLAN (TEST NATURAL)
PLAN (TEST ORDER TEST_ID)
PLAN (TEST NATURAL)
PLAN (TEST ORDER TEST_ID)
PLAN JOIN (S TEST INDEX (TEST_ID), T INDEX (TEST_ID))
PLAN JOIN (S TEST ORDER TEST_ID, T INDEX (TEST_ID))
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-22 21:59:15 +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