Subject Re: [firebird-support] foreign key strangeness
Author Ann Harrison
Dmitry Yemanov wrote

>Out of curiosity, do you know any other RDBMS that allows that?
>
InterBase. The Rdb database that Oracle sells.

>IMO, reliability is much better than SQL conformance in such questionable situations.
>
There's no reason why an int and a varchar wouldn't be reliable as a
primary foreign key pair. If the varchar were in the parent, it
couldn't have children unless its contents were numeric and within the
range of an int.. If the varchar were in the child, it would be
restricted to numeric contents and the range of an int. Dumb, but it
works fine.

> And, BTW, I don't know what
>"comparable" means in the SQL specification, so probably my previous
>supposition re. INT vs VARCHAR is totally wrong ;-)
>
In fact, INT and VARCHAR compare better than either does to FLOAT.
Comparable is implementor defined, I believe.

We made a change in FB1 that has caused a lot of complaints and problems
when we required qualification on ambiguous field references. That was
done because in some cases, the ambiguity resulted in answers that were
not what they appeared to be. Wrong answers are a problem worth fixing.
I was astonished at the number of self-proclaimed "professional"
programmers who do not qualify field references consistently - had I
realized what problem that was I would have found a way to defer the
check until after we know that not all fields with the ambiguous name
are described as equal.

Mixed types in foreign key relationships work fine. It seems likely
that there are databases that use them. "Fixing" this "bug" will cause
a lot of pain for no gain - at least none obvious to me.


Best regards,


Ann

>
>
>