[MDEV-20253] DEFAULT is erroneously copied in `CREATE..SELECT column` Created: 2019-08-05  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.11

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

Issue Links:
Relates
relates to MDEV-18918 SQL mode EMPTY_STRING_IS_NULL breaks ... Closed

 Description   

DEFAULT is erroneously copied in `CREATE..SELECT column`

CREATE OR REPLACE TABLE t1 (a VARCHAR(10) DEFAULT 'x');
CREATE OR REPLACE TABLE t2 AS SELECT a FROM t1;
SHOW CREATE TABLE t2;

+-------+------------------------------------------------------------------------------------------+
| Table | Create Table                                                                             |
+-------+------------------------------------------------------------------------------------------+
| t2    | CREATE TABLE `t2` (
  `a` varchar(10) DEFAULT 'x'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+------------------------------------------------------------------------------------------+

Notice, the default value was copied from `t1.a` to `t2.a`. It does not look correct. It should not copy DEFAULT.


Generated at Thu Feb 08 08:58:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.