[MDEV-8082] ON UPDATE is not preserved by CREATE TABLE .. SELECT Created: 2015-04-30  Updated: 2015-05-05  Resolved: 2015-05-05

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Temporal Types
Affects Version/s: 10.0, 10.1
Fix Version/s: 10.0.18

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-7778 impossible create copy of table, if t... Closed

 Description   

This script:

DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (
  vc VARCHAR(10) NOT NULL DEFAULT 'test',
  ts timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 0;
SHOW CREATE TABLE t2;

returns

+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t2    | CREATE TABLE `t2` (
  `vc` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT 'test',
  `ts` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+

Notice: DEFAULT is preserved, ON UPDATE is not.

The expected behaviour is to preserve both.



 Comments   
Comment by Alexander Barkov [ 2015-04-30 ]

The patch for mdev-7778 fixes this problem as well. Waiting for Serg to review 7778.

Generated at Thu Feb 08 07:24:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.