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

View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)

Details

    • 10.2.4-1, 10.2.4-2

    Description

      MariaDB [test]> CREATE OR REPLACE VIEW v1 AS SELECT (2, 3) NOT IN ( SELECT i, j FROM t1 );
      Query OK, 0 rows affected (0.10 sec)
       
      MariaDB [test]> SELECT * FROM v1;
      ERROR 1241 (21000): Operand should contain 1 column(s)
      MariaDB [test]> SHOW CREATE VIEW v1;
      ERROR 1241 (21000): Operand should contain 1 column(s)
      

      The problem was introduced with this commit in 10.2:

      commit 180065ebb0db78ea5c955b54c9f7997dbcba3121
      Author: Sergei Golubchik <serg@mariadb.org>
      Date:   Sun Nov 27 19:50:10 2016 +0100
       
          Item::print(): remove redundant parentheses
          
          by introducing new Item::precedence() method and using it
          to decide whether parentheses are required
      

      The view is created with this definition in the frm file:

      query=select !(2,3) in (select `test`.`t1`.`i`,`test`.`t1`.`j` from `test`.`t1`) AS `(2, 3) NOT IN ( SELECT i, j FROM t1 )`
      

      Before the change, it was

      query=select (not((2,3) in (select `test`.`t1`.`i`,`test`.`t1`.`j` from `test`.`t1`))) AS `(2, 3) NOT IN ( SELECT i, j FROM t1 )`
      

      Test case

      CREATE TABLE t1 (i INT, j INT);
      INSERT INTO t1 VALUES (1,1),(2,2);
      CREATE OR REPLACE VIEW v1 AS SELECT (2, 3) NOT IN ( SELECT i, j FROM t1 );
      SELECT * FROM v1;
      DROP VIEW v1;
      DROP TABLE t1;
      

      Attachments

        Activity

          elenst Elena Stepanova created issue -
          serg Sergei Golubchik made changes -
          Field Original Value New Value
          Fix Version/s 10.2 [ 14601 ]
          Fix Version/s 10.2.4 [ 22116 ]
          elenst Elena Stepanova made changes -
          Labels regression 10.2-rc regression
          ratzpo Rasmus Johansson (Inactive) made changes -
          Sprint 10.2.4-1 [ 132 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Rank Ranked higher
          serg Sergei Golubchik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          serg Sergei Golubchik made changes -
          Status Stalled [ 10000 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Sprint 10.2.4-1 [ 132 ] 10.2.4-1, 10.2.4-2 [ 132, 134 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.2.4 [ 22116 ]
          Fix Version/s 10.2 [ 14601 ]
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 79185 ] MariaDB v4 [ 151523 ]

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.