From 424864fcfb4fcafcf40897e0d74aac06e7711132 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Wed, 28 Jun 2023 15:50:36 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_7638_test.py: Checked on 5.0.0.1093 (intermediate build). --- tests/bugs/gh_7638_test.py | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/bugs/gh_7638_test.py diff --git a/tests/bugs/gh_7638_test.py b/tests/bugs/gh_7638_test.py new file mode 100644 index 00000000..b8806cd7 --- /dev/null +++ b/tests/bugs/gh_7638_test.py @@ -0,0 +1,47 @@ +#coding:utf-8 + +""" +ID: issue-7638 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/7638 +TITLE: OVERRIDING USER VALUE should be allowed for GENERATED ALWAYS AS IDENTITY +DESCRIPTION: +NOTES: + [29.06.2023] pzotov + Checked on 5.0.0.1093 (intermediate build). +""" + +import pytest +from firebird.qa import * + +db = db_factory() + +test_script = """ + set list on; + recreate table IDENTITY_ALWAYS ( + ID bigint generated always as identity constraint pk_identity_always primary key, + VAL varchar(10) + ); + commit; + + insert into IDENTITY_ALWAYS (ID, VAL) overriding user value values (-9223372036854775808, 'B1') returning ID, VAL; + insert into IDENTITY_ALWAYS (ID, VAL) overriding user value values (null, 'B2') returning ID, VAL; + insert into IDENTITY_ALWAYS (ID, VAL) overriding user value values (cast(9223372036854775808 as int128), 'B3') returning ID, VAL; +""" + + +act = isql_act('db', test_script) + +expected_stdout = """ + ID 1 + VAL B1 + ID 2 + VAL B2 + ID 3 + VAL B3 +""" + +@pytest.mark.version('>=5.0') +def test_1(act: Action): + act.expected_stdout = expected_stdout + act.execute() + assert act.clean_stdout == act.clean_expected_stdout