UUID clash while importing data

I have a table in csv file with roughly 10 million records. The primary key in existing db is an integer field.

Old schema (in existing db):
create table T (id int primary key not null default autoincrement, …);
New schema (in cockroach):
create table T (id uuid primary key not null default gen_random_uuid(), oldid serial not null, …);

Then I import using:
IMPORT INTO T (oldid, …) CSV DATA (‘filename’);

I am expecting import to generate the random uuids for the id field.

It generates id but after some time, I get a collision:
ERROR: duplicate key in primary index: duplicate key: /Table/118/1/"\x00\x00j\x8eu\xb8A\xf2\x80\x005G:\xdc\x10\xf9"/0

Has anyone seen something similar? Am I doing something wrong?

Hi didwania,

It seems like you’ve uncovered a bug. Could you file an issue with the reproduction steps and whatever details you have?


Hi didwania – thank you for filing importccl: UUID clash while importing data · Issue #61203 · cockroachdb/cockroach · GitHub! This does look like a bug in IMPORT. I’ve followed up on that ticket with a bit more info.