[ipboard.rb] ERROR: duplicate key value violates unique constraint "import_ids_pkey" (PG::UniqueViolation)

Hello, i’m trying to import an IPB 3.4 forum using ipboard.rb, i got this error with topic import :

.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:56:in `exec': ERROR:  duplicate key value violates unique constraint "import_ids_pkey" (PG::UniqueViolation)
DETAIL:  Key (val)=(discussion#2264) already exists.

I deleted the 2264 topic from sql database and launch the script again, now its ok… but i lost the topic :sob: and 5 or 6 other important topics with the same error. What’s wrong ? How can i import these topics ?

Thanks.

Maybe the script is using the wrong ID? Or maybe the version you’re coming from isn’t what the script expects.

You didn’t run the script, then delete topics and try to run it again did you?

I got this issue only with 9 topics, every else is ok, and i allways start from fresh install database, checked with differents sql backups and differents hosts. No error found in ipboard (index, database etc.).
I dont understand. :confused:

1 Like

Souds like something non-obvious. My best guess is something like. . . well. I don’t have a best guess.

Maybe the query is somehow returning those topics twice somehow? You might try adding a .where ID=123 to the query that’s getting the topics to see if it’s somehow getting it twice and then figure out why.

Should i add it to ipboard.rb file ?

I world look at the query in the script and do it by hand as I described and see what the results are

Ok, I found ! :sunglasses:
Thank you for directing me to the solution. Look, I don’t know why but several posts related to problematic topics had the field new_topic = 1.

Note: I manually edited the fields and everything is ok now.

1 Like