mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
65 lines
1.7 KiB
Python
65 lines
1.7 KiB
Python
#coding:utf-8
|
|
|
|
"""
|
|
ID: issue-5702
|
|
ISSUE: 5702
|
|
TITLE: Support for INCREMENT option in identity columns
|
|
DESCRIPTION:
|
|
JIRA: CORE-5430
|
|
FBTEST: bugs.core_5430
|
|
"""
|
|
|
|
import pytest
|
|
from firebird.qa import *
|
|
|
|
db = db_factory()
|
|
|
|
test_script = """
|
|
set list on;
|
|
--set echo on;
|
|
recreate table test1(
|
|
id int generated by default as identity ( start with 12345 )
|
|
);
|
|
recreate table test2(
|
|
id int generated by default as identity ( start with 12345 increment 22222 )
|
|
);
|
|
|
|
recreate table test3(
|
|
id int generated by default as identity ( increment 33333 )
|
|
);
|
|
|
|
insert into test1 default values returning id as test1_id;
|
|
insert into test2 default values returning id as test2_id;
|
|
insert into test3 default values returning id as test3_id;
|
|
commit;
|
|
|
|
alter table test1 alter column id restart;
|
|
alter table test2 alter column id restart with 23456;
|
|
|
|
alter table test3 alter column id restart with 0;
|
|
alter table test3 alter column id set increment 11111;
|
|
commit;
|
|
|
|
insert into test1 default values returning id as test1_restarted_id;
|
|
insert into test2 default values returning id as test2_restarted_id;
|
|
insert into test3 default values returning id as test3_chng_incr_id;
|
|
"""
|
|
|
|
act = isql_act('db', test_script)
|
|
|
|
expected_stdout = """
|
|
TEST1_ID 12345
|
|
TEST2_ID 12345
|
|
TEST3_ID 1
|
|
TEST1_RESTARTED_ID 12345
|
|
TEST2_RESTARTED_ID 23456
|
|
TEST3_CHNG_INCR_ID -22222
|
|
"""
|
|
|
|
@pytest.mark.version('>=4.0')
|
|
def test_1(act: Action):
|
|
act.expected_stdout = expected_stdout
|
|
act.execute()
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
|
|