Subject | Re: Foreign key problem |
---|---|
Author | acegracely |
Post date | 2005-03-22T15:07:31Z |
Pavel, that works!
I see what I was doing wrong. I thought the foreign key constraint
should be defined from the master table not the child table.
I put the constraint on the basket table and it works.
This is different to what I am used to with Advantage Database server.
Martijn,
Sorry, I didn't understand what you meant.
Regards
Mike
--- In firebird-support@yahoogroups.com, Pavel Menshchikov
<mpn2001@y...> wrote:
I see what I was doing wrong. I thought the foreign key constraint
should be defined from the master table not the child table.
I put the constraint on the basket table and it works.
This is different to what I am used to with Advantage Database server.
Martijn,
Sorry, I didn't understand what you meant.
Regards
Mike
--- In firebird-support@yahoogroups.com, Pavel Menshchikov
<mpn2001@y...> wrote:
> Hello Mike,
>
> a> No, the mastuser table is the parent, basket is the child. It's a one
> a> to many relationship.
> a> I want the constraint in so that if I delete a mastuser record, all
> a> corresponding basket records will be deleted as well.
> Martijn try to say that you have to define PRIMARY KEY or UNIQUE
> constarint on (ACCOUNT, USER_NAME) for mastuser firstly, then commit,
> then define FOREIGN KEY for basket (with ON DELETE CASCADE), and
> commit.
>
>
> HTH
> --
> Best regards,
> Pavel Menshchikov
> http://www.ls-software.com