6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_5431_test.py

81 lines
2.0 KiB
Python

#coding:utf-8
#
# id: bugs.core_5431
# title: Support for DROP IDENTITY clause
# decription:
# Checked on 4.0.0.477
# 18.08.2020: replaced expected_stdout, checked on 4.0.0.2164.
#
# tracker_id: CORE-5431
# min_versions: ['4.0']
# versions: 4.0
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 4.0
# resources: None
substitutions_1 = [('RDB\\$[\\d]+', 'RDB')]
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
--set echo on;
recreate table test1(
id smallint generated by default as identity ( start with 32767 increment -65535 )
);
commit;
-- Should be 1:
select count(*) as identity_sequences_count_1
from rdb$generators
where rdb$system_flag = 6;
insert into test1 default values returning id as test1_id;
commit;
alter table test1 alter column id drop identity;
commit;
-- Should be 0:
select count(*) as identity_sequences_count_2
from rdb$generators
where rdb$system_flag = 6;
-- Should issue
-- Statement failed, SQLSTATE = 42000
-- invalid request BLR at offset 47
-- -generator RDB$nnn is not defined
insert into test1 default values returning id as test1_id;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
IDENTITY_SEQUENCES_COUNT_1 1
TEST1_ID 32767
IDENTITY_SEQUENCES_COUNT_2 0
"""
expected_stderr_1 = """
Statement failed, SQLSTATE = 42000
invalid request BLR at offset 47
-generator RDB is not defined
"""
@pytest.mark.version('>=4.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.expected_stderr = expected_stderr_1
act_1.execute()
assert act_1.clean_expected_stderr == act_1.clean_stderr
assert act_1.clean_expected_stdout == act_1.clean_stdout