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

INSERT INTO view_name () VALUES () fails with ER_WRONG_VALUE_COUNT_ON_ROW

    XMLWordPrintable

Details

    Description

      An attempt to insert all default values into a view fails with "Column count doesn't match value count at row 1", while the same statement with the base table works all right. I couldn't find any explanation or a mention of such limitation in the docs.

      CREATE TABLE t1 (i INT DEFAULT '0');
      CREATE VIEW v1 AS SELECT * FROM t1;
      INSERT INTO v1 () VALUES ();
       
      # Cleanup
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.2 259e5243

      mysqltest: At line 3: query 'INSERT INTO v1 () VALUES ()' failed: 1136: Column count doesn't match value count at row 1
      

      Same with INSERT INTO v1 VALUES ().

      Reproducible on all of MariaDB and previous versions of MySQL. It has been recently fixed in MySQL 8.0.22.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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