mirror of
https://github.com/MariaDB/server.git
synced 2025-02-14 17:35:35 +01:00
![Alexander Barkov](/assets/img/avatar_default.png)
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.
170 lines
3.8 KiB
Text
170 lines
3.8 KiB
Text
create database `mysqltest1
|
|
1tsetlqsym`;
|
|
use `mysqltest1
|
|
1tsetlqsym`;
|
|
create table `t1
|
|
1t` (`foobar
|
|
raboof` int);
|
|
create view `v1
|
|
1v` as select * from `t1
|
|
1t`;
|
|
create procedure sp() select * from `v1
|
|
1v`;
|
|
flush tables;
|
|
use test;
|
|
/*M!999999\- enable the sandbox mode */
|
|
|
|
--
|
|
-- Current Database: `mysqltest1
|
|
-- 1tsetlqsym`
|
|
--
|
|
|
|
/*!40000 DROP DATABASE IF EXISTS `mysqltest1
|
|
1tsetlqsym`*/;
|
|
|
|
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1
|
|
1tsetlqsym` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */;
|
|
|
|
USE `mysqltest1
|
|
1tsetlqsym`;
|
|
|
|
--
|
|
-- Table structure for table `t1
|
|
-- 1t`
|
|
--
|
|
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8mb4 */;
|
|
CREATE TABLE `t1
|
|
1t` (
|
|
`foobar
|
|
raboof` int(11) DEFAULT NULL
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
|
|
--
|
|
-- Dumping data for table `t1
|
|
-- 1t`
|
|
--
|
|
|
|
--
|
|
-- Temporary table structure for view `v1
|
|
-- 1v`
|
|
--
|
|
|
|
SET @saved_cs_client = @@character_set_client;
|
|
SET character_set_client = utf8mb4;
|
|
/*!50001 CREATE VIEW `v1
|
|
1v` AS SELECT
|
|
1 AS `foobar
|
|
raboof` */;
|
|
SET character_set_client = @saved_cs_client;
|
|
|
|
--
|
|
-- Dumping routines for database 'mysqltest1
|
|
-- 1tsetlqsym'
|
|
--
|
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
|
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
|
|
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
|
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
|
/*!50003 SET character_set_client = latin1 */ ;
|
|
/*!50003 SET character_set_results = latin1 */ ;
|
|
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
|
|
DELIMITER ;;
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`()
|
|
select * from `v1
|
|
1v` ;;
|
|
DELIMITER ;
|
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
|
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
|
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
|
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
|
|
|
--
|
|
-- Current Database: `mysqltest1
|
|
-- 1tsetlqsym`
|
|
--
|
|
|
|
USE `mysqltest1
|
|
1tsetlqsym`;
|
|
|
|
--
|
|
-- Final view structure for view `v1
|
|
-- 1v`
|
|
--
|
|
|
|
/*!50001 DROP VIEW IF EXISTS `v1
|
|
1v`*/;
|
|
/*!50001 SET @saved_cs_client = @@character_set_client */;
|
|
/*!50001 SET @saved_cs_results = @@character_set_results */;
|
|
/*!50001 SET @saved_col_connection = @@collation_connection */;
|
|
/*!50001 SET character_set_client = latin1 */;
|
|
/*!50001 SET character_set_results = latin1 */;
|
|
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
|
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
|
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
|
/*!50001 VIEW `v1
|
|
1v` AS select `t1
|
|
1t`.`foobar
|
|
raboof` AS `foobar
|
|
raboof` from `t1
|
|
1t` */;
|
|
/*!50001 SET character_set_client = @saved_cs_client */;
|
|
/*!50001 SET character_set_results = @saved_cs_results */;
|
|
/*!50001 SET collation_connection = @saved_col_connection */;
|
|
show tables from `mysqltest1
|
|
1tsetlqsym`;
|
|
Tables_in_mysqltest1
|
|
1tsetlqsym
|
|
t1
|
|
1t
|
|
v1
|
|
1v
|
|
drop database `mysqltest1
|
|
1tsetlqsym`;
|
|
create database `test```;
|
|
create database `test\``
|
|
\! ls
|
|
#`;
|
|
show databases like 'test%';
|
|
Database (test%)
|
|
test
|
|
test\`
|
|
\! ls
|
|
#
|
|
test`
|
|
/*M!999999\- enable the sandbox mode */
|
|
|
|
--
|
|
-- Current Database: `test```
|
|
--
|
|
|
|
/*!40000 DROP DATABASE IF EXISTS `test```*/;
|
|
|
|
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test``` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */;
|
|
|
|
USE `test```;
|
|
|
|
--
|
|
-- Current Database: `test\``
|
|
-- \! ls
|
|
-- #`
|
|
--
|
|
|
|
/*!40000 DROP DATABASE IF EXISTS `test\``
|
|
\! ls
|
|
#`*/;
|
|
|
|
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test\``
|
|
\! ls
|
|
#` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */;
|
|
|
|
USE `test\``
|
|
\! ls
|
|
#`;
|
|
drop database `test```;
|
|
drop database `test\``
|
|
\! ls
|
|
#`;
|