Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Not a Bug
-
10.1.21, 10.1(EOL)
-
any
Description
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.
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
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: Query OK, 0 rows affected (0.39 sec) 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. |
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: Query OK, 0 rows affected (0.39 sec) 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. |
Summary | replicating a table created from a view losses default value | replicating a table created from a view loses default value |
Description |
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: Query OK, 0 rows affected (0.39 sec) 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. |
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: {code:sql} 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) {code} {code:sql} 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) {code} {code:sql} 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) {code} {code:sql} MariaDB [test]> create table t2 as select * from testview; Query OK, 0 rows affected (1.38 sec) Records: 0 Duplicates: 0 Warnings: 0 {code} {code:sql} 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) {code} On B: {code:sql} 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) {code} on C: {code:sql} 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) {code} The default value for `value` field is lost. The servers are all default values except for statement based replication is used. |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Assignee | Sergei Golubchik [ serg ] |
Affects Version/s | 10.1 [ 16100 ] |
Labels | view |
Fix Version/s | N/A [ 14700 ] | |
Resolution | Not a Bug [ 6 ] | |
Status | Confirmed [ 10101 ] | Closed [ 6 ] |
Resolution | Not a Bug [ 6 ] | |
Status | Closed [ 6 ] | Stalled [ 10000 ] |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | N/A [ 14700 ] |
Assignee | Sergei Golubchik [ serg ] | Alexey Botchkov [ holyfoot ] |
Component/s | Replication [ 10100 ] |
Assignee | Alexey Botchkov [ holyfoot ] | Ian Gilfillan [ greenman ] |
Assignee | Ian Gilfillan [ greenman ] | Sergei Golubchik [ serg ] |
Assignee | Sergei Golubchik [ serg ] |
Priority | Major [ 3 ] | Minor [ 4 ] |
Assignee | Sergei Golubchik [ serg ] |
Fix Version/s | N/A [ 14700 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Not a Bug [ 6 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Component/s | Replication [ 10100 ] |
Workflow | MariaDB v3 [ 79953 ] | MariaDB v4 [ 151805 ] |
Zendesk Related Tickets | 106500 |
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.