Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.0

into  may.pils.ru:/home/svoj/devel/mysql/BUG19192/mysql-5.0
This commit is contained in:
svoj@may.pils.ru 2006-06-07 13:58:23 +05:00
commit d14e190ce8
38 changed files with 677 additions and 144 deletions

View file

@ -276,6 +276,7 @@ bkpush.log
bkpush.log* bkpush.log*
build.log build.log
build_tags.sh build_tags.sh
client/#mysql.cc#
client/*.ds? client/*.ds?
client/*.vcproj client/*.vcproj
client/completion_hash.cpp client/completion_hash.cpp
@ -290,6 +291,7 @@ client/my_decimal.h
client/my_user.c client/my_user.c
client/mysql client/mysql
client/mysql.cpp client/mysql.cpp
client/mysql_upgrade
client/mysqladmin client/mysqladmin
client/mysqladmin.c client/mysqladmin.c
client/mysqladmin.cpp client/mysqladmin.cpp
@ -365,6 +367,9 @@ extra/resolve_stack_dump
extra/resolveip extra/resolveip
extra/sql_state.h extra/sql_state.h
extra/tztime.cc extra/tztime.cc
extra/yassl/taocrypt/benchmark/benchmark
extra/yassl/taocrypt/test/test
extra/yassl/testsuite/testsuite
fcns.c fcns.c
fcns.h fcns.h
gdbinit gdbinit
@ -382,6 +387,7 @@ include/my_global.h
include/mysql_version.h include/mysql_version.h
include/mysqld_ername.h include/mysqld_ername.h
include/mysqld_error.h include/mysqld_error.h
include/openssl
include/readline include/readline
include/readline/*.h include/readline/*.h
include/readline/readline.h include/readline/readline.h
@ -672,6 +678,7 @@ mysql-test/r/bdb-alter-table-2.err
mysql-test/r/bdb-crash.err mysql-test/r/bdb-crash.err
mysql-test/r/bdb-deadlock.err mysql-test/r/bdb-deadlock.err
mysql-test/r/bdb.err mysql-test/r/bdb.err
mysql-test/r/bdb.log
mysql-test/r/bdb_cache.err mysql-test/r/bdb_cache.err
mysql-test/r/client_test.err mysql-test/r/client_test.err
mysql-test/r/csv.err mysql-test/r/csv.err
@ -679,6 +686,7 @@ mysql-test/r/ctype_ucs.err
mysql-test/r/derived.err mysql-test/r/derived.err
mysql-test/r/exampledb.err mysql-test/r/exampledb.err
mysql-test/r/func_encrypt.err mysql-test/r/func_encrypt.err
mysql-test/r/im_client_port.log
mysql-test/r/index_merge_load.result mysql-test/r/index_merge_load.result
mysql-test/r/isam.err mysql-test/r/isam.err
mysql-test/r/lowercase_table2.err mysql-test/r/lowercase_table2.err
@ -727,6 +735,7 @@ mysql-test/r/rpl000016.eval
mysql-test/r/rpl_log.eval mysql-test/r/rpl_log.eval
mysql-test/r/slave-running.eval mysql-test/r/slave-running.eval
mysql-test/r/slave-stopped.eval mysql-test/r/slave-stopped.eval
mysql-test/r/udf.log
mysql-test/share/mysql mysql-test/share/mysql
mysql-test/std_data/*.pem mysql-test/std_data/*.pem
mysql-test/t/index_merge.load mysql-test/t/index_merge.load
@ -1051,6 +1060,7 @@ scripts/mysql_install_db
scripts/mysql_secure_installation scripts/mysql_secure_installation
scripts/mysql_setpermission scripts/mysql_setpermission
scripts/mysql_tableinfo scripts/mysql_tableinfo
scripts/mysql_upgrade
scripts/mysql_zap scripts/mysql_zap
scripts/mysqlaccess scripts/mysqlaccess
scripts/mysqlbug scripts/mysqlbug
@ -1142,7 +1152,9 @@ sql/pack.c
sql/safe_to_cache_query.txt sql/safe_to_cache_query.txt
sql/share/*.sys sql/share/*.sys
sql/share/charsets/gmon.out sql/share/charsets/gmon.out
sql/share/fixerrmsg.pl
sql/share/gmon.out sql/share/gmon.out
sql/share/iso639-2.txt
sql/share/mysql sql/share/mysql
sql/share/norwegian-ny/errmsg.sys sql/share/norwegian-ny/errmsg.sys
sql/share/norwegian/errmsg.sys sql/share/norwegian/errmsg.sys
@ -1273,12 +1285,3 @@ vio/viotest-sslconnect.cpp
vio/viotest.cpp vio/viotest.cpp
zlib/*.ds? zlib/*.ds?
zlib/*.vcproj zlib/*.vcproj
scripts/mysql_upgrade
include/openssl
mysql-test/r/bdb.log
mysql-test/r/im_client_port.log
mysql-test/r/udf.log
extra/yassl/taocrypt/benchmark/benchmark
extra/yassl/taocrypt/test/test
extra/yassl/testsuite/testsuite
client/mysql_upgrade

View file

@ -823,6 +823,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_NOPAGER: case OPT_NOPAGER:
printf("WARNING: option deprecated; use --disable-pager instead.\n"); printf("WARNING: option deprecated; use --disable-pager instead.\n");
opt_nopager= 1; opt_nopager= 1;
break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
{ {
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)

View file

@ -1,4 +1,14 @@
yaSSL Release notes, version 1.3.0 (04/26/06) yaSSL Release notes, version 1.3.5 (06/01/06)
This release of yaSSL contains bug fixes, portability enhancements,
better libcurl support, and improved non-blocking I/O.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0.
********************yaSSL Release notes, version 1.3.0 (04/26/06)
This release of yaSSL contains minor bug fixes, portability enhancements, This release of yaSSL contains minor bug fixes, portability enhancements,
@ -17,8 +27,8 @@ See normal build instructions below under 1.0.6.
make make
make openssl-links make openssl-links
(then go to your libcurl home and tell libcurl about yaSSL) (then go to your libcurl home and tell libcurl about yaSSL build dir)
./configure --with-ssl=/yaSSL-HomeDir ./configure --with-ssl=/yaSSL-BuildDir LDFLAGS=-lm
make make

View file

@ -0,0 +1,5 @@
/* engine.h for libcurl */
#undef HAVE_OPENSSL_ENGINE_H

View file

@ -0,0 +1,5 @@
/* pkcs12.h for libcurl */
#undef HAVE_OPENSSL_PKCS12_H

View file

@ -458,6 +458,11 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl)
uint16 sz = ((b0 & 0x7f) << 8) | b1; uint16 sz = ((b0 & 0x7f) << 8) | b1;
if (sz > input.get_remaining()) {
ssl.SetError(bad_input);
return;
}
// hashHandShake manually // hashHandShake manually
const opaque* buffer = input.get_buffer() + input.get_current(); const opaque* buffer = input.get_buffer() + input.get_current();
ssl.useHashes().use_MD5().update(buffer, sz); ssl.useHashes().use_MD5().update(buffer, sz);
@ -681,25 +686,38 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
// old style sslv2 client hello? // old style sslv2 client hello?
if (ssl.getSecurity().get_parms().entity_ == server_end && if (ssl.getSecurity().get_parms().entity_ == server_end &&
ssl.getStates().getServer() == clientNull) ssl.getStates().getServer() == clientNull)
if (buffer.peek() != handshake) if (buffer.peek() != handshake) {
ProcessOldClientHello(buffer, ssl); ProcessOldClientHello(buffer, ssl);
if (ssl.GetError()) {
buffered.reset(0);
return buffered;
}
}
while(!buffer.eof()) { while(!buffer.eof()) {
// each record // each record
RecordLayerHeader hdr; RecordLayerHeader hdr;
bool needHdr = false;
if (static_cast<uint>(RECORD_HEADER) > buffer.get_remaining())
needHdr = true;
else {
buffer >> hdr; buffer >> hdr;
ssl.verifyState(hdr); ssl.verifyState(hdr);
}
// make sure we have enough input in buffer to process this record // make sure we have enough input in buffer to process this record
if (hdr.length_ > buffer.get_remaining()) { if (needHdr || hdr.length_ > buffer.get_remaining()) {
uint sz = buffer.get_remaining() + RECORD_HEADER; // put header in front for next time processing
uint extra = needHdr ? 0 : RECORD_HEADER;
uint sz = buffer.get_remaining() + extra;
buffered.reset(NEW_YS input_buffer(sz, buffer.get_buffer() + buffered.reset(NEW_YS input_buffer(sz, buffer.get_buffer() +
buffer.get_current() - RECORD_HEADER, sz)); buffer.get_current() - extra, sz));
break; break;
} }
while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) { while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) {
// each message in record // each message in record, can be more than 1 if not encrypted
if (ssl.getSecurity().get_parms().pending_ == false) // cipher on if (ssl.getSecurity().get_parms().pending_ == false) // cipher on
decrypt_message(ssl, buffer, hdr.length_); decrypt_message(ssl, buffer, hdr.length_);
mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_), ysDelete); mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_), ysDelete);
@ -717,7 +735,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
} }
offset += hdr.length_ + RECORD_HEADER; offset += hdr.length_ + RECORD_HEADER;
} }
return buffered; // done, don't call again return buffered;
} }

View file

@ -384,6 +384,7 @@ inline double ulonglong2double(ulonglong value)
#define FN_LIBCHAR '\\' #define FN_LIBCHAR '\\'
#define FN_ROOTDIR "\\" #define FN_ROOTDIR "\\"
#define FN_DEVCHAR ':'
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ #define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */ #define FN_NO_CASE_SENCE /* Files are not case-sensitive */
#define OS_FILE_LIMIT 2048 #define OS_FILE_LIMIT 2048

View file

@ -599,7 +599,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ #define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ #define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
#define FN_PARENTDIR ".." /* Parent directory; Must be a string */ #define FN_PARENTDIR ".." /* Parent directory; Must be a string */
#define FN_DEVCHAR ':'
#ifndef FN_LIBCHAR #ifndef FN_LIBCHAR
#ifdef __EMX__ #ifdef __EMX__

View file

@ -1296,9 +1296,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
# The next should give an error # The next should give an error
# #
-- error 1072 -- error 1176
explain select fld3 from t2 ignore index (fld3,not_used); explain select fld3 from t2 ignore index (fld3,not_used);
-- error 1072 -- error 1176
explain select fld3 from t2 use index (not_used); explain select fld3 from t2 use index (not_used);
# #

View file

