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

Data truncated for column 'date_1' for alter ADD PERIOD FOR date_period command

    XMLWordPrintable

    Details

      Description

      Reading Application-time period tables doc:
      https://mariadb.com/kb/en/library/temporal-data-tables/#creating-tables-with-time-periods
      and
      https://mariadb.com/kb/en/library/temporal-data-tables/#adding-and-removing-time-periods

      It is clear that there is alter statement for adding time_period, but if we also have date_period why not to add it using alter as well? If yes it can be added to the DOC as well.
      If this step is not supported, then it should be prohibited by proper error message or syntax error:

      Adding columns to table:

      MariaDB [sbtest]> alter table sbtest1 add column date_1 date;
      Query OK, 0 rows affected (0.047 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [sbtest]> alter table sbtest1 add column date_2 date;
      Query OK, 0 rows affected (0.040 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 '',
        `date_1` date DEFAULT NULL,
        `date_2` date DEFAULT NULL,
        PRIMARY KEY (`id`),
        KEY `k_1` (`k`)
      ) ENGINE=InnoDB AUTO_INCREMENT=220753785 DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
      

      Trying to add date_period:

      MariaDB [sbtest]> ALTER TABLE sbtest1 ADD PERIOD FOR date_period(date_1, date_2);
      ERROR 1265 (01000): Data truncated for column 'date_1' at row 1
      

      Why? It is not clear.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              greenman Ian Gilfillan
              Reporter:
              shako Shahriyar Rzayev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.