My guess is that Iin 99% collision could occur during insert. Most of the time db will just not allow to insert duplicated record.
Sort of the distinction between unspecified behaviour and undefined behaviour in C.
You need some UX like an error message in a red rectangle or something.
the solution might as well just be not to care about this case (no sarcasm).
Your application might not care about treating this error, but the DB will report it.