• I’ve been upgrading to 2.0.2 from 1.5.2. Other than Lazy Image Layout, everything seems to be working great, with the exception of posting! When I try to post I get this message:

    WordPress database error: [Duplicate entry '0' for key 1]
    INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES ('0','_pingme','1')

    WordPress database error: [Duplicate entry '0' for key 1]
    INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUES ('0','_encloseme','1')

    Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/sheff/konnorwithak.com/blog/wp-includes/wp-db.php:102) in /hsphere/local/home/sheff/konnorwithak.com/blog/wp-admin/post.php on line 60

    Does anyone know how to fix this? I’m assuming it’s an error in my database.

Viewing 11 replies - 1 through 11 (of 11 total)
  • After you finished copying the upgrade files, did you run /blog/wp-admin/upgrade.php?

    Thread Starter cosmogrrl

    (@cosmogrrl)

    I have, I also just re-ran it and I still get the same error ??

    Well, not sure if this is the right direction to start, but here’s some info on the “Headers Already Sent” error.

    It seems like I’ve seen those DB errors before, but my initial search didn’t turn ’em up. I’ll try some more shortly.

    Oh – and make sure you’ve either turned off all your plugins or updated them.

    Thread Starter cosmogrrl

    (@cosmogrrl)

    Alrightie, I’ve narrowed down the problem, only now I can’t fix it. It seems that when I post it sets the post id to ‘0’, not the next sequential number (in this case it should be post #69). How do I solve that? The problem seems to lie in my wp_postmeta table. When I compare it to one of my other wordpress databases I notice that the difference lies in the “cardinality” of the PRIMARY. Could this be because not only did I do an upgrade, I also changed domains? I backed up the database and imported it to the new domain, then ran upgrade.php. The MySql versions were not the same. Should I instead be using my original database somehow by editing wp-config.php?

    Thread Starter cosmogrrl

    (@cosmogrrl)

    Oh yeah – forgot to mention – I’m upgrading from: 1.5.1.3

    Cosmogrrl, I have the exact same problem but haven’t found a fix yet. I had WP 1.2 running on a staging server (for testing) and a colo server (production). I upgraded on the staging server to 2.0, then dumped the db and installed wp 2.0 from scratch on the colo server. I manually changed all of the server references in the dumped 2.0 db from “staging” to “production” (according to the WP notes on moving the db to a new server). Then I loaded the modified 2.0 db dump from the staging server onto the colo server. This worked for existing data, but somehow it’s munged the wp_postmeta table. The post ids are not incrementing and only the very first post (post id=0) got submitted (because there was no id=0 initially – posts started with id=1). All subsquent posts try to submit to the same id (id=0) and fail.

    I wish I were more of a db expert here. I’m not sure how to tell mysql to autoincrement and to reset the next id value to be 84 (which is 1 more than the number o posts currently in the database). I installed phpMyAdmin but that isn’t helping me much. More important is *why* did this happen during the migration. Did I mess something up? Or did I miss something during the migration?

    Did you go from 1.2 straight to 2.0? My understanding is that you’d want to go 1.2 -> 1.5.x -> 2.x with each upgrade.php along the way.

    Hmmm. I don’t think so. I think I went straight to 2.0. I hope that doesn’t mean I’m dead in the water.

    I have the old 1.2.1 db. I should be able to load that db on the staging server, then install 1.5 and do the migration there. Then I can do the 1.5 to 2.0 migration on the staging server as well to get a db that I can push to the production server. I’d lose one post on the production server, but that’s easily saved off before reloading the properly migrated db on the production server. And I can manually repost afterwards.

    I’ll give that a try. I don’t know what else to try at the moment.

    Yep, that’s what I’d try. Save the dbs along the way just in case you need to regress (but sounds like you already know that).

    Thanks HandySolo – looks like doing the migration in the proper order fixed things. I migrated from 1.2.1 to 1.5, then migrated from 1.5 to 2.0.2. I also did this on the staging server and when I was done I was able to change the appropriate entries in the db manually to move the db to the production server.

    Looks like it’s working properly now. I can post new messages and the post ids look correct.

    Thanks again.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Error when posting’ is closed to new replies.