diff options
author | unknown <monty@narttu.mysql.fi> | 2003-11-03 22:48:03 +0200 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-11-03 22:48:03 +0200 |
commit | 30c97ed1755b50f14f294108d93bd37d2094010c (patch) | |
tree | 68c6948d4fbd18bb59fa1aeafdce4a07a41b835f /mysql-test | |
parent | 78ee8de22df90d4c0d21887c67e0d0e51b210727 (diff) | |
parent | 4cb95b8dfdcd511d9e3f0a164747a5181686d2c7 (diff) | |
download | mariadb-git-30c97ed1755b50f14f294108d93bd37d2094010c.tar.gz |
Merge
BitKeeper/etc/ignore:
auto-union
include/m_ctype.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/func_compress.result:
Auto merged
mysql-test/t/date_formats.test:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
strings/ctype-bin.c:
Auto merged
include/mysqld_error.h:
Merge error messages
mysql-test/r/date_formats.result:
merge
sql/derror.cc:
Fixed wront return value
sql/item_timefunc.cc:
merge
sql/item_timefunc.h:
merge
sql/mysqld.cc:
merge
sql/share/czech/errmsg.txt:
Merge error messages
sql/share/danish/errmsg.txt:
Merge error messages
sql/share/dutch/errmsg.txt:
Merge error messages
sql/share/english/errmsg.txt:
Merge error messages
sql/share/estonian/errmsg.txt:
Merge error messages
sql/share/french/errmsg.txt:
Merge error messages
sql/share/german/errmsg.txt:
Merge error messages
sql/share/greek/errmsg.txt:
Merge error messages
sql/share/hungarian/errmsg.txt:
Merge error messages
sql/share/italian/errmsg.txt:
Merge error messages
sql/share/japanese/errmsg.txt:
Merge error messages
sql/share/korean/errmsg.txt:
Merge error messages
sql/share/norwegian-ny/errmsg.txt:
Merge error messages
sql/share/norwegian/errmsg.txt:
Merge error messages
sql/share/polish/errmsg.txt:
Merge error messages
sql/share/portuguese/errmsg.txt:
Merge error messages
sql/share/romanian/errmsg.txt:
Merge error messages
sql/share/russian/errmsg.txt:
Merge error messages
sql/share/serbian/errmsg.txt:
Merge error messages
sql/share/slovak/errmsg.txt:
Merge error messages
sql/share/spanish/errmsg.txt:
Merge error messages
sql/share/swedish/errmsg.txt:
Merge error messages
sql/share/ukrainian/errmsg.txt:
Merge error messages
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/mysql-test-run.sh | 6 | ||||
-rw-r--r-- | mysql-test/r/ctype_latin1_de.result | 12 | ||||
-rw-r--r-- | mysql-test/r/ctype_recoding.result | 4 | ||||
-rw-r--r-- | mysql-test/r/date_formats.result | 436 | ||||
-rw-r--r-- | mysql-test/r/func_compress.result | 2 | ||||
-rw-r--r-- | mysql-test/r/rpl_temporary.result | 1 | ||||
-rw-r--r-- | mysql-test/t/create.test | 22 | ||||
-rw-r--r-- | mysql-test/t/ctype_latin1_de.test | 2 | ||||
-rw-r--r-- | mysql-test/t/ctype_recoding.test | 4 | ||||
-rw-r--r-- | mysql-test/t/date_formats-master.opt | 2 | ||||
-rw-r--r-- | mysql-test/t/date_formats.test | 253 | ||||
-rw-r--r-- | mysql-test/t/overflow.test | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl_temporary-master.opt | 0 | ||||
-rw-r--r-- | mysql-test/t/rpl_temporary.test | 8 | ||||
-rw-r--r-- | mysql-test/t/symlink.test | 4 |
15 files changed, 537 insertions, 221 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 94affe6b2f7..eda2f3b2a34 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -394,7 +394,7 @@ SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log" SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err" CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test" -SMALL_SERVER="-O key_buffer_size=1M -O sort_buffer=256K -O max_heap_table_size=1M" +SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M" export MASTER_MYPORT export SLAVE_MYPORT @@ -795,13 +795,13 @@ manager_launch() ident=$1 shift if [ $USE_MANAGER = 0 ] ; then - $@ >> $CUR_MYERR 2>&1 & + $@ >> $CUR_MYERR 2>&1 & sleep 2 #hack return fi $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \ --password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF -def_exec $ident $@ +def_exec $ident "$@" set_exec_stdout $ident $CUR_MYERR set_exec_stderr $ident $CUR_MYERR set_exec_con $ident root localhost $CUR_MYSOCK diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index 3db2f3d5519..07ea97258d9 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -219,6 +219,13 @@ a test drop table t1; create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `word` varchar(255) collate latin1_german2_ci NOT NULL default '', + `word2` varchar(255) collate latin1_german2_ci NOT NULL default '', + KEY `word` (`word`) +) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_german2_ci insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); update t1 set word2=word; select word, word=binary 0xdf as t from t1 having t > 0; @@ -273,6 +280,11 @@ drop table t1; CREATE TABLE t1 ( s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci ); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` char(5) collate latin1_german2_ci default NULL +) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_german2_ci INSERT INTO t1 VALUES ('э'); INSERT INTO t1 VALUES ('ue'); SELECT DISTINCT s1 FROM t1; diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 5a53c1db2e1..1fe07692290 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -1,5 +1,5 @@ SET CHARACTER SET koi8r; -DROP TABLE IF EXISTS таблица; +DROP TABLE IF EXISTS таблица, t1; SET CHARACTER SET koi8r; CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'проба' AS a; SHOW CREATE TABLE t1; @@ -14,7 +14,7 @@ SELECT HEX(a) FROM t1; HEX(a) EFF0EEE1E0 DROP TABLE t1; -CREATE TABLE таблица +CREATE TABLE `таблица` ( поле CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "комментарий поля" ) COMMENT "комментарий таблицы"; diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index e21e05b4dfe..346d086f34c 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -1,151 +1,315 @@ +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' SHOW GLOBAL VARIABLES LIKE "%_format%"; Variable_name Value date_format %d.%m.%Y -datetime_format %Y/%d/%m-%H:%i:%s +datetime_format %Y-%m-%d %H:%i:%s default_week_format 0 time_format %H.%i.%s SHOW SESSION VARIABLES LIKE "%_format%"; Variable_name Value date_format %d.%m.%Y -datetime_format %Y/%d/%m-%H:%i:%s +datetime_format %Y-%m-%d %H:%i:%s default_week_format 0 time_format %H.%i.%s -SET date_format="%d.%m.%Y"; -select CAST("01.01.2001" as DATE) as a; -a -01.01.2001 -SET datetime_format="%d.%m.%Y %H.%i.%s"; -select CAST("01.01.2001 05.12.06" as DATETIME) as a; -a -01.01.2001 05.12.06 -SET time_format="%H.%i.%s"; -select CAST("05.12.06" as TIME) as a; -a -05.12.06 -SET datetime_format="%d.%m.%Y %h:%i:%s %p"; -select CAST("01.01.2001 05:12:06AM" as DATETIME) as a; -a -01.01.2001 05:12:06 AM -select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a; -a -01.01.2001 05:12:06 PM -SET time_format="%h:%i:%s %p"; -select CAST("05:12:06 AM" as TIME) as a; -a -05:12:06 AM -select CAST("05:12:06.1234PM" as TIME) as a; -a -05:12:06.001234 PM -SET time_format="%h.%i.%s %p"; -SET date_format='%d.%m.%y'; -SET datetime_format="%d.%m.%y %h.%i.%s %p"; -select CAST("12-12-06" as DATE) as a; -a -12.12.06 -select adddate("01.01.97 11.59.59.000001 PM", 10); -adddate("01.01.97 11.59.59.000001 PM", 10) -11.01.97 11.59.59.000001 PM -select datediff("31.12.97 11.59:59.000001 PM","01.01.98"); -datediff("31.12.97 11.59:59.000001 PM","01.01.98") --1 -select weekofyear("31.11.97 11:59:59.000001 PM"); -weekofyear("31.11.97 11:59:59.000001 PM") -49 -select makedate(1997,1); -makedate(1997,1) -01.01.97 -select addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"); -addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002") -02.01.98 01.01.01.000001 AM -select maketime(23,11,12); -maketime(23,11,12) -11.11.12 PM -select timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"); -timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM") -8795.59.59.999999 PM -SET time_format="%H%i%s"; -SET time_format="%h%i%s"; -ERROR HY000: Unknown error +SET time_format='%H%i%s'; +SET time_format='%H:%i:%s.%f'; +SET time_format='%h-%i-%s.%f%p'; +SET time_format='%h:%i:%s.%f %p'; +SET time_format='%h:%i:%s%p'; +SET date_format='%Y%m%d'; +SET date_format='%Y.%m.%d'; +SET date_format='%d.%m.%Y'; +SET date_format='%m-%d-%Y'; +set datetime_format= '%Y%m%d%H%i%s'; +set datetime_format= '%Y-%m-%d %H:%i:%s'; +set datetime_format= '%m-%d-%y %H:%i:%s.%f'; +set datetime_format= '%d-%m-%Y %h:%i:%s%p'; +set datetime_format= '%H:%i:%s %Y-%m-%d'; +set datetime_format= '%H:%i:%s.%f %m-%d-%Y'; +set datetime_format= '%h:%i:%s %p %Y-%m-%d'; +set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d'; +SHOW SESSION VARIABLES LIKE "%format"; +Variable_name Value +date_format %m-%d-%Y +datetime_format %h:%i:%s.%f %p %Y-%m-%d +default_week_format 0 +time_format %h:%i:%s%p +SET time_format='%h:%i:%s'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s' +SET time_format='%H %i:%s'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%H %i:%s' +SET time_format='%H::%i:%s'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%H::%i:%s' +SET time_format='%H:%i:%s%f'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%f' +SET time_format='%H:%i.%f:%s'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i.%f:%s' +SET time_format='%H:%i:%s%p'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%p' +SET time_format='%h:%i:%s.%f %p %Y-%m-%d'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s.%f %p %Y-%m-%d' +SET time_format='%H%i%s.%f'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%H%i%s.%f' +SET time_format='%H:%i-%s.%f'; +ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i-%s.%f' SET date_format='%d.%m.%d'; -ERROR HY000: Unknown error -SET datetime_format="%d.%m.%y %h.%i.%s"; -ERROR HY000: Unknown error +ERROR 42000: Variable 'date_format' can't be set to the value of '%d.%m.%d' +SET datetime_format='%h.%m.%y %d.%i.%s'; +ERROR 42000: Variable 'datetime_format' can't be set to the value of '%h.%m.%y %d.%i.%s' +set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d'; +ERROR 42000: Variable 'datetime_format' can't be set to the value of '%H:%i:%s.%f %p %Y-%m-%d' +set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d'; +SET SESSION datetime_format=default; +select @@global.datetime_format, @@session.datetime_format; +@@global.datetime_format @@session.datetime_format +%H:%i:%s %Y-%m-%d %H:%i:%s %Y-%m-%d +SET GLOBAL datetime_format=default; +SET SESSION datetime_format=default; +select @@global.datetime_format, @@session.datetime_format; +@@global.datetime_format @@session.datetime_format +%Y-%m-%d %H:%i:%s %Y-%m-%d %H:%i:%s SET GLOBAL date_format=default; -SHOW GLOBAL VARIABLES LIKE "date_format%"; -Variable_name Value -date_format %d.%m.%Y SET GLOBAL time_format=default; -SHOW GLOBAL VARIABLES LIKE "time_format%"; -Variable_name Value -time_format %H.%i.%s SET GLOBAL datetime_format=default; -SHOW GLOBAL VARIABLES LIKE "datetime_format%"; -Variable_name Value -datetime_format %Y/%d/%m-%H:%i:%s -SET date_format=default; -SHOW SESSION VARIABLES LIKE "date_format%"; -Variable_name Value -date_format %d.%m.%Y SET time_format=default; -SHOW SESSION VARIABLES LIKE "time_format%"; -Variable_name Value -time_format %H.%i.%s +SET date_format=default; SET datetime_format=default; -SHOW SESSION VARIABLES LIKE "datetime_format%"; -Variable_name Value -datetime_format %Y/%d/%m-%H:%i:%s -SET time_format='%i:%s:%H'; -select cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME); -cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME) -59:59:12 -SET GLOBAL date_format='%Y-%m-%d'; -SET GLOBAL time_format='%H:%i:%s'; -SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s'; -SET date_format='%Y-%m-%d'; -SET time_format='%H:%i:%s'; -SET datetime_format='%Y-%m-%d %H:%i:%s'; -select str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S"); -str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") -2001-01-15 12:59:59 -select str_to_date("15 September 2001", "%d %M %Y"); -str_to_date("15 September 2001", "%d %M %Y") -2001-09-15 00:00:00 -select str_to_date("15 Septembeb 2001", "%d %M %Y"); -str_to_date("15 Septembeb 2001", "%d %M %Y") -NULL -select str_to_date("15 MAY 2001", "%d %b %Y"); -str_to_date("15 MAY 2001", "%d %b %Y") -2001-05-15 00:00:00 -select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y"); -str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y") -2001-05-15 00:00:00 -select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y"); -str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y") -NULL -select str_to_date("Sundai 15 MA", "%W %d %b %Y"); -str_to_date("Sundai 15 MA", "%W %d %b %Y") -NULL -select str_to_date("Tuesday 52 2001", "%W %V %X"); -str_to_date("Tuesday 52 2001", "%W %V %X") -NULL -select str_to_date("Sunday 01 2001", "%W %V %X"); -str_to_date("Sunday 01 2001", "%W %V %X") -NULL -select str_to_date("Tuesday 00 2002", "%W %U %Y"); -str_to_date("Tuesday 00 2002", "%W %U %Y") -2002-01-01 00:00:00 -select str_to_date("Thursday 53 1998", "%W %u %Y"); -str_to_date("Thursday 53 1998", "%W %u %Y") -1998-12-31 00:00:00 -select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S"); -str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S") -2001-01-15 00:00:00 -select str_to_date("15-01-20", "%d-%m-%Y"); -str_to_date("15-01-20", "%d-%m-%Y") -NULL -select str_to_date("15-2001-1", "%d-%Y-%c"); -str_to_date("15-2001-1", "%d-%Y-%c") -2001-01-15 00:00:00 +select str_to_date(concat('15-01-2001',' 2:59:58.999'), +concat('%d-%m-%Y',' ','%H:%i:%s.%f')); +str_to_date(concat('15-01-2001',' 2:59:58.999'), +concat('%d-%m-%Y',' ','%H:%i:%s.%f')) +2001-01-15 02:59:58.000999 +create table t1 (date char(30), format char(30) not null); +insert into t1 values +('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'), +('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S'), +('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'), +('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'), +('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'), +('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'), +('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'), +('10:20:10', '%H:%i:%s'), +('10:20:10', '%h:%i:%s.%f'), +('10:20:10AM', '%h:%i:%s%p'), +('10:20:10.44AM', '%h:%i:%s.%f%p'), +('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'), +('15 September 2001', '%d %M %Y'), +('15 SEPTEMB 2001', '%d %M %Y'), +('15 MAY 2001', '%d %b %Y'), +('Sunday 15 MAY 2001', '%W %d %b %Y'), +('Sund 15 MAY 2001', '%W %d %b %Y'), +('Tuesday 00 2002', '%W %U %Y'), +('Thursday 53 1998', '%W %u %Y'), +('15-01-2001', '%d-%m-%Y %H:%i:%S'), +('15-01-20', '%d-%m-%y'), +('15-2001-1', '%d-%Y-%c'); +select date,format,str_to_date(date, format) as str_to_date from t1; +date format str_to_date +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02 08:11:02 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.012345 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.012345 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.012345 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12 +10:20:10 %H:%i:%s 0000-00-00 10:20:10 +10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10 +10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10 +10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.000044 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58 +15 September 2001 %d %M %Y 2001-09-15 00:00:00 +15 SEPTEMB 2001 %d %M %Y 2001-01-15 00:00:00 +15 MAY 2001 %d %b %Y 2001-05-15 00:00:00 +Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00 +Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00 +Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00 +Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00 +15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00 +15-01-20 %d-%m-%y 2020-01-15 00:00:00 +15-2001-1 %d-%Y-%c 2001-01-15 00:00:00 +select date,format,concat('',str_to_date(date, format)) as con from t1; +date format con +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02 08:11:02 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.012345 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.012345 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.012345 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12 +10:20:10 %H:%i:%s 0000-00-00 10:20:10 +10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10 +10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10 +10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.000044 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58 +15 September 2001 %d %M %Y 2001-09-15 00:00:00 +15 SEPTEMB 2001 %d %M %Y 2001-01-15 00:00:00 +15 MAY 2001 %d %b %Y 2001-05-15 00:00:00 +Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00 +Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00 +Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00 +Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00 +15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00 +15-01-20 %d-%m-%y 2020-01-15 00:00:00 +15-2001-1 %d-%Y-%c 2001-01-15 00:00:00 +select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1; +date format datetime +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02 08:11:02 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.012345 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.012345 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.012345 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12 +10:20:10 %H:%i:%s 0000-00-00 10:20:10 +10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10 +10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10 +10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.000044 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58 +15 September 2001 %d %M %Y 2001-09-15 00:00:00 +15 SEPTEMB 2001 %d %M %Y 2001-01-15 00:00:00 +15 MAY 2001 %d %b %Y 2001-05-15 00:00:00 +Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00 +Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00 +Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00 +Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00 +15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00 +15-01-20 %d-%m-%y 2020-01-15 00:00:00 +15-2001-1 %d-%Y-%c 2001-01-15 00:00:00 +select date,format,DATE(str_to_date(date, format)) as date2 from t1; +date format date2 +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 2003-01-02 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 +10:20:10 %H:%i:%s 0000-00-00 +10:20:10 %h:%i:%s.%f 0000-00-00 +10:20:10AM %h:%i:%s%p 0000-00-00 +10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 +15 September 2001 %d %M %Y 2001-09-15 +15 SEPTEMB 2001 %d %M %Y 2001-01-15 +15 MAY 2001 %d %b %Y 2001-05-15 +Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 +Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 +Tuesday 00 2002 %W %U %Y 2002-01-01 +Thursday 53 1998 %W %u %Y 1998-12-31 +15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 +15-01-20 %d-%m-%y 2020-01-15 +15-2001-1 %d-%Y-%c 2001-01-15 +select date,format,TIME(str_to_date(date, format)) as time from t1; +date format time +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 08:11:02 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.012345 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.012345 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.012345 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 +10:20:10 %H:%i:%s 10:20:10 +10:20:10 %h:%i:%s.%f 10:20:10 +10:20:10AM %h:%i:%s%p 10:20:10 +10:20:10.44AM %h:%i:%s.%f%p 10:20:10.000044 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 +15 September 2001 %d %M %Y 00:00:00 +15 SEPTEMB 2001 %d %M %Y 00:00:00 +15 MAY 2001 %d %b %Y 00:00:00 +Sunday 15 MAY 2001 %W %d %b %Y 00:00:00 +Sund 15 MAY 2001 %W %d %b %Y 00:00:00 +Tuesday 00 2002 %W %U %Y 00:00:00 +Thursday 53 1998 %W %u %Y 00:00:00 +15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 +15-01-20 %d-%m-%y 00:00:00 +15-2001-1 %d-%Y-%c 00:00:00 +select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1; +date format time2 +2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 +03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S 08:11:02 +2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12 +2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.012345 +2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.012345 +2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.012345 +2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12 +10:20:10 %H:%i:%s 10:20:10 +10:20:10 %h:%i:%s.%f 10:20:10 +10:20:10AM %h:%i:%s%p 10:20:10 +10:20:10.44AM %h:%i:%s.%f%p 10:20:10.000044 +15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58 +15 September 2001 %d %M %Y 00:00:00 +15 SEPTEMB 2001 %d %M %Y 00:00:00 +15 MAY 2001 %d %b %Y 00:00:00 +Sunday 15 MAY 2001 %W %d %b %Y 00:00:00 +Sund 15 MAY 2001 %W %d %b %Y 00:00:00 +Tuesday 00 2002 %W %U %Y 00:00:00 +Thursday 53 1998 %W %u %Y 00:00:00 +15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00 +15-01-20 %d-%m-%y 00:00:00 +15-2001-1 %d-%Y-%c 00:00:00 +truncate table t1; +insert into t1 values +('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'), +('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'), +('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'), +('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'), +('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'), +('10:20:10AM', '%H:%i:%s%p'), +('15 Septembei 2001', '%d %M %Y'), +('15 Ju 2001', '%d %M %Y'), +('Sund 15 MA', '%W %d %b %Y'), +('Sunday 01 2001', '%W %V %X'), +('Thursdai 12 1998', '%W %u %Y'), +(NULL, get_format(DATE,'USA')), +('Tuesday 52 2001', '%W %V %X'); +select date,format,str_to_date(date, format) as str_to_date from t1; +date format str_to_date +2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL +2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL +2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL +2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL +2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL +10:20:10AM %H:%i:%s%p NULL +15 Septembei 2001 %d %M %Y NULL +15 Ju 2001 %d %M %Y NULL +Sund 15 MA %W %d %b %Y NULL +Sunday 01 2001 %W %V %X NULL +Thursdai 12 1998 %W %u %Y NULL +NULL %m.%d.%Y NULL +Tuesday 52 2001 %W %V %X NULL +select date,format,concat(str_to_date(date, format),'') as con from t1; +date format con +2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL +2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL +2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL +2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL +2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL +10:20:10AM %H:%i:%s%p NULL +15 Septembei 2001 %d %M %Y NULL +15 Ju 2001 %d %M %Y NULL +Sund 15 MA %W %d %b %Y NULL +Sunday 01 2001 %W %V %X NULL +Thursdai 12 1998 %W %u %Y NULL +NULL %m.%d.%Y NULL +Tuesday 52 2001 %W %V %X NULL +truncate table t1; +insert into t1 values +('10:20:10AM', '%h:%i:%s'), +('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'), +('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'); +select date,format,str_to_date(date, format) as str_to_date from t1; +date format str_to_date +10:20:10AM %h:%i:%s 0000-00-00 10:20:10 +2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 +03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12 +select date,format,concat(str_to_date(date, format),'') as con from t1; +date format con +10:20:10AM %h:%i:%s 0000-00-00 10:20:10 +2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 +03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12 +drop table t1; select get_format(DATE, 'USA') as a; a %m.%d.%Y @@ -154,7 +318,13 @@ a %H%i%s select get_format(DATETIME, 'eur') as a; a -%Y-%m-%d-%H.%i.%s +%Y-%m-%d %H.%i.%s +select get_format(DATE, 'TEST') as a; +a +NULL +select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA')); +str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA')) +NULL explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001"); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 0e46f7dd16d..461fc1018c1 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -65,6 +65,6 @@ NULL 50000 NULL Warnings: -Error 1258 Z_DATA_ERROR: Input data was corrupted for zlib +Error 1258 ZLIB: Input data was corrupted for zlib Error 1255 Too big size of uncompressed data. The maximum size is 1048576. (probably, length of uncompressed data was corrupted) drop table t1; diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result index cf2b8814047..e7b64066c37 100644 --- a/mysql-test/r/rpl_temporary.result +++ b/mysql-test/r/rpl_temporary.result @@ -74,3 +74,4 @@ f 5 7 drop table t1,t2; +create temporary table t3 (f int); diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 059808161a3..cec7dd17e6d 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -40,9 +40,9 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null -- error 1044,1 create table not_existing_database.test (a int); ---error 1103 +--error 1279 create table `a/a` (a int); ---error 1103 +--error 1279 create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int); --error 1059 create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int); @@ -66,11 +66,11 @@ create table test_$1.test2$ (a int); drop table test_$1.test2$; drop database test_$1; ---error 1103 +--error 1279 create table `` (a int); ---error 1103 +--error 1279 drop table if exists ``; ---error 1166 +--error 1279 create table t1 (`` int); --error 1279 create table t1 (i int, index `` (i)); @@ -254,12 +254,16 @@ create table t2 like t3; show create table t2; select * from t2; create table t3 like t1; -!$1050 create table t3 like test_$1.t3; +--error 1050 +create table t3 like test_$1.t3; --error 1044,1 create table non_existing_database.t1 like t1; -!$1051 create table t3 like non_existing_table; -!$1050 create temporary table t3 like t1; -!$1103 create table t3 like `a/a`; +--error 1051 +create table t3 like non_existing_table; +--error 1050 +create temporary table t3 like t1; +--error 1279 +create table t3 like `a/a`; drop table t1, t2, t3; drop table t3; drop database test_$1; diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index 52ee227b011..a5d0c29baf6 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -64,6 +64,7 @@ drop table t1; # The below checks both binary and character comparisons. # create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word)); +show create table t1; insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); update t1 set word2=word; select word, word=binary 0xdf as t from t1 having t > 0; @@ -85,6 +86,7 @@ drop table t1; CREATE TABLE t1 ( s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci ); +show create table t1; INSERT INTO t1 VALUES ('э'); INSERT INTO t1 VALUES ('ue'); SELECT DISTINCT s1 FROM t1; diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index 325a8f075ed..2f08e021df2 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -1,7 +1,7 @@ SET CHARACTER SET koi8r; --disable_warnings -DROP TABLE IF EXISTS таблица; +DROP TABLE IF EXISTS таблица, t1; --enable_warnings SET CHARACTER SET koi8r; @@ -11,7 +11,7 @@ SELECT a FROM t1; SELECT HEX(a) FROM t1; DROP TABLE t1; -CREATE TABLE таблица +CREATE TABLE `таблица` ( поле CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "комментарий поля" ) COMMENT "комментарий таблицы"; diff --git a/mysql-test/t/date_formats-master.opt b/mysql-test/t/date_formats-master.opt index 7977a601dd7..ab243fe729c 100644 --- a/mysql-test/t/date_formats-master.opt +++ b/mysql-test/t/date_formats-master.opt @@ -1 +1 @@ ---date_format=%d.%m.%Y --time_format=%H.%i.%s --datetime_format=%Y/%d/%m-%H:%i:%s +--date-format=%d.%m.%Y --time-format=%H.%i.%s diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index e2d0e5d2c6d..d9219d3ac2e 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -1,83 +1,202 @@ +# +# Test of date format functions +# + +--disable-warnings +drop table if exists t1; +--enable-warnings + SHOW GLOBAL VARIABLES LIKE "%_format%"; SHOW SESSION VARIABLES LIKE "%_format%"; -SET date_format="%d.%m.%Y"; -select CAST("01.01.2001" as DATE) as a; -SET datetime_format="%d.%m.%Y %H.%i.%s"; -select CAST("01.01.2001 05.12.06" as DATETIME) as a; -SET time_format="%H.%i.%s"; -select CAST("05.12.06" as TIME) as a; - -SET datetime_format="%d.%m.%Y %h:%i:%s %p"; -select CAST("01.01.2001 05:12:06AM" as DATETIME) as a; -select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a; - -SET time_format="%h:%i:%s %p"; -select CAST("05:12:06 AM" as TIME) as a; -select CAST("05:12:06.1234PM" as TIME) as a; - -SET time_format="%h.%i.%s %p"; -SET date_format='%d.%m.%y'; -SET datetime_format="%d.%m.%y %h.%i.%s %p"; -select CAST("12-12-06" as DATE) as a; - -select adddate("01.01.97 11.59.59.000001 PM", 10); -select datediff("31.12.97 11.59:59.000001 PM","01.01.98"); -select weekofyear("31.11.97 11:59:59.000001 PM"); -select makedate(1997,1); -select addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"); -select maketime(23,11,12); -select timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"); - -SET time_format="%H%i%s"; ---error 1105 -SET time_format="%h%i%s"; ---error 1105 +# +# Test setting a lot of different formats to see which formats are accepted and +# which aren't +# + +SET time_format='%H%i%s'; +SET time_format='%H:%i:%s.%f'; +SET time_format='%h-%i-%s.%f%p'; +SET time_format='%h:%i:%s.%f %p'; +SET time_format='%h:%i:%s%p'; + +SET date_format='%Y%m%d'; +SET date_format='%Y.%m.%d'; +SET date_format='%d.%m.%Y'; +SET date_format='%m-%d-%Y'; + +set datetime_format= '%Y%m%d%H%i%s'; +set datetime_format= '%Y-%m-%d %H:%i:%s'; +set datetime_format= '%m-%d-%y %H:%i:%s.%f'; +set datetime_format= '%d-%m-%Y %h:%i:%s%p'; +set datetime_format= '%H:%i:%s %Y-%m-%d'; +set datetime_format= '%H:%i:%s.%f %m-%d-%Y'; +set datetime_format= '%h:%i:%s %p %Y-%m-%d'; +set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d'; + +SHOW SESSION VARIABLES LIKE "%format"; + +--error 1231 +SET time_format='%h:%i:%s'; +--error 1231 +SET time_format='%H %i:%s'; +--error 1231 +SET time_format='%H::%i:%s'; +--error 1231 +SET time_format='%H:%i:%s%f'; +--error 1231 +SET time_format='%H:%i.%f:%s'; +--error 1231 +SET time_format='%H:%i:%s%p'; +--error 1231 +SET time_format='%h:%i:%s.%f %p %Y-%m-%d'; +--error 1231 +SET time_format='%H%i%s.%f'; +--error 1231 +SET time_format='%H:%i-%s.%f'; +--error 1231 SET date_format='%d.%m.%d'; ---error 1105 -SET datetime_format="%d.%m.%y %h.%i.%s"; +--error 1231 +SET datetime_format='%h.%m.%y %d.%i.%s'; +--error 1231 +set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d'; + +# +# Test GLOBAL values + +set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d'; +SET SESSION datetime_format=default; +select @@global.datetime_format, @@session.datetime_format; +SET GLOBAL datetime_format=default; +SET SESSION datetime_format=default; +select @@global.datetime_format, @@session.datetime_format; SET GLOBAL date_format=default; -SHOW GLOBAL VARIABLES LIKE "date_format%"; SET GLOBAL time_format=default; -SHOW GLOBAL VARIABLES LIKE "time_format%"; SET GLOBAL datetime_format=default; -SHOW GLOBAL VARIABLES LIKE "datetime_format%"; - -SET date_format=default; -SHOW SESSION VARIABLES LIKE "date_format%"; SET time_format=default; -SHOW SESSION VARIABLES LIKE "time_format%"; +SET date_format=default; SET datetime_format=default; -SHOW SESSION VARIABLES LIKE "datetime_format%"; - -SET time_format='%i:%s:%H'; -select cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME); - -SET GLOBAL date_format='%Y-%m-%d'; -SET GLOBAL time_format='%H:%i:%s'; -SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s'; -SET date_format='%Y-%m-%d'; -SET time_format='%H:%i:%s'; -SET datetime_format='%Y-%m-%d %H:%i:%s'; - -select str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S"); -select str_to_date("15 September 2001", "%d %M %Y"); -select str_to_date("15 Septembeb 2001", "%d %M %Y"); -select str_to_date("15 MAY 2001", "%d %b %Y"); -select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y"); -select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y"); -select str_to_date("Sundai 15 MA", "%W %d %b %Y"); -select str_to_date("Tuesday 52 2001", "%W %V %X"); -select str_to_date("Sunday 01 2001", "%W %V %X"); -select str_to_date("Tuesday 00 2002", "%W %U %Y"); -select str_to_date("Thursday 53 1998", "%W %u %Y"); -select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S"); -select str_to_date("15-01-20", "%d-%m-%Y"); -select str_to_date("15-2001-1", "%d-%Y-%c"); + +# +# The following tests will work only when we at some point will enable +# dynamic changing of formats +# + +# SET date_format='%d.%m.%Y'; +# select CAST('01.01.2001' as DATE) as a; +# SET datetime_format='%d.%m.%Y %H.%i.%s'; +# select CAST('01.01.2001 05.12.06' as DATETIME) as a; +# SET time_format='%H.%i.%s'; +# select CAST('05.12.06' as TIME) as a; +# +# SET datetime_format='%d.%m.%Y %h:%i:%s %p'; +# select CAST('01.01.2001 05:12:06AM' as DATETIME) as a; +# select CAST('01.01.2001 05:12:06 PM' as DATETIME) as a; +# +# SET time_format='%h:%i:%s %p'; +# select CAST('05:12:06 AM' as TIME) as a; +# select CAST('05:12:06.1234PM' as TIME) as a; +# +# SET time_format='%h.%i.%s %p'; +# SET date_format='%d.%m.%y'; +# SET datetime_format='%d.%m.%y %h.%i.%s %p'; +# select CAST('12-12-06' as DATE) as a; +# +# select adddate('01.01.97 11.59.59.000001 PM', 10); +# select datediff('31.12.97 11.59:59.000001 PM','01.01.98'); +# select weekofyear('31.11.97 11:59:59.000001 PM'); +# select makedate(1997,1); +# select addtime('31.12.97 11.59.59.999999 PM', '1 1.1.1.000002'); +# select maketime(23,11,12); +# select timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM'); +# +# SET time_format='%i:%s:%H'; +# select cast(str_to_date('15-01-2001 12:59:59', '%d-%m-%Y %H:%i:%S') as TIME); + +# +# Test of str_to_date +# + +select str_to_date(concat('15-01-2001',' 2:59:58.999'), + concat('%d-%m-%Y',' ','%H:%i:%s.%f')); + +create table t1 (date char(30), format char(30) not null); +insert into t1 values +('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'), +('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S'), +('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'), +('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'), +('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'), +('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'), +('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'), +('10:20:10', '%H:%i:%s'), +('10:20:10', '%h:%i:%s.%f'), +('10:20:10AM', '%h:%i:%s%p'), +('10:20:10.44AM', '%h:%i:%s.%f%p'), +('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'), +('15 September 2001', '%d %M %Y'), +('15 SEPTEMB 2001', '%d %M %Y'), +('15 MAY 2001', '%d %b %Y'), +('Sunday 15 MAY 2001', '%W %d %b %Y'), +('Sund 15 MAY 2001', '%W %d %b %Y'), +('Tuesday 00 2002', '%W %U %Y'), +('Thursday 53 1998', '%W %u %Y'), +('15-01-2001', '%d-%m-%Y %H:%i:%S'), +('15-01-20', '%d-%m-%y'), +('15-2001-1', '%d-%Y-%c'); + +# Use through protocol functions +select date,format,str_to_date(date, format) as str_to_date from t1; +# Use as a string +select date,format,concat('',str_to_date(date, format)) as con from t1; +# Use as datetime +select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1; +select date,format,DATE(str_to_date(date, format)) as date2 from t1; +select date,format,TIME(str_to_date(date, format)) as time from t1; +select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1; + +# Test wrong dates + +truncate table t1; +insert into t1 values +('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'), +('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'), +('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'), +('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'), +('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'), +('10:20:10AM', '%H:%i:%s%p'), +('15 Septembei 2001', '%d %M %Y'), +('15 Ju 2001', '%d %M %Y'), +('Sund 15 MA', '%W %d %b %Y'), +('Sunday 01 2001', '%W %V %X'), +('Thursdai 12 1998', '%W %u %Y'), +(NULL, get_format(DATE,'USA')), +('Tuesday 52 2001', '%W %V %X'); +select date,format,str_to_date(date, format) as str_to_date from t1; +select date,format,concat(str_to_date(date, format),'') as con from t1; + +# Test 'maybe' date formats and 'strange but correct' results + +truncate table t1; +insert into t1 values +('10:20:10AM', '%h:%i:%s'), +('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'), +('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'); + +select date,format,str_to_date(date, format) as str_to_date from t1; +select date,format,concat(str_to_date(date, format),'') as con from t1; + +drop table t1; + +# +# Test of get_format +# select get_format(DATE, 'USA') as a; select get_format(TIME, 'internal') as a; select get_format(DATETIME, 'eur') as a; +select get_format(DATE, 'TEST') as a; +select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA')); explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001"); diff --git a/mysql-test/t/overflow.test b/mysql-test/t/overflow.test index 6619a87cabb..7a9616fd24e 100644 --- a/mysql-test/t/overflow.test +++ b/mysql-test/t/overflow.test @@ -1,4 +1,4 @@ connect (con1,localhost,boo,,); connection con1; --- error 1064,1102 +-- error 1064,1102,1279 drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; diff --git a/mysql-test/t/rpl_temporary-master.opt b/mysql-test/t/rpl_temporary-master.opt new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/mysql-test/t/rpl_temporary-master.opt diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test index f1373d7ef23..0df8ceb6377 100644 --- a/mysql-test/t/rpl_temporary.test +++ b/mysql-test/t/rpl_temporary.test @@ -108,3 +108,11 @@ drop temporary table t3; select * from t2; drop table t1,t2; + +# Create last a temporary table that is not dropped at end to ensure that we +# don't get any memory leaks for this + +create temporary table t3 (f int); +sync_with_master; + +# The server will now close done diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index f618c342936..4be0cd0c6a2 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -65,7 +65,7 @@ drop table t1; # disable_query_log; ---error 1103,1103 +--error 1279,1279 create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp"; # Check that we cannot link over a table from another database. @@ -75,7 +75,7 @@ create database mysqltest; --error 1,1 create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist"; ---error 1103,1103 +--error 1279,1279 create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path"; --error 1,1 |