NOT NULL constraint is not synchronized after rename column [CORE5896] #6154
Labels
affect-version: 2.1.7
affect-version: 2.5.0
affect-version: 2.5.1
affect-version: 2.5.2 Update 1
affect-version: 2.5.2
affect-version: 2.5.3 Update 1
affect-version: 2.5.3
affect-version: 2.5.4
affect-version: 2.5.5
affect-version: 2.5.6
affect-version: 2.5.7
affect-version: 2.5.8
affect-version: 3.0.0
affect-version: 3.0.1
affect-version: 3.0.2
affect-version: 3.0.3
affect-version: 4.0 Alpha 1
affect-version: 4.0 Initial
fix-version: 4.0 Beta 1
priority: major
qa: done successfully
type: bug
Submitted by: Van den Wouwer Danny (dannyvdw)
CREATE TABLE TEST (
ID BIGINT NOT NULL
);
alter table TEST
add constraint PK_TEST
primary key (ID);
COMMIT WORK;
-- Rename column from ID to ID2
ALTER TABLE TEST DROP CONSTRAINT PK_TEST;
ALTER TABLE TEST ALTER ID TO ID2;
alter table TEST
add constraint PK_TEST
primary key (ID2);
COMMIT WORK;
// end of script
// Check rdb$check_constraints
select cc.rdb$constraint_name, rc.rdb$relation_name, cc.rdb$trigger_name
from rdb$check_constraints cc
join rdb$relation_constraints rc on cc.rdb$constraint_name = rc.rdb$constraint_name
left join rdb$relation_fields rf
on rc.rdb$relation_name = rf.rdb$relation_name
and cc.rdb$trigger_name = rf.rdb$field_name
where rc.rdb$constraint_type = 'NOT NULL';
Is this a wrong interpretation from me? I didn't suspected that ID is still present in de rdb$check_constraints system-table present AFTER changing the name to ID2?
I'm still not getting the rdb$relation_constraints either, especially the NOT NULL constraints, most of the time they aren't synced with the NOT NULL on the domain / fields.
After creating databases with a lot of tables and I run this query:
select cc.rdb$constraint_name , rc.rdb$relation_name, rf.rdb$field_name, rf.rdb$field_source
from rdb$check_constraints cc
join rdb$relation_constraints rc on cc.rdb$constraint_name = rc.rdb$constraint_name
left join rdb$relation_fields rf
on rc.rdb$relation_name = rf.rdb$relation_name
and cc.rdb$trigger_name = rf.rdb$field_name
where rc.rdb$constraint_type = 'NOT NULL'
and rf.rdb$field_name is null
I suspect to get no results, but most of the time I do, i dunno if those two phenomenons are related to each other.
Commits: 8f3000e
The text was updated successfully, but these errors were encountered: