Subject Re: [IBO] Re: Newbie transaction questions
Author Helen Borrie
At 08:42 PM 10-12-02 +0000, you wrote:
> >
> > Can both inserts and commits generate Key Violations (depending on
>the situation),
> > or is it only commits?

You shouldn't be thinking of "an insert causing a key violation". An
insert is a client-side operation. The server doesn't know about it until
the client actually posts an INSERT statement to the server.

Upon posting, the transaction which posts the INSERT statement knows only
about data inside its own "purview". The other transaction may have posted
an INSERT statement using the same key but, at this stage, there is no key
violation because the "public view" of the database cannot see either of
the posted rows.

Once one of the transactions commits the new key, the key violation will
occur when the second transaction posts the same key.

If your transaction has Autocommit true, the Post and the Commit occur in
one "hit". In that case, the first to post the new row wins. When the
second transaction tries to post a record having the same key, then the key
violation occurs.

Helen