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

SET NEW = (SELECT ...) in a BEFORE INSERT trigger fails with ER_OPERAND_COLUMNS (1241) on a single-column table

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Major
    • Resolution: Unresolved
    • 13.2
    • 13.2
    • Triggers
    • None
    • Not for Release Notes
    • Q1/2027 Server Development

    Description

      CREATE TABLE t (a INT);                                                                                                                                                                                          
      CREATE TRIGGER tr BEFORE INSERT ON t FOR EACH ROW SET NEW = (SELECT 5);                                                                                                                                          
      INSERT INTO t VALUES (1);  -- ERROR 1241 (21000): Operand should contain 1 column(s); expected: row 5 inserted 
      

      CLI Output

      13.2.0-opt>CREATE TABLE t (a INT);                                                                                                                                                                                          
      Query OK, 0 rows affected (0.008 sec)
       
      13.2.0-opt>CREATE TRIGGER tr BEFORE INSERT ON t FOR EACH ROW SET NEW = (SELECT 5);                                                                                                                                          
      Query OK, 0 rows affected (0.005 sec)
       
      13.2.0-opt>INSERT INTO t VALUES (1); 
      ERROR 1241 (21000): Operand should contain 1 column(s)
      13.2.0-opt>
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              ramesh Ramesh Sivaraman
              Ramesh Sivaraman Ramesh Sivaraman
              Dmitry Shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 0.5h Remaining Estimate - 1.5d
                  1.5d
                  Logged:
                  Time Spent - 0.5h Remaining Estimate - 1.5d
                  0.5h

                  Git Integration

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