More tests for "MDEV-7563 Support CHECK constraint".
Testing non-ASCII string literals.
This commit is contained in:
parent
11debf698f
commit
3f32bf627f
@ -10459,5 +10459,81 @@ HEX(a)
|
||||
613F
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-10134 Add full support for DEFAULT
|
||||
#
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
|
||||
SET NAMES utf8;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(30) DEFAULT CONCAT('ß')
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a),a FROM t1;
|
||||
HEX(a) a
|
||||
C39F ß
|
||||
SET NAMES latin1;
|
||||
ALTER TABLE t1 ADD b VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß');
|
||||
SET NAMES utf8;
|
||||
ALTER TABLE t1 ADD c VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß');
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(30) DEFAULT CONCAT('ß'),
|
||||
`b` varchar(30) DEFAULT CONCAT('ß'),
|
||||
`c` varchar(30) DEFAULT CONCAT('ß')
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES();
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
ß ß ß
|
||||
SET NAMES latin1;
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES();
|
||||
SET NAMES utf8;
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
ß ß ß
|
||||
DROP TABLE t1;
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
|
||||
SET NAMES utf8;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a), a FROM t1;
|
||||
HEX(a) a
|
||||
C383C5B8 ß
|
||||
DROP TABLE t1;
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(30) DEFAULT CONCAT('ß')
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a) FROM t1;
|
||||
HEX(a)
|
||||
DF
|
||||
DROP TABLE t1;
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a) FROM t1;
|
||||
HEX(a)
|
||||
C39F
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
@ -1982,6 +1982,60 @@ LOAD XML INFILE '../../std_data/loaddata/mdev9874.xml' INTO TABLE t1 CHARACTER S
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10134 Add full support for DEFAULT
|
||||
--echo #
|
||||
|
||||
# This test uses some magic codes:
|
||||
# _latin1 0xC39F is "A WITH TILDE + Y WITH DIAERESIS"
|
||||
# _utf8 0xC39F is "SHARP S"
|
||||
|
||||
# "A WITH TILDE + Y WITH DIAERESIS" in DEFAULT.
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
|
||||
SET NAMES utf8;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a),a FROM t1;
|
||||
SET NAMES latin1;
|
||||
ALTER TABLE t1 ADD b VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß');
|
||||
SET NAMES utf8;
|
||||
ALTER TABLE t1 ADD c VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß');
|
||||
SHOW CREATE TABLE t1;
|
||||
# Testing that DEFAULT is independent on the current "SET NAMES".
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES();
|
||||
SELECT * FROM t1;
|
||||
SET NAMES latin1;
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES();
|
||||
SET NAMES utf8;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
|
||||
SET NAMES utf8;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a), a FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# "SHARP S" in DEFAULT
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (DEFAULT);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -966,10 +966,8 @@ int set_var_collation_client::check(THD *thd)
|
||||
|
||||
int set_var_collation_client::update(THD *thd)
|
||||
{
|
||||
thd->variables.character_set_client= character_set_client;
|
||||
thd->variables.character_set_results= character_set_results;
|
||||
thd->variables.collation_connection= collation_connection;
|
||||
thd->update_charset();
|
||||
thd->update_charset(character_set_client, collation_connection,
|
||||
character_set_results);
|
||||
thd->protocol_text.init(thd);
|
||||
thd->protocol_binary.init(thd);
|
||||
return 0;
|
||||
|
@ -3024,13 +3024,10 @@ void set_slave_thread_default_charset(THD* thd, rpl_group_info *rgi)
|
||||
{
|
||||
DBUG_ENTER("set_slave_thread_default_charset");
|
||||
|
||||
thd->variables.character_set_client=
|
||||
global_system_variables.character_set_client;
|
||||
thd->variables.collation_connection=
|
||||
global_system_variables.collation_connection;
|
||||
thd->variables.collation_server=
|
||||
global_system_variables.collation_server;
|
||||
thd->update_charset();
|
||||
thd->update_charset(global_system_variables.character_set_client,
|
||||
global_system_variables.collation_connection);
|
||||
|
||||
thd->system_thread_info.rpl_sql_info->cached_charset_invalidate();
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -11774,7 +11774,6 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
|
||||
{
|
||||
if (thd_init_client_charset(thd, uint2korr(next_field)))
|
||||
DBUG_RETURN(1);
|
||||
thd->update_charset();
|
||||
next_field+= 2;
|
||||
}
|
||||
|
||||
@ -11940,7 +11939,6 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
|
||||
DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8]));
|
||||
if (thd_init_client_charset(thd, (uint) net->read_pos[8]))
|
||||
return packet_error;
|
||||
thd->update_charset();
|
||||
end= (char*) net->read_pos+32;
|
||||
}
|
||||
else
|
||||
|
@ -3417,6 +3417,22 @@ public:
|
||||
|
||||
inline CHARSET_INFO *charset() { return variables.character_set_client; }
|
||||
void update_charset();
|
||||
void update_charset(CHARSET_INFO *character_set_client,
|
||||
CHARSET_INFO *collation_connection)
|
||||
{
|
||||
variables.character_set_client= character_set_client;
|
||||
variables.collation_connection= collation_connection;
|
||||
update_charset();
|
||||
}
|
||||
void update_charset(CHARSET_INFO *character_set_client,
|
||||
CHARSET_INFO *collation_connection,
|
||||
CHARSET_INFO *character_set_results)
|
||||
{
|
||||
variables.character_set_client= character_set_client;
|
||||
variables.collation_connection= collation_connection;
|
||||
variables.character_set_results= character_set_results;
|
||||
update_charset();
|
||||
}
|
||||
|
||||
inline Query_arena *activate_stmt_arena_if_needed(Query_arena *backup)
|
||||
{
|
||||
|
@ -799,12 +799,9 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
|
||||
if (!opt_character_set_client_handshake ||
|
||||
!(cs= get_charset(cs_number, MYF(0))))
|
||||
{
|
||||
thd->variables.character_set_client=
|
||||
global_system_variables.character_set_client;
|
||||
thd->variables.collation_connection=
|
||||
global_system_variables.collation_connection;
|
||||
thd->variables.character_set_results=
|
||||
global_system_variables.character_set_results;
|
||||
thd->update_charset(global_system_variables.character_set_client,
|
||||
global_system_variables.collation_connection,
|
||||
global_system_variables.character_set_results);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -814,10 +811,8 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "character_set_client",
|
||||
cs->csname);
|
||||
return true;
|
||||
}
|
||||
thd->variables.character_set_results=
|
||||
thd->variables.collation_connection=
|
||||
thd->variables.character_set_client= cs;
|
||||
}
|
||||
thd->update_charset(cs,cs,cs);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1710,10 +1710,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
decrease_user_connections(thd->user_connect);
|
||||
thd->user_connect= save_user_connect;
|
||||
thd->reset_db(save_db, save_db_length);
|
||||
thd->variables.character_set_client= save_character_set_client;
|
||||
thd->variables.collation_connection= save_collation_connection;
|
||||
thd->variables.character_set_results= save_character_set_results;
|
||||
thd->update_charset();
|
||||
thd->update_charset(save_character_set_client, save_collation_connection,
|
||||
save_character_set_results);
|
||||
thd->failed_com_change_user++;
|
||||
my_sleep(1000000);
|
||||
}
|
||||
|
@ -126,10 +126,7 @@ Default_object_creation_ctx::create_backup_ctx(THD *thd) const
|
||||
|
||||
void Default_object_creation_ctx::change_env(THD *thd) const
|
||||
{
|
||||
thd->variables.character_set_client= m_client_cs;
|
||||
thd->variables.collation_connection= m_connection_cl;
|
||||
|
||||
thd->update_charset();
|
||||
thd->update_charset(m_client_cs, m_connection_cl);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user