Subject | Re: [ib-support] Foreign Key |
---|---|
Author | Nando Dessena |
Post date | 2003-04-11T15:35:29Z |
Miguel,
I> I have the folowing foreign key (Hotel,Epoca) with table Epocas that have
I> Primary Key (Hotel,Codigo). Firebird permit Hotel field filled but Epoca
I> with null value. This is correct or a bug?
I> Hotel | Epoca
I> 1 null
I> 2 Alta
I don't know if it should be allowed or not, I usually don't have
multicolumn foreign keys (and in that rare case they aren't nullable).
I guess it depends on what the SQL standard has to say about it.
OTTOMH I'd reject it as a foreign key violation (which Firebird
doesn't), but with a bit of imagination I can see why it does allow
it: since null means unknown it cannot be sure it's a foreign key
violation. :-)
More pragmatically, it looks like it considers the whole key null if
at least one of the segments is null, which does make sense.
I am not a SQL standard expert, though.
Ciao
--
Nando mailto:nandod@...
I> I have the folowing foreign key (Hotel,Epoca) with table Epocas that have
I> Primary Key (Hotel,Codigo). Firebird permit Hotel field filled but Epoca
I> with null value. This is correct or a bug?
I> Hotel | Epoca
I> 1 null
I> 2 Alta
I don't know if it should be allowed or not, I usually don't have
multicolumn foreign keys (and in that rare case they aren't nullable).
I guess it depends on what the SQL standard has to say about it.
OTTOMH I'd reject it as a foreign key violation (which Firebird
doesn't), but with a bit of imagination I can see why it does allow
it: since null means unknown it cannot be sure it's a foreign key
violation. :-)
More pragmatically, it looks like it considers the whole key null if
at least one of the segments is null, which does make sense.
I am not a SQL standard expert, though.
Ciao
--
Nando mailto:nandod@...