Compound ALTER TABLE statement with ADD and DROP the same constraint failed if 
this constraint involves index creation (PK/UNQ/FK)
----------------------------------------------------------------------------------------------------------------------------------

                 Key: CORE-4878
                 URL: http://tracker.firebirdsql.org/browse/CORE-4878
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.1.7, 3.0 RC 1, 2.5.5
            Reporter: Pavel Zotov
            Priority: Minor


All following is done with SET AUTODDL ON (default setting).

Test-1:
=====
recreate table t(x int not null);
alter table t add constraint cx check(x>0), drop constraint cx; -- i.e. NO 
index will be created for this constraint

Result: OK, no errors.

Test-2:
=====
recreate table t(x int not null);
alter table t add constraint t_unq unique(x), drop constraint t_unq;

Result:
2.1) in 2.1.7:
Statement failed, SQLCODE = -607
unsuccessful metadata update
-too few key columns found for index T_UNQ (incorrect column name?)

2.2) in 2.5.5:
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-cannot create index T_UNQ

2.3) in 3.0:
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-ALTER TABLE T failed
-CONSTRAINT T_UNQ does not exist.

Similar results will be for 

recreate table t(x int not null);
alter table t add constraint t_pk primary key(x), drop constraint t_pk;

and

recreate table t(x int not null);
alter table t add constraint t_pk primary key(x), add constraint t_fk foreign 
key(x) references t(x), drop constraint t_fk;

PS. Yes, all these statements can be done separately and w/o any errors. I've 
made this ticket only to illustrate minor problem that exists when ALTER TABLE 
consists of several statements and some of them cancels previous which are 
issued in the same statement.

-- 
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

        

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to