Support » Plugin: EWWW Image Optimizer » WordPress database error Multiple primary key defined for query

  • Resolved Steve

    (@steveatty)


    I’m seeing this error in my php error logs :

    [24-Jan-2021 22:50:48 UTC] WordPress database error Multiple primary key defined for query ALTER TABLE blogs_2_ewwwio_queue CHANGE COLUMN id id int(14) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY made by do_action(‘admin_init’), WP_Hook->do_action, WP_Hook->apply_filters, ewww_image_optimizer_admin_init, ewww_image_optimizer_upgrade, ewww_image_optimizer_install_table, dbDelta

    I’m on version 6.00

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

    (@nosilver4u)

    There should not be another primary key, so you’ll want to take a look at the existing indices on the ewwwio_queue table and remove any primary keys that aren’t on the ID column.

    Thread Starter Steve

    (@steveatty)

    I think I’ve found it.

    I’m running MySQL 8.0.22

    Display width specification for integer data types was deprecated in MySQL 8.0.17

    So I think what is happening is that the WordPress dbDelta is picking up that ID has no width set compared to the table definition in your code, and tries to set it. But as the column already has an index on it the alter code fails.

    Plugin Author nosilver4u

    (@nosilver4u)

    Hmm, that’s possible, as I haven’t run EWWW IO on a MySQL 8 server. I’m a bit surprised no one else has reported the issue previously, but I’ll test it out and see if I can replicate it.
    I suspect the fix is to simply remove the display widths, but I’ll have to test and see if that causes any issues.

    Plugin Author nosilver4u

    (@nosilver4u)

    Yup, you were right on! Installed on a clean server with 8.0.22, then changed version to trigger upgrade routine, and it threw errors on both tables.
    I removed the display widths, increased the version, and no errors, hurrah!
    Also tested on my dev server with Maria 10.5 and no errors there either, so I’ll include this in the next release.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.