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

CONSTRAINT `time_period` failed for `sbtest`.`sbtest1` unclear error while adding time_period

    XMLWordPrintable

Details

    Description

      Reading DOC:
      https://mariadb.com/kb/en/library/temporal-data-tables/#adding-and-removing-time-periods

      Adding timestamp columns to the table:

      MariaDB [sbtest]> alter table sbtest1 add column time_1 timestamp(6);
      Query OK, 0 rows affected (0.046 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [sbtest]> alter table sbtest1 add column time_2 timestamp(6);
      Query OK, 0 rows affected (0.041 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [sbtest]> show create table sbtest1\G
      *************************** 1. row ***************************
             Table: sbtest1
      Create Table: CREATE TABLE `sbtest1` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `k` int(11) NOT NULL DEFAULT 0,
        `c` char(120) NOT NULL DEFAULT '',
        `pad` char(60) NOT NULL DEFAULT '',
        `time_1` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
        `time_2` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
        PRIMARY KEY (`id`),
        KEY `k_1` (`k`)
      ) ENGINE=InnoDB AUTO_INCREMENT=220753785 DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
      1 row in set (0.001 sec)
      

      Trying to add time_period:

      MariaDB [sbtest]> alter table sbtest1 add period for time_period(time_1, time_2);
      ERROR 4025 (23000): CONSTRAINT `time_period` failed for `sbtest`.`sbtest1`
      

      Why failed? What is time_period constraint?

      Attachments

        Activity

          People

            JoeCotellese Joe Cotellese
            shako Shahriyar Rzayev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.