Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33083

"AFTER UPDATE" trigger does not fire when duplicate inserted with "ON DUPLICATE KEY UPDATE"

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • For INSERT.. ON DUPLICATE KEY UPDATE, AFTER UPDATE trigger is now always executed in case of duplicate key, even if update did not result in any data changes. This matches the existing behavior of UPDATE command.
    • Q3/2025 Maintenance, Q4/2025 Server Maintenance, Q2/2026 Server Maintenance

    Description

      According to https://mariadb.com/kb/en/trigger-overview/ - the following triggers should fire when an ON DUPLICATE KEY insert is used and a duplicate is detected:

      BEFORE INSERT;
      BEFORE UPDATE;
      AFTER UPDATE.

      We're seeing that the AFTER UPDATE trigger never fires when a duplicate row is inserted. See attached test case and output.

      Tested on 10.6.16 and 11.0.4

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            psumner Phil Sumner
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.