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

46 lines
1.3 KiB
Python

#coding:utf-8
"""
ID: issue-4524
ISSUE: 4524
TITLE: Add optional START WITH clause to identity columns
DESCRIPTION:
We create table with identity column and use 'START WITH' clause for it.
Then we add three rows in this table and calculate difference betwee max and min
values of this identity column. In must be equal 2.
Behaviour of FB 4.x was changed since 06-aug-2020 when core-6084 was fixed:
now FB 4.x will assign to ID column values which less than FB 3.x for 1.
For this reason it was changed avoid check for concrete values.
Rather, it is enough to verify only difference between max and min ID.
JIRA: CORE-4199
FBTEST: bugs.core_4199
"""
import pytest
from firebird.qa import *
db = db_factory()
test_script = """
recreate table test(id int generated by default as identity (start with 1000) );
commit;
insert into test default values;
insert into test default values;
insert into test default values;
set heading off;
select max(id)-min(id) from test;
"""
act = isql_act('db', test_script)
expected_stdout = """
2
"""
@pytest.mark.version('>=3.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout