Quantcast
Viewing all articles
Browse latest Browse all 92

prim29913:Upgrade from interbase to v5.0 fails with exception: Insert statement conflicted with COLUMN FOREIGN KEY constraint ‘fk_task_project’

Solution ID: prim29913
Upgrade from interbase to v5.0 fails with exception: Insert statement conflicted with COLUMN FOREIGN KEY constraint ‘fk_task_project’
Status: Reviewed
Version(s): 5.0



Problem: Error upgrading Interbase database to 5.0 database.
Problem: Error using CA.exe to move and upgrade a database.  “Process failed with exception: Database server error; The ALTER TABLE statement conflicted with the FOREIGN KEY constraint “fk_task_project”. The conflict occured in database “PMDB”, table “dbo.PROJECT”, column’proj_id”.”
Problem: Process failed with exception: SQL Server Error: The statement has been terminated.  INSERT statement conflicted with COLUMN FOREIGN KEY constraint ‘fk_task_project’.  The conflict occurred in database ‘<pmdb$primavera>’, table “PROJECT’, column ‘proj_id’.
Problem: Configasst upgrade fails when upgrading task table.
Cause: There is a project_id field that exists in the task table, that does not exist in the project table.  It needs to be deleted from the task table.
Fix: To resolve this issue with Oracle or SQL:

1.  Ensure that you have a full and current backup of the Project Management database.


2.  Run the following query against the database (substituting the name of the admuser in the PMDB schema if necessary).  Please be aware that any rows returned from that query are orphaned task records.



select * from admuser.task where proj_id not in (select proj_id from admuser.project);


3.  If the users of the Project Management software feel that their projects are complete and are working correctly, delete the orphaned records, using the following SQL statement:



delete from admuser.task where proj_id not in (select proj_id from admuser.project);


To resolve this issue with Interbase:


1.  Make a backup of the database.


2.  Open the Interbase Console by going to Start, Programs, Interbase, Interbase Console.


Image may be NSFW.
Clik here to view.


3. Log into the Interbase Console by right clicking the local server and selecting login.  Enter sysdba as your username and masterkey as your password.


Image may be NSFW.
Clik here to view.


4.  Expand the local server, right click database and select register.  When the box comes up select the location of your gdb file, and again enter sysdba and masterkey as the username and password.


Image may be NSFW.
Clik here to view.


5.  Go to the Tools menu, and select Interactive SQL.


6.  Enter the following line into the command window:


select

task_id from task where proj_id is not NULL and not exists(select proj_id from project where task.proj_id=project.proj_id);

 Execute the query

Image may be NSFW.
Clik here to view.


7.  Run a delete statement to get rid of the task_id’s for the invalid proj_id’s:


Delete from Task where task_id = <task_id that was returned in the previous select statement>;


    delete all the task_id’s that came back from the select statement


Image may be NSFW.
Clik here to view.


8.  Go to the Transactions menu, and choose Commit.


You will now be able to upgrade the database.


Viewing all articles
Browse latest Browse all 92

Trending Articles