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

got error 'Invalid default value for timestamp column' when trying create copy table structure from view

    XMLWordPrintable

Details

    Description

      MariaDB [test]> CREATE TABLE `t_example` (
          ->   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
          ->   `description` VARCHAR(10) DEFAULT NULL,
          ->   `insert_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
          ->   PRIMARY KEY (`id`)
          -> );
      Query OK, 0 rows affected (0.05 sec)
       
      MariaDB [test]> CREATE VIEW `v_example` AS (
          -> SELECT
          ->   `id`          AS `id`,
          ->   `description` AS `description`,
          ->   `insert_time` AS `insert_time`
          -> FROM `t_example`);
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> CREATE TEMPORARY TABLE `tt_example` SELECT * FROM `v_example` WHERE 0;
      ERROR 1067 (42000): Invalid default value for 'insert_time'
      MariaDB [test]> SELECT @@SQL_MODE;
      +---------------------------------------------------------------------------------------------------------------------------+
      | @@SQL_MODE                                                                                                                |
      +---------------------------------------------------------------------------------------------------------------------------+
      | NO_BACKSLASH_ESCAPES,STRICT_ALL_TABLES,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
      +---------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> SELECT VERSION();
      +-----------------+
      | VERSION()       |
      +-----------------+
      | 10.1.17-MariaDB |
      +-----------------+
      1 row in set (0.00 sec)
      
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            mikhail Mikhail Gavrilov
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.