Subject Re: [firebird-support] Foreign Key / Referential Integerity
Author Helen Borrie
At 10:50 PM 18/06/2004 +1000, you wrote:
>This may seem like a very basic question but what is happening is not what
>I expected, as follows:
>
>Table1
>Client_ID Primary Key
>
>
>Table2
>Policy_ID Primary Key
>Client_ID Foreign Key constraint
>
>
>I expected that when I added a record to Table2 its Client_ID field would
>be automatically
>populated with the Client_ID from Table1.

Nope. The FK constraint protects the relationship and applies selected
rules to DML operations but it doesn't do ESP.


>This is not happening - Client_ID value remains null.
>
>I am using D7, what am I doing wrong or do I need to turn on (whatever) or
>is my understanding just incorrect.

This is a matter of client-side implementation. Most data access
components for Delphi support Master-Detail relationships to a lesser or
greater extent. So, indeed, using IBO for example, you can set up the
conditions where a "detail" record can be made to lift the PK from the
currently-linked master record and write it into its own linking field.

/heLen