• Resolved Jaro

    (@pixtweaks)


    Hi,
    we have in error logs the following error:

    Error 32768 - Database error

    Duplicate entry 'lastNotificationID' for key 'PRIMARY'

    INSERT INTO wp_wfConfig (name, val, autoload) values ('lastNotificationID', '1', 'no')

    I’ve seen responses to the same issue that we should suppress errors. Well, please let me suggest a solution to change from INSERT into UPDATE statement and the issue would be solved, no error suppression would be needed. Error reporting is a messenger, not good to kill the messenger ??
    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support wfpeter

    (@wfpeter)

    Hi @pixtweaks, thank-you for your suggestion.

    UPDATE wouldn’t work in the instance we’re talking because it doesn’t fall back to INSERT if the record doesn’t exist. It’s more expensive a query on people’s servers to always check for the presence of certain records beforehand so we could look into the feasibility of something like INSERT ON DUPLICATE KEY UPDATE. We utilize WordPress’ inbuilt $wpdb->suppress_errors(true); function or PHP’s @ whenever we do that but third-party error reporting tools will often still show them.

    We do have a development case to address certain suppressed errors that aren’t issues to the functionality of Wordfence, but can be picked up like this. I’ve mentioned your observation to the team looking at that case.

    Many thanks,
    Peter.

    Thread Starter Jaro

    (@pixtweaks)

    Hi,
    thanks for the reply. How I see it that this table is config table wp_wfConfig so, when the plugin is activated, default settings is inserted, including lastNotificationID so UPDATE will work all the time, presuming there is no DELETE for this row.

    Regards,
    Jaro

    Plugin Support wfpeter

    (@wfpeter)

    Thanks for your reply, I’ve noted the precise circumstances of the query you mention to the team looking at making those changes.

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