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

Allow functions for column default values

    XMLWordPrintable

    Details

      Description

      With datetime we can do:

      CREATE TABLE t1 (
      updatedTime datetime DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP()
      );
      

      We should be able to use any function as a default on any data type, like this:

      CREATE TABLE t1 (
      myCol longtext DEFAULT JSON_OBJECT('a',1,'b',2),
      lottoNumber int(11) DEFAULT myUDF(),
      updatedBy varchar(255) DEFAULT CURRENT_USER() ON UPDATE CURRENT_USER()
      );
      

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            manjot Manjot Singh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration