Subject Re: [firebird-support] Re: Unable to re-create foreign key
Author Helen Borrie
At 01:28 PM 15/11/2006, you wrote:
> > It looks as though you might have been trying to create the foreign
> > key whilst the parent constraint was uncommitted.
>
>I was able to create a separate fk from a different table. Also, in
>trying to fix it using IBExpert, I disconnected and then reconnected
>to the database and then tried to create the FK and the problem continued.

OK, sounds like something fishy in the FK column itself. What kind
of key is it? Is its data type compatible with the referenced PK?


>The Primary key exists on the source table, I just can't create the FK
>from one detail table.
>
>Any other things I may look at?

Just look harder at that column in the child table. There will
*something* there that you've missed.

Try
select child.PK, child.ProblemColumn, parent.PK from child
left join parent on parent.PK = child.ProblemColumn
where parent.PK is null

If you get any rows returned from this query, they will be the offending ones.

./heLen