Book a Demo

Author Topic: Adding Forigen Keys  (Read 3367 times)

cchobanik

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Adding Forigen Keys
« on: July 28, 2006, 12:05:21 pm »
I trying to do some database modling using your product and I am trying to assign a forigen key to a uniqe set of columns in another table and I am getting a error message "Destination Column(s) not part of the primary key or is not unique". I Created a unique constraint on the columns I am trying to reference, thus it isn't the primary key, but it should still work, as I can do it via code in Oracle 9i.

Program Version 6.1.785

Does anyone know why this is doing this???

Cory

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Adding Forigen Keys
« Reply #1 on: July 28, 2006, 02:46:54 pm »
Cory,

I remember seeing some fixes for similar sounding stuff in a recent set of release notes for an EA build. Is it convenient for you to upgrade to the current build - 792 at this time? That might be all you need to handle this. You might want to look into recent release notes in the Announcements section of the forum first.

There is a small possibility that this is a limitation in EA, relating to being able to use a compound key at one end or the other (I don't remember which) of a foreign key relationship. However, I suspect this might be the issue that was addressed in the recent build. [It might also be my failing memory, so don't panic just yet.]

Please let us know if this resolves your problem.

David
No, you can't have it!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Adding Foreigner Keys
« Reply #2 on: July 28, 2006, 04:45:14 pm »
Quote
I trying to do some database modling using your product and I am trying to assign a foreigner key to a unique set of columns in another table and I am getting a error message "Destination Column(s) not part of the primary key or is not unique". I Created a unique constraint on the columns I am trying to reference, thus it isn't the primary key, but it should still work, as I can do it via code in Oracle 9i.

Program Version 6.1.785

Does anyone know why this is doing this???

Cory
This is one of the tests I use when determining if a database modelling tool can really handle REAL databases.  Some modelling tools, notably Embarcadero ER/Studio are fixated by the US IDEF1X standard - which prohibits foreign keys to other than the foreign primary key.  It took me 6 years to get them to actually conform to relational theory!

It was one of the first tests I applied to EA when I investigated it.  It could handle the non-primary foreign key.

However, it should be noted that a unique constraint is NOT NECESSARILY the same as a unique index.  In practical terms, a unique constraint is almost always handled by a unique index and a unique index effectively imposes a unique constraint.  BUT you don't have to have a unique index to impose a unique constraint!

So Cory, as David suggests, have a look at the release notes and if things still don't work, check whether the foreign table has the unique constraint as an alternate key.

(As with Embarcadero ER/Studio, I believe the unique constraint is all that is required by relational theory - but I'm more forgiving of EA if it hasn't quite got this right yet.  This one is a bit more subtle - and compounded by the fact than many DBMSs don't do a good job here either and EA has to support them).

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

cchobanik

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Adding Forigen Keys
« Reply #3 on: July 29, 2006, 08:42:50 am »
Wow quick responses, I am not at work today but I will try that on Monday to see if it works, and I will make a post to let you know.

Thanks,
Cory