mirror of
https://github.com/MariaDB/server.git
synced 2025-02-05 05:12:17 +01:00
350cc77fee
Item:print_for_table_def() uses QT_TO_SYSTEM_CHARSET to print the DEFAULT expression into FRM file during CREATE TABLE. Therefore, the expression is encoded in utf8 in FRM. get_field_default_value() erroneously used field->charset() to print the DEFAULT expression at SHOW CREATE TABLE time. Fixing get_field_default_value() to use &my_charset_utf8mb4_general_ci instead. This makes DEFAULT work in the way way with: - virtual column expressions: if (field->vcol_info) { StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci); field->vcol_info->print(&str); - check constraint expressions: if (field->check_constraint) { StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci); field->check_constraint->print(&str); Additional cleanup: Fixing system_charset_info to &my_charset_utf8mb4_general_ci in a few places to make non-BMP characters work in DEFAULT, virtual column, check constraint expressions.
72 lines
3.3 KiB
Text
72 lines
3.3 KiB
Text
CREATE SEQUENCE a1 engine=aria;
|
|
CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024;
|
|
insert into t1 values (1),(2);
|
|
CREATE SEQUENCE x1 engine=innodb;
|
|
# dump whole database
|
|
/*M!999999\- enable the sandbox mode */
|
|
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
|
|
DO SETVAL(`a1`, 1, 0);
|
|
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB;
|
|
DO SETVAL(`x1`, 1, 0);
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
KEY `a` (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
INSERT INTO `t1` VALUES (1),(2);
|
|
# dump by tables order 1
|
|
/*M!999999\- enable the sandbox mode */
|
|
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
|
|
DO SETVAL(`a1`, 1, 0);
|
|
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB;
|
|
DO SETVAL(`x1`, 1, 0);
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
KEY `a` (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
INSERT INTO `t1` VALUES (1),(2);
|
|
# dump by tables order 2
|
|
/*M!999999\- enable the sandbox mode */
|
|
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
|
|
DO SETVAL(`a1`, 1, 0);
|
|
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB;
|
|
DO SETVAL(`x1`, 1, 0);
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
KEY `a` (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
INSERT INTO `t1` VALUES (1),(2);
|
|
# dump by tables only tables
|
|
/*M!999999\- enable the sandbox mode */
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
KEY `a` (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=1024;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
INSERT INTO `t1` VALUES (1),(2);
|
|
# dump by tables only sequences
|
|
/*M!999999\- enable the sandbox mode */
|
|
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
|
|
DO SETVAL(`a1`, 1, 0);
|
|
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB;
|
|
DO SETVAL(`x1`, 1, 0);
|
|
# end of dumps
|
|
DROP TABLE a1,t1,x1;
|
|
set default_storage_engine=InnoDB;
|
|
create sequence t1;
|
|
LOCK TABLES t1 READ;
|
|
SELECT * FROM t1;
|
|
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
unlock tables;
|
|
drop table t1;
|