• Resolved Slim Karaaslan

    (@slimx91)


    hey so lately I’ve been having issues with our WooCommerce search. I’ve been trying to REVERT MY KEYS. But I simply cannot.

    Meta Upload ID: VvU4jhLL

    I keep getting this error:

    Duplicate entry ‘simple_history_db_version’ for key ‘option_name’

    And now i have “Convert Keys” and “Revert Keys” as an option for wp_options :/

    Could you please help ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author OllieJones

    (@olliejones)

    Sorry for the hassle.

    It looks to me like your wp_options table has somehow gotten a duplicate name in it. There’s supposed to be a UNIQUE key (or a primary key) on the option_name column to prevent this.

    You can get rid of the duplicates by putting this query into phpmyadmin or some other MySQL / MariaDB client.

    DELETE o
    FROM wp_options o
    JOIN (
    SELECT option_name, MIN(option_id) option_id
    FROM wp_options
    GROUP BY option_name
    HAVING COUNT(*) > 1
    ) dups ON o.option_name = dups.option_name
    WHERE o.option_id > dups.option_id

    Then you should be able to convert or revert your keys.

    Would you be kind enough to try uploading your metadata again? I don’t think your upload went through.

    • This reply was modified 1 year, 3 months ago by OllieJones.
    Thread Starter Slim Karaaslan

    (@slimx91)

    hey when i run it i get an error unfortunately :(:

    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘o.option_id > dups.option_id’ at line 1

    Plugin Author OllieJones

    (@olliejones)

    Maybe the way I showed the query on multiple lines somehow turned into copypasta on your setup. Here is the deduplicating SQL command as a single long line.

    DELETE o FROM wp_options o JOIN ( SELECT option_name, MIN(option_id) option_id FROM wp_options GROUP BY option_name HAVING COUNT(*) > 1) dups ON o.option_name = dups.option_name WHERE o.option_id > dups.option_id
    Thread Starter Slim Karaaslan

    (@slimx91)

    I love the way you worded that lmao.
    Dude you are a legend. Thank you so much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘duplicate entry related errors’ is closed to new replies.