gen_random_uuid key collision

Поиск
Список
Период
Сортировка
От jesusthefrog
Тема gen_random_uuid key collision
Дата
Msg-id CAH_wARuGPc6xDLGLo4U1=gvuKvnKO3NVjwzkFef5sPETQ9-Hcg@mail.gmail.com
обсуждение исходный текст
Ответы Re: gen_random_uuid key collision  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: gen_random_uuid key collision  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: gen_random_uuid key collision  (Mark Dilger <mark.dilger@enterprisedb.com>)
Список pgsql-general
Hello, I'm hoping someone might be able to shed a little light on a strange situation I encountered recently.

I work with a postgres instance which has dozens (probably hundreds) of tables which each have a column defined as "uuid primary key default gen_random_uuid()".

Most of the time this is fine, but one specific table has recently started repeatedly having inserts fail because of a unique constraint violation involving the primary key. The table only has ~10,000 rows, but I'll sometimes see two or three collisions in a single day. No other table (even those with many, many more rows) exhibit this issue.

We're running postgres 12, so I believe the gen_random_uuid function is provided by the pgcrypto extension, but either way it'll be the same for that entire database instance, so I can't explain why only one table would be having problems if it were due to a bug in the function. Also, since I believe it just uses openssl (which we have linked) to generate random bytes, the chance of a bug should be very low.

Anyone have any thoughts on this?

--
-----BEGIN GEEK CODE BLOCK-----
  Version: 3.12
  GIT d- s+ a- C++++ L+++ S++ B+ P++>++++ E++ W+++
  N o? K- !w++++ O- M- V? PS++ PE- Y+ PGP t+ 5+++
  X R+ tv b+++ DI++ D++ G+ e-- h- r++ y
------END GEEK CODE BLOCK------

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Query takes around 15 to 20 min over 20Lakh rows
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: gen_random_uuid key collision