NOT NULL constraint are not synchronized after using some DML's
---------------------------------------------------------------

                 Key: CORE-5896
                 URL: http://tracker.firebirdsql.org/browse/CORE-5896
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 3.0.3, 2.5.8, 4.0 Alpha 1, 3.0.2, 2.5.7, 3.0.1, 2.5.6, 
3.0.0, 4.0 Initial, 2.5.5, 2.5.4, 2.5.3 Update 1, 2.1.7, 2.5.3, 2.5.2 Update 1, 
2.5.2, 2.5.1, 2.5.0
         Environment: doesn't matter
            Reporter: Van den Wouwer Danny


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.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to