WordPress.org

Ready to get started?Download WordPress

Forums

Simple Content Templates
[resolved] WordPress database error: [Multiple primary key defined] (10 posts)

  1. qaws
    Member
    Posted 1 year ago #

    If I have WP_DEBUG set to true I get the following message:

    WordPress database error: [Multiple primary key defined]
    ALTER TABLE wp_simple_post_templates ADD PRIMARY KEY (id)

    http://wordpress.org/extend/plugins/simple-post-template/

  2. qaws
    Member
    Posted 1 year ago #

    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)

  3. obsessedwithfilm
    Member
    Posted 1 year ago #

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

    WordPress 3.5

  4. tpecop
    Member
    Posted 1 year ago #

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

  5. AdamConway
    Member
    Posted 1 year ago #

    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.

  6. Clifton Griffin
    Member
    Plugin Author

    Posted 1 year ago #

    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

  7. one3rdnerd
    Member
    Posted 1 year ago #

    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?

  8. Clifton Griffin
    Member
    Plugin Author

    Posted 1 year ago #

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

  9. one3rdnerd
    Member
    Posted 1 year ago #

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

    Thanks

  10. one3rdnerd
    Member
    Posted 1 year ago #

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

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.