Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
041d0984
Commit
041d0984
authored
Jan 14, 2009
by
Chad MILLER
Browse files
Options
Browse Files
Download
Plain Diff
Merge from bugteam trunk.
parents
97523591
53e42d9e
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
846 additions
and
210 deletions
+846
-210
client/mysqlcheck.c
client/mysqlcheck.c
+17
-10
mysql-test/extra/rpl_tests/rpl_auto_increment.test
mysql-test/extra/rpl_tests/rpl_auto_increment.test
+17
-0
mysql-test/include/check_events_off.inc
mysql-test/include/check_events_off.inc
+31
-0
mysql-test/include/no_running_event_scheduler.inc
mysql-test/include/no_running_event_scheduler.inc
+23
-0
mysql-test/include/no_running_events.inc
mysql-test/include/no_running_events.inc
+25
-0
mysql-test/include/running_event_scheduler.inc
mysql-test/include/running_event_scheduler.inc
+30
-0
mysql-test/r/events_bugs.result
mysql-test/r/events_bugs.result
+13
-14
mysql-test/r/log_state.result
mysql-test/r/log_state.result
+48
-33
mysql-test/r/mysqlcheck.result
mysql-test/r/mysqlcheck.result
+55
-0
mysql-test/r/type_date.result
mysql-test/r/type_date.result
+8
-5
mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result
mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result
+0
-0
mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test
mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test
+2
-2
mysql-test/suite/rpl/r/rpl_auto_increment.result
mysql-test/suite/rpl/r/rpl_auto_increment.result
+17
-0
mysql-test/t/events_bugs.test
mysql-test/t/events_bugs.test
+217
-55
mysql-test/t/log_state.test
mysql-test/t/log_state.test
+147
-53
mysql-test/t/mysqlcheck.test
mysql-test/t/mysqlcheck.test
+73
-0
mysql-test/t/type_date.test
mysql-test/t/type_date.test
+23
-8
sql/log_event.cc
sql/log_event.cc
+4
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_table.cc
sql/sql_table.cc
+26
-5
sql/sql_trigger.cc
sql/sql_trigger.cc
+65
-23
sql/sql_trigger.h
sql/sql_trigger.h
+4
-2
No files found.
client/mysqlcheck.c
View file @
041d0984
...
@@ -40,15 +40,13 @@ static uint verbose = 0, opt_mysql_port=0;
...
@@ -40,15 +40,13 @@ static uint verbose = 0, opt_mysql_port=0;
static
int
my_end_arg
;
static
int
my_end_arg
;
static
char
*
opt_mysql_unix_port
=
0
;
static
char
*
opt_mysql_unix_port
=
0
;
static
char
*
opt_password
=
0
,
*
current_user
=
0
,
static
char
*
opt_password
=
0
,
*
current_user
=
0
,
*
default_charset
=
(
char
*
)
MYSQL_DEFAULT_CHARSET_NAME
,
*
default_charset
=
0
,
*
current_host
=
0
;
*
current_host
=
0
;
static
int
first_error
=
0
;
static
int
first_error
=
0
;
DYNAMIC_ARRAY
tables4repair
;
DYNAMIC_ARRAY
tables4repair
;
#ifdef HAVE_SMEM
#ifdef HAVE_SMEM
static
char
*
shared_memory_base_name
=
0
;
static
char
*
shared_memory_base_name
=
0
;
#endif
#endif
static
uint
opt_protocol
=
0
;
static
uint
opt_protocol
=
0
;
static
CHARSET_INFO
*
charset_info
=
&
my_charset_latin1
;
enum
operations
{
DO_CHECK
,
DO_REPAIR
,
DO_ANALYZE
,
DO_OPTIMIZE
,
DO_UPGRADE
};
enum
operations
{
DO_CHECK
,
DO_REPAIR
,
DO_ANALYZE
,
DO_OPTIMIZE
,
DO_UPGRADE
};
...
@@ -282,12 +280,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
...
@@ -282,12 +280,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break
;
break
;
case
OPT_FIX_DB_NAMES
:
case
OPT_FIX_DB_NAMES
:
what_to_do
=
DO_UPGRADE
;
what_to_do
=
DO_UPGRADE
;
default_charset
=
(
char
*
)
"utf8"
;
opt_databases
=
1
;
opt_databases
=
1
;
break
;
break
;
case
OPT_FIX_TABLE_NAMES
:
case
OPT_FIX_TABLE_NAMES
:
what_to_do
=
DO_UPGRADE
;
what_to_do
=
DO_UPGRADE
;
default_charset
=
(
char
*
)
"utf8"
;
break
;
break
;
case
'p'
:
case
'p'
:
if
(
argument
)
if
(
argument
)
...
@@ -367,11 +363,20 @@ static int get_options(int *argc, char ***argv)
...
@@ -367,11 +363,20 @@ static int get_options(int *argc, char ***argv)
what_to_do
=
DO_CHECK
;
what_to_do
=
DO_CHECK
;
}
}
/* TODO: This variable is not yet used */
/*
if
(
strcmp
(
default_charset
,
charset_info
->
csname
)
&&
If there's no --default-character-set option given with
!
(
charset_info
=
get_charset_by_csname
(
default_charset
,
--fix-table-name or --fix-db-name set the default character set to "utf8".
MY_CS_PRIMARY
,
MYF
(
MY_WME
))))
*/
exit
(
1
);
if
(
!
default_charset
&&
(
opt_fix_db_names
||
opt_fix_table_names
))
{
default_charset
=
(
char
*
)
"utf8"
;
}
if
(
default_charset
&&
!
get_charset_by_csname
(
default_charset
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
)))
{
printf
(
"Unsupported character set: %s
\n
"
,
default_charset
);
return
1
;
}
if
(
*
argc
>
0
&&
opt_alldbs
)
if
(
*
argc
>
0
&&
opt_alldbs
)
{
{
printf
(
"You should give only options, no arguments at all, with option
\n
"
);
printf
(
"You should give only options, no arguments at all, with option
\n
"
);
...
@@ -779,6 +784,8 @@ static int dbConnect(char *host, char *user, char *passwd)
...
@@ -779,6 +784,8 @@ static int dbConnect(char *host, char *user, char *passwd)
if
(
shared_memory_base_name
)
if
(
shared_memory_base_name
)
mysql_options
(
&
mysql_connection
,
MYSQL_SHARED_MEMORY_BASE_NAME
,
shared_memory_base_name
);
mysql_options
(
&
mysql_connection
,
MYSQL_SHARED_MEMORY_BASE_NAME
,
shared_memory_base_name
);
#endif
#endif
if
(
default_charset
)
mysql_options
(
&
mysql_connection
,
MYSQL_SET_CHARSET_NAME
,
default_charset
);
if
(
!
(
sock
=
mysql_real_connect
(
&
mysql_connection
,
host
,
user
,
passwd
,
if
(
!
(
sock
=
mysql_real_connect
(
&
mysql_connection
,
host
,
user
,
passwd
,
NULL
,
opt_mysql_port
,
opt_mysql_unix_port
,
0
)))
NULL
,
opt_mysql_port
,
opt_mysql_unix_port
,
0
)))
{
{
...
...
mysql-test/extra/rpl_tests/rpl_auto_increment.test
View file @
041d0984
...
@@ -145,6 +145,23 @@ select * from t3 order by a;
...
@@ -145,6 +145,23 @@ select * from t3 order by a;
connection
master
;
connection
master
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
sync_slave_with_master
;
#
# BUG#41986 Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables
#
connection
master
;
set
auto_increment_increment
=
1
;
set
auto_increment_offset
=
1
;
CREATE
TABLE
t1
(
id
MEDIUMINT
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
)
ENGINE
=
innodb
;
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
show
create
table
t1
;
sync_slave_with_master
;
show
create
table
t1
;
connection
master
;
drop
table
t1
;
# End cleanup
# End cleanup
sync_slave_with_master
;
sync_slave_with_master
;
mysql-test/include/check_events_off.inc
0 → 100644
View file @
041d0984
########## include/check_events_off.inc ####################################
# #
# Purpose: #
# Wait till we can expect that we have no event activity till the scheduler is #
# switched on again. #
# = There will be no modifications of user tables by existing events #
# except they use "INSERT DELAYED" or the server system variable #
# "concurrent_inserts" is not switched off. #
# Only some storage engines support concurrent_inserts" or "INSERT DELAYED". #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for bug fixes in tests #
# #
################################################################################
# 1. Check that the server system variable shows the state needed
if
(
`SELECT @@global.event_scheduler <> 'OFF'`
)
{
--
echo
# Error: We expect here that the event scheduler is switched off.
SELECT
@@
global
.
event_scheduler
;
--
echo
# Thinkable reasons:
--
echo
# 1. SET GLOBAL event_scheduler = OFF had not the expected effect.
--
echo
# 2. Use of the current routine (include/check_events_off.inc)
--
echo
# within the wrong situation
--
die
}
# 2. Wait till we have no event_scheduler session within the processlist
--
source
include
/
no_running_event_scheduler
.
inc
# 3. Wait till we have no event executor sessions within the processlist
--
source
include
/
no_running_events
.
inc
mysql-test/include/no_running_event_scheduler.inc
0 → 100644
View file @
041d0984
########## include/no_running_event_scheduler.inc ##########################
# #
# Wait till the event scheduler disappeared from processlist. #
# #
# The characteristics of the event_scheduler entry within the processlist is #
# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if #
# ther is no short phase with command <> 'Daemon'. #
# A query with WHERE user = 'event_scheduler' only will also catch events in #
# startup phase. This is no problem since this phase is very short. #
# #
# A wait_timeout of >= 3 seconds was within experiments sufficient even on a #
# testing box with heavy parallel load. Therefore 5 seconds should be enough. #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for test bug fixes #
# #
################################################################################
let
$wait_timeout
=
5
;
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
information_schema
.
processlist
WHERE
user
=
'event_scheduler'
;
--
source
include
/
wait_condition
.
inc
mysql-test/include/no_running_events.inc
0 → 100644
View file @
041d0984
########## include/no_running_events.inc ###################################
# #
# Wait till all event executors have finished their work. #
# #
# Different event executors share the characteristics that their entry within #
# processlist contains command = 'Connect'. #
# Of course the corresponding query will also catch other connections being #
# within the connect phase. This is no problem since the connect phase is #
# usually very short. #
# #
# A wait_timeout of >= 3 seconds was during experiments in case of "simple" #
# SQL commands sufficient even on a testing box with heavy parallel load. #
# "simple" = no sleeps, no long running commands, no waiting for lock ... #
# We use here the default of 30 seconds because this wastes some time only in #
# case of unexpected situations. #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for test bug fixes #
# #
################################################################################
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
0
FROM
information_schema
.
processlist
WHERE
command
=
'Connect'
;
--
source
include
/
wait_condition
.
inc
mysql-test/include/running_event_scheduler.inc
0 → 100644
View file @
041d0984
############# include/running_event_scheduler.inc ##########################
# #
# Wait till the event scheduler reached its final state within the processlist.#
# #
# The characteristics of the event_scheduler entry within the processlist is #
# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if #
# ther is no short phase with command <> 'Daemon'. #
# A query with WHERE user = 'event_scheduler' only will also catch events in #
# startup phase. #
# #
# Creation: #
# 2008-12-19 mleich Implement this check needed for test bug fixes #
# #
################################################################################
# 1. Check that the server system variable shows the state needed
if
(
`SELECT @@global.event_scheduler <> 'ON'`
)
{
--
echo
# Error: We expect here that the event scheduler is switched on.
SELECT
@@
global
.
event_scheduler
;
--
echo
# Thinkable reasons:
--
echo
# 1. SET GLOBAL event_scheduler = ON had not the expected effect.
--
echo
# 2. Use of the current routine (include/running_event_scheduler.inc)
--
echo
# within the wrong situation
--
die
}
let
$wait_condition
=
SELECT
COUNT
(
*
)
=
1
FROM
information_schema
.
processlist
WHERE
user
=
'event_scheduler'
AND
command
=
'Daemon'
;
--
source
include
/
wait_condition
.
inc
mysql-test/r/events_bugs.result
View file @
041d0984
...
@@ -3,6 +3,8 @@ drop database if exists mysqltest_db1;
...
@@ -3,6 +3,8 @@ drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2;
drop database if exists mysqltest_db2;
create database events_test;
create database events_test;
use events_test;
use events_test;
set @concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert = 0;
select * from information_schema.global_variables where variable_name like 'event_scheduler';
select * from information_schema.global_variables where variable_name like 'event_scheduler';
VARIABLE_NAME VARIABLE_VALUE
VARIABLE_NAME VARIABLE_VALUE
EVENT_SCHEDULER ON
EVENT_SCHEDULER ON
...
@@ -60,7 +62,7 @@ select get_lock('test_bug16407', 60);
...
@@ -60,7 +62,7 @@ select get_lock('test_bug16407', 60);
end|
end|
"Now if everything is fine the event has compiled and is locked"
"Now if everything is fine the event has compiled and is locked"
select /*1*/ user, host, db, info from information_schema.processlist
select /*1*/ user, host, db, info from information_schema.processlist
where info = 'select get_lock(\'test_bug16407\', 60)';
where
state = 'User lock' and
info = 'select get_lock(\'test_bug16407\', 60)';
user host db info
user host db info
root localhost events_test select get_lock('test_bug16407', 60)
root localhost events_test select get_lock('test_bug16407', 60)
select release_lock('test_bug16407');
select release_lock('test_bug16407');
...
@@ -84,7 +86,7 @@ get_lock('ee_16407_2', 60)
...
@@ -84,7 +86,7 @@ get_lock('ee_16407_2', 60)
set global event_scheduler= 1;
set global event_scheduler= 1;
"Another sql_mode test"
"Another sql_mode test"
set sql_mode="traditional";
set sql_mode="traditional";
create table events_smode_test(ev_name char(10), a date)
engine=myisam
;
create table events_smode_test(ev_name char(10), a date);
"This should never insert something"
"This should never insert something"
create event ee_16407_2 on schedule every 60 second do
create event ee_16407_2 on schedule every 60 second do
begin
begin
...
@@ -92,7 +94,7 @@ select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
...
@@ -92,7 +94,7 @@ select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
select release_lock('ee_16407_2');
select release_lock('ee_16407_2');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
end|
insert into events_smode_test values ('test','1980-19-02')|
insert into events_
test.events_
smode_test values ('test','1980-19-02')|
ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
"This is ok"
"This is ok"
create event ee_16407_3 on schedule every 60 second do
create event ee_16407_3 on schedule every 60 second do
...
@@ -116,7 +118,7 @@ events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_
...
@@ -116,7 +118,7 @@ events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_
events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
events_test ee_16407_4
events_test ee_16407_4
select /*2*/ user, host, db, info from information_schema.processlist
select /*2*/ user, host, db, info from information_schema.processlist
where info = 'select get_lock(\'ee_16407_2\', 60)';
where
state = 'User lock' and
info = 'select get_lock(\'ee_16407_2\', 60)';
user host db info
user host db info
root localhost events_test select get_lock('ee_16407_2', 60)
root localhost events_test select get_lock('ee_16407_2', 60)
root localhost events_test select get_lock('ee_16407_2', 60)
root localhost events_test select get_lock('ee_16407_2', 60)
...
@@ -125,10 +127,10 @@ select release_lock('ee_16407_2');
...
@@ -125,10 +127,10 @@ select release_lock('ee_16407_2');
release_lock('ee_16407_2')
release_lock('ee_16407_2')
1
1
select /*3*/ user, host, db, info from information_schema.processlist
select /*3*/ user, host, db, info from information_schema.processlist
where info = 'select get_lock(\'ee_16407_2\', 60)';
where
state = 'User lock' and
info = 'select get_lock(\'ee_16407_2\', 60)';
user host db info
user host db info
set global event_scheduler= off;
set global event_scheduler= off;
select * from events_smode_test order by ev_name, a;
select * from events_
test.events_
smode_test order by ev_name, a;
ev_name a
ev_name a
ee_16407_3 1980-02-19
ee_16407_3 1980-02-19
ee_16407_3 1980-02-29
ee_16407_3 1980-02-29
...
@@ -143,7 +145,7 @@ drop event ee_16407_2;
...
@@ -143,7 +145,7 @@ drop event ee_16407_2;
drop event ee_16407_3;
drop event ee_16407_3;
drop event ee_16407_4;
drop event ee_16407_4;
"And now one last test regarding sql_mode and call of SP from an event"
"And now one last test regarding sql_mode and call of SP from an event"
delete from events_smode_test;
delete from events_
test.events_
smode_test;
set sql_mode='ansi';
set sql_mode='ansi';
select get_lock('ee_16407_5', 60);
select get_lock('ee_16407_5', 60);
get_lock('ee_16407_5', 60)
get_lock('ee_16407_5', 60)
...
@@ -166,10 +168,8 @@ call events_test.ee_16407_6_pendant();
...
@@ -166,10 +168,8 @@ call events_test.ee_16407_6_pendant();
end|
end|
"Should have 2 locked processes"
"Should have 2 locked processes"
select /*4*/ user, host, db, info from information_schema.processlist
select /*4*/ user, host, db, info from information_schema.processlist
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
order by info;
user host db info
user host db info
event_scheduler localhost NULL NULL
root localhost events_test select get_lock('ee_16407_5', 60)
root localhost events_test select get_lock('ee_16407_5', 60)
root localhost events_test select get_lock('ee_16407_5', 60)
root localhost events_test select get_lock('ee_16407_5', 60)
select release_lock('ee_16407_5');
select release_lock('ee_16407_5');
...
@@ -177,11 +177,9 @@ release_lock('ee_16407_5')
...
@@ -177,11 +177,9 @@ release_lock('ee_16407_5')
1
1
"Should have 0 processes locked"
"Should have 0 processes locked"
select /*5*/ user, host, db, info from information_schema.processlist
select /*5*/ user, host, db, info from information_schema.processlist
where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%')
where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
order by info;
user host db info
user host db info
event_scheduler localhost NULL NULL
select * from events_test.events_smode_test order by ev_name, a;
select * from events_smode_test order by ev_name, a;
ev_name a
ev_name a
ee_16407_6 2004-02-29
ee_16407_6 2004-02-29
"And here we check one more time before we drop the events"
"And here we check one more time before we drop the events"
...
@@ -740,3 +738,4 @@ name
...
@@ -740,3 +738,4 @@ name
drop event e1;
drop event e1;
DROP DATABASE events_test;
DROP DATABASE events_test;
SET GLOBAL event_scheduler = 'ON';
SET GLOBAL event_scheduler = 'ON';
SET @@global.concurrent_insert = @concurrent_insert;
mysql-test/r/log_state.result
View file @
041d0984
SET @old_general_log= @@global.general_log;
SET @old_general_log_file= @@global.general_log_file;
SET @old_slow_query_log= @@global.slow_query_log;
SET @old_slow_query_log_file= @@global.slow_query_log_file;
set global general_log= OFF;
set global general_log= OFF;
truncate table mysql.general_log;
truncate table mysql.general_log;
truncate table mysql.slow_log;
truncate table mysql.slow_log;
...
@@ -33,20 +37,26 @@ general_log ON
...
@@ -33,20 +37,26 @@ general_log ON
log ON
log ON
log_slow_queries OFF
log_slow_queries OFF
slow_query_log OFF
slow_query_log OFF
set session long_query_time=1;
# Establish connection con1 (user=root)
select sleep(2);
# Switch to connection con1
sleep(2)
set @long_query_time = <long_query_time>;
set session long_query_time = @long_query_time;
select sleep(@long_query_time + 1);
sleep(@long_query_time + 1)
0
0
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
# Switch to connection default
set global slow_query_log= ON;
set global slow_query_log= ON;
set session long_query_time=1;
# Switch to connection con1
select sleep(2);
set session long_query_time = @long_query_time;
sleep(2)
select sleep(@long_query_time + 1);
sleep(@long_query_time + 1)
0
0
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2)
TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(@long_query_time + 1)
# Switch to connection default
show global variables
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
...
@@ -92,8 +102,8 @@ slow_query_log_file #
...
@@ -92,8 +102,8 @@ slow_query_log_file #
show variables like 'log_output';
show variables like 'log_output';
Variable_name Value
Variable_name Value
log_output FILE,TABLE
log_output FILE,TABLE
set global general_log_file='/not exiting path/log.master';
set global general_log_file='/not exi
s
ting path/log.master';
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exi
s
ting path/log.master'
set global general_log_file='MYSQLTEST_VARDIR';
set global general_log_file='MYSQLTEST_VARDIR';
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR'
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR'
set global general_log_file='';
set global general_log_file='';
...
@@ -153,8 +163,10 @@ select * from mysql.general_log;
...
@@ -153,8 +163,10 @@ select * from mysql.general_log;
event_time user_host thread_id server_id command_type argument
event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST # 1 Query drop table t1
TIMESTAMP USER_HOST # 1 Query drop table t1
TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
SET @old_general_log_state = @@global.general_log;
SET @@global.general_log = @old_general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
SET GLOBAL general_log = ON;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL slow_query_log = ON;
FLUSH TABLES WITH READ LOCK;
FLUSH TABLES WITH READ LOCK;
...
@@ -173,10 +185,9 @@ SET GLOBAL READ_ONLY = ON;
...
@@ -173,10 +185,9 @@ SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = ON;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_log_state;
SET GLOBAL slow_query_log = @old_slow_query_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = ON;
SET @old_slow_log_state = @@global.slow_query_log;
SHOW VARIABLES LIKE 'general_log';
SHOW VARIABLES LIKE 'general_log';
Variable_name Value
Variable_name Value
general_log ON
general_log ON
...
@@ -239,29 +250,24 @@ log_slow_queries ON
...
@@ -239,29 +250,24 @@ log_slow_queries ON
SELECT @@slow_query_log, @@log_slow_queries;
SELECT @@slow_query_log, @@log_slow_queries;
@@slow_query_log @@log_slow_queries
@@slow_query_log @@log_slow_queries
1 1
1 1
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_log_state;
SET GLOBAL slow_query_log = @old_slow_query_log;
set @old_general_log_file= @@global.general_log_file;
SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r');
set @old_slow_query_log_file= @@global.slow_query_log_file;
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not existing path/log.master'
set global general_log_file= concat('/not exiting path/log.maste', 'r');
SET GLOBAL general_log_file= NULL;
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
set global general_log_file= NULL;
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'NULL'
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'NULL'
set global slow_query_log_file= concat('/not exi
ting path/log.maste', 'r');
SET GLOBAL slow_query_log_file= CONCAT('/not exis
ting path/log.maste', 'r');
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not exiting path/log.master'
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not exi
s
ting path/log.master'
set global
slow_query_log_file= NULL;
SET GLOBAL
slow_query_log_file= NULL;
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL'
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL'
set global
general_log_file= @old_general_log_file;
SET GLOBAL
general_log_file= @old_general_log_file;
set global
slow_query_log_file= @old_slow_query_log_file;
SET GLOBAL
slow_query_log_file= @old_slow_query_log_file;
# --
# --
# -- Bug#32748: Inconsistent handling of assignments to
# -- Bug#32748: Inconsistent handling of assignments to
# -- general_log_file/slow_query_log_file.
# --
general_log_file/slow_query_log_file.
# --
# --
SET @general_log_file_saved = @@global.general_log_file;
SET @slow_query_log_file_saved = @@global.slow_query_log_file;
SET GLOBAL general_log_file = 'bug32748.query.log';
SET GLOBAL general_log_file = 'bug32748.query.log';
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
...
@@ -270,8 +276,8 @@ Variable_name Value
...
@@ -270,8 +276,8 @@ Variable_name Value
general_log_file bug32748.query.log
general_log_file bug32748.query.log
slow_query_log_file bug32748.slow.log
slow_query_log_file bug32748.slow.log
SET GLOBAL general_log_file = @
general_log_file_saved
;
SET GLOBAL general_log_file = @
old_general_log_file
;
SET GLOBAL slow_query_log_file = @
slow_query_log_file_saved
;
SET GLOBAL slow_query_log_file = @
old_slow_query_log_file
;
# -- End of Bug#32748.
# -- End of Bug#32748.
deprecated:
deprecated:
...
@@ -298,4 +304,13 @@ SET GLOBAL general_log_file = @my_glf;
...
@@ -298,4 +304,13 @@ SET GLOBAL general_log_file = @my_glf;
SET GLOBAL slow_query_log_file = @my_sqlf;
SET GLOBAL slow_query_log_file = @my_sqlf;
SET GLOBAL general_log = DEFAULT;
SET GLOBAL general_log = DEFAULT;
SET GLOBAL slow_query_log = DEFAULT;
SET GLOBAL slow_query_log = DEFAULT;
SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
End of 5.1 tests
End of 5.1 tests
# Close connection con1
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
SET global slow_query_log_file = @old_slow_query_log_file;
mysql-test/r/mysqlcheck.result
View file @
041d0984
...
@@ -130,3 +130,58 @@ v1
...
@@ -130,3 +130,58 @@ v1
v-1
v-1
drop view v1, `v-1`;
drop view v1, `v-1`;
drop table t1;
drop table t1;
SET NAMES utf8;
CREATE TABLE `#mysql50#@` (a INT);
SHOW TABLES;
Tables_in_test
#mysql50#@
SET NAMES DEFAULT;
mysqlcheck --fix-table-names --databases test
SET NAMES utf8;
SHOW TABLES;
Tables_in_test
@
DROP TABLE `@`;
CREATE TABLE `я` (a INT);
SET NAMES DEFAULT;
mysqlcheck --default-character-set="latin1" --databases test
test.?
Error : Table 'test.?' doesn't exist
error : Corrupt
mysqlcheck --default-character-set="utf8" --databases test
test.я OK
SET NAMES utf8;
DROP TABLE `я`;
SET NAMES DEFAULT;
CREATE DATABASE `#mysql50#a@b`;
USE `#mysql50#a@b`;
CREATE TABLE `#mysql50#c@d` (a INT);
CREATE TABLE t1 (a INT);
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
NULL #mysql50#a@b tr1 INSERT NULL #mysql50#a@b #mysql50#c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
NULL #mysql50#a@b tr2 INSERT NULL #mysql50#a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
Warnings:
Warning 1603 Triggers for table `#mysql50#a@b`.`#mysql50#c@d` have no creation context
Warning 1603 Triggers for table `#mysql50#a@b`.`t1` have no creation context
mysqlcheck --fix-db-names --fix-table-names --all-databases
USE `a@b`;
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA="a@b" ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
NULL a@b tr1 INSERT NULL a@b c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
NULL a@b tr2 INSERT NULL a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
INSERT INTO `c@d` VALUES (2), (1);
SELECT * FROM `c@d`;
a
20
10
INSERT INTO t1 VALUES (3), (5);
SELECT * FROM t1;
a
300
500
DROP DATABASE `a@b`;
USE test;
End of 5.1 tests
mysql-test/r/type_date.result
View file @
041d0984
...
@@ -65,12 +65,15 @@ CREATE TABLE t1(AFIELD INT);
...
@@ -65,12 +65,15 @@ CREATE TABLE t1(AFIELD INT);
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(GMT VARCHAR(32));
CREATE TABLE t2(GMT VARCHAR(32));
INSERT INTO t2 VALUES('GMT-0800');
INSERT INTO t2 VALUES('GMT-0800');
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD;
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
FROM t1, t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800
Wed, 06 March 2002 10:11:12 GMT-0800
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(1);
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)),
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
FROM t1,t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800
Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800
drop table t1,t2;
drop table t1,t2;
CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
...
@@ -155,7 +158,7 @@ str_to_date( '', a )
...
@@ -155,7 +158,7 @@ str_to_date( '', a )
0000-00-00 00:00:00
0000-00-00 00:00:00
NULL
NULL
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a DATE, b
int
, PRIMARY KEY (a,b));
CREATE TABLE t1 (a DATE, b
INT
, PRIMARY KEY (a,b));
INSERT INTO t1 VALUES (DATE(NOW()), 1);
INSERT INTO t1 VALUES (DATE(NOW()), 1);
SELECT COUNT(*) FROM t1 WHERE a = NOW();
SELECT COUNT(*) FROM t1 WHERE a = NOW();
COUNT(*)
COUNT(*)
...
...
mysql-test/suite/funcs_1/r/is_coll
ation_character_set_applicability
.result
→
mysql-test/suite/funcs_1/r/is_coll
_char_set_appl
.result
View file @
041d0984
File moved
mysql-test/suite/funcs_1/t/is_coll
ation_character_set_applicability
.test
→
mysql-test/suite/funcs_1/t/is_coll
_char_set_appl
.test
View file @
041d0984
# suite/funcs_1/t/is_coll
ation_character_set_applicability
.test
# suite/funcs_1/t/is_coll
_char_set_appl
.test
#
#
# Check the layout of information_schema.collation_character_set_applicability
# Check the layout of information_schema.collation_character_set_applicability
# and some functionality re
al
ted tests.
# and some functionality re
la
ted tests.
#
#
# Author:
# Author:
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
...
...
mysql-test/suite/rpl/r/rpl_auto_increment.result
View file @
041d0984
...
@@ -227,3 +227,20 @@ select * from t3 order by a;
...
@@ -227,3 +227,20 @@ select * from t3 order by a;
a
a
127
127
drop table t1,t2,t3;
drop table t1,t2,t3;
set auto_increment_increment=1;
set auto_increment_offset=1;
CREATE TABLE t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
drop table t1;
mysql-test/t/events_bugs.test
View file @
041d0984
This diff is collapsed.
Click to expand it.
mysql-test/t/log_state.test
View file @
041d0984
This diff is collapsed.
Click to expand it.
mysql-test/t/mysqlcheck.test
View file @
041d0984
...
@@ -112,3 +112,76 @@ show tables;
...
@@ -112,3 +112,76 @@ show tables;
show
tables
;
show
tables
;
drop
view
v1
,
`v-1`
;
drop
view
v1
,
`v-1`
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #33094: Error in upgrading from 5.0 to 5.1 when table contains triggers
# Bug #41385: Crash when attempting to repair a #mysql50# upgraded table with
# triggers
#
SET
NAMES
utf8
;
CREATE
TABLE
`#mysql50#@`
(
a
INT
);
SHOW
TABLES
;
SET
NAMES
DEFAULT
;
--
echo
mysqlcheck
--
fix
-
table
-
names
--
databases
test
--
exec
$MYSQL_CHECK
--
fix
-
table
-
names
--
databases
test
SET
NAMES
utf8
;
SHOW
TABLES
;
DROP
TABLE
`@`
;
CREATE
TABLE
`я`
(
a
INT
);
SET
NAMES
DEFAULT
;
--
echo
mysqlcheck
--
default
-
character
-
set
=
"latin1"
--
databases
test
--
exec
$MYSQL_CHECK
--
default
-
character
-
set
=
"latin1"
--
databases
test
--
echo
mysqlcheck
--
default
-
character
-
set
=
"utf8"
--
databases
test
--
exec
$MYSQL_CHECK
--
default
-
character
-
set
=
"utf8"
--
databases
test
SET
NAMES
utf8
;
DROP
TABLE
`я`
;
SET
NAMES
DEFAULT
;
CREATE
DATABASE
`#mysql50#a@b`
;
USE
`#mysql50#a@b`
;
CREATE
TABLE
`#mysql50#c@d`
(
a
INT
);
CREATE
TABLE
t1
(
a
INT
);
# Create 5.0 like triggers
--
write_file
$MYSQLTEST_VARDIR
/
master
-
data
/
a
@
b
/
c
@
d
.
TRG
TYPE
=
TRIGGERS
triggers
=
'CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a'
sql_modes
=
0
definers
=
'root@localhost'
EOF
--
write_file
$MYSQLTEST_VARDIR
/
master
-
data
/
a
@
b
/
tr1
.
TRN
TYPE
=
TRIGGERNAME
trigger_table
=
c
@
d
EOF
--
write_file
$MYSQLTEST_VARDIR
/
master
-
data
/
a
@
b
/
t1
.
TRG
TYPE
=
TRIGGERS
triggers
=
'CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a'
sql_modes
=
0
definers
=
'root@localhost'
EOF
--
write_file
$MYSQLTEST_VARDIR
/
master
-
data
/
a
@
b
/
tr2
.
TRN
TYPE
=
TRIGGERNAME
trigger_table
=
t1
EOF
SELECT
*
FROM
INFORMATION_SCHEMA
.
TRIGGERS
WHERE
TRIGGER_SCHEMA
=
"#mysql50#a@b"
ORDER
BY
trigger_name
;
--
echo
mysqlcheck
--
fix
-
db
-
names
--
fix
-
table
-
names
--
all
-
databases
--
exec
$MYSQL_CHECK
--
fix
-
db
-
names
--
fix
-
table
-
names
--
all
-
databases
USE
`a@b`
;
SELECT
*
FROM
INFORMATION_SCHEMA
.
TRIGGERS
WHERE
TRIGGER_SCHEMA
=
"a@b"
ORDER
BY
trigger_name
;
INSERT
INTO
`c@d`
VALUES
(
2
),
(
1
);
SELECT
*
FROM
`c@d`
;
INSERT
INTO
t1
VALUES
(
3
),
(
5
);
SELECT
*
FROM
t1
;
DROP
DATABASE
`a@b`
;
USE
test
;
--
echo
End
of
5.1
tests
mysql-test/t/type_date.test
View file @
041d0984
...
@@ -62,7 +62,7 @@ drop table t1;
...
@@ -62,7 +62,7 @@ drop table t1;
# Test of date and not null
# Test of date and not null
#
#
create
table
t1
(
date
date
);
create
table
t1
(
date
date
);
insert
into
t1
values
(
"2000-08-10"
),(
"2000-08-11"
);
insert
into
t1
values
(
"2000-08-10"
),(
"2000-08-11"
);
select
date_add
(
date
,
INTERVAL
1
DAY
),
date_add
(
date
,
INTERVAL
1
SECOND
)
from
t1
;
select
date_add
(
date
,
INTERVAL
1
DAY
),
date_add
(
date
,
INTERVAL
1
SECOND
)
from
t1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -75,9 +75,12 @@ CREATE TABLE t1(AFIELD INT);
...
@@ -75,9 +75,12 @@ CREATE TABLE t1(AFIELD INT);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t1
VALUES
(
1
);
CREATE
TABLE
t2
(
GMT
VARCHAR
(
32
));
CREATE
TABLE
t2
(
GMT
VARCHAR
(
32
));
INSERT
INTO
t2
VALUES
(
'GMT-0800'
);
INSERT
INTO
t2
VALUES
(
'GMT-0800'
);
SELECT
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
))
FROM
t1
,
t2
GROUP
BY
t1
.
AFIELD
;
SELECT
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
))
FROM
t1
,
t2
GROUP
BY
t1
.
AFIELD
;
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t1
VALUES
(
1
);
SELECT
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
)),
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
))
FROM
t1
,
t2
GROUP
BY
t1
.
AFIELD
;
SELECT
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
)),
DATE_FORMAT
(
"2002-03-06 10:11:12"
,
CONCAT
(
'%a, %d %M %Y %H:%i:%s '
,
t2
.
GMT
))
FROM
t1
,
t2
GROUP
BY
t1
.
AFIELD
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
#
...
@@ -90,7 +93,7 @@ SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
...
@@ -90,7 +93,7 @@ SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
4937: different date -> string conversion when using SELECT ... UNION
# Bug
#
4937: different date -> string conversion when using SELECT ... UNION
# and INSERT ... SELECT ... UNION
# and INSERT ... SELECT ... UNION
#
#
...
@@ -141,7 +144,7 @@ select * from t1;
...
@@ -141,7 +144,7 @@ select * from t1;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#30942: select str_to_date from derived table returns varying results
# Bug#30942: select str_to_date from derived table returns varying results
#
#
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
INT
a
INT
...
@@ -155,10 +158,22 @@ DROP TABLE t1;
...
@@ -155,10 +158,22 @@ DROP TABLE t1;
#
#
# Bug
#31221: Optimizer incorrectly identifies impossible WHERE clause
# Bug#31221: Optimizer incorrectly identifies impossible WHERE clause
#
#
CREATE
TABLE
t1
(
a
DATE
,
b
int
,
PRIMARY
KEY
(
a
,
b
));
CREATE
TABLE
t1
(
a
DATE
,
b
INT
,
PRIMARY
KEY
(
a
,
b
));
## The current sub test could fail (difference to expected result) if we
## have just reached midnight.
## (Bug#41776 type_date.test may fail if run around midnight)
## Therefore we sleep a bit if we are too close to midnight.
## The complete test itself needs in average less than 1 second.
## Therefore a time_distance to midnight of 5 seconds should be sufficient.
if
(
`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`
)
{
# We are here when CURTIME() is between '23:59:56' and '23:59:59'.
# So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'.
--
real_sleep
5
}
INSERT
INTO
t1
VALUES
(
DATE
(
NOW
()),
1
);
INSERT
INTO
t1
VALUES
(
DATE
(
NOW
()),
1
);
SELECT
COUNT
(
*
)
FROM
t1
WHERE
a
=
NOW
();
SELECT
COUNT
(
*
)
FROM
t1
WHERE
a
=
NOW
();
EXPLAIN
SELECT
COUNT
(
*
)
FROM
t1
WHERE
a
=
NOW
();
EXPLAIN
SELECT
COUNT
(
*
)
FROM
t1
WHERE
a
=
NOW
();
...
@@ -174,7 +189,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
...
@@ -174,7 +189,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#28687: Search fails on '0000-00-00' date after sql_mode change
# Bug#28687: Search fails on '0000-00-00' date after sql_mode change
#
#
CREATE
TABLE
t1
(
a
DATE
);
CREATE
TABLE
t1
(
a
DATE
);
...
...
sql/log_event.cc
View file @
041d0984
...
@@ -8129,6 +8129,9 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability
...
@@ -8129,6 +8129,9 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability
analyze if explicit data is provided for slave's TIMESTAMP columns).
analyze if explicit data is provided for slave's TIMESTAMP columns).
*/
*/
m_table
->
timestamp_field_type
=
TIMESTAMP_NO_AUTO_SET
;
m_table
->
timestamp_field_type
=
TIMESTAMP_NO_AUTO_SET
;
/* Honor next number column if present */
m_table
->
next_number_field
=
m_table
->
found_next_number_field
;
return
error
;
return
error
;
}
}
...
@@ -8137,6 +8140,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability *
...
@@ -8137,6 +8140,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability *
int
error
)
int
error
)
{
{
int
local_error
=
0
;
int
local_error
=
0
;
m_table
->
next_number_field
=
0
;
if
(
bit_is_set
(
slave_exec_mode
,
SLAVE_EXEC_MODE_IDEMPOTENT
)
==
1
||
if
(
bit_is_set
(
slave_exec_mode
,
SLAVE_EXEC_MODE_IDEMPOTENT
)
==
1
||
m_table
->
s
->
db_type
()
->
db_type
==
DB_TYPE_NDBCLUSTER
)
m_table
->
s
->
db_type
()
->
db_type
==
DB_TYPE_NDBCLUSTER
)
{
{
...
...
sql/mysql_priv.h
View file @
041d0984
...
@@ -2230,6 +2230,7 @@ uint strconvert(CHARSET_INFO *from_cs, const char *from,
...
@@ -2230,6 +2230,7 @@ uint strconvert(CHARSET_INFO *from_cs, const char *from,
CHARSET_INFO
*
to_cs
,
char
*
to
,
uint
to_length
,
uint
*
errors
);
CHARSET_INFO
*
to_cs
,
char
*
to
,
uint
to_length
,
uint
*
errors
);
uint
filename_to_tablename
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
uint
filename_to_tablename
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
uint
tablename_to_filename
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
uint
tablename_to_filename
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
uint
check_n_cut_mysql50_prefix
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
#endif
/* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#endif
/* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
#ifdef MYSQL_SERVER
uint
build_table_filename
(
char
*
buff
,
size_t
bufflen
,
const
char
*
db
,
uint
build_table_filename
(
char
*
buff
,
size_t
bufflen
,
const
char
*
db
,
...
...
sql/sql_table.cc
View file @
041d0984
...
@@ -114,6 +114,30 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
...
@@ -114,6 +114,30 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
}
}
/**
Check if given string begins with "#mysql50#" prefix, cut it if so.
@param from string to check and cut
@param to[out] buffer for result string
@param to_length its size
@retval
0 no prefix found
@retval
non-0 result string length
*/
uint
check_n_cut_mysql50_prefix
(
const
char
*
from
,
char
*
to
,
uint
to_length
)
{
if
(
from
[
0
]
==
'#'
&&
!
strncmp
(
from
,
MYSQL50_TABLE_NAME_PREFIX
,
MYSQL50_TABLE_NAME_PREFIX_LENGTH
))
return
(
uint
)
(
strmake
(
to
,
from
+
MYSQL50_TABLE_NAME_PREFIX_LENGTH
,
to_length
-
1
)
-
to
);
return
0
;
}
/*
/*
Translate a table name to a file name (WL #1324).
Translate a table name to a file name (WL #1324).
...
@@ -133,11 +157,8 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
...
@@ -133,11 +157,8 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
DBUG_ENTER
(
"tablename_to_filename"
);
DBUG_ENTER
(
"tablename_to_filename"
);
DBUG_PRINT
(
"enter"
,
(
"from '%s'"
,
from
));
DBUG_PRINT
(
"enter"
,
(
"from '%s'"
,
from
));
if
(
from
[
0
]
==
'#'
&&
!
strncmp
(
from
,
MYSQL50_TABLE_NAME_PREFIX
,
if
((
length
=
check_n_cut_mysql50_prefix
(
from
,
to
,
to_length
)))
MYSQL50_TABLE_NAME_PREFIX_LENGTH
))
DBUG_RETURN
(
length
);
DBUG_RETURN
((
uint
)
(
strmake
(
to
,
from
+
MYSQL50_TABLE_NAME_PREFIX_LENGTH
,
to_length
-
1
)
-
(
from
+
MYSQL50_TABLE_NAME_PREFIX_LENGTH
)));
length
=
strconvert
(
system_charset_info
,
from
,
length
=
strconvert
(
system_charset_info
,
from
,
&
my_charset_filename
,
to
,
to_length
,
&
errors
);
&
my_charset_filename
,
to
,
to_length
,
&
errors
);
if
(
check_if_legal_tablename
(
to
)
&&
if
(
check_if_legal_tablename
(
to
)
&&
...
...
sql/sql_trigger.cc
View file @
041d0984
...
@@ -1368,15 +1368,27 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
...
@@ -1368,15 +1368,27 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
if
(
triggers
->
on_table_names_list
.
push_back
(
on_table_name
,
&
table
->
mem_root
))
if
(
triggers
->
on_table_names_list
.
push_back
(
on_table_name
,
&
table
->
mem_root
))
goto
err_with_lex_cleanup
;
goto
err_with_lex_cleanup
;
#ifndef DBUG_OFF
/*
/*
Let us check that we correctly update trigger definitions when we
Let us check that we correctly update trigger definitions when we
rename tables with triggers.
rename tables with triggers.
In special cases like "RENAME TABLE `#mysql50#somename` TO `somename`"
or "ALTER DATABASE `#mysql50#somename` UPGRADE DATA DIRECTORY NAME"
we might be given table or database name with "#mysql50#" prefix (and
trigger's definiton contains un-prefixed version of the same name).
To remove this prefix we use check_n_cut_mysql50_prefix().
*/
*/
DBUG_ASSERT
(
!
my_strcasecmp
(
table_alias_charset
,
lex
.
query_tables
->
db
,
db
)
&&
!
my_strcasecmp
(
table_alias_charset
,
lex
.
query_tables
->
table_name
,
table_name
));
char
fname
[
NAME_LEN
+
1
];
DBUG_ASSERT
((
!
my_strcasecmp
(
table_alias_charset
,
lex
.
query_tables
->
db
,
db
)
||
(
check_n_cut_mysql50_prefix
(
db
,
fname
,
sizeof
(
fname
))
&&
!
my_strcasecmp
(
table_alias_charset
,
lex
.
query_tables
->
db
,
fname
)))
&&
(
!
my_strcasecmp
(
table_alias_charset
,
lex
.
query_tables
->
table_name
,
table_name
)
||
(
check_n_cut_mysql50_prefix
(
table_name
,
fname
,
sizeof
(
fname
))
&&
!
my_strcasecmp
(
table_alias_charset
,
lex
.
query_tables
->
table_name
,
fname
))));
#endif
if
(
names_only
)
if
(
names_only
)
{
{
lex_end
(
&
lex
);
lex_end
(
&
lex
);
...
@@ -1692,7 +1704,8 @@ end:
...
@@ -1692,7 +1704,8 @@ end:
(change name of table in triggers' definitions).
(change name of table in triggers' definitions).
@param thd Thread context
@param thd Thread context
@param db_name Database of subject table
@param old_db_name Old database of subject table
@param new_db_name New database of subject table
@param old_table_name Old subject table's name
@param old_table_name Old subject table's name
@param new_table_name New subject table's name
@param new_table_name New subject table's name
...
@@ -1704,7 +1717,8 @@ end:
...
@@ -1704,7 +1717,8 @@ end:
bool
bool
Table_triggers_list
::
change_table_name_in_triggers
(
THD
*
thd
,
Table_triggers_list
::
change_table_name_in_triggers
(
THD
*
thd
,
const
char
*
db_name
,
const
char
*
old_db_name
,
const
char
*
new_db_name
,
LEX_STRING
*
old_table_name
,
LEX_STRING
*
old_table_name
,
LEX_STRING
*
new_table_name
)
LEX_STRING
*
new_table_name
)
{
{
...
@@ -1757,11 +1771,11 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
...
@@ -1757,11 +1771,11 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
if
(
thd
->
is_fatal_error
)
if
(
thd
->
is_fatal_error
)
return
TRUE
;
/* OOM */
return
TRUE
;
/* OOM */
if
(
save_trigger_file
(
this
,
db_name
,
new_table_name
->
str
))
if
(
save_trigger_file
(
this
,
new_
db_name
,
new_table_name
->
str
))
return
TRUE
;
return
TRUE
;
if
(
rm_trigger_file
(
path_buff
,
db_name
,
old_table_name
->
str
))
if
(
rm_trigger_file
(
path_buff
,
old_
db_name
,
old_table_name
->
str
))
{
{
(
void
)
rm_trigger_file
(
path_buff
,
db_name
,
new_table_name
->
str
);
(
void
)
rm_trigger_file
(
path_buff
,
new_
db_name
,
new_table_name
->
str
);
return
TRUE
;
return
TRUE
;
}
}
return
FALSE
;
return
FALSE
;
...
@@ -1772,7 +1786,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
...
@@ -1772,7 +1786,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
Iterate though Table_triggers_list::names_list list and update
Iterate though Table_triggers_list::names_list list and update
.TRN files after renaming triggers' subject table.
.TRN files after renaming triggers' subject table.
@param db_name Database of subject table
@param old_db_name Old database of subject table
@param new_db_name New database of subject table
@param new_table_name New subject table's name
@param new_table_name New subject table's name
@param stopper Pointer to Table_triggers_list::names_list at
@param stopper Pointer to Table_triggers_list::names_list at
which we should stop updating.
which we should stop updating.
...
@@ -1785,7 +1800,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
...
@@ -1785,7 +1800,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
*/
*/
LEX_STRING
*
LEX_STRING
*
Table_triggers_list
::
change_table_name_in_trignames
(
const
char
*
db_name
,
Table_triggers_list
::
change_table_name_in_trignames
(
const
char
*
old_db_name
,
const
char
*
new_db_name
,
LEX_STRING
*
new_table_name
,
LEX_STRING
*
new_table_name
,
LEX_STRING
*
stopper
)
LEX_STRING
*
stopper
)
{
{
...
@@ -1798,7 +1814,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name,
...
@@ -1798,7 +1814,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name,
while
((
trigger
=
it_name
++
)
!=
stopper
)
while
((
trigger
=
it_name
++
)
!=
stopper
)
{
{
trigname_file
.
length
=
build_table_filename
(
trigname_buff
,
FN_REFLEN
-
1
,
trigname_file
.
length
=
build_table_filename
(
trigname_buff
,
FN_REFLEN
-
1
,
db_name
,
trigger
->
str
,
new_
db_name
,
trigger
->
str
,
TRN_EXT
,
0
);
TRN_EXT
,
0
);
trigname_file
.
str
=
trigname_buff
;
trigname_file
.
str
=
trigname_buff
;
...
@@ -1807,6 +1823,16 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name,
...
@@ -1807,6 +1823,16 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name,
if
(
sql_create_definition_file
(
NULL
,
&
trigname_file
,
&
trigname_file_type
,
if
(
sql_create_definition_file
(
NULL
,
&
trigname_file
,
&
trigname_file_type
,
(
uchar
*
)
&
trigname
,
trigname_file_parameters
))
(
uchar
*
)
&
trigname
,
trigname_file_parameters
))
return
trigger
;
return
trigger
;
/* Remove stale .TRN file in case of database upgrade */
if
(
old_db_name
)
{
if
(
rm_trigname_file
(
trigname_buff
,
old_db_name
,
trigger
->
str
))
{
(
void
)
rm_trigname_file
(
trigname_buff
,
new_db_name
,
trigger
->
str
);
return
trigger
;
}
}
}
}
return
0
;
return
0
;
...
@@ -1840,6 +1866,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
...
@@ -1840,6 +1866,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
{
{
TABLE
table
;
TABLE
table
;
bool
result
=
0
;
bool
result
=
0
;
bool
upgrading50to51
=
FALSE
;
LEX_STRING
*
err_trigname
;
LEX_STRING
*
err_trigname
;
DBUG_ENTER
(
"change_table_name"
);
DBUG_ENTER
(
"change_table_name"
);
...
@@ -1877,14 +1904,27 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
...
@@ -1877,14 +1904,27 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
moving table with them between two schemas raises too many questions.
moving table with them between two schemas raises too many questions.
(E.g. what should happen if in new schema we already have trigger
(E.g. what should happen if in new schema we already have trigger
with same name ?).
with same name ?).
In case of "ALTER DATABASE `#mysql50#db1` UPGRADE DATA DIRECTORY NAME"
we will be given table name with "#mysql50#" prefix
To remove this prefix we use check_n_cut_mysql50_prefix().
*/
*/
if
(
my_strcasecmp
(
table_alias_charset
,
db
,
new_db
))
if
(
my_strcasecmp
(
table_alias_charset
,
db
,
new_db
))
{
{
my_error
(
ER_TRG_IN_WRONG_SCHEMA
,
MYF
(
0
));
char
dbname
[
NAME_LEN
+
1
];
result
=
1
;
if
(
check_n_cut_mysql50_prefix
(
db
,
dbname
,
sizeof
(
dbname
))
&&
goto
end
;
!
my_strcasecmp
(
table_alias_charset
,
dbname
,
new_db
))
{
upgrading50to51
=
TRUE
;
}
else
{
my_error
(
ER_TRG_IN_WRONG_SCHEMA
,
MYF
(
0
));
result
=
1
;
goto
end
;
}
}
}
if
(
table
.
triggers
->
change_table_name_in_triggers
(
thd
,
db
,
if
(
table
.
triggers
->
change_table_name_in_triggers
(
thd
,
db
,
new_db
,
&
old_table_name
,
&
old_table_name
,
&
new_table_name
))
&
new_table_name
))
{
{
...
@@ -1892,7 +1932,8 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
...
@@ -1892,7 +1932,8 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
goto
end
;
goto
end
;
}
}
if
((
err_trigname
=
table
.
triggers
->
change_table_name_in_trignames
(
if
((
err_trigname
=
table
.
triggers
->
change_table_name_in_trignames
(
db
,
&
new_table_name
,
0
)))
upgrading50to51
?
db
:
NULL
,
new_db
,
&
new_table_name
,
0
)))
{
{
/*
/*
If we were unable to update one of .TRN files properly we will
If we were unable to update one of .TRN files properly we will
...
@@ -1900,16 +1941,17 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
...
@@ -1900,16 +1941,17 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
We assume that we will be able to undo our changes without errors
We assume that we will be able to undo our changes without errors
(we can't do much if there will be an error anyway).
(we can't do much if there will be an error anyway).
*/
*/
(
void
)
table
.
triggers
->
change_table_name_in_trignames
(
db
,
(
void
)
table
.
triggers
->
change_table_name_in_trignames
(
&
old_table_name
,
upgrading50to51
?
new_db
:
NULL
,
db
,
err_trigname
);
&
old_table_name
,
err_trigname
);
(
void
)
table
.
triggers
->
change_table_name_in_triggers
(
thd
,
db
,
(
void
)
table
.
triggers
->
change_table_name_in_triggers
(
&
new_table_name
,
thd
,
db
,
new_db
,
&
old_table_name
);
&
new_table_name
,
&
old_table_name
);
result
=
1
;
result
=
1
;
goto
end
;
goto
end
;
}
}
}
}
end:
end:
delete
table
.
triggers
;
delete
table
.
triggers
;
free_root
(
&
table
.
mem_root
,
MYF
(
0
));
free_root
(
&
table
.
mem_root
,
MYF
(
0
));
...
...
sql/sql_trigger.h
View file @
041d0984
...
@@ -146,11 +146,13 @@ public:
...
@@ -146,11 +146,13 @@ public:
private:
private:
bool
prepare_record1_accessors
(
TABLE
*
table
);
bool
prepare_record1_accessors
(
TABLE
*
table
);
LEX_STRING
*
change_table_name_in_trignames
(
const
char
*
db_name
,
LEX_STRING
*
change_table_name_in_trignames
(
const
char
*
old_db_name
,
const
char
*
new_db_name
,
LEX_STRING
*
new_table_name
,
LEX_STRING
*
new_table_name
,
LEX_STRING
*
stopper
);
LEX_STRING
*
stopper
);
bool
change_table_name_in_triggers
(
THD
*
thd
,
bool
change_table_name_in_triggers
(
THD
*
thd
,
const
char
*
db_name
,
const
char
*
old_db_name
,
const
char
*
new_db_name
,
LEX_STRING
*
old_table_name
,
LEX_STRING
*
old_table_name
,
LEX_STRING
*
new_table_name
);
LEX_STRING
*
new_table_name
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment