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

Persistent virtual fields don't insert with auto_incremented fields

    Details

    • Type: Bug
    • Status: Confirmed
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.3.12, 10.1, 10.0, 5.5
    • Fix Version/s: 10.1, 10.0
    • Component/s: Virtual Columns
    • Labels:
    • Environment:
      Installed via yum on Redhat

      Description

      MariaDB [testdb]> CREATE TABLE `cats` (
          ->   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
          ->   `name` varchar(255),
          ->   `full_nm` varchar(255) AS (TRIM(CONCAT(name, ' - ', id))) PERSISTENT,
          ->   `display_nm` varchar(255) AS (TRIM(CONCAT(name, ' - ', id))) VIRTUAL,
          ->     PRIMARY KEY (`id`)
          ->   ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
      Query OK, 0 rows affected (0.06 sec)
      
      MariaDB [testdb]> insert into cats (`name`) values ('freddy'), ('sammy'), ('spot'), ('boots');
      Query OK, 4 rows affected (0.00 sec)
      Records: 4  Duplicates: 0  Warnings: 0
      
      MariaDB [testdb]> select * from cats;
      +----+--------+------------+------------+
      | id | name   | full_nm    | display_nm |
      +----+--------+------------+------------+
      |  1 | freddy | freddy - 0 | freddy - 1 |
      |  2 | sammy  | sammy - 0  | sammy - 2  |
      |  3 | spot   | spot - 0   | spot - 3   |
      |  4 | boots  | boots - 0  | boots - 4  |
      +----+--------+------------+------------+
      4 rows in set (0.00 sec)
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Thanks for the report.
            As a workaround, you can perform an operation on the table (any void operation, just to get virtual column values updated, e.g. ALTER TABLE cats FORCE or UPDATE cats SET name = name, etc.).

            Igor Babaev,

            If it's a known limitation, please reassign it back to me or directly to Ian Gilfillan to update the documentation.

            Show
            elenst Elena Stepanova added a comment - Thanks for the report. As a workaround, you can perform an operation on the table (any void operation, just to get virtual column values updated, e.g. ALTER TABLE cats FORCE or UPDATE cats SET name = name , etc.). Igor Babaev , If it's a known limitation, please reassign it back to me or directly to Ian Gilfillan to update the documentation.

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                terrycullen Terry Cullen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: