#coding:utf-8 # # id: bugs.core_4453 # title: Regression: NOT NULL constraint, declared in domain, does not work # decription: # tracker_id: CORE-4453 # min_versions: ['3.0'] # versions: 3.0 # qmid: None import pytest from firebird.qa import db_factory, isql_act, Action # version: 3.0 # resources: None substitutions_1 = [] init_script_1 = """ -- Tests that manipulates with NULL fields/domains and check results: -- CORE-1518 Adding a non-null restricted column to a populated table renders the table inconsistent -- CORE-4453 (Regression: NOT NULL constraint, declared in domain, does not work) -- CORE-4725 (Inconsistencies with ALTER DOMAIN and ALTER TABLE with DROP NOT NULL and PRIMARY KEYs) -- CORE-4733 (Command "Alter table alter TYPE and makes incorrect assignments in to ZERO / JULIAN_DATE / ASCII(0) for types INT, TIMESTAMP and VARCHAR) create domain dm_01 varchar(20) not null; commit; create table t_01(s dm_01, x int); commit; """ db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1) test_script_1 = """ insert into t_01(x) values(100); select * from t_01 where s is null; """ act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1) expected_stderr_1 = """ Statement failed, SQLSTATE = 23000 validation error for column "T_01"."S", value "*** null ***" """ @pytest.mark.version('>=3.0') def test_1(act_1: Action): act_1.expected_stderr = expected_stderr_1 act_1.execute() assert act_1.clean_stderr == act_1.clean_expected_stderr