db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: [Derby-359]Skipping over user inserted values into GENERATED BY DEFAULT identity columns....
Date Thu, 15 Dec 2005 05:48:21 GMT
Satheesh Bandaram wrote:
> Current problem with GENERATED BY DEFAULT is that once it generates a
> value that is already present in the table, *NONE* of the future inserts
> can succeed. I can understand the current insert failing when there is a
> duplicate value, but preventing all future inserts (fails because they
> keep generating the same value, I suppose) seems wrong.
> I would be happy if Derby can consume identity values even if current
> insert statement fails. For this case, some insert statements may fail
> when they generate a value that is already present. But subsequent
> inserts should pass.

I wouldn't! I think you are saying that it's ok for inserts to fail
until a value is found that is not currently used. If I pre-loaded a
table with 100,000 rows with consective values, then it's going to
require 100,000 subsequent failing inserts before one succeeds. Ie. the
counter has gone beyond the max value used. That would result in very
unhappy customers in an e-commerce site.

I wonder if the counter should be bumped to the max value on a failed
insert, there is only a problem if a unique index exists, so getting the
max will be fast.


View raw message