clrnd / discogs2pg

Discogs to PostgreSQL importer
BSD 3-Clause "New" or "Revised" License
35 stars 8 forks source link

Composite primary keys fail in index.sql #1

Closed gerbal closed 6 years ago

gerbal commented 8 years ago

The composite primary keys on indexes.sql are not unique and are not reliable not-null.

clrnd commented 8 years ago

Could you please elaborate?

  1. Are you seeing them fail on specific data?
  2. What does "not reliable not-null" mean?
  3. What kind of solution would you suggest? (automatic serial?)

Thanks!

RobSis commented 7 years ago

Hello. I had the same issue back when I was indexing. (don't remember the exact error message, though).

I remember I had to remove all duplicate rows from all intermediate tables to make indexing possible.

EDIT: the error message was something like SQL error: ERROR: could not create unique index "master_artist" DETAIL: Key (master_id)=() is duplicated

clrnd commented 6 years ago

Hey! This was a bug and I fixed it a time ago.

z-yan commented 6 years ago

Hello. I have a similar issue with index creation: ALTER TABLE ERROR: could not create unique index "master_artist_pkey" DETAIL: Key (master_id, artist_id)=(59474, 1355202) is duplicated.

clrnd commented 6 years ago

Hi, this is a different thing though. But let me see, you can always drop the unique constraint and have the performance improvement of the index anyway.

clrnd commented 6 years ago

So yeah indexes were quite broken 😂 I'll be doing a release soon.