mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 06:22:28 +01:00
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/Users/kent/mysql/bk/mysql-5.0
This commit is contained in:
commit
04a475e55a
42 changed files with 933 additions and 165 deletions
|
@ -456,7 +456,7 @@ SOURCE=.\gstream.cpp
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\examples\ha_archive.cpp
|
||||
SOURCE=.\ha_archive.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ static struct my_option my_long_options[] =
|
|||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &tcp_port,
|
||||
(gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
|
||||
(gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"relative", 'r',
|
||||
|
|
|
@ -67,7 +67,7 @@ static const char* database= 0;
|
|||
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
|
||||
static ulonglong offset = 0;
|
||||
static const char* host = 0;
|
||||
static int port = MYSQL_PORT;
|
||||
static int port= 0;
|
||||
static const char* sock= 0;
|
||||
static const char* user = 0;
|
||||
static char* pass = 0;
|
||||
|
@ -688,7 +688,7 @@ static struct my_option my_long_options[] =
|
|||
{"password", 'p', "Password to connect to remote server.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Use port to connect to the remote server.",
|
||||
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0,
|
||||
(gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
|
||||
0, 0, 0},
|
||||
{"position", 'j', "Deprecated. Use --start-position instead.",
|
||||
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
|
||||
|
|
|
@ -122,7 +122,7 @@ static struct my_option my_long_options[] =
|
|||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
|
||||
0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
|
|
@ -330,7 +330,7 @@ static struct my_option my_long_options[] =
|
|||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
|
||||
0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
|
|
@ -121,7 +121,7 @@ static struct my_option my_long_options[] =
|
|||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
|
||||
0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
|
|
@ -188,7 +188,7 @@ static struct my_option my_long_options[] =
|
|||
"Password to use when connecting to server. If password is not given it's asked from the tty.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &opt_mysql_port,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
|
||||
(gptr*) &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
|
||||
0},
|
||||
#ifdef __WIN__
|
||||
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
|
||||
|
|
|
@ -2763,7 +2763,7 @@ static struct my_option my_long_options[] =
|
|||
{"password", 'p', "Password to use when connecting to server.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
|
||||
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
|
||||
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ps-protocol", OPT_PS_PROTOCOL, "Use prepared statements protocol for communication",
|
||||
(gptr*) &ps_protocol, (gptr*) &ps_protocol, 0,
|
||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
|
|
@ -17,6 +17,7 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
|
|||
yassl_dir="extra/yassl"
|
||||
yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
|
||||
yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
|
||||
yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.la \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.la"
|
||||
AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
|
||||
AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
|
||||
# System specific checks
|
||||
|
@ -35,6 +36,7 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
|
|||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST(yassl_libs)
|
||||
AC_SUBST(yassl_libs_with_path)
|
||||
AC_SUBST(yassl_includes)
|
||||
AC_SUBST(yassl_dir)
|
||||
AM_CONDITIONAL([HAVE_YASSL], [ test "with_yassl" = "yes" ])
|
||||
|
|
|
@ -279,10 +279,10 @@ inline double ulonglong2double(ulonglong value)
|
|||
*((T)+4)=(uchar) (((A) >> 32)); }
|
||||
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
|
||||
|
||||
#define doubleget(V,M) { *((long *) &V) = *((long*) M); \
|
||||
*(((long *) &V)+1) = *(((long*) M)+1); }
|
||||
#define doublestore(T,V) { *((long *) T) = *((long*) &V); \
|
||||
*(((long *) T)+1) = *(((long*) &V)+1); }
|
||||
#define doubleget(V,M) do { *((long *) &V) = *((long*) M); \
|
||||
*(((long *) &V)+1) = *(((long*) M)+1); } while(0)
|
||||
#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
|
||||
*(((long *) T)+1) = *(((long*) &V)+1); } while(0)
|
||||
#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
|
||||
#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
|
||||
#define floatget(V,M) memcpy((byte*)(&V), (byte*)(M), sizeof(float))
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
target = libmysqlclient.la
|
||||
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
|
||||
LIBS = @CLIENT_LIBS@ @yassl_libs@
|
||||
LIBS = @CLIENT_LIBS@
|
||||
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
|
||||
$(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
|
||||
|
||||
include $(srcdir)/Makefile.shared
|
||||
|
||||
libmysqlclient_la_SOURCES = $(target_sources)
|
||||
libmysqlclient_la_LIBADD = $(target_libadd)
|
||||
libmysqlclient_la_LIBADD = $(target_libadd) $(yassl_libs_with_path)
|
||||
libmysqlclient_la_LDFLAGS = $(target_ldflags)
|
||||
EXTRA_DIST = Makefile.shared libmysql.def
|
||||
noinst_HEADERS = client_settings.h
|
||||
|
|
|
@ -556,3 +556,9 @@ ERROR 3D000: No database selected
|
|||
alter table test.t1 rename test.t1;
|
||||
use test;
|
||||
drop table t1;
|
||||
create table t1 (mycol int(10) not null);
|
||||
alter table t1 alter column mycol set default 0;
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
mycol int(10) NO 0
|
||||
drop table t1;
|
||||
|
|
|
@ -743,3 +743,22 @@ t2 CREATE TABLE `t2` (
|
|||
`a2` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2;
|
||||
create table t1 (i int) engine=myisam max_rows=100000000000;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
|
||||
alter table t1 max_rows=100;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=100
|
||||
alter table t1 max_rows=100000000000;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
|
||||
drop table t1;
|
||||
|
|
|
@ -181,11 +181,18 @@ select * from t1 where a=_koi8r'
|
|||
a
|
||||
×ÁÓÑ
|
||||
select * from t1 where a=concat(_koi8r'×ÁÓÑ');
|
||||
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
|
||||
a
|
||||
×ÁÓÑ
|
||||
select * from t1 where a=_latin1'×ÁÓÑ';
|
||||
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
create table t1 (a char(10) character set utf8 collate utf8_bin);
|
||||
insert into t1 values (' xxx');
|
||||
select * from t1 where a=lpad('xxx',10,' ');
|
||||
a
|
||||
xxx
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1 (c1 char(10) character set cp1251);
|
||||
insert into t1 values ('ß');
|
||||
|
|
|
@ -594,3 +594,24 @@ flush privileges;
|
|||
set @user123="non-existent";
|
||||
select * from mysql.db where user=@user123;
|
||||
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
|
||||
set names koi8r;
|
||||
create database ÂÄ;
|
||||
grant select on ÂÄ.* to root@localhost;
|
||||
select hex(Db) from mysql.db where Db='ÂÄ';
|
||||
hex(Db)
|
||||
D0B1D0B4
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
|
||||
flush privileges;
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
|
||||
drop database ÂÄ;
|
||||
revoke all privileges on ÂÄ.* from root@localhost;
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
set names latin1;
|
||||
|
|
|
@ -391,3 +391,304 @@ i i i
|
|||
2 NULL 4
|
||||
2 2 2
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (c int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (b int, c int);
|
||||
create table t4 (y int, c int);
|
||||
create table t5 (y int, z int);
|
||||
create table t6 (a int, c int);
|
||||
insert into t1 values (10,1);
|
||||
insert into t1 values (3 ,1);
|
||||
insert into t1 values (3 ,2);
|
||||
insert into t2 values (2, 1);
|
||||
insert into t3 values (1, 3);
|
||||
insert into t3 values (1,10);
|
||||
insert into t4 values (11,3);
|
||||
insert into t4 values (2, 3);
|
||||
insert into t5 values (11,4);
|
||||
insert into t6 values (2, 3);
|
||||
create algorithm=merge view v1a as
|
||||
select * from t1 natural join t2;
|
||||
create algorithm=merge view v1b(a,b,c) as
|
||||
select * from t1 natural join t2;
|
||||
create algorithm=merge view v1c as
|
||||
select b as a, c as b, a as c from t1 natural join t2;
|
||||
create algorithm=merge view v1d(b, a, c) as
|
||||
select a as c, c as b, b as a from t1 natural join t2;
|
||||
create algorithm=merge view v2a as
|
||||
select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
create algorithm=merge view v2b as
|
||||
select t1.c as b, t1.b as a, t2.a as c
|
||||
from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
create algorithm=merge view v3a as
|
||||
select * from t1 natural join t2 natural join t3;
|
||||
create algorithm=merge view v3b as
|
||||
select * from t1 natural join (t2 natural join t3);
|
||||
create algorithm=merge view v4 as
|
||||
select * from v2a natural join v3a;
|
||||
select * from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
b c a y
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (t1 natural left join t2) natural left join (t3 natural left join t4);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
2 3 NULL NULL
|
||||
select * from (t4 natural right join t3) natural right join (t2 natural right join t1);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
2 3 NULL NULL
|
||||
select * from t1 natural join t2 natural join t3 natural join t4;
|
||||
c b a y
|
||||
3 1 2 11
|
||||
3 1 2 2
|
||||
select * from ((t1 natural join t2) natural join t3) natural join t4;
|
||||
c b a y
|
||||
3 1 2 11
|
||||
3 1 2 2
|
||||
select * from t1 natural join (t2 natural join (t3 natural join t4));
|
||||
c b a y
|
||||
3 1 2 11
|
||||
3 1 2 2
|
||||
select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3));
|
||||
y c b a z
|
||||
11 3 1 2 4
|
||||
2 3 1 2 NULL
|
||||
NULL 10 1 2 NULL
|
||||
select * from (t1 natural join t2), (t3 natural join t4);
|
||||
b c a c b y
|
||||
1 10 2 3 1 11
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 11
|
||||
1 3 2 3 1 2
|
||||
select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c);
|
||||
c b a b y
|
||||
3 1 2 1 11
|
||||
3 1 2 1 2
|
||||
select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c));
|
||||
b c a y
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select a,b,c from (t1 natural join t2) natural join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a;
|
||||
a b c
|
||||
2 1 3
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
b c a y
|
||||
1 3 2 2
|
||||
1 3 2 11
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
b c a y
|
||||
1 3 2 2
|
||||
1 3 2 11
|
||||
select * from t1 natural join t2 where t1.c > t2.a;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from t1 natural join t2 where t1.b > t2.b;
|
||||
b c a
|
||||
select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
c b a b y c
|
||||
3 1 2 1 2 3
|
||||
3 2 2 1 2 3
|
||||
select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c;
|
||||
a b y c c b
|
||||
2 1 2 3 3 1
|
||||
2 1 2 3 3 2
|
||||
select * from t1 natural join (t2 join t4 on b + 1 = y);
|
||||
c b a y
|
||||
3 1 2 2
|
||||
select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c);
|
||||
c b a b b c y c
|
||||
10 1 2 1 1 3 11 3
|
||||
10 1 2 1 1 10 11 3
|
||||
3 1 2 1 1 3 11 3
|
||||
3 1 2 1 1 10 11 3
|
||||
3 2 2 1 1 3 11 3
|
||||
3 2 2 1 1 10 11 3
|
||||
select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c);
|
||||
c b a b b c y c
|
||||
10 1 2 1 1 3 11 3
|
||||
10 1 2 1 1 10 11 3
|
||||
3 1 2 1 1 3 11 3
|
||||
3 1 2 1 1 10 11 3
|
||||
3 2 2 1 1 3 11 3
|
||||
3 2 2 1 1 10 11 3
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on a = y;
|
||||
b c a c b y
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 2
|
||||
select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3;
|
||||
b c c b a b y c y z
|
||||
1 3 10 1 2 1 11 3 11 4
|
||||
1 10 10 1 2 1 11 3 11 4
|
||||
1 3 3 1 2 1 11 3 11 4
|
||||
1 10 3 1 2 1 11 3 11 4
|
||||
select * from t1 natural join t2 where t1.b > 0;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from t1 natural join (t4 natural join t5) where t4.y > 7;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from (t4 natural join t5) natural join t1 where t4.y > 7;
|
||||
c y z b
|
||||
3 11 4 1
|
||||
3 11 4 2
|
||||
select * from t1 natural left join (t4 natural join t5) where t4.y > 7;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from (t4 natural join t5) natural right join t1 where t4.y > 7;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b;
|
||||
b c a c b y
|
||||
1 10 2 3 1 11
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 11
|
||||
1 3 2 3 1 2
|
||||
select t1.*, t2.* from t1 natural join t2;
|
||||
c b a b
|
||||
10 1 2 1
|
||||
3 1 2 1
|
||||
select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
c b a b b c y c
|
||||
3 1 2 1 1 3 11 3
|
||||
3 1 2 1 1 3 2 3
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
b c a y
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural left join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (select * from t3 natural join t4) as t34
|
||||
natural right join
|
||||
(select * from t1 natural join t2) as t12;
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from v1a;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v1b;
|
||||
a b c
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v1c;
|
||||
a b c
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v1d;
|
||||
b a c
|
||||
2 10 1
|
||||
2 3 1
|
||||
select * from v2a;
|
||||
c b a
|
||||
3 1 2
|
||||
3 2 2
|
||||
select * from v2b;
|
||||
b a c
|
||||
3 1 2
|
||||
3 2 2
|
||||
select * from v3a;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v3b;
|
||||
c b a
|
||||
10 1 2
|
||||
3 1 2
|
||||
select * from v4;
|
||||
c b a
|
||||
3 1 2
|
||||
select * from v1a natural join v2a;
|
||||
b c a
|
||||
1 3 2
|
||||
select v2a.* from v1a natural join v2a;
|
||||
c b a
|
||||
3 1 2
|
||||
select * from v1b join v2a on v1b.b = v2a.c;
|
||||
a b c c b a
|
||||
1 3 2 3 1 2
|
||||
1 3 2 3 2 2
|
||||
select * from v1c join v2a on v1c.b = v2a.c;
|
||||
a b c c b a
|
||||
1 3 2 3 1 2
|
||||
1 3 2 3 2 2
|
||||
select * from v1d join v2a on v1d.a = v2a.c;
|
||||
b a c c b a
|
||||
2 3 1 3 1 2
|
||||
2 3 1 3 2 2
|
||||
select * from v1a join (t3 natural join t4) on a = y;
|
||||
b c a c b y
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 2
|
||||
select * from t1 natural join (t3 cross join t4);
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from (t3 cross join t4) natural join t1;
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from t1 join (t2, t3) using (b);
|
||||
ERROR 23000: Column 'b' in from clause is ambiguous
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
|
||||
ERROR 23000: Column 'b' in from clause is ambiguous
|
||||
select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
|
||||
ERROR 23000: Column 'b' in from clause is ambiguous
|
||||
select * from (t3 join (t4 natural join t5) on (b < z))
|
||||
natural join
|
||||
(t1 natural join t2);
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select t1.b from v1a;
|
||||
ERROR 42S22: Unknown column 't1.b' in 'field list'
|
||||
select * from v1a join v1b on t1.b = t2.b;
|
||||
ERROR 42S22: Unknown column 't1.b' in 'on clause'
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
drop view v1a;
|
||||
drop view v1b;
|
||||
drop view v1c;
|
||||
drop view v1d;
|
||||
drop view v2a;
|
||||
drop view v2b;
|
||||
drop view v3a;
|
||||
drop view v3b;
|
||||
drop view v4;
|
||||
|
|
|
@ -825,3 +825,10 @@ execute stmt;
|
|||
drop table t1;
|
||||
set names default;
|
||||
deallocate prepare stmt;
|
||||
create table t1 (id int);
|
||||
prepare ins_call from "insert into t1 (id) values (1)";
|
||||
execute ins_call;
|
||||
select row_count();
|
||||
row_count()
|
||||
1
|
||||
drop table t1;
|
||||
|
|
|
@ -4010,4 +4010,40 @@ s1
|
|||
2
|
||||
drop procedure bug13729|
|
||||
drop table t3|
|
||||
drop procedure if exists bug14643_1|
|
||||
drop procedure if exists bug14643_2|
|
||||
create procedure bug14643_1()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
begin
|
||||
declare v int default x;
|
||||
if v = 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end if;
|
||||
end;
|
||||
end|
|
||||
create procedure bug14643_2()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
case x
|
||||
when 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end case;
|
||||
end|
|
||||
call bug14643_1()|
|
||||
Handler
|
||||
boo
|
||||
2
|
||||
2
|
||||
call bug14643_2()|
|
||||
Handler
|
||||
boo
|
||||
2
|
||||
2
|
||||
drop procedure bug14643_1|
|
||||
drop procedure bug14643_2|
|
||||
drop table t1,t2;
|
||||
|
|
11
mysql-test/r/type_newdecimal-big.result
Normal file
11
mysql-test/r/type_newdecimal-big.result
Normal file
|
@ -0,0 +1,11 @@
|
|||
drop procedure if exists sp1;
|
||||
create procedure sp1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
call sp1()//
|
||||
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
|
||||
1.000000100000 1.999999900000 1.000000100000 1.999999900000
|
||||
drop procedure sp1;
|
|
@ -678,16 +678,6 @@ select -18.3=18.3;
|
|||
select 0.8 = 0.7 + 0.1;
|
||||
0.8 = 0.7 + 0.1
|
||||
1
|
||||
create procedure p1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
call p1()//
|
||||
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
|
||||
1.000000100000 1.999999900000 1.000000100000 1.999999900000
|
||||
drop procedure p1;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
|
@ -1267,34 +1257,6 @@ CAST(my_varchar AS DECIMAL(65,30)) my_varchar
|
|||
0.011754943450000000000000000000 1.175494345e-2
|
||||
0.117549434500000000000000000000 1.175494345e-1
|
||||
UPDATE t1 SET my_decimal = my_float;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 1
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 2
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 3
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 4
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 5
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 6
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 7
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 8
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 9
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 10
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 11
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 12
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 13
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 14
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 15
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 16
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 17
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 19
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 20
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 21
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 22
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 23
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 26
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 27
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 30
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 31
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 32
|
||||
SELECT my_decimal, my_float FROM t1;
|
||||
my_decimal my_float
|
||||
0.000000000000000000000000000000 1.17549e-32
|
||||
|
@ -1330,24 +1292,6 @@ my_decimal my_float
|
|||
0.011754943057894710000000000000 0.0117549
|
||||
0.117549434304237400000000000000 0.117549
|
||||
UPDATE t1 SET my_decimal = my_double;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 1
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 2
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 3
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 4
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 5
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 6
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 7
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 8
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 9
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 10
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 11
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 13
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 14
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 16
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 18
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 20
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 31
|
||||
SELECT my_decimal, my_double FROM t1;
|
||||
my_decimal my_double
|
||||
0.000000000000000000000000000000 1.175494345e-32
|
||||
|
|
|
@ -215,7 +215,7 @@ Field Type Collation Null Key Default Extra Privileges Comment
|
|||
auto int(5) unsigned NULL NO MUL NULL auto_increment #
|
||||
string char(10) latin1_swedish_ci YES newdefault #
|
||||
tiny tinyint(4) NULL NO MUL 0 #
|
||||
short smallint(6) NULL NO MUL 0 #
|
||||
short smallint(6) NULL NO MUL #
|
||||
medium mediumint(8) NULL NO MUL 0 #
|
||||
long_int int(11) NULL NO 0 #
|
||||
longlong bigint(13) NULL NO MUL 0 #
|
||||
|
|
|
@ -1220,6 +1220,32 @@ show columns from t2;
|
|||
Field Type Null Key Default Extra
|
||||
a varchar(3) YES NULL
|
||||
drop table t2, t1;
|
||||
create table t1 (f1 decimal(60,25), f2 decimal(60,25));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
f1
|
||||
0.0000000000000000000000000
|
||||
0.0000000000000000000000000
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
description f1
|
||||
XXXXXXXXXXXXXXXXXXXX 0.0000000000000000000000000
|
||||
YYYYYYYYYYYYYYYYYYYY 0.0000000000000000000000000
|
||||
drop table t1;
|
||||
create table t1 (f1 decimal(60,24), f2 decimal(60,24));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
f1
|
||||
0.000000000000000000000000
|
||||
0.000000000000000000000000
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
description f1
|
||||
XXXXXXXXXXXXXXXXXXXX 0.000000000000000000000000
|
||||
YYYYYYYYYYYYYYYYYYYY 0.000000000000000000000000
|
||||
drop table t1;
|
||||
create table t1 (a varchar(5));
|
||||
create table t2 select * from t1 union select 'abcdefghijkl';
|
||||
show create table t2;
|
||||
|
|
|
@ -401,3 +401,12 @@ use test;
|
|||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #14693 (ALTER SET DEFAULT doesn't work)
|
||||
#
|
||||
|
||||
create table t1 (mycol int(10) not null);
|
||||
alter table t1 alter column mycol set default 0;
|
||||
desc t1;
|
||||
drop table t1;
|
||||
|
|
|
@ -631,3 +631,17 @@ show create table t2;
|
|||
drop table t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
|
||||
# platforms
|
||||
#
|
||||
create table t1 (i int) engine=myisam max_rows=100000000000;
|
||||
show create table t1;
|
||||
alter table t1 max_rows=100;
|
||||
show create table t1;
|
||||
alter table t1 max_rows=100000000000;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
|
|
@ -144,8 +144,7 @@ create table t1 (a char(10) character set cp1251);
|
|||
insert into t1 values (_koi8r'×ÁÓÑ');
|
||||
# this is possible:
|
||||
select * from t1 where a=_koi8r'×ÁÓÑ';
|
||||
# this is not possible, because we have a function, not just a constant:
|
||||
--error 1267
|
||||
# this is possible, because we have a function with constant arguments:
|
||||
select * from t1 where a=concat(_koi8r'×ÁÓÑ');
|
||||
# this is not posible, cannot convert _latin1'×ÁÓÑ' into cp1251:
|
||||
--error 1267
|
||||
|
@ -153,6 +152,14 @@ select * from t1 where a=_latin1'
|
|||
drop table t1;
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# Bug#10446 Illegal mix of collations
|
||||
#
|
||||
create table t1 (a char(10) character set utf8 collate utf8_bin);
|
||||
insert into t1 values (' xxx');
|
||||
select * from t1 where a=lpad('xxx',10,' ');
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check more automatic conversion
|
||||
#
|
||||
|
|
|
@ -487,4 +487,16 @@ flush privileges;
|
|||
set @user123="non-existent";
|
||||
select * from mysql.db where user=@user123;
|
||||
|
||||
set names koi8r;
|
||||
create database 薩;
|
||||
grant select on 薩.* to root@localhost;
|
||||
select hex(Db) from mysql.db where Db='薩';
|
||||
show grants for root@localhost;
|
||||
flush privileges;
|
||||
show grants for root@localhost;
|
||||
drop database 薩;
|
||||
revoke all privileges on 薩.* from root@localhost;
|
||||
show grants for root@localhost;
|
||||
set names latin1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
|
@ -334,3 +334,210 @@ select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i
|
|||
drop table t1,t2,t3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Tests for WL#2486 Natural/using join according to SQL:2003.
|
||||
#
|
||||
# NOTICE:
|
||||
# - The tests are designed so that all statements, except MySQL
|
||||
# extensions run on any SQL server. Please do no change.
|
||||
# - Tests marked with TODO will be submitted as bugs.
|
||||
#
|
||||
|
||||
create table t1 (c int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (b int, c int);
|
||||
create table t4 (y int, c int);
|
||||
create table t5 (y int, z int);
|
||||
create table t6 (a int, c int);
|
||||
|
||||
insert into t1 values (10,1);
|
||||
insert into t1 values (3 ,1);
|
||||
insert into t1 values (3 ,2);
|
||||
insert into t2 values (2, 1);
|
||||
insert into t3 values (1, 3);
|
||||
insert into t3 values (1,10);
|
||||
insert into t4 values (11,3);
|
||||
insert into t4 values (2, 3);
|
||||
insert into t5 values (11,4);
|
||||
insert into t6 values (2, 3);
|
||||
|
||||
-- Views with simple natural join.
|
||||
create algorithm=merge view v1a as
|
||||
select * from t1 natural join t2;
|
||||
-- as above, but column names are cross-renamed: a->c, c->b, b->a
|
||||
create algorithm=merge view v1b(a,b,c) as
|
||||
select * from t1 natural join t2;
|
||||
-- as above, but column names are aliased: a->c, c->b, b->a
|
||||
create algorithm=merge view v1c as
|
||||
select b as a, c as b, a as c from t1 natural join t2;
|
||||
-- as above, but column names are cross-renamed, and aliased
|
||||
-- a->c->b, c->b->a, b->a->c
|
||||
create algorithm=merge view v1d(b, a, c) as
|
||||
select a as c, c as b, b as a from t1 natural join t2;
|
||||
|
||||
-- Views with JOIN ... ON
|
||||
create algorithm=merge view v2a as
|
||||
select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
create algorithm=merge view v2b as
|
||||
select t1.c as b, t1.b as a, t2.a as c
|
||||
from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
|
||||
-- Views with bigger natural join
|
||||
create algorithm=merge view v3a as
|
||||
select * from t1 natural join t2 natural join t3;
|
||||
create algorithm=merge view v3b as
|
||||
select * from t1 natural join (t2 natural join t3);
|
||||
|
||||
-- View over views with mixed natural join and join ... on
|
||||
create algorithm=merge view v4 as
|
||||
select * from v2a natural join v3a;
|
||||
|
||||
-- Nested natural/using joins.
|
||||
select * from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4);
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2);
|
||||
select * from (t1 natural left join t2) natural left join (t3 natural left join t4);
|
||||
select * from (t4 natural right join t3) natural right join (t2 natural right join t1);
|
||||
select * from t1 natural join t2 natural join t3 natural join t4;
|
||||
select * from ((t1 natural join t2) natural join t3) natural join t4;
|
||||
select * from t1 natural join (t2 natural join (t3 natural join t4));
|
||||
-- BUG#15355: this query fails in 'prepared statements' mode
|
||||
-- select * from ((t3 natural join (t1 natural join t2)) natural join t4) natural join t5;
|
||||
-- select * from ((t3 natural left join (t1 natural left join t2)) natural left join t4) natural left join t5;
|
||||
select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3));
|
||||
select * from (t1 natural join t2), (t3 natural join t4);
|
||||
-- MySQL extension - nested comma ',' operator instead of cross join.
|
||||
-- BUG#15357 - natural join with nested cross-join results in incorrect columns
|
||||
-- select * from t5 natural join ((t1 natural join t2), (t3 natural join t4));
|
||||
-- select * from ((t1 natural join t2), (t3 natural join t4)) natural join t5;
|
||||
-- select * from t5 natural join ((t1 natural join t2) cross join (t3 natural join t4));
|
||||
-- select * from ((t1 natural join t2) cross join (t3 natural join t4)) natural join t5;
|
||||
|
||||
select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c);
|
||||
select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c));
|
||||
|
||||
|
||||
-- Other clauses refer to NJ columns.
|
||||
select a,b,c from (t1 natural join t2) natural join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a;
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
|
||||
-- Qualified column references to NJ columns.
|
||||
select * from t1 natural join t2 where t1.c > t2.a;
|
||||
select * from t1 natural join t2 where t1.b > t2.b;
|
||||
select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL;
|
||||
|
||||
-- Nested 'join ... on' - name resolution of ON conditions
|
||||
select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c;
|
||||
select * from t1 natural join (t2 join t4 on b + 1 = y);
|
||||
select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c);
|
||||
|
||||
-- MySQL extension - 'join ... on' over nested comma operator
|
||||
select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c);
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on a = y;
|
||||
select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3;
|
||||
|
||||
-- MySQL extension - refererence qualified coalesced columns
|
||||
select * from t1 natural join t2 where t1.b > 0;
|
||||
select * from t1 natural join (t4 natural join t5) where t4.y > 7;
|
||||
select * from (t4 natural join t5) natural join t1 where t4.y > 7;
|
||||
select * from t1 natural left join (t4 natural join t5) where t4.y > 7;
|
||||
select * from (t4 natural join t5) natural right join t1 where t4.y > 7;
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b;
|
||||
|
||||
-- MySQL extension - select qualified columns of NJ columns
|
||||
select t1.*, t2.* from t1 natural join t2;
|
||||
select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
|
||||
-- Queries over subselects in the FROM clause
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural left join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
select * from (select * from t3 natural join t4) as t34
|
||||
natural right join
|
||||
(select * from t1 natural join t2) as t12;
|
||||
|
||||
-- Queries over views
|
||||
select * from v1a;
|
||||
select * from v1b;
|
||||
select * from v1c;
|
||||
select * from v1d;
|
||||
select * from v2a;
|
||||
select * from v2b;
|
||||
select * from v3a;
|
||||
select * from v3b;
|
||||
select * from v4;
|
||||
select * from v1a natural join v2a;
|
||||
select v2a.* from v1a natural join v2a;
|
||||
select * from v1b join v2a on v1b.b = v2a.c;
|
||||
select * from v1c join v2a on v1c.b = v2a.c;
|
||||
select * from v1d join v2a on v1d.a = v2a.c;
|
||||
select * from v1a join (t3 natural join t4) on a = y;
|
||||
|
||||
-- TODO: add tests with correlated subqueries for natural join/join on.
|
||||
-- related to BUG#15269
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- Negative tests (tests for errors)
|
||||
----------------------------------------------------------------------
|
||||
-- error 1052
|
||||
select * from t1 natural join (t3 cross join t4); -- works in Oracle - bug
|
||||
-- error 1052
|
||||
select * from (t3 cross join t4) natural join t1; -- works in Oracle - bug
|
||||
-- error 1052
|
||||
select * from t1 join (t2, t3) using (b);
|
||||
-- error 1052
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
-- error 1052
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
-- error 1052
|
||||
-- BUG#15357: doesn't detect non-unique column 'c', as in the above query.
|
||||
-- select * from t6 natural join ((t1 natural join t2), (t3 natural join t4));
|
||||
-- error 1052
|
||||
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
|
||||
-- error 1052
|
||||
select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
|
||||
-- this one is OK, the next equivalent one is incorrect (bug in Oracle)
|
||||
-- error 1052
|
||||
select * from (t3 join (t4 natural join t5) on (b < z))
|
||||
natural join
|
||||
(t1 natural join t2);
|
||||
-- error 1052
|
||||
-- BUG#15357: this query should return an ambiguous column error
|
||||
-- Expected result: the query must return error with duplicate column 'c'
|
||||
--select * from (t1 natural join t2)
|
||||
-- natural join
|
||||
-- (t3 join (t4 natural join t5) on (b < z));
|
||||
|
||||
-- error 1054
|
||||
select t1.b from v1a;
|
||||
-- error 1054
|
||||
select * from v1a join v1b on t1.b = t2.b;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
|
||||
drop view v1a;
|
||||
drop view v1b;
|
||||
drop view v1c;
|
||||
drop view v1d;
|
||||
drop view v2a;
|
||||
drop view v2b;
|
||||
drop view v3a;
|
||||
drop view v3b;
|
||||
drop view v4;
|
||||
|
||||
# End of tests for WL#2486 - natural/using join
|
||||
|
|
|
@ -871,3 +871,15 @@ set names default;
|
|||
deallocate prepare stmt;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared
|
||||
# statement
|
||||
#
|
||||
create table t1 (id int);
|
||||
prepare ins_call from "insert into t1 (id) values (1)";
|
||||
execute ins_call;
|
||||
select row_count();
|
||||
drop table t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
|
|
@ -4781,6 +4781,48 @@ select * from t3|
|
|||
drop procedure bug13729|
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#14643: Stored Procedure: Continuing after failed var. initialization
|
||||
# crashes server.
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14643_1|
|
||||
drop procedure if exists bug14643_2|
|
||||
--enable_warnings
|
||||
|
||||
create procedure bug14643_1()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
|
||||
begin
|
||||
declare v int default x;
|
||||
|
||||
if v = 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end if;
|
||||
end;
|
||||
end|
|
||||
|
||||
create procedure bug14643_2()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
|
||||
case x
|
||||
when 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end case;
|
||||
end|
|
||||
|
||||
call bug14643_1()|
|
||||
call bug14643_2()|
|
||||
|
||||
drop procedure bug14643_1|
|
||||
drop procedure bug14643_2|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
|
|
31
mysql-test/t/type_newdecimal-big.test
Normal file
31
mysql-test/t/type_newdecimal-big.test
Normal file
|
@ -0,0 +1,31 @@
|
|||
--source include/big_test.inc
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists sp1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
#-- 2. Adding (one millionth) one million times should be the same as
|
||||
#-- adding 1. So a stored procedure with many iterations will show if
|
||||
#-- small errors accumulate.
|
||||
#
|
||||
|
||||
delimiter //;
|
||||
#
|
||||
create procedure sp1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
#
|
||||
call sp1()//
|
||||
#-- should return
|
||||
# -- v1=1.0000001
|
||||
# -- v2=1.999999900000
|
||||
# -- v3=1.0000001
|
||||
# -- v4=1.999999900000
|
||||
#
|
||||
delimiter ;//
|
||||
#
|
||||
drop procedure sp1;
|
|
@ -473,7 +473,7 @@ drop table wl1612_4;
|
|||
#
|
||||
#-- Additional tests for WL#1612 Precision math
|
||||
#
|
||||
#-- 1. Comparisons should show that a number is
|
||||
#-- Comparisons should show that a number is
|
||||
#-- exactly equal to its value as displayed.
|
||||
#
|
||||
set sql_mode='';
|
||||
|
@ -487,34 +487,9 @@ select 18.3=18.3;
|
|||
select -18.3=18.3;
|
||||
#
|
||||
select 0.8 = 0.7 + 0.1;
|
||||
|
||||
#
|
||||
#-- 2. Adding (one millionth) one million times should be the same as
|
||||
#-- adding 1. So a stored procedure with many iterations will show if
|
||||
#-- small errors accumulate.
|
||||
#
|
||||
#drop procedure p1;
|
||||
#
|
||||
delimiter //;
|
||||
#
|
||||
create procedure p1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
#
|
||||
call p1()//
|
||||
#-- should return
|
||||
# -- v1=1.0000001
|
||||
# -- v2=1.999999900000
|
||||
# -- v3=1.0000001
|
||||
# -- v4=1.999999900000
|
||||
#
|
||||
delimiter ;//
|
||||
#
|
||||
drop procedure p1;
|
||||
#
|
||||
#-- 3. It should be possible to define a column
|
||||
#-- It should be possible to define a column
|
||||
#-- with up to 38 digits precision either before
|
||||
#-- or after the decimal point. Any number which
|
||||
#-- is inserted, if it's within the range, should
|
||||
|
@ -565,7 +540,7 @@ select * from t1;
|
|||
#
|
||||
drop table t1;
|
||||
#
|
||||
#-- 4. The usual arithmetic operators / * + - should work.
|
||||
#-- The usual arithmetic operators / * + - should work.
|
||||
#
|
||||
#select 77777777777777777777777777777777777777 / 7777777777777777777777777777777777777 = 10;
|
||||
#-- should return 0 (false).
|
||||
|
@ -668,7 +643,7 @@ select truncate(99999999999999999999999999999999999999,-31);
|
|||
#drop procedure p1;
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 7. When I say DECIMAL(x) I should be able to store x digits.
|
||||
#-- When I say DECIMAL(x) I should be able to store x digits.
|
||||
#-- If I can't, there should be an error at CREATE time.
|
||||
#
|
||||
#drop table if exists t1;
|
||||
|
@ -676,7 +651,8 @@ select truncate(99999999999999999999999999999999999999,-31);
|
|||
#create table t1 (col1 decimal(254));
|
||||
#-- should return SQLSTATE 22003 numeric value out of range
|
||||
#
|
||||
#-- 8. When I say DECIMAL(x,y) there should be no silent change of precision or scale.
|
||||
#-- When I say DECIMAL(x,y) there should be no silent change of precision or
|
||||
#-- scale.
|
||||
#
|
||||
#drop table if exists t1;
|
||||
#
|
||||
|
@ -694,7 +670,7 @@ select truncate(99999999999999999999999999999999999999,-31);
|
|||
#
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 9. From WL#1612 "The future" point 2.:
|
||||
#-- From WL#1612 "The future" point 2.:
|
||||
#-- The standard requires that we treat numbers like "0.5" as
|
||||
#-- DECIMAL or NUMERIC, not as floating-point.
|
||||
#
|
||||
|
@ -715,7 +691,7 @@ show create table t1;
|
|||
#
|
||||
drop table t1;
|
||||
#
|
||||
#-- 10. From WL#1612, "The future", point 3.: We have to start rounding correctly.
|
||||
#-- From WL#1612, "The future", point 3.: We have to start rounding correctly.
|
||||
#
|
||||
select round(1.5),round(2.5);
|
||||
#-- should return:
|
||||
|
@ -725,13 +701,13 @@ select round(1.5),round(2.5);
|
|||
#| 2 | 3 |
|
||||
#+------------+------------+
|
||||
#
|
||||
#-- 11. From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00.
|
||||
#-- From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00.
|
||||
#-- If operand#1 has scale X and operand#2 has scale Y, then result should have scale (X+Y).
|
||||
#
|
||||
select 0.07 * 0.07;
|
||||
#-- should return 0.0049
|
||||
#
|
||||
#-- 12. From WL#1612, "The future", point 5.: Division by zero is an error.
|
||||
#-- From WL#1612, "The future", point 5.: Division by zero is an error.
|
||||
#
|
||||
set sql_mode='traditional';
|
||||
#
|
||||
|
@ -752,7 +728,7 @@ select 1 / 0;
|
|||
#+-------+
|
||||
#1 row in set, 1 warning (0.00 sec)
|
||||
#
|
||||
#-- 13. From WL#1612 "The future" point 6.: Overflow is an error.
|
||||
#-- From WL#1612 "The future" point 6.: Overflow is an error.
|
||||
#
|
||||
#set sql_mode='';
|
||||
#
|
||||
|
@ -793,7 +769,8 @@ select 1 / 0;
|
|||
#drop table t2;
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 15. From WL#1612 "The future" point 8.: Stop storing leading "+" signs and leading "0"s.
|
||||
#-- From WL#1612 "The future" point 8.: Stop storing leading "+" signs and
|
||||
# leading "0"s.
|
||||
#
|
||||
#drop table if exists t1;
|
||||
#
|
||||
|
@ -805,7 +782,7 @@ select 1 / 0;
|
|||
#
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 16. From WL#1612, The future" point 9.:
|
||||
#-- From WL#1612, The future" point 9.:
|
||||
#-- Accept the data type and precision and scale as the user
|
||||
#-- asks, or return an error, but don't change to something else.
|
||||
#
|
||||
|
@ -817,7 +794,7 @@ select 1 / 0;
|
|||
#
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 17. The scripts in the following bugs should work:
|
||||
#-- The scripts in the following bugs should work:
|
||||
#
|
||||
|
||||
#BUG#559 Maximum precision for DECIMAL column ...
|
||||
|
@ -833,7 +810,7 @@ select 1 / 0;
|
|||
#BUG#6048 Stored procedure causes operating system reboot
|
||||
#BUG#6053 DOUBLE PRECISION literal
|
||||
|
||||
-- 18. Tests from 'traditional' mode tests
|
||||
-- Tests from 'traditional' mode tests
|
||||
#
|
||||
set sql_mode='ansi,traditional';
|
||||
#
|
||||
|
@ -1077,10 +1054,17 @@ SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1;
|
|||
SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1;
|
||||
SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1;
|
||||
|
||||
# We have to disable warnings here as the test in
|
||||
# Field_new_decimal::store(double):
|
||||
# if (nr2 != nr)
|
||||
# fails randomly depending on compiler options
|
||||
|
||||
--disable_warnings
|
||||
UPDATE t1 SET my_decimal = my_float;
|
||||
SELECT my_decimal, my_float FROM t1;
|
||||
UPDATE t1 SET my_decimal = my_double;
|
||||
SELECT my_decimal, my_double FROM t1;
|
||||
--enable_warnings
|
||||
UPDATE t1 SET my_decimal = my_varchar;
|
||||
SELECT my_decimal, my_varchar FROM t1;
|
||||
|
||||
|
|
|
@ -753,6 +753,24 @@ create table t2 select a from t1 union select b from t1;
|
|||
show columns from t2;
|
||||
drop table t2, t1;
|
||||
|
||||
#
|
||||
# Bug #14216: UNION + DECIMAL wrong values in result
|
||||
#
|
||||
create table t1 (f1 decimal(60,25), f2 decimal(60,25));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
drop table t1;
|
||||
create table t1 (f1 decimal(60,24), f2 decimal(60,24));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that union with VARCHAR produces dynamic row tables
|
||||
#
|
||||
|
|
|
@ -252,6 +252,7 @@ if ( defined $opt{regexp} ) {
|
|||
my $sth_dbs = $dbh->prepare("show databases");
|
||||
$sth_dbs->execute;
|
||||
while ( my ($db_name) = $sth_dbs->fetchrow_array ) {
|
||||
next if $db_name =~ m/^information_schema$/i;
|
||||
push @db_desc, { 'src' => $db_name, 't_regex' => $t_regex } if ( $db_name =~ m/$opt{regexp}/o );
|
||||
}
|
||||
}
|
||||
|
|
45
sql/item.cc
45
sql/item.cc
|
@ -601,16 +601,8 @@ bool Item::eq(const Item *item, bool binary_cmp) const
|
|||
|
||||
Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
{
|
||||
/*
|
||||
Allow conversion from and to "binary".
|
||||
Don't allow automatic conversion to non-Unicode charsets,
|
||||
as it potentially loses data.
|
||||
*/
|
||||
if (collation.collation != &my_charset_bin &&
|
||||
tocs != &my_charset_bin &&
|
||||
!(tocs->state & MY_CS_UNICODE))
|
||||
return NULL; // safe conversion is not possible
|
||||
return new Item_func_conv_charset(this, tocs);
|
||||
Item_func_conv_charset *conv= new Item_func_conv_charset(this, tocs, 1);
|
||||
return conv->safe ? conv : NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -700,23 +692,15 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
|
|||
{
|
||||
if (const_item())
|
||||
{
|
||||
Item_string *conv;
|
||||
uint cnv_errors;
|
||||
char buf[MAX_FIELD_WIDTH];
|
||||
String tmp(buf, sizeof(buf), &my_charset_bin);
|
||||
String cstr, *ostr= val_str(&tmp);
|
||||
/*
|
||||
As safe_charset_converter is not executed for
|
||||
a parameter bound to NULL, ostr should never be 0.
|
||||
*/
|
||||
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &cnv_errors);
|
||||
if (cnv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
|
||||
cstr.charset(),
|
||||
collation.derivation)))
|
||||
return NULL;
|
||||
conv->str_value.copy();
|
||||
conv->str_value.mark_as_const();
|
||||
return conv;
|
||||
String *ostr= val_str(&cnvstr);
|
||||
cnvitem->str_value.copy(ostr->ptr(), ostr->length(),
|
||||
ostr->charset(), tocs, &cnv_errors);
|
||||
if (cnv_errors)
|
||||
return NULL;
|
||||
cnvitem->str_value.mark_as_const();
|
||||
cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen;
|
||||
return cnvitem;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2104,6 +2088,8 @@ Item_param::Item_param(unsigned pos_in_query_arg) :
|
|||
value is set.
|
||||
*/
|
||||
maybe_null= 1;
|
||||
cnvitem= new Item_string("", 0, &my_charset_bin, DERIVATION_COERCIBLE);
|
||||
cnvstr.set(cnvbuf, sizeof(cnvbuf), &my_charset_bin);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5826,8 +5812,11 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
|||
{
|
||||
int delta1= max_length_orig - decimals_orig;
|
||||
int delta2= item->max_length - item->decimals;
|
||||
max_length= min(max(delta1, delta2) + decimals,
|
||||
(fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7);
|
||||
if (fld_type == MYSQL_TYPE_DECIMAL)
|
||||
max_length= max(delta1, delta2) + decimals;
|
||||
else
|
||||
max_length= min(max(delta1, delta2) + decimals,
|
||||
(fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7);
|
||||
}
|
||||
else
|
||||
max_length= (fld_type == MYSQL_TYPE_FLOAT) ? FLT_DIG+6 : DBL_DIG+7;
|
||||
|
|
|
@ -1084,7 +1084,11 @@ public:
|
|||
|
||||
class Item_param :public Item
|
||||
{
|
||||
char cnvbuf[MAX_FIELD_WIDTH];
|
||||
String cnvstr;
|
||||
Item *cnvitem;
|
||||
public:
|
||||
|
||||
enum enum_item_param_state
|
||||
{
|
||||
NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE,
|
||||
|
|
|
@ -2316,6 +2316,8 @@ String *Item_func_conv::val_str(String *str)
|
|||
String *Item_func_conv_charset::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
if (use_cached_value)
|
||||
return null_value ? 0 : &str_value;
|
||||
String *arg= args[0]->val_str(str);
|
||||
uint dummy_errors;
|
||||
if (!arg)
|
||||
|
|
|
@ -652,10 +652,40 @@ public:
|
|||
|
||||
class Item_func_conv_charset :public Item_str_func
|
||||
{
|
||||
bool use_cached_value;
|
||||
public:
|
||||
bool safe;
|
||||
CHARSET_INFO *conv_charset; // keep it public
|
||||
Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a)
|
||||
{ conv_charset=cs; }
|
||||
Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a)
|
||||
{ conv_charset= cs; use_cached_value= 0; safe= 0; }
|
||||
Item_func_conv_charset(Item *a, CHARSET_INFO *cs, bool cache_if_const)
|
||||
:Item_str_func(a)
|
||||
{
|
||||
DBUG_ASSERT(args[0]->fixed);
|
||||
conv_charset= cs;
|
||||
if (cache_if_const && args[0]->const_item())
|
||||
{
|
||||
uint errors= 0;
|
||||
String tmp, *str= args[0]->val_str(&tmp);
|
||||
if (!str || str_value.copy(str->ptr(), str->length(),
|
||||
str->charset(), conv_charset, &errors))
|
||||
null_value= 1;
|
||||
use_cached_value= 1;
|
||||
safe= (errors == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
use_cached_value= 0;
|
||||
/*
|
||||
Conversion from and to "binary" is safe.
|
||||
Conversion to Unicode is safe.
|
||||
Other kind of conversions are potentially lossy.
|
||||
*/
|
||||
safe= (args[0]->collation.collation == &my_charset_bin ||
|
||||
cs == &my_charset_bin ||
|
||||
(cs->state & MY_CS_UNICODE));
|
||||
}
|
||||
}
|
||||
String *val_str(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "convert"; }
|
||||
|
|
|
@ -2209,6 +2209,26 @@ sp_instr_set::exec_core(THD *thd, uint *nextp)
|
|||
{
|
||||
int res= thd->spcont->set_item_eval(thd, m_offset, &m_value, m_type);
|
||||
|
||||
if (res < 0 &&
|
||||
thd->spcont->get_item(m_offset) == NULL &&
|
||||
thd->spcont->found_handler_here())
|
||||
{
|
||||
/*
|
||||
Failed to evaluate the value, the variable is still not initialized,
|
||||
and a handler has been found. Set to null so we can continue.
|
||||
*/
|
||||
Item *it= new Item_null();
|
||||
|
||||
if (!it || thd->spcont->set_item_eval(thd, m_offset, &it, m_type) < 0)
|
||||
{ /* If this also failed, we have to abort */
|
||||
sp_rcontext *spcont= thd->spcont;
|
||||
|
||||
thd->spcont= 0; /* Avoid handlers */
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0));
|
||||
spcont->clear_handler();
|
||||
thd->spcont= spcont;
|
||||
}
|
||||
}
|
||||
*nextp = m_ip+1;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -4844,11 +4844,15 @@ end_with_restore_list:
|
|||
|
||||
|
||||
/*
|
||||
The return value for ROW_COUNT() is "implementation dependent" if
|
||||
the statement is not DELETE, INSERT or UPDATE (or a CALL executing
|
||||
such a statement), but -1 is what JDBC and ODBC wants.
|
||||
The return value for ROW_COUNT() is "implementation dependent" if the
|
||||
statement is not DELETE, INSERT or UPDATE, but -1 is what JDBC and ODBC
|
||||
wants.
|
||||
|
||||
We do not change the value for a CALL or EXECUTE statement, so the value
|
||||
generated by the last called (or executed) statement is preserved.
|
||||
*/
|
||||
if (lex->sql_command != SQLCOM_CALL && uc_update_queries[lex->sql_command]<2)
|
||||
if (lex->sql_command != SQLCOM_CALL && lex->sql_command != SQLCOM_EXECUTE &&
|
||||
uc_update_queries[lex->sql_command]<2)
|
||||
thd->row_count_func= -1;
|
||||
goto cleanup;
|
||||
|
||||
|
|
|
@ -3400,7 +3400,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
def->def=alter->def; // Use new default
|
||||
if ((def->def=alter->def)) // Use new default
|
||||
def->flags&= ~NO_DEFAULT_VALUE_FLAG;
|
||||
else
|
||||
def->flags|= NO_DEFAULT_VALUE_FLAG;
|
||||
alter_it.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1405,10 +1405,10 @@ File create_frm(THD *thd, my_string name, const char *db,
|
|||
|
||||
#if SIZEOF_OFF_T > 4
|
||||
/* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */
|
||||
if (create_info->max_rows > ~(ulong) 0)
|
||||
create_info->max_rows= ~(ulong) 0;
|
||||
if (create_info->min_rows > ~(ulong) 0)
|
||||
create_info->min_rows= ~(ulong) 0;
|
||||
if (create_info->max_rows > UINT_MAX32)
|
||||
create_info->max_rows= UINT_MAX32;
|
||||
if (create_info->min_rows > UINT_MAX32)
|
||||
create_info->min_rows= UINT_MAX32;
|
||||
#endif
|
||||
/*
|
||||
Ensure that raid_chunks can't be larger than 255, as this would cause
|
||||
|
|
|
@ -191,9 +191,6 @@ void netware_ssl_cleanup()
|
|||
/* NetWare SSL initialization */
|
||||
static void netware_ssl_init()
|
||||
{
|
||||
/* initialize OpenSSL library */
|
||||
SSL_library_init();
|
||||
|
||||
/* cleanup OpenSSL library */
|
||||
NXVmRegisterExitHandler(netware_ssl_cleanup, NULL);
|
||||
}
|
||||
|
@ -228,16 +225,17 @@ new_VioSSLConnectorFd(const char* key_file,
|
|||
ptr->ssl_method= 0;
|
||||
/* FIXME: constants! */
|
||||
|
||||
#ifdef __NETWARE__
|
||||
netware_ssl_init();
|
||||
#endif
|
||||
|
||||
if (!ssl_algorithms_added)
|
||||
{
|
||||
DBUG_PRINT("info", ("todo: OpenSSL_add_all_algorithms()"));
|
||||
ssl_algorithms_added = TRUE;
|
||||
SSL_library_init();
|
||||
OpenSSL_add_all_algorithms();
|
||||
}
|
||||
#ifdef __NETWARE__
|
||||
netware_ssl_init();
|
||||
#endif
|
||||
|
||||
if (!ssl_error_strings_loaded)
|
||||
{
|
||||
DBUG_PRINT("info", ("todo:SSL_load_error_strings()"));
|
||||
|
@ -319,17 +317,18 @@ new_VioSSLAcceptorFd(const char *key_file,
|
|||
/* FIXME: constants! */
|
||||
ptr->session_id_context= ptr;
|
||||
|
||||
#ifdef __NETWARE__
|
||||
netware_ssl_init();
|
||||
#endif
|
||||
|
||||
if (!ssl_algorithms_added)
|
||||
{
|
||||
DBUG_PRINT("info", ("todo: OpenSSL_add_all_algorithms()"));
|
||||
ssl_algorithms_added = TRUE;
|
||||
SSL_library_init();
|
||||
OpenSSL_add_all_algorithms();
|
||||
|
||||
}
|
||||
#ifdef __NETWARE__
|
||||
netware_ssl_init();
|
||||
#endif
|
||||
|
||||
if (!ssl_error_strings_loaded)
|
||||
{
|
||||
DBUG_PRINT("info", ("todo: SSL_load_error_strings()"));
|
||||
|
|
Loading…
Reference in a new issue