Subject | Re: [ib-support] The dreaded foreign key creation error |
---|---|
Author | Martijn Tonies |
Post date | 2002-01-03T17:43:26Z |
Hmmm, seems my reply didn't get through.
I think in this case both the PK and FK are valid and clear design.
A record in LEVERANCIER is identified by its RelatieID and values in this
column have to exist in RELATIE. I don't see what's wrong with this, Helen?
--
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
"Helen Borrie" <helebor@...> wrote in message
news:5.1.0.14.0.20020104023117.02a45c60@......
NEVER make a primary key do double action as a foreign key. If I want a
foreign key, I create a column for it, i.e. design the database before you
create it. It doesn't cost much and it keeps keys "functionally pure".
I think in this case both the PK and FK are valid and clear design.
A record in LEVERANCIER is identified by its RelatieID and values in this
column have to exist in RELATIE. I don't see what's wrong with this, Helen?
--
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
"Helen Borrie" <helebor@...> wrote in message
news:5.1.0.14.0.20020104023117.02a45c60@......
> At 04:20 PM 03-01-02 +0100, you wrote:in
> >Hi all,
> >
> >Perhaps we all know the error:
> >
> >My metadata was this:
> >
> >Table "RELATIE"
> >
> >RelatieID PK
> >... more columns ...
> >
> >Table "LEVERANCIER"
> >
> >RelatieID PK, FK to RELATIE
> >... more columns ...
> >
> >Table "ORDERREGEL"
> >
> >LeverancierID FK to LEVERANCIER
> >
> >Creating this constraint gave me the error that some index wasn't defined
> >the tables and a trigger raised an exception bla bla...because
> >
> >A common cause for this error is have an index defined on a primary key
> >column. In this case, the index was created by the system - namely
> >of the FK from LEVERANCIER to RELATIE.determined by the need to work around your problem, but by aesthetics) is to
> >
> >Dropping this FK results in removing the index and the second FK (from
> >ORDERREGEL to LEVERANCIER) could be created without problems. Next up:
> >creating the FK from LEVERANCIER to RELATIE. All went well...
> >
> >It is a workaround for a strange problem -- comments, anyone?
>
> Well, you won't like it, probably..but my rule (incidentally NOT
NEVER make a primary key do double action as a foreign key. If I want a
foreign key, I create a column for it, i.e. design the database before you
create it. It doesn't cost much and it keeps keys "functionally pure".
>
> :)
>
> Helen
>
>
>
> All for Open and Open for All
> Firebird Open SQL Database � http://firebirdsql.org
> _______________________________________________________
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>