WordPress.org

Support

Support » Plugins and Hacks » [Resolved] WordPress database error: [Multiple primary key defined]

[Resolved] WordPress database error: [Multiple primary key defined]

Viewing 9 replies - 1 through 9 (of 9 total)
  • This is in the debug.log:

    [21-Dec-2012 14:17:01] WordPress database error Multiple primary key defined for query ALTER TABLE wp_simple_post_templates ADD PRIMARY KEY (‘id’) made by require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), include_once(‘/plugins/simple-post-template/simple-post-template.php’), SimplePostTemplate->__construct, SimplePostTemplate->activate, dbDelta

    (note I changed the backticks of the primary key to apostrophe’s in this post so they appear)

    Same issue. Had to disable the plugin as it was adding hundreds of lines to an error log every minute.

    WordPress 3.5

    Same here, updated this plugin and got tons of errors.

    Same here. In my case it’s a table I define in my own plugin, not a third party wordpress plugin, but the code (run on plugin_activate) worked under the previous WP version:

    $sql = "CREATE TABLE $cpr_tablesname (
      id varchar(100) NOT NULL,
      PRIMARY KEY (id)
    );";
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    dbDelta($sql);

    (example simplified by removing other fields)

    However, on double checking the docs for dbdelta I found the follwoing:

    You must have two spaces between the words PRIMARY KEY and the definition of your primary key.

    This fixed it for me. Suggest you check the source of the plugin in question and if that is the problem contact the author.

    Plugin Author Clifton Griffin

    @clifgriffin

    Hey guys!

    Hadn’t heard about this error until yesterday when a kind soul e-mailed me to ask me about it.

    I just uploaded version 2.0.5 that implements the fix above from AdamConway, as well as several other recommendations from the dbDelta article.

    I did a brief test and did not see any errors in my log.

    Regards,
    Clif

    I am getting this error now.

    pache2/pixelloop-error.log
    [Mon Jul 08 14:45:16 2013] [error] [client 90.206.209.32] WordPress database error Multiple primary key defined for query ALTER TABLE c2sjh_wpcreviews ADD PRIMARY KEY (id) made by require_once(‘wp-admin/admin.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), call_user_func_array, WPCustomerReviews->init, WPCustomerReviews->check_migrate, WPCustomerReviewsAdmin->createUpdateReviewTable, dbDelta, referer: http://pixelloop.org/wp-admin/update.php?action=upgrade-plugin&plugin=wp-customer-reviews%2Fwp-customer-reviews.php&_wpnonce=df8baca746

    Is this something that can be patched again? is this the same or different to the previous error?

    Plugin Author Clifton Griffin

    @clifgriffin

    It looks like your error is coming from WP Customer Reviews, not my plugin.

    ooops my bad, I came across this thread when googling my error but it must have been a different part.

    Thanks

    ooops my bad, I came across this thread when googling my error but it must have been a different part.

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] WordPress database error: [Multiple primary key defined]’ is closed to new replies.