View Issue Details

IDProjectCategoryView StatusLast Update
0001341SymmetricDSBugpublic2019-04-11 15:20
ReportergwilmerAssigned Toelong 
Prioritynormal 
Status closedResolutionduplicate 
Product Version 
Target VersionFixed in Version 
Summary0001341: Initial loads on table with FK to itself may fail with FK violations
DescriptionWhen you have a table that has a foreign key to itself, the initial load doesn't pay attention to the FK ordering and will fail with FK issues.

We might want to try to suspend FK constraints during the initial load in this case...
Steps To ReproduceTable:

test_table

Columns:

col1 int pk not null
col2 varchar(50) not null
col3 int (fk to col1) (this one is nullable)

Here is the data scenario that gets you in trouble:

1 blah NULL
2 blahblah 1
3 blahblahblah 4
4 fk row NULL

To set up this scenario you have to insert row 3 with a null FK, then insert row 4, then update row 3 to reference row 4. When you do this the natural ordering of the select for the initial load will be in pk order and you will get the FK issue on initial load.
TagsNo tags attached.

Relationships

duplicate of 0003711 closedjosh-a-hicks Table reload request for a table with a foreign to itself and a data row where the row fk is to itself doesn't load any data 
related to 0003853 closedelong Defer indexes and foreign key constraints for table creation until after initial load 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2013-07-24 10:24 gwilmer New Issue
2019-04-11 15:20 elong Relationship added duplicate of 0003711
2019-04-11 15:20 elong Relationship added related to 0003853
2019-04-11 15:20 elong Assigned To => elong
2019-04-11 15:20 elong Status new => closed
2019-04-11 15:20 elong Resolution open => duplicate