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

ER_TOO_MANY_ROWS should be checked after CHECK OPTION in view while Update Returning Into

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • N/A
    • 13.2
    • Server
    • None
    • Q4/2026 Server Maintenance

    Description

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(10);
      CREATE VIEW v1 AS SELECT * FROM t1 WHERE a < 100 WITH CHECK OPTION;
       
      #no error expected -after check options failure there is 1 row update, which could be returned
      --error 1172
      UPDATE IGNORE v1 SET a=IF(a=1,2,1000) RETURNING a INTO @a;
      SELECT * FROM t1;
       
      DROP VIEW v1;
      DROP TABLE t1;
      

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(10);
      CREATE VIEW v1 AS SELECT * FROM t1 WHERE a < 100 WITH CHECK OPTION;
      UPDATE IGNORE v1 SET a=IF(a=1,2,1000) RETURNING a INTO @a;
      ERROR 42000: Result consisted of more than one row
      SELECT * FROM t1;
      a
      2
      10
      

      without returning:

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(10);
      CREATE VIEW v1 AS SELECT * FROM t1 WHERE a < 100 WITH CHECK OPTION;
      UPDATE IGNORE v1 SET a=IF(a=1,2,1000);
      Warnings:
      Warning	1369	CHECK OPTION failed `test`.`v1`
      SELECT * FROM t1;
      a
      2
      10
      DROP VIEW v1;
      DROP TABLE t1;
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 4h 58m
                  4h 58m
                  Remaining:
                  Remaining Estimate - 4h 58m
                  4h 58m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Git Integration

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