Subject | Re: [firebird-support] Re: Foreign key violation, where there isn't |
---|---|
Author | Kjell Rilbe |
Post date | 2008-05-28T08:50:46Z |
Sándor Tamás (HostWare Kft.) wrote:
I know = comparisons ignore trailing blanks, but I'm not sure how
foreign key constraints act if two values differ only in trailing
blanks. I would suspect that it considers them not equal, but I'm
guessing. A join using = would join tables where key fields differ in
trailing blanks, but maybe FK:s don't?
Anyway, you can check for trailing blanks to rule this out as the culprit.
Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64
> Thank you for your help.Trailing blanks in varchar fields perhaps?
>
> I've tried it with ISQL, watched carefully for the proper values, inserted,
> created, altered from scratch, and I've got the same result.
>
> When I try a joined select between the two table, it shows me the right
> values, FB can find the record. But then, when I try an 'alter table' on
> the
> detail table, I got this FK violation error.
>
> Can it be a problem that I use a varchar field as primary, and foreign key?
I know = comparisons ignore trailing blanks, but I'm not sure how
foreign key constraints act if two values differ only in trailing
blanks. I would suspect that it considers them not equal, but I'm
guessing. A join using = would join tables where key fields differ in
trailing blanks, but maybe FK:s don't?
Anyway, you can check for trailing blanks to rule this out as the culprit.
Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64