When creating a table from a view and replicating the table creation from 10.0 to 10.1 a default value is lost.
replicated from (A)10.0.19 >(B) 10.0.19 >(C) 10.1.21.
On A:
MariaDB [test]> create table t1(
|
-> `field1` bigint(20) NOT NULL,
|
-> `field2` bigint(20) NOT NULL,
|
-> `text1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
|
-> `type1` enum('Broad','Exact','Phrase','WebSite','Content','SuperBroad','TrueExact','PhraseCore','PhraseExact','PhraseSynonym','Custom') DEFAULT NULL)
|
-> engine=innodb charset=utf8
|
-> ;
|
Query OK, 0 rows affected (0.41 sec)
|
MariaDB [test]> create view testview as
|
-> select t1.`field1` as t1_f1,
|
-> t1.`field2` as t1_f2,
|
-> 'value',
|
-> t1.`text1` as t1_text1,
|
-> t1.`type1` as t1_type1
|
-> from t1;
|
Query OK, 0 rows affected (0.90 sec)
|
MariaDB [test]> show create view testview;
|
+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
| View | Create View | character_set_client | collation_connection |
|
+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
| testview | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testview` AS select `t1`.`field1` AS `t1_f1`,`t1`.`field2` AS `t1_f2`,'value' AS `value`,`t1`.`text1` AS `t1_text1`,`t1`.`type1` AS `t1_type1` from `t1` | cp850 | cp850_general_ci |
|
+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
|
1 row in set (0.03 sec)
|
MariaDB [test]> create table t2 as select * from testview;
|
Query OK, 0 rows affected (1.38 sec)
|
Records: 0 Duplicates: 0 Warnings: 0
|
MariaDB [test]> show create table t2;
|
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| t2 | CREATE TABLE `t2` (
|
`t1_f1` bigint(20) NOT NULL,
|
`t1_f2` bigint(20) NOT NULL,
|
`value` varchar(5) CHARACTER SET cp850 NOT NULL DEFAULT '',
|
`t1_text1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
|
`t1_type1` enum('Broad','Exact','Phrase','WebSite','Content','SuperBroad','TrueExact','PhraseCore','PhraseExact','PhraseSynonym','Custom') CHARACTER SET utf8 DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
1 row in set (0.00 sec)
|
On B:
MariaDB [test]> show create table t2;
|
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| t2 | CREATE TABLE `t2` (
|
`t1_f1` bigint(20) NOT NULL,
|
`t1_f2` bigint(20) NOT NULL,
|
`value` varchar(5) CHARACTER SET cp850 NOT NULL DEFAULT '',
|
`t1_text1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
|
`t1_type1` enum('Broad','Exact','Phrase','WebSite','Content','SuperBroad','TrueExact','PhraseCore','PhraseExact','PhraseSynonym','Custom') CHARACTER SET utf8 DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
1 row in set (0.00 sec)
|
on C:
MariaDB [test]> show create table t2;
|
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| t2 | CREATE TABLE `t2` (
|
`t1_f1` bigint(20) NOT NULL,
|
`t1_f2` bigint(20) NOT NULL,
|
`value` varchar(5) CHARACTER SET cp850 NOT NULL,
|
`t1_text1` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
|
`t1_type1` enum('Broad','Exact','Phrase','WebSite','Content','SuperBroad','TrueExact','PhraseCore','PhraseExact','PhraseSynonym','Custom') CHARACTER SET utf8 DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
1 row in set (0.00 sec)
|
The default value for `value` field is lost.
The servers are all default values except for statement based replication is used.
{"report":{"fcp":1930.7999999523163,"ttfb":415.7000000476837,"pageVisibility":"visible","entityId":60547,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"be6c572b-c445-4247-9f42-fcd9d374b9b5","navigationType":0,"readyForUser":2098.600000023842,"redirectCount":0,"resourceLoadedEnd":2156.2999999523163,"resourceLoadedStart":453.60000002384186,"resourceTiming":[{"duration":770.8999999761581,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":453.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":453.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1224.5,"responseStart":0,"secureConnectionStart":0},{"duration":772.4000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":453.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":453.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1226.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":781.8999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":454,"connectEnd":454,"connectStart":454,"domainLookupEnd":454,"domainLookupStart":454,"fetchStart":454,"redirectEnd":0,"redirectStart":0,"requestStart":454,"responseEnd":1235.8999999761581,"responseStart":1235.8999999761581,"secureConnectionStart":454},{"duration":823.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":454.2000000476837,"connectEnd":454.2000000476837,"connectStart":454.2000000476837,"domainLookupEnd":454.2000000476837,"domainLookupStart":454.2000000476837,"fetchStart":454.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":454.2000000476837,"responseEnd":1277.5,"responseStart":1277.5,"secureConnectionStart":454.2000000476837},{"duration":827,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":454.39999997615814,"connectEnd":454.39999997615814,"connectStart":454.39999997615814,"domainLookupEnd":454.39999997615814,"domainLookupStart":454.39999997615814,"fetchStart":454.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":454.39999997615814,"responseEnd":1281.3999999761581,"responseStart":1281.3999999761581,"secureConnectionStart":454.39999997615814},{"duration":827.3999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":454.5,"connectEnd":454.5,"connectStart":454.5,"domainLookupEnd":454.5,"domainLookupStart":454.5,"fetchStart":454.5,"redirectEnd":0,"redirectStart":0,"requestStart":454.5,"responseEnd":1281.8999999761581,"responseStart":1281.8999999761581,"secureConnectionStart":454.5},{"duration":827.5999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":454.7000000476837,"connectEnd":454.7000000476837,"connectStart":454.7000000476837,"domainLookupEnd":454.7000000476837,"domainLookupStart":454.7000000476837,"fetchStart":454.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":454.7000000476837,"responseEnd":1282.2999999523163,"responseStart":1282.2999999523163,"secureConnectionStart":454.7000000476837},{"duration":955.6000000238419,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":454.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":454.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1410.5,"responseStart":0,"secureConnectionStart":0},{"duration":831.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":455.10000002384186,"connectEnd":455.10000002384186,"connectStart":455.10000002384186,"domainLookupEnd":455.10000002384186,"domainLookupStart":455.10000002384186,"fetchStart":455.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":455.10000002384186,"responseEnd":1286.3999999761581,"responseStart":1286.3999999761581,"secureConnectionStart":455.10000002384186},{"duration":955.3999999761581,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":455.2000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":455.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1410.6000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":831.8000000715256,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":455.2999999523163,"connectEnd":455.2999999523163,"connectStart":455.2999999523163,"domainLookupEnd":455.2999999523163,"domainLookupStart":455.2999999523163,"fetchStart":455.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":455.2999999523163,"responseEnd":1287.1000000238419,"responseStart":1287.1000000238419,"secureConnectionStart":455.2999999523163},{"duration":1303.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":456.2000000476837,"connectEnd":456.2000000476837,"connectStart":456.2000000476837,"domainLookupEnd":456.2000000476837,"domainLookupStart":456.2000000476837,"fetchStart":456.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":456.2000000476837,"responseEnd":1759.7000000476837,"responseStart":1759.7000000476837,"secureConnectionStart":456.2000000476837},{"duration":1700,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":456.2999999523163,"connectEnd":456.2999999523163,"connectStart":456.2999999523163,"domainLookupEnd":456.2999999523163,"domainLookupStart":456.2999999523163,"fetchStart":456.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":456.2999999523163,"responseEnd":2156.2999999523163,"responseStart":2156.2999999523163,"secureConnectionStart":456.2999999523163},{"duration":366.1999999284744,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1424.2000000476837,"connectEnd":1424.2000000476837,"connectStart":1424.2000000476837,"domainLookupEnd":1424.2000000476837,"domainLookupStart":1424.2000000476837,"fetchStart":1424.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":1424.2000000476837,"responseEnd":1790.3999999761581,"responseStart":1790.3999999761581,"secureConnectionStart":1424.2000000476837}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":221,"responseStart":415,"responseEnd":437,"domLoading":450,"domInteractive":2202,"domContentLoadedEventStart":2202,"domContentLoadedEventEnd":2258,"domComplete":2861,"loadEventStart":2862,"loadEventEnd":2862,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2160.5},{"name":"bigPipe.sidebar-id.end","time":2161.399999976158},{"name":"bigPipe.activity-panel-pipe-id.start","time":2161.600000023842},{"name":"bigPipe.activity-panel-pipe-id.end","time":2164.7000000476837},{"name":"activityTabFullyLoaded","time":2312}],"measures":[],"correlationId":"39ed7e85376157","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":115,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
It's unrelated to replication. The basic test case is this:
10.0
10.1
The change appears to be intentional, introduced by this commit:
commit 6b20342651bb5207b6c125d2d11b664a1bebcc41
Author: Monty <monty@mariadb.org>
Date: Tue Aug 18 00:42:08 2015 +0300
Ensure that fields declared with NOT NULL doesn't have DEFAULT values if not specified and if not timestamp or auto_increment
I'll assign to serg to confirm (or not) whether this particular effect with views was expected/desirable.