@ -145,9 +145,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used); explain select fld3 from t2 ignore index (fld3,not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used); explain select fld3 from t2 use index (not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3 fld3
honeysuckle honeysuckle

View file

@ -0,0 +1,14 @@
drop table if exists `about:text`;
create table `about:text` (
_id int not null auto_increment,
`about:text` varchar(255) not null default '',
primary key (_id)
);
show create table `about:text`;
Table Create Table
about:text CREATE TABLE `about:text` (
`_id` int(11) NOT NULL auto_increment,
`about:text` varchar(255) NOT NULL default '',
PRIMARY KEY (`_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table `about:text`;

View file

@ -24,9 +24,9 @@ explain select * from t1 use key (str,str) where str="foo";
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const str str 11 const 1 1 SIMPLE t1 const str str 11 const 1
explain select * from t1 use key (str,str,foo) where str="foo"; explain select * from t1 use key (str,str,foo) where str="foo";
ERROR 42000: Key column 'foo' doesn't exist in table ERROR HY000: Key 'foo' doesn't exist in table 't1'
explain select * from t1 ignore key (str,str,foo) where str="foo"; explain select * from t1 ignore key (str,str,foo) where str="foo";
ERROR 42000: Key column 'foo' doesn't exist in table ERROR HY000: Key 'foo' doesn't exist in table 't1'
drop table t1; drop table t1;
explain select 1; explain select 1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra

View file

@ -605,6 +605,7 @@ insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_gr
flush privileges; flush privileges;
delete from tables_priv where host = '' and user = 'mysqltest_1'; delete from tables_priv where host = '' and user = 'mysqltest_1';
flush privileges; flush privileges;
use test;
set @user123="non-existent"; set @user123="non-existent";
select * from mysql.db where user=@user123; 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 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
@ -635,7 +636,6 @@ show grants for mysqltest_7@;
Grants for mysqltest_7@ Grants for mysqltest_7@
GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517' GRANT USAGE ON *.* TO 'mysqltest_7'@'' IDENTIFIED BY PASSWORD '*2FB071A056F9BB745219D9C876814231DAF46517'
drop user mysqltest_7@; drop user mysqltest_7@;
flush privileges;
show grants for mysqltest_7@; show grants for mysqltest_7@;
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host '' ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
create database mysqltest; create database mysqltest;
@ -656,3 +656,214 @@ delete from mysql.db where user='mysqltest1';
delete from mysql.tables_priv where user='mysqltest1'; delete from mysql.tables_priv where user='mysqltest1';
flush privileges; flush privileges;
drop database mysqltest; drop database mysqltest;
use test;
create table t1 (a int);
create table t2 as select * from mysql.user where user='';
delete from mysql.user where user='';
flush privileges;
create user mysqltest_8@'';
create user mysqltest_8;
create user mysqltest_8@host8;
create user mysqltest_8@'';
ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@''
create user mysqltest_8;
ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%'
create user mysqltest_8@host8;
ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'host8'
select user, QUOTE(host) from mysql.user where user="mysqltest_8";
user QUOTE(host)
mysqltest_8 ''
mysqltest_8 '%'
mysqltest_8 'host8'
Schema privileges
grant select on mysqltest.* to mysqltest_8@'';
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
grant select on mysqltest.* to mysqltest_8@;
show grants for mysqltest_8@;
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
grant select on mysqltest.* to mysqltest_8;
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%'
select * from information_schema.schema_privileges
where grantee like "'mysqltest_8'%";
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'%' NULL mysqltest SELECT NO
'mysqltest_8'@'' NULL mysqltest SELECT NO
select * from t1;
a
revoke select on mysqltest.* from mysqltest_8@'';
revoke select on mysqltest.* from mysqltest_8;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
select * from information_schema.schema_privileges
where grantee like "'mysqltest_8'%";
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
flush privileges;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
show grants for mysqltest_8@;
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
grant select on mysqltest.* to mysqltest_8@'';
flush privileges;
show grants for mysqltest_8@;
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@''
revoke select on mysqltest.* from mysqltest_8@'';
flush privileges;
Column privileges
grant update (a) on t1 to mysqltest_8@'';
grant update (a) on t1 to mysqltest_8;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
flush privileges;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
select * from information_schema.column_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'%' NULL test t1 a UPDATE NO
'mysqltest_8'@'' NULL test t1 a UPDATE NO
select * from t1;
a
revoke update (a) on t1 from mysqltest_8@'';
revoke update (a) on t1 from mysqltest_8;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
select * from information_schema.column_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
flush privileges;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
Table privileges
grant update on t1 to mysqltest_8@'';
grant update on t1 to mysqltest_8;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
flush privileges;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
select * from information_schema.table_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'%' NULL test t1 UPDATE NO
'mysqltest_8'@'' NULL test t1 UPDATE NO
select * from t1;
a
revoke update on t1 from mysqltest_8@'';
revoke update on t1 from mysqltest_8;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
select * from information_schema.table_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
flush privileges;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
"DROP USER" should clear privileges
grant all privileges on mysqltest.* to mysqltest_8@'';
grant select on mysqltest.* to mysqltest_8@'';
grant update on t1 to mysqltest_8@'';
grant update (a) on t1 to mysqltest_8@'';
grant all privileges on mysqltest.* to mysqltest_8;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
select * from information_schema.user_privileges
where grantee like "'mysqltest_8'%";
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'host8' NULL USAGE NO
'mysqltest_8'@'%' NULL USAGE NO
'mysqltest_8'@'' NULL USAGE NO
select * from t1;
a
flush privileges;
show grants for mysqltest_8@'';
Grants for mysqltest_8@
GRANT USAGE ON *.* TO 'mysqltest_8'@''
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@''
GRANT UPDATE, UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
drop user mysqltest_8@'';
show grants for mysqltest_8@'';
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host ''
show grants for mysqltest_8;
Grants for mysqltest_8@%
GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
select * from information_schema.user_privileges
where grantee like "'mysqltest_8'%";
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_8'@'host8' NULL USAGE NO
'mysqltest_8'@'%' NULL USAGE NO
drop user mysqltest_8;
connect(localhost,mysqltest_8,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'mysqltest_8'@'localhost' (using password: NO)
show grants for mysqltest_8;
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%'
drop user mysqltest_8@host8;
show grants for mysqltest_8@host8;
ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host 'host8'
insert into mysql.user select * from t2;
flush privileges;
drop table t2;
drop table t1;

View file

@ -866,58 +866,62 @@ grant select (f1) on mysqltest.t1 to user1@localhost;
grant select on mysqltest.t2 to user2@localhost; grant select on mysqltest.t2 to user2@localhost;
grant select on mysqltest.* to user3@localhost; grant select on mysqltest.* to user3@localhost;
grant select on *.* to user4@localhost; grant select on *.* to user4@localhost;
select * from information_schema.column_privileges; select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO 'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
select * from information_schema.table_privileges; select * from information_schema.table_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.schema_privileges; select * from information_schema.schema_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.user_privileges; select * from information_schema.user_privileges order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL USAGE NO 'user1'@'localhost' NULL USAGE NO
show grants; show grants;
Grants for user1@localhost Grants for user1@localhost
GRANT USAGE ON *.* TO 'user1'@'localhost' GRANT USAGE ON *.* TO 'user1'@'localhost'
GRANT SELECT (f1) ON `mysqltest`.`t1` TO 'user1'@'localhost' GRANT SELECT (f1) ON `mysqltest`.`t1` TO 'user1'@'localhost'
select * from information_schema.column_privileges; select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.table_privileges; select * from information_schema.table_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user2'@'localhost' NULL mysqltest t2 SELECT NO 'user2'@'localhost' NULL mysqltest t2 SELECT NO
select * from information_schema.schema_privileges; select * from information_schema.schema_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.user_privileges; select * from information_schema.user_privileges order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user2'@'localhost' NULL USAGE NO 'user2'@'localhost' NULL USAGE NO
show grants; show grants;
Grants for user2@localhost Grants for user2@localhost
GRANT USAGE ON *.* TO 'user2'@'localhost' GRANT USAGE ON *.* TO 'user2'@'localhost'
GRANT SELECT ON `mysqltest`.`t2` TO 'user2'@'localhost' GRANT SELECT ON `mysqltest`.`t2` TO 'user2'@'localhost'
select * from information_schema.column_privileges; select * from information_schema.column_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.table_privileges; select * from information_schema.table_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
select * from information_schema.schema_privileges; select * from information_schema.schema_privileges order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'user3'@'localhost' NULL mysqltest SELECT NO 'user3'@'localhost' NULL mysqltest SELECT NO
select * from information_schema.user_privileges; select * from information_schema.user_privileges order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user3'@'localhost' NULL USAGE NO 'user3'@'localhost' NULL USAGE NO
show grants; show grants;
Grants for user3@localhost Grants for user3@localhost
GRANT USAGE ON *.* TO 'user3'@'localhost' GRANT USAGE ON *.* TO 'user3'@'localhost'
GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost' GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost'
select * from information_schema.column_privileges where grantee like '%user%'; select * from information_schema.column_privileges where grantee like '%user%'
order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO 'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
select * from information_schema.table_privileges where grantee like '%user%'; select * from information_schema.table_privileges where grantee like '%user%'
order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user2'@'localhost' NULL mysqltest t2 SELECT NO 'user2'@'localhost' NULL mysqltest t2 SELECT NO
select * from information_schema.schema_privileges where grantee like '%user%'; select * from information_schema.schema_privileges where grantee like '%user%'
order by grantee;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'user3'@'localhost' NULL mysqltest SELECT NO 'user3'@'localhost' NULL mysqltest SELECT NO
select * from information_schema.user_privileges where grantee like '%user%'; select * from information_schema.user_privileges where grantee like '%user%'
order by grantee;
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
'user1'@'localhost' NULL USAGE NO 'user1'@'localhost' NULL USAGE NO
'user2'@'localhost' NULL USAGE NO 'user2'@'localhost' NULL USAGE NO
@ -1121,3 +1125,12 @@ NULL test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
set @a:= '.';
create table t1(f1 char(5));
create table t2(f1 char(5));
select concat(@a, table_name), @a, table_name
from information_schema.tables where table_schema = 'test';
concat(@a, table_name) @a table_name
.t1 . t1
.t2 . t2
drop table t1,t2;

View file

@ -191,10 +191,10 @@ cache index t1 in unknown_key_cache;
ERROR HY000: Unknown key cache 'unknown_key_cache' ERROR HY000: Unknown key cache 'unknown_key_cache'
cache index t1 key (unknown_key) in keycache1; cache index t1 key (unknown_key) in keycache1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 assign_to_keycache error Key column 'unknown_key' doesn't exist in table test.t1 assign_to_keycache error Key 'unknown_key' doesn't exist in table 't1'
test.t1 assign_to_keycache status Operation failed test.t1 assign_to_keycache status Operation failed
Warnings: Warnings:
Error 1072 Key column 'unknown_key' doesn't exist in table Error 1176 Key 'unknown_key' doesn't exist in table 't1'
select @@keycache2.key_buffer_size; select @@keycache2.key_buffer_size;
@@keycache2.key_buffer_size @@keycache2.key_buffer_size
4194304 4194304

View file

@ -165,3 +165,12 @@ create table t1Aa (col1 int);
select t1Aa.col1 from t1aA,t2Aa where t1Aa.col1 = t2aA.col1; select t1Aa.col1 from t1aA,t2Aa where t1Aa.col1 = t2aA.col1;
col1 col1
drop table t2aA, t1Aa; drop table t2aA, t1Aa;
create database mysqltest_LC2;
use mysqltest_LC2;
create table myUC (i int);
select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
where TABLE_SCHEMA ='mysqltest_LC2';
TABLE_SCHEMA TABLE_NAME
mysqltest_LC2 myUC
use test;
drop database mysqltest_LC2;

View file

@ -160,11 +160,11 @@ Key_reads 0
load index into cache t3 key (b), t2 key (c) ; load index into cache t3 key (b), t2 key (c) ;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t3 preload_keys error Table 'test.t3' doesn't exist test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys error Key column 'c' doesn't exist in table test.t2 preload_keys error Key 'c' doesn't exist in table 't2'
test.t2 preload_keys status Operation failed test.t2 preload_keys status Operation failed
Warnings: Warnings:
Error 1146 Table 'test.t3' doesn't exist Error 1146 Table 'test.t3' doesn't exist
Error 1072 Key column 'c' doesn't exist in table Error 1176 Key 'c' doesn't exist in table 't2'
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 0 Key_read_requests 0

View file

@ -144,9 +144,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used); explain select fld3 from t2 ignore index (fld3,not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used); explain select fld3 from t2 use index (not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3 fld3
honeysuckle honeysuckle
@ -2716,6 +2716,16 @@ select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 fro
f1 f2 f1 f2
1 1 1 1
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (a int, INDEX idx(a));
INSERT INTO t1 VALUES (2), (3), (1);
EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
ERROR HY000: Key 'a' doesn't exist in table 't1'
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
ERROR HY000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
CREATE TABLE t1 ( city char(30) ); CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London'); INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris'); INSERT INTO t1 VALUES ('Paris');

View file

@ -145,9 +145,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used); explain select fld3 from t2 ignore index (fld3,not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used); explain select fld3 from t2 use index (not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3 fld3
honeysuckle honeysuckle

View file

@ -148,9 +148,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index 1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used); explain select fld3 from t2 ignore index (fld3,not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
explain select fld3 from t2 use index (not_used); explain select fld3 from t2 use index (not_used);
ERROR 42000: Key column 'not_used' doesn't exist in table ERROR HY000: Key 'not_used' doesn't exist in table 't2'
select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
fld3 fld3
honeysuckle honeysuckle

View file

@ -614,7 +614,7 @@ drop table t1;
create table t1 (a int, b int); create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a; create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1; select b from v1 use index (some_index) where b=1;
ERROR 42000: Key column 'some_index' doesn't exist in table ERROR HY000: Key 'some_index' doesn't exist in table 'v1'
drop view v1; drop view v1;
drop table t1; drop table t1;
create table t1 (col1 char(5),col2 char(5)); create table t1 (col1 char(5),col2 char(5));

View file

@ -0,0 +1,20 @@
# Non-windows specific create tests.
--source include/not_windows.inc
#
# Bug#19479:mysqldump creates invalid dump
#
--disable_warnings
drop table if exists `about:text`;
--enable_warnings
create table `about:text` (
_id int not null auto_increment,
`about:text` varchar(255) not null default '',
primary key (_id)
);
show create table `about:text`;
drop table `about:text`;
# End of 5.0 tests

View file

@ -15,9 +15,9 @@ explain select * from t1 ignore key (str) where str="foo";
explain select * from t1 use key (str,str) where str="foo"; explain select * from t1 use key (str,str) where str="foo";
#The following should give errors #The following should give errors
--error 1072 --error 1176
explain select * from t1 use key (str,str,foo) where str="foo"; explain select * from t1 use key (str,str,foo) where str="foo";
--error 1072 --error 1176
explain select * from t1 ignore key (str,str,foo) where str="foo"; explain select * from t1 ignore key (str,str,foo) where str="foo";
drop table t1; drop table t1;

View file

@ -490,6 +490,7 @@ insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_gr
flush privileges; flush privileges;
delete from tables_priv where host = '' and user = 'mysqltest_1'; delete from tables_priv where host = '' and user = 'mysqltest_1';
flush privileges; flush privileges;
use test;
# #
# Bug #10892 user variables not auto cast for comparisons # Bug #10892 user variables not auto cast for comparisons
@ -518,7 +519,6 @@ create user mysqltest_7@;
set password for mysqltest_7@ = password('systpass'); set password for mysqltest_7@ = password('systpass');
show grants for mysqltest_7@; show grants for mysqltest_7@;
drop user mysqltest_7@; drop user mysqltest_7@;
flush privileges; # BUG#16297(flush should be removed when that bug is fixed)
--error 1141 --error 1141
show grants for mysqltest_7@; show grants for mysqltest_7@;
@ -539,3 +539,145 @@ flush privileges;
drop database mysqltest; drop database mysqltest;
# End of 4.1 tests # End of 4.1 tests
#
# Bug #16297 In memory grant tables not flushed when users's hostname is ""
#
use test;
create table t1 (a int);
# Backup anonymous users and remove them. (They get in the way of
# the one we test with here otherwise.)
create table t2 as select * from mysql.user where user='';
delete from mysql.user where user='';
flush privileges;
# Create some users with different hostnames
create user mysqltest_8@'';
create user mysqltest_8;
create user mysqltest_8@host8;
# Try to create them again
--error 1396
create user mysqltest_8@'';
--error 1396
create user mysqltest_8;
--error 1396
create user mysqltest_8@host8;
select user, QUOTE(host) from mysql.user where user="mysqltest_8";
--echo Schema privileges
grant select on mysqltest.* to mysqltest_8@'';
show grants for mysqltest_8@'';
grant select on mysqltest.* to mysqltest_8@;
show grants for mysqltest_8@;
grant select on mysqltest.* to mysqltest_8;
show grants for mysqltest_8;
select * from information_schema.schema_privileges
where grantee like "'mysqltest_8'%";
connect (conn3,localhost,mysqltest_8,,);
select * from t1;
disconnect conn3;
connection master;
revoke select on mysqltest.* from mysqltest_8@'';
revoke select on mysqltest.* from mysqltest_8;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.schema_privileges
where grantee like "'mysqltest_8'%";
flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8@;
grant select on mysqltest.* to mysqltest_8@'';
flush privileges;
show grants for mysqltest_8@;
revoke select on mysqltest.* from mysqltest_8@'';
flush privileges;
--echo Column privileges
grant update (a) on t1 to mysqltest_8@'';
grant update (a) on t1 to mysqltest_8;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.column_privileges;
connect (conn4,localhost,mysqltest_8,,);
select * from t1;
disconnect conn4;
connection master;
revoke update (a) on t1 from mysqltest_8@'';
revoke update (a) on t1 from mysqltest_8;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.column_privileges;
flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
--echo Table privileges
grant update on t1 to mysqltest_8@'';
grant update on t1 to mysqltest_8;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.table_privileges;
connect (conn5,localhost,mysqltest_8,,);
select * from t1;
disconnect conn5;
connection master;
revoke update on t1 from mysqltest_8@'';
revoke update on t1 from mysqltest_8;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.table_privileges;
flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
--echo "DROP USER" should clear privileges
grant all privileges on mysqltest.* to mysqltest_8@'';
grant select on mysqltest.* to mysqltest_8@'';
grant update on t1 to mysqltest_8@'';
grant update (a) on t1 to mysqltest_8@'';
grant all privileges on mysqltest.* to mysqltest_8;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.user_privileges
where grantee like "'mysqltest_8'%";
connect (conn5,localhost,mysqltest_8,,);
select * from t1;
disconnect conn5;
connection master;
flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
drop user mysqltest_8@'';
--error 1141
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.user_privileges
where grantee like "'mysqltest_8'%";
drop user mysqltest_8;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
connect (conn6,localhost,mysqltest_8,,);
connection master;
--error 1141
show grants for mysqltest_8;
drop user mysqltest_8@host8;
--error 1141
show grants for mysqltest_8@host8;
# Restore the anonymous users.
insert into mysql.user select * from t2;
flush privileges;
drop table t2;
drop table t1;

View file

@ -576,28 +576,32 @@ connect (con2,localhost,user2,,mysqltest);
connect (con3,localhost,user3,,mysqltest); connect (con3,localhost,user3,,mysqltest);
connect (con4,localhost,user4,,); connect (con4,localhost,user4,,);
connection con1; connection con1;
select * from information_schema.column_privileges; select * from information_schema.column_privileges order by grantee;
select * from information_schema.table_privileges; select * from information_schema.table_privileges order by grantee;
select * from information_schema.schema_privileges; select * from information_schema.schema_privileges order by grantee;
select * from information_schema.user_privileges; select * from information_schema.user_privileges order by grantee;
show grants; show grants;
connection con2; connection con2;
select * from information_schema.column_privileges; select * from information_schema.column_privileges order by grantee;
select * from information_schema.table_privileges; select * from information_schema.table_privileges order by grantee;
select * from information_schema.schema_privileges; select * from information_schema.schema_privileges order by grantee;
select * from information_schema.user_privileges; select * from information_schema.user_privileges order by grantee;
show grants; show grants;
connection con3; connection con3;
select * from information_schema.column_privileges; select * from information_schema.column_privileges order by grantee;
select * from information_schema.table_privileges; select * from information_schema.table_privileges order by grantee;
select * from information_schema.schema_privileges; select * from information_schema.schema_privileges order by grantee;
select * from information_schema.user_privileges; select * from information_schema.user_privileges order by grantee;
show grants; show grants;
connection con4; connection con4;
select * from information_schema.column_privileges where grantee like '%user%'; select * from information_schema.column_privileges where grantee like '%user%'
select * from information_schema.table_privileges where grantee like '%user%'; order by grantee;
select * from information_schema.schema_privileges where grantee like '%user%'; select * from information_schema.table_privileges where grantee like '%user%'
select * from information_schema.user_privileges where grantee like '%user%'; order by grantee;
select * from information_schema.schema_privileges where grantee like '%user%'
order by grantee;
select * from information_schema.user_privileges where grantee like '%user%'
order by grantee;
show grants; show grants;
connection default; connection default;
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
@ -838,3 +842,13 @@ connection default;
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
#
# Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
#
set @a:= '.';
create table t1(f1 char(5));
create table t2(f1 char(5));
select concat(@a, table_name), @a, table_name
from information_schema.tables where table_schema = 'test';
drop table t1,t2;

View file

@ -139,3 +139,14 @@ select t1Aa.col1 from t1aA,t2Aa where t1Aa.col1 = t2aA.col1;
drop table t2aA, t1Aa; drop table t2aA, t1Aa;
# End of 4.1 tests # End of 4.1 tests
#
# Bug#17661 information_schema.SCHEMATA returns uppercase with lower_case_table_names = 1
#
create database mysqltest_LC2;
use mysqltest_LC2;
create table myUC (i int);
select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
where TABLE_SCHEMA ='mysqltest_LC2';
use test;
drop database mysqltest_LC2;

View file

@ -1296,9 +1296,9 @@ explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
# The next should give an error # The next should give an error
# #
-- error 1072 -- error 1176
explain select fld3 from t2 ignore index (fld3,not_used); explain select fld3 from t2 ignore index (fld3,not_used);
-- error 1072 -- error 1176
explain select fld3 from t2 use index (not_used); explain select fld3 from t2 use index (not_used);
# #
@ -2264,6 +2264,21 @@ insert into t2 values(1,1);
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2)); select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
drop table t1,t2; drop table t1,t2;
#
# Bug #17873: confusing error message when IGNORE INDEX refers a column name
#
CREATE TABLE t1 (a int, INDEX idx(a));
INSERT INTO t1 VALUES (2), (3), (1);
EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
--error 1176
EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
--error 1176
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
# #

View file

@ -516,7 +516,7 @@ drop table t1;
# #
create table t1 (a int, b int); create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a; create view v1 as select a, sum(b) from t1 group by a;
-- error 1072 -- error 1176
select b from v1 use index (some_index) where b=1; select b from v1 use index (some_index) where b=1;
drop view v1; drop view v1;
drop table t1; drop table t1;

View file

@ -40,14 +40,14 @@ my_string fn_ext(const char *name)
DBUG_ENTER("fn_ext"); DBUG_ENTER("fn_ext");
DBUG_PRINT("mfunkt",("name: '%s'",name)); DBUG_PRINT("mfunkt",("name: '%s'",name));
#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) #if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL)
{ {
char buff[FN_REFLEN]; char buff[FN_REFLEN];
gpos=(my_string) name+dirname_part(buff,(char*) name); gpos=(my_string) name+dirname_part(buff,(char*) name);
} }
#else #else
if (!(gpos=strrchr(name,FNLIBCHAR))) if (!(gpos= strrchr(name, FN_LIBCHAR)))
gpos=name; gpos= (my_string) name;
#endif #endif
pos=strchr(gpos,FN_EXTCHAR); pos=strchr(gpos,FN_EXTCHAR);
DBUG_RETURN (pos ? pos : strend(gpos)); DBUG_RETURN (pos ? pos : strend(gpos));

View file

@ -45,9 +45,11 @@ fi
mkdir -p $BASE/lib mkdir -p $BASE/lib
for i in \ for i in \
libmysql/.libs/libmysqlclient.s{l,o}* \ libmysql/.libs/libmysqlclient.so* \
libmysql/.libs/libmysqlclient.sl* \
libmysql/.libs/libmysqlclient*.dylib \ libmysql/.libs/libmysqlclient*.dylib \
libmysql_r/.libs/libmysqlclient_r.s{l,o}* \ libmysql_r/.libs/libmysqlclient_r.so* \
libmysql_r/.libs/libmysqlclient_r.sl* \
libmysql_r/.libs/libmysqlclient_r*.dylib libmysql_r/.libs/libmysqlclient_r*.dylib
do do
if [ -f $i ] if [ -f $i ]

View file

@ -345,6 +345,7 @@ mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp
find $BASE \( -name "*.cnf" -o -name "*.ini" \ find $BASE \( -name "*.cnf" -o -name "*.ini" \
-o -name COPYING -o -name ChangeLog -o -name EXCEPTIONS-CLIENT \ -o -name COPYING -o -name ChangeLog -o -name EXCEPTIONS-CLIENT \
-o -name "INSTALL*" -o -name LICENSE -o -name "README*" \ -o -name "INSTALL*" -o -name LICENSE -o -name "README*" \
-o -name "*.dsp" -o -name "*.dsw" \
-o -name "*.vcproj" -o -name "*.sln" \) -type f -print \ -o -name "*.vcproj" -o -name "*.sln" \) -type f -print \
| while read v | while read v
do do

View file

@ -674,6 +674,7 @@ public:
str->charset(), conv_charset, &errors)) str->charset(), conv_charset, &errors))
null_value= 1; null_value= 1;
use_cached_value= 1; use_cached_value= 1;
str_value.mark_as_const();
safe= (errors == 0); safe= (errors == 0);
} }
else else

View file

@ -991,7 +991,11 @@ static void __cdecl kill_server(int sig_ptr)
my_thread_init(); // If this is a new thread my_thread_init(); // If this is a new thread
#endif #endif
close_connections(); close_connections();
if (sig != MYSQL_KILL_SIGNAL && sig != 0) if (sig != MYSQL_KILL_SIGNAL &&
#ifdef __WIN__
sig != SIGINT && /* Bug#18235 */
#endif
sig != 0)
unireg_abort(1); /* purecov: inspected */ unireg_abort(1); /* purecov: inspected */
else else
unireg_end(); unireg_end();
@ -4598,6 +4602,7 @@ enum options_mysqld
OPT_INNODB_FILE_IO_THREADS, OPT_INNODB_FILE_IO_THREADS,
OPT_INNODB_LOCK_WAIT_TIMEOUT, OPT_INNODB_LOCK_WAIT_TIMEOUT,
OPT_INNODB_THREAD_CONCURRENCY, OPT_INNODB_THREAD_CONCURRENCY,
OPT_INNODB_COMMIT_CONCURRENCY,
OPT_INNODB_FORCE_RECOVERY, OPT_INNODB_FORCE_RECOVERY,
OPT_INNODB_STATUS_FILE, OPT_INNODB_STATUS_FILE,
OPT_INNODB_MAX_DIRTY_PAGES_PCT, OPT_INNODB_MAX_DIRTY_PAGES_PCT,
@ -5540,7 +5545,7 @@ log and this option does nothing anymore.",
(gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0, (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0,
GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0, GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
1024*1024L, 0}, 1024*1024L, 0},
{"innodb_commit_concurrency", OPT_INNODB_THREAD_CONCURRENCY, {"innodb_commit_concurrency", OPT_INNODB_COMMIT_CONCURRENCY,
"Helps in performance tuning in heavily concurrent environments.", "Helps in performance tuning in heavily concurrent environments.",
(gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency,
0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0}, 0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},

View file

@ -227,7 +227,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
"case that has been forced to lowercase because " "case that has been forced to lowercase because "
"lower_case_table_names is set. It will not be " "lower_case_table_names is set. It will not be "
"possible to remove this privilege using REVOKE.", "possible to remove this privilege using REVOKE.",
host.host.hostname, host.db); host.host.hostname ? host.host.hostname : "",
host.db ? host.db : "");
} }
host.access= get_access(table,2); host.access= get_access(table,2);
host.access= fix_rights_for_db(host.access); host.access= fix_rights_for_db(host.access);
@ -236,7 +237,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
{ {
sql_print_warning("'host' entry '%s|%s' " sql_print_warning("'host' entry '%s|%s' "
"ignored in --skip-name-resolve mode.", "ignored in --skip-name-resolve mode.",
host.host.hostname, host.db?host.db:""); host.host.hostname ? host.host.hostname : "",
host.db ? host.db : "");
continue; continue;
} }
#ifndef TO_BE_REMOVED #ifndef TO_BE_REMOVED
@ -306,7 +308,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
{ {
sql_print_warning("'user' entry '%s@%s' " sql_print_warning("'user' entry '%s@%s' "
"ignored in --skip-name-resolve mode.", "ignored in --skip-name-resolve mode.",
user.user, user.host.hostname); user.user ? user.user : "",
user.host.hostname ? user.host.hostname : "");
continue; continue;
} }
@ -415,8 +418,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
#endif #endif
} }
VOID(push_dynamic(&acl_users,(gptr) &user)); VOID(push_dynamic(&acl_users,(gptr) &user));
if (!user.host.hostname || user.host.hostname[0] == wild_many && if (!user.host.hostname ||
!user.host.hostname[1]) (user.host.hostname[0] == wild_many && !user.host.hostname[1]))
allow_all_hosts=1; // Anyone can connect allow_all_hosts=1; // Anyone can connect
} }
} }
@ -442,7 +445,9 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
{ {
sql_print_warning("'db' entry '%s %s@%s' " sql_print_warning("'db' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.", "ignored in --skip-name-resolve mode.",
db.db, db.user, db.host.hostname); db.db,
db.user ? db.user : "",
db.host.hostname ? db.host.hostname : "");
continue; continue;
} }
db.access=get_access(table,3); db.access=get_access(table,3);
@ -461,7 +466,9 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
"case that has been forced to lowercase because " "case that has been forced to lowercase because "
"lower_case_table_names is set. It will not be " "lower_case_table_names is set. It will not be "
"possible to remove this privilege using REVOKE.", "possible to remove this privilege using REVOKE.",
db.db, db.user, db.host.hostname, db.host.hostname); db.db,
db.user ? db.user : "",
db.host.hostname ? db.host.hostname : "");
} }
} }
db.sort=get_sort(3,db.host.hostname,db.db,db.user); db.sort=get_sort(3,db.host.hostname,db.db,db.user);
@ -1035,8 +1042,7 @@ static void acl_update_user(const char *user, const char *host,
{ {
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*); ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
if (!acl_user->user && !user[0] || if (!acl_user->user && !user[0] ||
acl_user->user && acl_user->user && !strcmp(user,acl_user->user))
!strcmp(user,acl_user->user))
{ {
if (!acl_user->host.hostname && !host[0] || if (!acl_user->host.hostname && !host[0] ||
acl_user->host.hostname && acl_user->host.hostname &&
@ -1099,8 +1105,8 @@ static void acl_insert_user(const char *user, const char *host,
set_user_salt(&acl_user, password, password_len); set_user_salt(&acl_user, password, password_len);
VOID(push_dynamic(&acl_users,(gptr) &acl_user)); VOID(push_dynamic(&acl_users,(gptr) &acl_user));
if (!acl_user.host.hostname || acl_user.host.hostname[0] == wild_many if (!acl_user.host.hostname ||
&& !acl_user.host.hostname[1]) (acl_user.host.hostname[0] == wild_many && !acl_user.host.hostname[1]))
allow_all_hosts=1; // Anyone can connect /* purecov: tested */ allow_all_hosts=1; // Anyone can connect /* purecov: tested */
qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements, qsort((gptr) dynamic_element(&acl_users,0,ACL_USER*),acl_users.elements,
sizeof(ACL_USER),(qsort_cmp) acl_compare); sizeof(ACL_USER),(qsort_cmp) acl_compare);
@ -1160,7 +1166,7 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
ACL_DB acl_db; ACL_DB acl_db;
safe_mutex_assert_owner(&acl_cache->lock); safe_mutex_assert_owner(&acl_cache->lock);
acl_db.user=strdup_root(&mem,user); acl_db.user=strdup_root(&mem,user);
update_hostname(&acl_db.host,strdup_root(&mem,host)); update_hostname(&acl_db.host, *host ? strdup_root(&mem,host) : 0);
acl_db.db=strdup_root(&mem,db); acl_db.db=strdup_root(&mem,db);
acl_db.access=privileges; acl_db.access=privileges;
acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user); acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user);
@ -1548,11 +1554,10 @@ find_acl_user(const char *host, const char *user, my_bool exact)
{ {
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*); ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
DBUG_PRINT("info",("strcmp('%s','%s'), compare_hostname('%s','%s'),", DBUG_PRINT("info",("strcmp('%s','%s'), compare_hostname('%s','%s'),",
user, user, acl_user->user ? acl_user->user : "",
acl_user->user ? acl_user->user : "", host,
host, acl_user->host.hostname ? acl_user->host.hostname :
acl_user->host.hostname ? acl_user->host.hostname : ""));
""));
if (!acl_user->user && !user[0] || if (!acl_user->user && !user[0] ||
acl_user->user && !strcmp(user,acl_user->user)) acl_user->user && !strcmp(user,acl_user->user))
{ {
@ -1602,7 +1607,7 @@ static const char *calc_ip(const char *ip, long *val, char end)
static void update_hostname(acl_host_and_ip *host, const char *hostname) static void update_hostname(acl_host_and_ip *host, const char *hostname)
{ {
host->hostname=(char*) hostname; // This will not be modified! host->hostname=(char*) hostname; // This will not be modified!
if (!hostname || if (!hostname ||
(!(hostname=calc_ip(hostname,&host->ip,'/')) || (!(hostname=calc_ip(hostname,&host->ip,'/')) ||
!(hostname=calc_ip(hostname+1,&host->ip_mask,'\0')))) !(hostname=calc_ip(hostname+1,&host->ip_mask,'\0'))))
@ -1622,8 +1627,8 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname,
} }
return (!host->hostname || return (!host->hostname ||
(hostname && !wild_case_compare(system_charset_info, (hostname && !wild_case_compare(system_charset_info,
hostname,host->hostname)) || hostname, host->hostname)) ||
(ip && !wild_compare(ip,host->hostname,0))); (ip && !wild_compare(ip, host->hostname, 0)));
} }
bool hostname_requires_resolving(const char *hostname) bool hostname_requires_resolving(const char *hostname)
@ -2270,7 +2275,8 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
{ {
if (exact) if (exact)
{ {
if ((host && if (!grant_name->host.hostname ||
(host &&
!my_strcasecmp(system_charset_info, host, !my_strcasecmp(system_charset_info, host,
grant_name->host.hostname)) || grant_name->host.hostname)) ||
(ip && !strcmp(ip, grant_name->host.hostname))) (ip && !strcmp(ip, grant_name->host.hostname)))
@ -3369,8 +3375,10 @@ static my_bool grant_load(TABLE_LIST *tables)
{ {
sql_print_warning("'tables_priv' entry '%s %s@%s' " sql_print_warning("'tables_priv' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.", "ignored in --skip-name-resolve mode.",
mem_check->tname, mem_check->user, mem_check->tname,
mem_check->host, mem_check->host); mem_check->user ? mem_check->user : "",
mem_check->host.hostname ?
mem_check->host.hostname : "");
continue; continue;
} }
} }
@ -3408,7 +3416,8 @@ static my_bool grant_load(TABLE_LIST *tables)
sql_print_warning("'procs_priv' entry '%s %s@%s' " sql_print_warning("'procs_priv' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.", "ignored in --skip-name-resolve mode.",
mem_check->tname, mem_check->user, mem_check->tname, mem_check->user,
mem_check->host); mem_check->host.hostname ?
mem_check->host.hostname : "");
continue; continue;
} }
} }
@ -4120,11 +4129,6 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (!lex_user->host.str)
{
lex_user->host.str= (char*) "%";
lex_user->host.length=1;
}
if (lex_user->host.length > HOSTNAME_LENGTH || if (lex_user->host.length > HOSTNAME_LENGTH ||
lex_user->user.length > USERNAME_LENGTH) lex_user->user.length > USERNAME_LENGTH)
{ {
@ -4334,16 +4338,17 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
/* Add table & column access */ /* Add table & column access */
for (index=0 ; index < column_priv_hash.records ; index++) for (index=0 ; index < column_priv_hash.records ; index++)
{ {
const char *user; const char *user, *host;
GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
index); index);
if (!(user=grant_table->user)) if (!(user=grant_table->user))
user= ""; user= "";
if (!(host= grant_table->host.hostname))
host= "";
if (!strcmp(lex_user->user.str,user) && if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(system_charset_info, lex_user->host.str, !my_strcasecmp(system_charset_info, lex_user->host.str, host))
grant_table->host.hostname))
{ {
ulong table_access= grant_table->privs; ulong table_access= grant_table->privs;
if ((table_access | grant_table->cols) != 0) if ((table_access | grant_table->cols) != 0)
@ -4470,15 +4475,16 @@ static int show_routine_grants(THD* thd, LEX_USER *lex_user, HASH *hash,
/* Add routine access */ /* Add routine access */
for (index=0 ; index < hash->records ; index++) for (index=0 ; index < hash->records ; index++)
{ {
const char *user; const char *user, *host;
GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, index); GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, index);
if (!(user=grant_proc->user)) if (!(user=grant_proc->user))
user= ""; user= "";
if (!(host= grant_proc->host.hostname))
host= "";
if (!strcmp(lex_user->user.str,user) && if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(system_charset_info, lex_user->host.str, !my_strcasecmp(system_charset_info, lex_user->host.str, host))
grant_proc->host.hostname))
{ {
ulong proc_access= grant_proc->privs; ulong proc_access= grant_proc->privs;
if (proc_access != 0) if (proc_access != 0)
@ -4930,39 +4936,37 @@ static int handle_grant_struct(uint struct_no, bool drop,
{ {
/* /*
Get a pointer to the element. Get a pointer to the element.
Unfortunaltely, the host default differs for the structures.
*/ */
switch (struct_no) { switch (struct_no) {
case 0: case 0:
acl_user= dynamic_element(&acl_users, idx, ACL_USER*); acl_user= dynamic_element(&acl_users, idx, ACL_USER*);
user= acl_user->user; user= acl_user->user;
if (!(host= acl_user->host.hostname)) host= acl_user->host.hostname;
host= "%"; break;
break;
case 1: case 1:
acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*); acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
user= acl_db->user; user= acl_db->user;
if (!(host= acl_db->host.hostname)) host= acl_db->host.hostname;
host= "%";
break; break;
case 2: case 2:
grant_name= (GRANT_NAME*) hash_element(&column_priv_hash, idx); grant_name= (GRANT_NAME*) hash_element(&column_priv_hash, idx);
user= grant_name->user; user= grant_name->user;
if (!(host= grant_name->host.hostname)) host= grant_name->host.hostname;
host= "%";
break; break;
case 3: case 3:
grant_name= (GRANT_NAME*) hash_element(&proc_priv_hash, idx); grant_name= (GRANT_NAME*) hash_element(&proc_priv_hash, idx);
user= grant_name->user; user= grant_name->user;
if (!(host= grant_name->host.hostname)) host= grant_name->host.hostname;
host= "%";
break; break;
} }
if (! user) if (! user)
user= ""; user= "";
if (! host)
host= "";
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'", DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'",
struct_no, idx, user, host)); struct_no, idx, user, host));
@ -5547,8 +5551,10 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
LEX_USER lex_user; LEX_USER lex_user;
lex_user.user.str= grant_proc->user; lex_user.user.str= grant_proc->user;
lex_user.user.length= strlen(grant_proc->user); lex_user.user.length= strlen(grant_proc->user);
lex_user.host.str= grant_proc->host.hostname; lex_user.host.str= grant_proc->host.hostname ?
lex_user.host.length= strlen(grant_proc->host.hostname); grant_proc->host.hostname : (char*)"";
lex_user.host.length= grant_proc->host.hostname ?
strlen(grant_proc->host.hostname) : 0;
if (!replace_routine_table(thd,grant_proc,tables[4].table,lex_user, if (!replace_routine_table(thd,grant_proc,tables[4].table,lex_user,
grant_proc->db, grant_proc->tname, grant_proc->db, grant_proc->tname,
is_proc, ~(ulong)0, 1)) is_proc, ~(ulong)0, 1))
@ -5855,16 +5861,17 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
for (index=0 ; index < column_priv_hash.records ; index++) for (index=0 ; index < column_priv_hash.records ; index++)
{ {
const char *user, *is_grantable= "YES"; const char *user, *host, *is_grantable= "YES";
GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
index); index);
if (!(user=grant_table->user)) if (!(user=grant_table->user))
user= ""; user= "";
if (!(host= grant_table->host.hostname))
host= "";
if (no_global_access && if (no_global_access &&
(strcmp(thd->security_ctx->priv_user, user) || (strcmp(thd->security_ctx->priv_user, user) ||
my_strcasecmp(system_charset_info, curr_host, my_strcasecmp(system_charset_info, curr_host, host)))
grant_table->host.hostname)))
continue; continue;
ulong table_access= grant_table->privs; ulong table_access= grant_table->privs;
@ -5880,7 +5887,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(table_access & GRANT_ACL)) if (!(table_access & GRANT_ACL))
is_grantable= "NO"; is_grantable= "NO";
strxmov(buff,"'",user,"'@'",grant_table->host.hostname,"'",NullS); strxmov(buff, "'", user, "'@'", host, "'", NullS);
if (!test_access) if (!test_access)
update_schema_privilege(table, buff, grant_table->db, grant_table->tname, update_schema_privilege(table, buff, grant_table->db, grant_table->tname,
0, 0, STRING_WITH_LEN("USAGE"), is_grantable); 0, 0, STRING_WITH_LEN("USAGE"), is_grantable);
@ -5922,16 +5929,17 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
for (index=0 ; index < column_priv_hash.records ; index++) for (index=0 ; index < column_priv_hash.records ; index++)
{ {
const char *user, *is_grantable= "YES"; const char *user, *host, *is_grantable= "YES";
GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
index); index);
if (!(user=grant_table->user)) if (!(user=grant_table->user))
user= ""; user= "";
if (!(host= grant_table->host.hostname))
host= "";
if (no_global_access && if (no_global_access &&
(strcmp(thd->security_ctx->priv_user, user) || (strcmp(thd->security_ctx->priv_user, user) ||
my_strcasecmp(system_charset_info, curr_host, my_strcasecmp(system_charset_info, curr_host, host)))
grant_table->host.hostname)))
continue; continue;
ulong table_access= grant_table->cols; ulong table_access= grant_table->cols;
@ -5941,7 +5949,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
is_grantable= "NO"; is_grantable= "NO";
ulong test_access= table_access & ~GRANT_ACL; ulong test_access= table_access & ~GRANT_ACL;
strxmov(buff,"'",user,"'@'",grant_table->host.hostname,"'",NullS); strxmov(buff, "'", user, "'@'", host, "'", NullS);
if (!test_access) if (!test_access)
continue; continue;
else else

View file

@ -4441,6 +4441,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
table_list= table_list->next_leaf, tablenr++) table_list= table_list->next_leaf, tablenr++)
{ {
TABLE *table= table_list->table; TABLE *table= table_list->table;
table->pos_in_table_list= table_list;
if (first_select_table && if (first_select_table &&
table_list->top_table() == first_select_table) table_list->top_table() == first_select_table)
{ {
@ -4584,8 +4585,8 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table,
name->length(), 1)) <= name->length(), 1)) <=
0) 0)
{ {
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(), my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), name->c_ptr(),
table->s->table_name); table->pos_in_table_list->alias);
map->set_all(); map->set_all();
return 1; return 1;
} }

View file

@ -1992,13 +1992,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#else #else
char *buff= thd->net.last_error; char *buff= thd->net.last_error;
#endif #endif
STATUS_VAR current_global_status_var;
calc_sum_of_all_status(&current_global_status_var);
ulong uptime = (ulong) (thd->start_time - start_time); ulong uptime = (ulong) (thd->start_time - start_time);
sprintf((char*) buff, sprintf((char*) buff,
"Uptime: %lu Threads: %d Questions: %lu Slow queries: %lu Opens: %lu Flush tables: %lu Open tables: %u Queries per second avg: %.3f", "Uptime: %lu Threads: %d Questions: %lu Slow queries: %lu Opens: %lu Flush tables: %lu Open tables: %u Queries per second avg: %.3f",
uptime, uptime,
(int) thread_count, (ulong) thd->query_id, (int) thread_count, (ulong) thd->query_id,
(ulong) thd->status_var.long_query_count, current_global_status_var.long_query_count,
thd->status_var.opened_tables, refresh_version, cached_tables(), current_global_status_var.opened_tables, refresh_version, cached_tables(),
(uptime ? (ulonglong2double(thd->query_id) / (double) uptime) : (uptime ? (ulonglong2double(thd->query_id) / (double) uptime) :
(double) 0)); (double) 0));
#ifdef SAFEMALLOC #ifdef SAFEMALLOC

View file

@ -2070,7 +2070,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
ST_SCHEMA_TABLE *schema_table= tables->schema_table; ST_SCHEMA_TABLE *schema_table= tables->schema_table;
SELECT_LEX sel; SELECT_LEX sel;
INDEX_FIELD_VALUES idx_field_vals; INDEX_FIELD_VALUES idx_field_vals;
char path[FN_REFLEN], *end, *base_name, *file_name; char path[FN_REFLEN], *end, *base_name, *orig_base_name, *file_name;
uint len; uint len;
bool with_i_schema; bool with_i_schema;
enum enum_schema_tables schema_table_idx; enum enum_schema_tables schema_table_idx;
@ -2150,7 +2150,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
partial_cond= make_cond_for_info_schema(cond, tables); partial_cond= make_cond_for_info_schema(cond, tables);
it.rewind(); /* To get access to new elements in basis list */ it.rewind(); /* To get access to new elements in basis list */
while ((base_name= it++) || while ((orig_base_name= base_name= it++) ||
/* /*
generate error for non existing database. generate error for non existing database.
(to save old behaviour for SHOW TABLES FROM db) (to save old behaviour for SHOW TABLES FROM db)
@ -2181,6 +2181,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (mysql_find_files(thd, &files, base_name, if (mysql_find_files(thd, &files, base_name,
path, idx_field_vals.table_value, 0)) path, idx_field_vals.table_value, 0))
goto err; goto err;
if (lower_case_table_names)
orig_base_name= thd->strdup(base_name);
} }
List_iterator_fast<char> it_files(files); List_iterator_fast<char> it_files(files);
@ -2249,7 +2251,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
in this case. in this case.
*/ */
res= schema_table->process_table(thd, show_table_list, table, res= schema_table->process_table(thd, show_table_list, table,
res, base_name, res, orig_base_name,
show_table_list->alias); show_table_list->alias);
close_tables_for_reopen(thd, &show_table_list); close_tables_for_reopen(thd, &show_table_list);
DBUG_ASSERT(!lex->query_tables_own_last); DBUG_ASSERT(!lex->query_tables_own_last);

View file

@ -1614,6 +1614,10 @@ bool check_db_name(char *name)
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR || if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR) *name == FN_EXTCHAR)
return 1; return 1;
#ifdef FN_DEVCHAR
if (*name == FN_DEVCHAR)
return 1;
#endif
name++; name++;
} }
return last_char_is_space || (uint) (name - start) > NAME_LEN; return last_char_is_space || (uint) (name - start) > NAME_LEN;
@ -1656,6 +1660,10 @@ bool check_table_name(const char *name, uint length)
#endif #endif
if (*name == '/' || *name == '\\' || *name == FN_EXTCHAR) if (*name == '/' || *name == '\\' || *name == FN_EXTCHAR)
return 1; return 1;
#ifdef FN_DEVCHAR
if (*name == FN_DEVCHAR)
return 1;
#endif
name++; name++;
} }
#if defined(USE_MB) && defined(USE_MB_IDENT) #if defined(USE_MB) && defined(USE_MB_IDENT)