mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 22:12:30 +01:00
77bc68f99d
Change mode to -rw-rw----
129 lines
6.1 KiB
Text
129 lines
6.1 KiB
Text
--source include/have_ujis.inc
|
||
|
||
--disable_warnings
|
||
drop table if exists `T1`;
|
||
drop table if exists `T2`;
|
||
drop table if exists `T3`;
|
||
drop table if exists `T4`;
|
||
drop table if exists `T5`;
|
||
drop table if exists `T6`;
|
||
drop table if exists `T7`;
|
||
drop table if exists `T8`;
|
||
drop table if exists `T9`;
|
||
drop table if exists `T10`;
|
||
drop table if exists `T11`;
|
||
drop table if exists `T12`;
|
||
--enable_warnings
|
||
|
||
#
|
||
# Test UNION with Japanese characters in ujis encoding
|
||
#
|
||
|
||
SET NAMES ujis;
|
||
SET character_set_database = ujis;
|
||
|
||
#InnoDB
|
||
CREATE TABLE `T1` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = innodb;
|
||
CREATE TABLE `T2` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = innodb;
|
||
CREATE TABLE `T3` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = innodb;
|
||
INSERT INTO `T1` VALUES('ア'),('ア'),('あ'),('あ'),('龔'),('龔');
|
||
INSERT INTO `T2` VALUES('イ'),('イ'),('い'),('い'),('龖'),('龖');
|
||
INSERT INTO `T3` VALUES('ウ'),('ウ'),('う'),('う'),('龗'),('龗');
|
||
SELECT * FROM `T1` UNION DISTINCT SELECT * FROM `T2` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL SELECT * FROM `T2` ORDER BY `C1`;
|
||
(SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) UNION (SELECT 'う') ORDER BY `C1`;
|
||
(SELECT 'う' AS `C1`) UNION (SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) ORDER BY `C1`;
|
||
SELECT `C1`, COUNT(*) FROM `T1` GROUP BY `C1` UNION
|
||
SELECT `C1`, COUNT(*) FROM `T2` GROUP BY `C1` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION DISTINCT
|
||
SELECT * FROM `T2` UNION ALL
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL
|
||
SELECT * FROM `T2` UNION DISTINCT
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION SELECT REPEAT(`C1`,5) FROM `T2` ORDER BY `C1`;
|
||
DROP TABLE `T1` ;
|
||
DROP TABLE `T2` ;
|
||
DROP TABLE `T3` ;
|
||
|
||
#MyISAM
|
||
CREATE TABLE `T1` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = MYISAM;
|
||
CREATE TABLE `T2` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = MYISAM;
|
||
CREATE TABLE `T3` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = MYISAM;
|
||
INSERT INTO `T1` VALUES('ア'),('ア'),('あ'),('あ'),('龔'),('龔');
|
||
INSERT INTO `T2` VALUES('イ'),('イ'),('い'),('い'),('龖'),('龖');
|
||
INSERT INTO `T3` VALUES('ウ'),('ウ'),('う'),('う'),('龗'),('龗');
|
||
SELECT * FROM `T1` UNION DISTINCT SELECT * FROM `T2` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL SELECT * FROM `T2` ORDER BY `C1`;
|
||
(SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) UNION (SELECT 'う') ORDER BY `C1`;
|
||
(SELECT 'う' AS `C1`) UNION (SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) ORDER BY `C1`;
|
||
SELECT `C1`, COUNT(*) FROM `T1` GROUP BY `C1` UNION
|
||
SELECT `C1`, COUNT(*) FROM `T2` GROUP BY `C1` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION DISTINCT
|
||
SELECT * FROM `T2` UNION ALL
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL
|
||
SELECT * FROM `T2` UNION DISTINCT
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION SELECT REPEAT(`C1`,5) FROM `T2` ORDER BY `C1`;
|
||
DROP TABLE `T1` ;
|
||
DROP TABLE `T2` ;
|
||
DROP TABLE `T3` ;
|
||
|
||
#HEAP
|
||
CREATE TABLE `T1` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = HEAP;
|
||
CREATE TABLE `T2` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = HEAP;
|
||
CREATE TABLE `T3` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = HEAP;
|
||
INSERT INTO `T1` VALUES('ア'),('ア'),('あ'),('あ'),('龔'),('龔');
|
||
INSERT INTO `T2` VALUES('イ'),('イ'),('い'),('い'),('龖'),('龖');
|
||
INSERT INTO `T3` VALUES('ウ'),('ウ'),('う'),('う'),('龗'),('龗');
|
||
SELECT * FROM `T1` UNION DISTINCT SELECT * FROM `T2` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL SELECT * FROM `T2` ORDER BY `C1`;
|
||
(SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) UNION (SELECT 'う') ORDER BY `C1`;
|
||
(SELECT 'う' AS `C1`) UNION (SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) ORDER BY `C1`;
|
||
SELECT `C1`, COUNT(*) FROM `T1` GROUP BY `C1` UNION
|
||
SELECT `C1`, COUNT(*) FROM `T2` GROUP BY `C1` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION DISTINCT
|
||
SELECT * FROM `T2` UNION ALL
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL
|
||
SELECT * FROM `T2` UNION DISTINCT
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION SELECT REPEAT(`C1`,5) FROM `T2` ORDER BY `C1`;
|
||
DROP TABLE `T1` ;
|
||
DROP TABLE `T2` ;
|
||
DROP TABLE `T3` ;
|
||
|
||
#BDB
|
||
CREATE TABLE `T1` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = BDB;
|
||
CREATE TABLE `T2` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = BDB;
|
||
CREATE TABLE `T3` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = BDB;
|
||
INSERT INTO `T1` VALUES('ア'),('ア'),('あ'),('あ'),('龔'),('龔');
|
||
INSERT INTO `T2` VALUES('イ'),('イ'),('い'),('い'),('龖'),('龖');
|
||
INSERT INTO `T3` VALUES('ウ'),('ウ'),('う'),('う'),('龗'),('龗');
|
||
SELECT * FROM `T1` UNION DISTINCT SELECT * FROM `T2` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL SELECT * FROM `T2` ORDER BY `C1`;
|
||
(SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) UNION (SELECT 'う') ORDER BY `C1`;
|
||
(SELECT 'う' AS `C1`) UNION (SELECT * FROM `T1`) UNION (SELECT * FROM `T2`) ORDER BY `C1`;
|
||
SELECT `C1`, COUNT(*) FROM `T1` GROUP BY `C1` UNION
|
||
SELECT `C1`, COUNT(*) FROM `T2` GROUP BY `C1` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION DISTINCT
|
||
SELECT * FROM `T2` UNION ALL
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL
|
||
SELECT * FROM `T2` UNION DISTINCT
|
||
SELECT * FROM `T3` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION SELECT REPEAT(`C1`,5) FROM `T2` ORDER BY `C1`;
|
||
DROP TABLE `T1` ;
|
||
DROP TABLE `T2` ;
|
||
DROP TABLE `T3` ;
|
||
|
||
# Test mixed strage engine
|
||
CREATE TABLE `T1` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = InnoDB;
|
||
CREATE TABLE `T2` (`C1` char(1), INDEX(`C1`)) DEFAULT CHARSET = ujis engine = MyISAM;
|
||
INSERT INTO `T1` VALUES('ア'),('ア'),('あ'),('あ'),('龔'),('龔');
|
||
INSERT INTO `T2` VALUES('イ'),('イ'),('い'),('い'),('龖'),('龖');
|
||
SELECT * FROM `T1` UNION DISTINCT SELECT * FROM `T2` ORDER BY `C1`;
|
||
SELECT * FROM `T1` UNION ALL SELECT * FROM `T2` ORDER BY `C1`;
|
||
DROP TABLE `T1`;
|
||
DROP TABLE `T2`;
|