Subject Re: [firebird-support] Re: Foreign key violation, where there isn't
Author Sándor Tamás (HostWare Kft.)
Thank you for your help.

I've tried it with ISQL, watched carefully for the proper values, inserted,
created, altered from scratch, and I've got the same result.

When I try a joined select between the two table, it shows me the right
values, FB can find the record. But then, when I try an 'alter table' on the
detail table, I got this FK violation error.

Can it be a problem that I use a varchar field as primary, and foreign key?

Thanks,
SanTa

----- Original Message -----
From: "Adam" <s3057043@...>
To: <firebird-support@yahoogroups.com>
Sent: Wednesday, May 28, 2008 1:31 AM
Subject: [firebird-support] Re: Foreign key violation, where there isn't


> --- In firebird-support@yahoogroups.com, "Sandor Tamas"
> <sandortamas@...> wrote:
>>
>> Hi,
>>
>> I have a problem:
>> I have to tables, one has a PK, the other has a FK for the previous
>> table's PK.
>> But then, when I try to post new record, it sais I have a violation of
>> Foreign key on table. It is strange, because I tried it by hand, and
>> with IBExpert's help to choose the proper record from the primary table.
>>
>> Even when I tried it without foreign key, I was able to insert the
>> record, but then, it dropped me an error creating the foreign key.
>>
>> Is there something I don't know about foreign keys, or is there
>> something FB doesn't know about my foreign keys? :-)
>>
>> Any advices welcome!
>
> It may be a number of things that others have already mentioned. If
> you want a straight forward single answer, you really need to create a
> repeatable test case to demonstrate what you are talking about. The
> test case should be reproducible using iSQL or any other tool.
> Otherwise we may be looking at bugs in your preferred admin tool.
>
> Obviously, the parent record must exist, committed and visible to the
> current transaction. If there are concurrent pending changes to the
> primary key that are not visible to your transaction, then Firebird
> can obviously not allow you to achieve this.
>
> What may not be so obvious is a bug/artifact in Firebird where any
> change to the parent record (including updates to fields unrelated to
> the foreign key) can cause a foreign key violation when inserting
> records in the child table.
>
> http://tracker.firebirdsql.org/browse/CORE-1606
>
> Adam
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>