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

ERROR 1054 (42S22): Unknown column 'X' in 'NEW' in trigger

    XMLWordPrintable

Details

    Description

      From https://stackoverflow.com/questions/76985048/triggers-not-working-as-expected-for-set-columns-in-mariadb:

      Simplified version:

      CREATE TABLE t1 ( m set('sms') NOT NULL);
      CREATE TABLE t2 (i int);
      CREATE TABLE u (i int);
       create or replace trigger t1 AFTER INSERT ON t1 FOR EACH ROW INSERT IGNORE INTO t2 SELECT u.i from u JOIN (SELECT 'sms' AS method) m ON FIND_IN_SET(m.method, NEW.m);
      insert into t1 values ('sms');
      ERROR 1054 (42S22): Unknown column 'm' in 'field list'
      

      Requires the NEW.m reference to be in the JOIN ON criteria.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              danblack Daniel Black
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 0.25h
                  0.25h

                  Git Integration

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