Subject | Re: [firebird-support] Error creating Foreign key |
---|---|
Author | Mourad Hedfi |
Post date | 2018-06-13T08:05:09Z |
For example, I've 5 FK on this table and only the first was created and the others, as shown, are in error :
ALTER TABLE
TABLE FINSMR_INDIC_SMR_ATR ADD CONSTRAINT FK2_FINSMR_INDIC_SMR_ATR FOREIGN KEY (FINSMR_SP_CODE_FK_PK) REFERENCES SP_SPECIALITE (SP_CODE_SQ_PK) ON DELETE CASCADE - This operation is not defined for system tables.
ALTER TABLE FINSMR_INDIC_SMR_ATR ADD CONSTRAINT FK3_FINSMR_INDIC_SMR_ATR FOREIGN KEY (FINSMR_ATR_CODE_FK_PK) REFERENCES ATR_AVISCOMMISSIONTRANSPARENCE (ATR_CODE_SQ_PK) ON DELETE CASCADE - This operation is not defined for system tables.
ALTER TABLE FINSMR_INDIC_SMR_ATR ADD CONSTRAINT FK4_FINSMR_INDIC_SMR_ATR FOREIGN KEY (FINSMR_SP_CODE_FK_PK,FINSMR_ATR_CODE_FK_PK) REFERENCES SPATR_SPEC_AVISTRANSPARENCE (SPATR_SP_CODE_FK_PK,SPATR_ATR_CODE_FK_PK) - This operation is not defined for system tables
ALTER TABLE FINSMR_INDIC_SMR_ATR ADD CONSTRAINT FK5_FINSMR_INDIC_SMR_ATR FOREIGN KEY (FINSMR_FIN_CODE_FK_PK, FINSMR_SP_CODE_FK_PK) REFERENCES FINSP_INDSPE (FINSP_FIN_CODE_FK_PK,FINSP_SP_CODE_FK_PK) - This operation is not defined for system tables.
I'm connected with sysdba user and I can create those FK with Flamerobin.
Bien cordialement.
Mourad Hedfi
Directeur de projetsMourad Hedfi
2018-06-13 8:32 GMT+01:00 Svein Erling Tysvær setysvar@... [firebird-support] <firebird-support@yahoogroups.com>:
What are the names of the foreign keys? Just in case Firebird thinks two foreign keys are identical, e.g. the naming of both foreign keys have the same first 27 letters and only differ later (don't know if the limit is 27, I think it was 27 or 28 for tables earlier, have no clue about FKs). Are you allowed to create the foreign key if you use a completely different name for it?And what is the exact definition of the primary, foreign and unique keys for the tables in question?Set2018-06-12 10:59 GMT+02:00 Mourad Hedfi mourad@... [firebird-support] <firebird-support@yahoogroups. com>:
Hello All,I return to you after many tests and finally I've found that when I've two or more successive FK to create, only the first is created and I've the error "Object in use" for the others.I've tried :1. Add a commit command after every FK create command2. Disconnect after every FK create command==> always the same error.Doe's anyone have an idea to fix this problem ?Tél. : 01 83 62 36 85Bien cordialement.Directeur de projets
Mourad Hedfi2018-05-31 9:22 GMT+01:00 Mourad Hedfi <mourad@...>:Hello,Thanks for your reply.1. Why do you remove all FK?--> Data update covers all data's tables. I must remove all FK to be able to insert, delete records.2. Why do you still use such old Firebird version?--> You are wright. It's a big client database and I mist have it's agreement to use a recent version.Many things was fixed since FB1.5 and i suppose that only real fix to your problem is using recent FB.You can try disconnect after every FK.--> I'll try this and tell you if it resolve the problem. Note that on 477 deleted FK, 326 are created.You can also try do select count(*) from updated tables but you say that you do backup and restore...Tél. : 01 83 62 36 85Bien cordialement.Directeur de projets
Mourad Hedfi2018-05-31 8:42 GMT+01:00 liviuslivius liviuslivius@... [firebird-support] <firebird-support@yahoogroups. com>:Hi,Two questions1. Why do you remove all FK?2. Why do you still use such old Firebird version?Many things was fixed since FB1.5 and i suppose that only real fix to your problem is using recent FB.You can try disconnect after every FK.You can also try do select count(*) from updated tables but you say that you do backup and restore...Regards,Karol Bieniaszewski