I cut back my Drupal 5.21 installation as far as I could, deleting and uninstalling modules no longer in use, before updating to get things as trim as possible. I'm not even using a custom theme for my hobbyist site.

Imagine my surprise when my favorite CMS' upgrade from 5.21 to 6.15 throws all sorts of crazy errors. This happens if I just opt to have "system" upgrade itself, or other modules. The vast majority of the problems all live in "system".

I'm seeing several drop index failures, and most of those indexes don't exist at the end of the process. But a couple of them do exist despite the error. I initially ran with these errors and found to my horror that adding content was causing duplicate key violations and all sorts of terrible things, so I reverted back.

I'm also seeing some gallery-related menu_router inserts overrunning some values. Not sure what the devil is going on there.

Here's the error log in handy PDF format:
http://www.mediafire.com/file/uoq2d2zz2my/20100125_d5_to_d6_upgrade_fail...

I'm running PostgreSQL 8.4.2 on Fedora 11.

Any help is very greatly appreciated. I've reverted back to 5.21 for the time being, but I have a new Drupal 6 book I'd like to use so want to upgrade to stay current.

Seriously if I could just export all my content to a file and stream it back into a new version of the site I'd do so. I'd had such high hopes after hearing nice things from the upgrade screencast. :-/

Comments

PMunn’s picture

I pulled out the Gallery module, which I wasn't really using anyhow, and the upgrade still threw index and primary key dropping errors.

Initially it looked good, but then, not so good. I'm now unable to post content as a non-admin user. It throws key violation errors on the node, node_revisions, and subscriptions tables. Fantastic.

pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "node_revisions_pkey" in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "node_vid_idx" in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "forum_pkey" in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

pg_query() [function.pg-query]: Query failed: ERROR: syntax error at end of input LINE 12: s.author_uid IN (2, -1) AND ^ in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

I'm positive this has to do with using PostgreSQL. I'm not sure how I'm going to be able to troubleshoot the upgrade process given how complex it is. Help? Anyone?

PMunn’s picture

Trying again, I managed to still get the index dropping errors.

This time I noticed a sequence error when adding a post.

pg_query() [function.pg-query]: Query failed: ERROR: currval of sequence "node_revisions_vid_seq" is not yet defined in this session in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

the first topic causes that, entering a second topic causes a meltdown. Logging out shows the "welcome to your new drupal website" message and getting back in as the admin user shows the following error entries.

pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "node_revisions_pkey" in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

query: INSERT INTO node_revisions (nid, uid, title, body, teaser, log, timestamp, format) VALUES (0, 2, 'sample topic.', 'The PSN sample topic goes here. Will it blow up?', 'The PSN sample topic goes here. Will it blow up?', '', 1267065612, 1) in /www/drupal/farbot-6.15/includes/common.inc on line 3467.

pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "node_vid_idx" in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

query: INSERT INTO node (vid, type, language, title, uid, status, created, changed, comment, promote, moderate, sticky, tnid, translate) VALUES (0, 'forum', '', 'sample topic.', 2, 0, 1267065612, 1267065612, 2, 0, 0, 0, 0, 0) in /www/drupal/farbot-6.15/includes/common.inc on line 3467.

pg_query() [function.pg-query]: Query failed: ERROR: duplicate key value violates unique constraint "forum_pkey" in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

query: INSERT INTO forum (tid, vid, nid) VALUES (4, 0, 0) in /www/drupal/farbot-6.15/modules/forum/forum.module on line 281.

pg_query() [function.pg-query]: Query failed: ERROR: syntax error at end of input LINE 12: s.author_uid IN (2, -1) AND ^ in /www/drupal/farbot-6.15/includes/database.pgsql.inc on line 139.

query: INSERT INTO subscriptions_queue (uid, name, mail, language, module, field, value, author_uid, send_interval, digest, last_sent, load_function, load_args, is_new) SELECT u.uid, u.name, u.mail, u.language, s.module, s.field, s.value, s.author_uid, s.send_interval, su.digest, COALESCE(sls.last_sent, 0), 'subscriptions_content_node_load', '', '1' FROM subscriptions s INNER JOIN subscriptions_user su ON s.recipient_uid = su.uid INNER JOIN users u ON su.uid = u.uid LEFT JOIN subscriptions_last_sent sls ON su.uid = sls.uid AND s.send_interval = sls.send_interval WHERE s.module = 'node' AND s.field = 'nid' AND s.author_uid IN (2, -1) AND in /www/drupal/farbot-6.15/sites/all/modules/subscriptions/subscriptions.module on line 339.

I'm sure this is postgresql related, but I have no idea how to fix it. Help?

PMunn’s picture

I can help if someone can give me a clue as to where in the source to look for the kinds of sequence modifications that are being made. As my numerous patches for PostgreSQL support show I'm more than happy to dive in and try and fix the code so it works properly on my system and then share my findings for public review.

So, in essence, please help me help my fellow PostgreSQL friends.

PMunn’s picture

It looks like 6.16's fix for this:
http://drupal.org/node/261258

has covered this problem for me. My upgrade to 6.16 is so far OK. Nice!

PMunn’s picture

I didn't check my logs closely enough last night.

Adding a new node generated a sequence error:

pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: currval of sequence &quot;node_revisions_vid_seq&quot; is not yet defined in this session in /www/drupal/farbot-6.16/includes/database.pgsql.inc on line 139.

Aaand my second post also broke. "Post could not be saved." That's the end of that. Back to 5. Boohoo!

PMunn’s picture

Apparently, according to one bug I found, this is because my site is so old, e.g. came from a 4.x release of Drupal, through 5, and now into 6. A couple of the tables are not properly linked to their sequences for key values.

I've used the queries there to solve my problem, so far.

http://drupal.org/node/301818#comment-2678376