Book a Demo

Author Topic: BUG: Premature FK deletion  (Read 3144 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
BUG: Premature FK deletion
« on: October 04, 2006, 01:41:08 am »
It is possible to make more than one relationship originate from the same Foreign Key columnSet.  This is quite normal, if not typical.

However, if you delete a relationship that uses a particular columnSet, the «FK» stereotyped operation is deleted regardless of whether it is currently in use by another relationship.

If the «FK» stereotyped operation is still in use, it MUST NOT be deleted!

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

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: BUG: Premature FK deletion
« Reply #1 on: October 04, 2006, 05:14:22 am »
Yes, I agree. There needs to be a check to ensure no other indexes reference the same key.
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: BUG: Premature FK deletion
« Reply #2 on: October 04, 2006, 06:04:34 am »
Quote
Yes, I agree. There needs to be a check to ensure no other indexes reference the same key.
Sorry to be pedantic David, but it is vital to ensure we are saying the correct thing...

Your response should have read:

I agree.  There needs to be a check that no other relationships reference the same named column set.

I will almost certainly be teaching grandmother to suck eggs here - but someone at Sparx isn't a grandmother.

We call a column set that is the origin end of a database relationship a Foreign Key because it is native to the current table and because only extremely rarely is it a Key (unique index).   ::)

A Foreign Key is a column set that references a Key in the Foreign table.  :-X

Actually, Foreign Key is a misnomer - it is actually the Foreign Key Constraint.  Each unique relationship requires a unique FK Constraint.  Because of the Role selection bug described in: Bug: DB Relationship Roles you can (incorrectly) reselect the same «FK» stereotyped operation.

Consequently, when you delete the relationship, you should be able to (optionally) delete the (unique)  «FK» stereotyped operation - but unfortunately, because it's been (incorrectly) reused, you also delete the other relationship's column set!

Paolo
« Last Edit: October 04, 2006, 06:06:13 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: BUG: Premature FK deletion
« Reply #3 on: October 04, 2006, 02:47:00 pm »
Paolo,

I stand corrected.

Quote
There needs to be a check that no other relationships reference the same named column set.


Yes, you are certainly correct. I took a short cut, using a common term for what EA (or actually the data modelling profile) refers to.

But, it's when people take that kind of short cut that we seem to get into these binds.

David

PS: My grandmother would doubtless agree with your position too.
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: BUG: Premature FK deletion
« Reply #4 on: October 04, 2006, 06:36:12 pm »
To add insult to injury...  ;D

The "Deleted" «FK» stereotyped operations remain visible in the browser - but not the diagram, nor the actual Operations dialog!

You need to reload the current project to get rid of them from the browser...

Manage Complexity,
       Reduce Ambiguity,
               Eliminate Inconsistency!
TM


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

barry_abs

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: BUG: Premature FK deletion
« Reply #5 on: October 09, 2006, 06:26:36 am »
suffered this bug a lot recently.. i still have notes around my data model saying "recreate FK" after constraints have been deleted.