#coding:utf-8 """ ID: issue-5703 ISSUE: https://github.com/FirebirdSQL/firebird/issues/5703 TITLE: Support for DROP IDENTITY clause DESCRIPTION: JIRA: CORE-5431 FBTEST: bugs.core_5431 NOTES: [23.02.2023] pzotov Adjusted expected_stderr according to notes in #7229. Removed unneeded substitutions and old comments. Confirmed problem on 5.0.0.573 Checked on 5.0.0.958, 4.0.3.2903 - all OK. """ import pytest from firebird.qa import * db = db_factory() test_script = """ 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 error: insert into test1 default values returning id as test1_id; """ act = isql_act('db', test_script) expected_stdout = """ IDENTITY_SEQUENCES_COUNT_1 1 TEST1_ID 32767 IDENTITY_SEQUENCES_COUNT_2 0 """ expected_stderr = """ Statement failed, SQLSTATE = 23000 validation error for column "TEST1"."ID", value "*** null ***" """ @pytest.mark.version('>=4.0') def test_1(act: Action): act.expected_stdout = expected_stdout act.expected_stderr = expected_stderr act.execute() assert (act.clean_stderr == act.clean_expected_stderr and act.clean_stdout == act.clean_expected_stdout)