Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2962 by Migrating from MySQL to PostgreSQL fails to properly initialize sequences

What version are you running?


What's the URL of the page containing the problem?


What steps will reproduce the problem?
1. Install ReviewBoard with MySQL database backend
2. Use rb-site manage ${OLD_SITE} dumpdb to dump the database
3. Install ReviewBoard with PostgreSQL database backend
4. TRUNCATE django_content_type CASCADE
5. TRUNCATE django_content_type CASCADE
6. rb-site manage ${NEW_SITE} loaddb dumpdb.json
7. Try to add a comment, create a review, etc.

What is the expected output? What do you see instead?

If should add the comment or create the review. Instead there's a 500 error. The following errors are in the log.

2013-04-24 18:32:51,325 - ERROR - Exception thrown for user dlee at http://rbtest.digium.internal/r/new/ duplicate key value violates unique constraint "diffviewer_diffsethistory_pkey"
DETAIL:  Key (id)=(7) already exists.

What operating system are you using? What browser?

Server is Ubuntu 12.04, x86_64. Browser is Chrome on OS X.

Please provide any additional information below.

The following script seems to fix up the sequences.

psql -t ${DB} -c "SELECT E'select setval(\'' || c.relname || E'\', (select max(id)+1 from ' || replace(c.relname, '_id_seq', '') || '), false);' FROM pg_class c WHERE c.relkind = 'S';" | psql ${DB}

You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:

You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to