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

MariaDB not use DEFAULT value even when inserted NULL for NOT NULLABLE column.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.67, 5.2.14, 5.3.12, 5.5, 10.1, 10.0
    • Fix Version/s: 10.1.10
    • Component/s: Triggers
    • Labels:
    • Environment:
      Linux
    • Sprint:
      10.1.9-3, 10.1.10

      Description

      MariaDB not use DEFAULT value even when inserted NULL for NOT NULLABLE column.

      Expected similar behavior as for AUTOINCREMENT and would be usefull for generation right value in trigger.
      http://stackoverflow.com/questions/15473654/mariadb-before-insert-trigger-for-uuid

      Of course in described example much better if MariaDB would support UUID data type and generate automaticaly UUID for AUTOINCREMENT fields.

      But I think it would be good idea if MariaDB would allow use any function for default value it would be good replacement of generators.

      For example:

      CREATE TABLE `c` (
        `id` VARBINARY(36) NOT NULL DEFAULT UUID(),
        PRIMARY KEY (`id`)
      ) ENGINE=INNODB DEFAULT CHARSET=utf8

      And it would here appropriate analogy with the behavior of AUTOINCREMENT

      And if make possible to work with property table autoincrement into functions would be generally be a bomb. It would be possible create complicated ID with concatenation static identifier if schema and autoincrement.

      For example:
      A-1
      A-2
      A-3
      A-5

      and on another schema for same table
      B-1
      B-2
      B-3
      B-4

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              mikhail Mikhail Gavrilov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: