Subject Re: Inserting into child table with foreign key constraint
Author jeff_j_dunlap
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...>
wrote:
> The trigger's working fine! :-) The error you got here was a primary
key/uniqueness violation, not a referential integrity violation. The
first record went in with a manually-determined PK value of 36. But
your generator was sitting there on 35 - with the next value to be
generated as 36. So, when the trigger fired, you got a PK violation.
>
> Perhaps you thought that poking that value in manually would somehow
cause the generator to synchronise itself with the table by some kind
of internal magic. It doesn't happen. In applications, if you're
generating keys you must make them unreachable by humans.
>
> ./heLen

You're totally right Helen, I did try poking that and higher values in
there to get the generator syncronized. It was a really dumb or rather
lack of experience mistake on my part using a domain that defaults the
value to zero but that won't happen again! :)