Jean-Christian Imbeault <jc@mega-bucks.co.jp> writes:
> Tom Lane wrote:
>> Fair enough, it would do that. But you still need the surrounding retry
>> logic to cope when a collision does happen.
> Why retry logic? I thought that if there was a collision one of the
> insert attempts would necessarily succeed and all the others fails. So
> no need for a retry since the record (pk) was inserted.
Well, if that's how your application logic works then you're done.
I was envisioning a case where you'd prefer to generate a new key
value and try the insert again.
regards, tom lane