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

INSERT with no fields names on a table with Virtual Columns raises an error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • None
    • None
    • None

    Description

      One can INSERT a row into a table without specifying the fields names. But if the table contains Virtual Columns, you don't include those values in the statement. But then, MariaDB says that column count doesn't match.

      MariaDB [test]> DROP VIEW IF EXISTS `t1`;
      Query OK, 0 rows affected, 1 warning (0.00 sec)

      MariaDB [test]> DROP TABLE IF EXISTS `t1`;
      Query OK, 0 rows affected (0.46 sec)

      MariaDB [test]> CREATE TABLE `t1` (
      -> `a` INTEGER UNSIGNED NULL DEFAULT NULL,
      -> `b` INTEGER UNSIGNED GENERATED ALWAYS AS (`a` + 1) PERSISTENT
      -> )
      -> ENGINE = Aria
      -> ROW_FORMAT = PAGE;
      Query OK, 0 rows affected (0.18 sec)

      MariaDB [test]> INSERT INTO `t1` VALUES (1);
      ERROR 1136 (21S01): Column count doesn't match value count at row 1

      Attachments

        Activity

          People

            elenst Elena Stepanova
            f_razzoli Federico Razzoli
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.