Commit c198ce2a authored by lars@mysql.com's avatar lars@mysql.com

Merge mysql.com:/home/bk/mysql-5.0 into mysql.com:/home/bk/mysql-5.1

parents 4634b7c7 df12e299
......@@ -49,6 +49,7 @@ dlenev@jabberwock.localdomain
dlenev@mysql.com
ejonore@mc03.ndb.mysql.com
gbichot@quadita2.mysql.com
gbichot@quadxeon.mysql.com
georg@beethoven.local
georg@beethoven.site
georg@lmy002.wdf.sap.corp
......
......@@ -36,7 +36,9 @@ extern dtype_t* dtype_binary;
#define DATA_BLOB 5 /* binary large object, or a TEXT type;
if prtype & DATA_BINARY_TYPE == 0, then this is
actually a TEXT column (or a BLOB created
with < 4.0.14) */
with < 4.0.14; since column prefix indexes
came only in 4.0.14, the missing flag in BLOBs
created before that does not cause any harm) */
#define DATA_INT 6 /* integer: can be any size 1 - 8 bytes */
#define DATA_SYS_CHILD 7 /* address of the child page in node pointer */
#define DATA_SYS 8 /* system column */
......
......@@ -195,10 +195,12 @@ dtype_get_pad_char(
|| type->mtype == DATA_BINARY
|| type->mtype == DATA_FIXBINARY
|| type->mtype == DATA_MYSQL
|| type->mtype == DATA_VARMYSQL) {
|| type->mtype == DATA_VARMYSQL
|| (type->mtype == DATA_BLOB
&& (type->prtype & DATA_BINARY_TYPE) == 0)) {
/* Space is the padding character for all char and binary
strings */
strings, and starting from 5.0.3, also for TEXT strings. */
return((ulint)' ');
}
......
......@@ -145,7 +145,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -30,7 +30,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -44,7 +44,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -110,7 +110,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -194,7 +194,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -219,7 +219,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -74,7 +74,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
......
......@@ -76,7 +76,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -263,7 +263,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -9,7 +9,7 @@ In most cases, you can run the executable from the command line with a "--help"
argument to display a brief summary of the executable's arguments and function.
For more information about MySQL, please refer to the MySQL reference manual,
which may already be installed locally and which is also available online at
http://dev.mysql.com/doc/
http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.\" end of man page
......@@ -83,7 +83,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -43,7 +43,7 @@ replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -57,7 +57,7 @@ perror(1),
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
is also available online at http://www.mysql.com/doc/en/
is also available online at http://dev.mysql.com/doc/mysql/en
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
.SH AUTHOR
......
......@@ -1535,12 +1535,12 @@ run_testcase ()
return
fi
if [ -f "$TESTDIR/$tname.disabled" ]
then
comment=`$CAT $TESTDIR/$tname.disabled`;
disable_test $tname "$comment"
return
fi
# if [ -f "$TESTDIR/$tname.disabled" ]
# then
# comment=`$CAT $TESTDIR/$tname.disabled`;
# disable_test $tname "$comment"
# return
# fi
if [ -f "$TESTDIR/disabled.def" ] ; then
comment=`$GREP "^$tname *: *" $TESTDIR/disabled.def`;
if [ -n "$comment" ]
......
......@@ -201,10 +201,12 @@ teststring
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
text1 length(text1)
teststring 11
teststring 10
teststring 11
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
text1 length(text1)
teststring 11
teststring 10
teststring 11
select concat('|', text1, '|') from t1 order by text1;
concat('|', text1, '|')
......
......@@ -888,3 +888,62 @@ SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
2
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, c int);
INSERT INTO t1 (a, b, c) VALUES
(1,1,1), (1,1,2), (1,1,3),
(1,2,1), (1,2,2), (1,2,3),
(1,3,1), (1,3,2), (1,3,3),
(2,1,1), (2,1,2), (2,1,3),
(2,2,1), (2,2,2), (2,2,3),
(2,3,1), (2,3,2), (2,3,3),
(3,1,1), (3,1,2), (3,1,3),
(3,2,1), (3,2,2), (3,2,3),
(3,3,1), (3,3,2), (3,3,3);
SELECT b/c as v, a FROM t1 ORDER BY v;
v a
0.33333 3
0.33333 1
0.33333 2
0.50000 1
0.50000 2
0.50000 3
0.66667 2
0.66667 1
0.66667 3
1.00000 3
1.00000 2
1.00000 3
1.00000 1
1.00000 2
1.00000 3
1.00000 2
1.00000 1
1.00000 1
1.50000 3
1.50000 2
1.50000 1
2.00000 1
2.00000 3
2.00000 2
3.00000 3
3.00000 2
3.00000 1
SELECT b/c as v, SUM(a) FROM t1 GROUP BY v;
v SUM(a)
0.33333 6
0.50000 6
0.66667 6
1.00000 18
1.50000 6
2.00000 6
3.00000 6
SELECT SUM(a) FROM t1 GROUP BY b/c;
SUM(a)
6
6
6
18
6
6
6
DROP TABLE t1;
......@@ -5,6 +5,23 @@ delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option;
create user mysqltest_2@localhost;
grant select on `my\_1`.* to mysqltest_2@localhost;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
ERROR 42000: You must have privileges to update tables in the mysql database to be able to change passwords for others
grant update on mysql.* to mysqltest_1@localhost;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
grant select on `my\_1`.* to mysqltest_3@localhost;
ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users
grant insert on mysql.* to mysqltest_1@localhost;
grant select on `my\_1`.* to mysqltest_3@localhost;
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass';
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
select current_user();
current_user()
......@@ -13,6 +30,7 @@ select current_user;
current_user
mysqltest_1@localhost
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%'
set @@sql_mode='NO_AUTO_CREATE_USER';
......@@ -23,15 +41,13 @@ grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `my\_%`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
show grants for mysqltest_2@localhost;
Grants for mysqltest_2@localhost
GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
GRANT ALL PRIVILEGES ON `my\_1`.* TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
ERROR 42000: There is no such grant defined for user 'mysqltest_2' on host 'localhost'
show grants for mysqltest_3@localhost;
ERROR 42000: There is no such grant defined for user 'mysqltest_3' on host 'localhost'
delete from mysql.user where user like 'mysqltest\_%';
......@@ -61,9 +77,9 @@ flush privileges;
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
grant select (a,b) on t1 to mysqltest_2@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users
grant select on t1 to mysqltest_3@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
......
......@@ -379,3 +379,16 @@ a sum(b)
4 4
NULL 14
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES
(1,4),
(2,2), (2,2),
(4,1), (4,1), (4,1), (4,1),
(2,1), (2,1);
SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
a SUM(b)
1 4
SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
a SUM(b)
1 4
DROP TABLE t1;
......@@ -2777,4 +2777,23 @@ a
3.2000
drop procedure bug8937|
delete from t1|
drop procedure if exists bug6600|
drop table if exists t3|
drop view if exists v1|
create table t3 (s1 decimal(31,30))|
create view v1 as select * from t3|
create procedure bug6600()
check table v1|
call bug6600()|
Table Op Msg_type Msg_text
test.v1 check status OK
call bug6600()|
Table Op Msg_type Msg_text
test.v1 check status OK
call bug6600()|
Table Op Msg_type Msg_text
test.v1 check status OK
drop procedure bug6600|
drop view v1|
drop table t3|
drop table t1,t2;
drop procedure if exists sp1;
drop procedure if exists bug8850|
create table t1 (a int) engine=innodb|
create procedure sp1 ()
create procedure bug8850()
begin
truncate table t1; insert t1 values (1); rollback;
end|
set autocommit=0;
insert t1 values (2);
call sp1();
set autocommit=0|
insert t1 values (2)|
call bug8850()|
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
commit;
select * from t1;
commit|
select * from t1|
a
2
call sp1();
call bug8850()|
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
set autocommit=1;
select * from t1;
set autocommit=1|
select * from t1|
a
2
drop table t1;
drop procedure sp1;
drop table t1|
drop procedure bug8850|
......@@ -601,3 +601,26 @@ INSERT INTO t1 (a) VALUES ("A"), ("a"), ("a "), ("a "),
("B"), ("b"), ("b "), ("b ");
SELECT COUNT(DISTINCT a) FROM t1;
DROP TABLE t1;
#
# Test for buf #9210: GROUP BY with expression if a decimal type
#
CREATE TABLE t1 (a int, b int, c int);
INSERT INTO t1 (a, b, c) VALUES
(1,1,1), (1,1,2), (1,1,3),
(1,2,1), (1,2,2), (1,2,3),
(1,3,1), (1,3,2), (1,3,3),
(2,1,1), (2,1,2), (2,1,3),
(2,2,1), (2,2,2), (2,2,3),
(2,3,1), (2,3,2), (2,3,3),
(3,1,1), (3,1,2), (3,1,3),
(3,2,1), (3,2,2), (3,2,3),
(3,3,1), (3,3,2), (3,3,3);
SELECT b/c as v, a FROM t1 ORDER BY v;
SELECT b/c as v, SUM(a) FROM t1 GROUP BY v;
SELECT SUM(a) FROM t1 GROUP BY b/c;
DROP TABLE t1;
......@@ -17,6 +17,36 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option;
create user mysqltest_2@localhost;
connect (user_a,localhost,mysqltest_1,,);
connection user_a;
grant select on `my\_1`.* to mysqltest_2@localhost;
--error 1132
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
disconnect user_a;
connection default;
grant update on mysql.* to mysqltest_1@localhost;
connect (user_b,localhost,mysqltest_1,,);
connection user_b;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
--error 1211
grant select on `my\_1`.* to mysqltest_3@localhost;
disconnect user_b;
connection default;
grant insert on mysql.* to mysqltest_1@localhost;
connect (user_c,localhost,mysqltest_1,,);
connection user_c;
grant select on `my\_1`.* to mysqltest_3@localhost;
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass';
disconnect user_c;
connection default;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
#
# wild_compare fun
#
......@@ -26,9 +56,11 @@ connect (user1,localhost,mysqltest_1,,);
connection user1;
select current_user();
select current_user;
--error 1211
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
#
# NO_AUTO_CREATE_USER mode
#
......@@ -36,12 +68,13 @@ set @@sql_mode='NO_AUTO_CREATE_USER';
select @@sql_mode;
--error 1211
grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
--error 1044
--error 1211
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
disconnect user1;
connection default;
show grants for mysqltest_1@localhost;
--error 1141
show grants for mysqltest_2@localhost;
--error 1141
show grants for mysqltest_3@localhost;
......@@ -83,9 +116,9 @@ create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect (mrugly, localhost, mysqltest_1,,mysqltest);
connection mrugly;
--error 1143
--error 1211
grant select (a,b) on t1 to mysqltest_2@localhost;
--error 1142
--error 1211
grant select on t1 to mysqltest_3@localhost;
disconnect mrugly;
......
......@@ -155,3 +155,19 @@ SELECT DISTINCT a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
DROP TABLE t1;
#
# Tests for bugs #8617: SQL_CACL_FOUND_ROWS with rollup and limit
#
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES
(1,4),
(2,2), (2,2),
(4,1), (4,1), (4,1), (4,1),
(2,1), (2,1);
SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
DROP TABLE t1;
......@@ -680,6 +680,15 @@ begin
end|
#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
#drop procedure if exists bugNNNN|
#--enable_warnings
#create procedure bugNNNN...
drop table t1|
delimiter ;|
#
# Testing stored procedures with multiple connections
# Testing stored procedures with multiple connections,
# except security/privilege tests, they go to sp-security.test
#
connect (con1root,localhost,root,,);
......@@ -52,3 +53,12 @@ connection con1root;
drop table t1;
drop procedure bug4934;
#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
#drop procedure if exists bugNNNN;
#--enable_warnings
#create procedure bugNNNN...
......@@ -4,11 +4,22 @@
# Please keep this file free of --error cases and other
# things that will not run in a single debugged mysqld
# process (e.g. master-slave things).
-- source include/have_innodb.inc
#
# Test cases for bugs are added at the end. See template there.
#
# Tests that require --error go into sp-error.test
# Tests that require inndb go into sp_trans.test
# Tests that check privilege and security issues go to sp-security.test.
# Tests that require multiple connections, except security/privilege tests,
# go to sp-thread.
use test;
# Test tables
#
# t1 and t2 are reused throughout the file, and dropped at the end.
# t3 and up are created and dropped when needed.
#
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -3387,6 +3398,37 @@ drop procedure bug8937|
delete from t1|
#
# BUG#6600: Stored procedure crash after repeated calls with check table
#
--disable_warnings
drop procedure if exists bug6600|
drop table if exists t3|
drop view if exists v1|
--enable_warnings
create table t3 (s1 decimal(31,30))|
create view v1 as select * from t3|
create procedure bug6600()
check table v1|
call bug6600()|
call bug6600()|
call bug6600()|
drop procedure bug6600|
drop view v1|
drop table t3|
#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
#drop procedure if exists bugNNNN|
#--enable_warnings
#create procedure bugNNNN...
# Add bugs above this line. Use existing tables t1 and t2 when
# practical, or create table t3, t3 etc temporarily (and drop them).
delimiter ;|
......
......@@ -4,32 +4,43 @@
-- source include/have_innodb.inc
delimiter |;
#
# BUG#8850
# BUG#8850: Truncate table in a stored procedure locks the tables
#
--disable_warnings
drop procedure if exists sp1;
drop procedure if exists bug8850|
--enable_warnings
delimiter |;
create table t1 (a int) engine=innodb|
create procedure sp1 ()
create procedure bug8850()
begin
truncate table t1; insert t1 values (1); rollback;
end|
delimiter ;|
set autocommit=0;
insert t1 values (2);
set autocommit=0|
insert t1 values (2)|
--error 1192
call sp1();
commit;
select * from t1;
call bug8850()|
commit|
select * from t1|
#
# when CALL will be fixed to not start a transaction, the error should
# go away
--error 1192
call sp1();
set autocommit=1;
select * from t1;
drop table t1;
drop procedure sp1;
call bug8850()|
set autocommit=1|
select * from t1|
drop table t1|
drop procedure bug8850|
#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
#drop procedure if exists bugNNNN|
#--enable_warnings
#create procedure bugNNNN...
delimiter ;|
......@@ -85,7 +85,7 @@ class my_decimal :public decimal
{
len= DECIMAL_BUFF_LENGTH;
buf= buffer;
#if !defined(HAVE_purify) && !defined(DBUG_OFF)
#if !defined(DBUG_OFF)
/* Set buffer to 'random' value to find wrong buffer usage */
for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
buffer[i]= i;
......
......@@ -58,6 +58,7 @@ sp_multi_results_command(enum enum_sql_command cmd)
{
switch (cmd) {
case SQLCOM_ANALYZE:
case SQLCOM_CHECK:
case SQLCOM_CHECKSUM:
case SQLCOM_HA_READ:
case SQLCOM_SHOW_BINLOGS:
......
......@@ -189,6 +189,8 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
bool mysql_procedure_grant(THD *thd, TABLE_LIST *table,
List <LEX_USER> &user_list, ulong rights,
bool revoke, bool no_error);
ACL_USER *check_acl_user(LEX_USER *user_name,
uint *acl_acl_userdx);
my_bool grant_init(THD *thd);
void grant_free(void);
void grant_reload(THD *thd);
......
......@@ -27,6 +27,7 @@
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
#ifdef HAVE_OPENSSL
/*
......@@ -3045,6 +3046,7 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */
thd->slow_command=TRUE;
res = mysql_check_table(thd, first_table, &lex->check_opt);
sp_cache_invalidate();
break;
}
case SQLCOM_ANALYZE:
......@@ -3629,18 +3631,36 @@ mysql_execute_command(THD *thd)
if (thd->user) // If not replication
{
LEX_USER *user;
uint counter;
List_iterator <LEX_USER> user_list(lex->users_list);
while ((user=user_list++))
{
if (user->password.str &&
(strcmp(thd->user, user->user.str) ||
if (strcmp(thd->user, user->user.str) ||
user->host.str &&
my_strcasecmp(system_charset_info,
user->host.str, thd->host_or_ip)))
user->host.str, thd->host_or_ip))
{
if (check_access(thd, UPDATE_ACL, "mysql", 0, 1, 0))
goto error;
break; // We are allowed to do changes
// We are trying to update another user, or create a new user
if (!check_access(thd, GRANT_ACL, "mysql", 0, 1, 1))
break; // We can update any existing, or add new users
if (!check_acl_user(user, &counter) &&
check_access(thd, INSERT_ACL, "mysql", 0, 1, 1))
{
my_error(ER_NO_PERMISSION_TO_CREATE_USER, MYF(0),
thd->user, thd->host_or_ip);
goto error; // Can't create new user, user does not exists
}
if (check_acl_user(user, &counter) &&
user->password.str &&
check_access(thd, UPDATE_ACL, "mysql", 0, 1, 1))
{
my_message(ER_PASSWORD_NOT_ALLOWED,
ER(ER_PASSWORD_NOT_ALLOWED), MYF(0));
goto error; // Can't update password, user already exists
}
}
}
}
......
......@@ -1386,7 +1386,6 @@ JOIN::exec()
{
DBUG_VOID_RETURN;
}
curr_join->group_list= 0;
}
thd->proc_info="Copying to group table";
......@@ -1407,8 +1406,10 @@ JOIN::exec()
}
}
if (curr_join->make_sum_func_list(*curr_all_fields, *curr_fields_list,
1, TRUE) ||
setup_sum_funcs(curr_join->thd, curr_join->sum_funcs) ||
1, TRUE))
DBUG_VOID_RETURN;
curr_join->group_list= 0;
if (setup_sum_funcs(curr_join->thd, curr_join->sum_funcs) ||
(tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table,
0)))
{
......@@ -11890,7 +11891,8 @@ calc_group_buffer(JOIN *join,ORDER *group)
join->group= 1;
for (; group ; group=group->next)
{
Field *field=(*group->item)->get_tmp_table_field();
Item *group_item= *group->item;
Field *field= group_item->get_tmp_table_field();
if (field)
{
if (field->type() == FIELD_TYPE_BLOB)
......@@ -11900,27 +11902,36 @@ calc_group_buffer(JOIN *join,ORDER *group)
else
key_length+= field->pack_length();
}
else if ((*group->item)->result_type() == REAL_RESULT)
key_length+=sizeof(double);
else if ((*group->item)->result_type() == INT_RESULT)
key_length+=sizeof(longlong);
else if ((*group->item)->result_type() == STRING_RESULT)
else
{
switch (group_item->result_type()) {
case REAL_RESULT:
key_length+= sizeof(double);
break;
case INT_RESULT:
key_length+= sizeof(longlong);
break;
case DECIMAL_RESULT:
key_length+= my_decimal_get_binary_size(group_item->max_length -
(group_item->decimals ? 1 : 0),
group_item->decimals);
break;
case STRING_RESULT:
/*
Group strings are taken as varstrings and require an length field.
A field is not yet created by create_tmp_field()
and the sizes should match up.
*/
key_length+= (*group->item)->max_length + HA_KEY_BLOB_LENGTH;
}
else
{
key_length+= group_item->max_length + HA_KEY_BLOB_LENGTH;
break;
default:
/* This case should never be choosen */
DBUG_ASSERT(0);
join->thd->fatal_error();
}
}
parts++;
if ((*group->item)->maybe_null)
if (group_item->maybe_null)
null_parts++;
}
join->tmp_table_param.group_length=key_length+null_parts;
......@@ -12735,7 +12746,7 @@ int JOIN::rollup_send_data(uint idx)
ref_pointer_array_size);
if ((!having || having->val_int()))
{
if (send_records < unit->select_limit_cnt &&
if (send_records < unit->select_limit_cnt && do_send_rows &&
result->send_data(rollup.fields[i]))
return 1;
send_records++;
......
......@@ -214,7 +214,6 @@ Optional MySQL server binary that supports additional features like:
- CSV Storage Engine
- Example Storage Engine
- Federated Storage Engine
- MyISAM RAID
- User Defined Functions (UDFs).
To activate this binary, just install this package in addition to
......@@ -328,7 +327,6 @@ BuildMySQL "--enable-shared \
--with-berkeley-db \
--with-innodb \
--with-ndbcluster \
--with-raid \
--with-archive \
--with-csv-storage-engine \
--with-example-storage-engine \
......@@ -694,9 +692,14 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Fri Mar 18 2005 Lenz Grimmer <lenz@mysql.com>
- Disabled RAID in the Max binares once and for all (it has finally been removed
from the source tree)
* Sun Feb 20 2005 Petr Chardin <petr@mysql.com>
- Install MySQL Instance Manager together with mysqld, toch mysqlmanager
- Install MySQL Instance Manager together with mysqld, touch mysqlmanager
password file
* Mon Feb 14 2005 Lenz Grimmer <lenz@mysql.com>
......
......@@ -2293,7 +2293,9 @@ session_id char(9) NOT NULL, \
"(\"abj\", 1, 2, 3, 2003-08-30), "
"(\"abk\", 1, 2, 3, 2003-08-30), "
"(\"abl\", 1, 2, 3, 2003-08-30), "
"(\"abq\", 1, 2, 3, 2003-08-30), "
"(\"abq\", 1, 2, 3, 2003-08-30) ");
myquery(rc);
rc= mysql_query(mysql, "INSERT INTO test_select VALUES "
"(\"abw\", 1, 2, 3, 2003-08-30), "
"(\"abe\", 1, 2, 3, 2003-08-30), "
"(\"abr\", 1, 2, 3, 2003-08-30), "
......@@ -4165,40 +4167,40 @@ static void test_prepare_ext()
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_prepare_ext");
myquery(rc);
sql= (char *)"CREATE TABLE test_prepare_ext\
(\
c1 tinyint, \
c2 smallint, \
c3 mediumint, \
c4 int, \
c5 integer, \
c6 bigint, \
c7 float, \
c8 double, \
c9 double precision, \
c10 real, \
c11 decimal(7, 4), \
c12 numeric(8, 4), \
c13 date, \
c14 datetime, \
c15 timestamp(14), \
c16 time, \
c17 year, \
c18 bit, \
c19 bool, \
c20 char, \
c21 char(10), \
c22 varchar(30), \
c23 tinyblob, \
c24 tinytext, \
c25 blob, \
c26 text, \
c27 mediumblob, \
c28 mediumtext, \
c29 longblob, \
c30 longtext, \
c31 enum('one', 'two', 'three'), \
c32 set('monday', 'tuesday', 'wednesday'))";
sql= (char *)"CREATE TABLE test_prepare_ext"
"("
" c1 tinyint,"
" c2 smallint,"
" c3 mediumint,"
" c4 int,"
" c5 integer,"
" c6 bigint,"
" c7 float,"
" c8 double,"
" c9 double precision,"
" c10 real,"
" c11 decimal(7, 4),"
" c12 numeric(8, 4),"
" c13 date,"
" c14 datetime,"
" c15 timestamp(14),"
" c16 time,"
" c17 year,"
" c18 bit,"
" c19 bool,"
" c20 char,"
" c21 char(10),"
" c22 varchar(30),"
" c23 tinyblob,"
" c24 tinytext,"
" c25 blob,"
" c26 text,"
" c27 mediumblob,"
" c28 mediumtext,"
" c29 longblob,"
" c30 longtext,"
" c31 enum('one', 'two', 'three'),"
" c32 set('monday', 'tuesday', 'wednesday'))";
rc= mysql_query(mysql, sql);
myquery(rc);
......@@ -10782,7 +10784,7 @@ static void test_view()
ulong length = 0L;
long is_null = 0L;
const char *query=
"SELECT COUNT(*) FROM v1 WHERE `SERVERNAME`=?";
"SELECT COUNT(*) FROM v1 WHERE SERVERNAME=?";
myheader("test_view");
......@@ -10791,13 +10793,38 @@ static void test_view()
rc = mysql_query(mysql, "DROP VIEW IF EXISTS v1,t1,t2,t3");
myquery(rc);
rc= mysql_query(mysql,"CREATE TABLE `t1` ( `SERVERGRP` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', `DBINSTANCE` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', PRIMARY KEY (`SERVERGRP`)) ENGINE=InnoDB DEFAULT CHARSET=latin1");
myquery(rc);
rc= mysql_query(mysql,"CREATE TABLE `t2` ( `SERVERNAME` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', `SERVERGRP` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', PRIMARY KEY (`SERVERNAME`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
rc= mysql_query(mysql,"CREATE TABLE t1 ("
" SERVERGRP varchar(20) NOT NULL default '', "
" DBINSTANCE varchar(20) NOT NULL default '', "
" PRIMARY KEY (SERVERGRP)) "
" CHARSET=latin1 collate=latin1_bin");
myquery(rc);
rc= mysql_query(mysql,"CREATE TABLE `t3` ( `SERVERGRP` varchar(20) character set latin1 collate latin1_bin NOT NULL default '', `TABNAME` varchar(30) character set latin1 collate latin1_bin NOT NULL default '', `MAPSTATE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `ACTSTATE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `LOCAL_NAME` varchar(30) character set latin1 collate latin1_bin NOT NULL default '', `CHG_DATE` varchar(8) character set latin1 collate latin1_bin NOT NULL default '00000000', `CHG_TIME` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `MXUSER` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', PRIMARY KEY (`SERVERGRP`,`TABNAME`,`MAPSTATE`,`ACTSTATE`,`LOCAL_NAME`)) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
rc= mysql_query(mysql,"CREATE TABLE t2 ("
" SERVERNAME varchar(20) NOT NULL, "
" SERVERGRP varchar(20) NOT NULL, "
" PRIMARY KEY (SERVERNAME)) "
" CHARSET=latin1 COLLATE latin1_bin");
myquery(rc);
rc= mysql_query(mysql,"CREATE VIEW v1 AS select sql_no_cache T0001.SERVERNAME AS `SERVERNAME`,T0003.TABNAME AS `TABNAME`,T0003.LOCAL_NAME AS `LOCAL_NAME`,T0002.DBINSTANCE AS `DBINSTANCE` from t2 T0001 join t1 T0002 join t3 T0003 where ((T0002.SERVERGRP = T0001.SERVERGRP) and (T0002.SERVERGRP = T0003.SERVERGRP) and (T0003.MAPSTATE = _latin1'A') and (T0003.ACTSTATE = _latin1' '))");
rc= mysql_query(mysql,
"CREATE TABLE t3 ("
" SERVERGRP varchar(20) BINARY NOT NULL, "
" TABNAME varchar(30) NOT NULL, MAPSTATE char(1) NOT NULL, "
" ACTSTATE char(1) NOT NULL , "
" LOCAL_NAME varchar(30) NOT NULL, "
" CHG_DATE varchar(8) NOT NULL default '00000000', "
" CHG_TIME varchar(6) NOT NULL default '000000', "
" MXUSER varchar(12) NOT NULL default '', "
" PRIMARY KEY (SERVERGRP, TABNAME, MAPSTATE, ACTSTATE, "
" LOCAL_NAME)) CHARSET=latin1 COLLATE latin1_bin");
myquery(rc);
rc= mysql_query(mysql,"CREATE VIEW v1 AS select sql_no_cache"
" T0001.SERVERNAME AS SERVERNAME, T0003.TABNAME AS"
" TABNAME,T0003.LOCAL_NAME AS LOCAL_NAME,T0002.DBINSTANCE AS"
" DBINSTANCE from t2 T0001 join t1 T0002 join t3 T0003 where"
" ((T0002.SERVERGRP = T0001.SERVERGRP) and"
" (T0002.SERVERGRP = T0003.SERVERGRP)"
" and (T0003.MAPSTATE = _latin1'A') and"
" (T0003.ACTSTATE = _latin1' '))");
myquery(rc);
stmt= mysql_stmt_init(mysql);
......@@ -10878,7 +10905,11 @@ static void test_view_2where()
MYSQL_BIND bind[8];
char parms[8][100];
ulong length[8];
const char *query= "SELECT `RELID` ,`REPORT` ,`HANDLE` ,`LOG_GROUP` ,`USERNAME` ,`VARIANT` ,`TYPE` ,`VERSION` ,`ERFDAT` ,`ERFTIME` ,`ERFNAME` ,`AEDAT` ,`AETIME` ,`AENAME` ,`DEPENDVARS` ,`INACTIVE` FROM `V_LTDX` WHERE `MANDT` = ? AND `RELID` = ? AND `REPORT` = ? AND `HANDLE` = ? AND `LOG_GROUP` = ? AND `USERNAME` IN ( ? , ? ) AND `TYPE` = ?";
const char *query=
"select relid, report, handle, log_group, username, variant, type, "
"version, erfdat, erftime, erfname, aedat, aetime, aename, dependvars, "
"inactive from V_LTDX where mandt = ? and relid = ? and report = ? and "
"handle = ? and log_group = ? and username in ( ? , ? ) and type = ?";
myheader("test_view_2where");
......@@ -10886,9 +10917,38 @@ static void test_view_2where()
myquery(rc);
rc= mysql_query(mysql, "DROP VIEW IF EXISTS V_LTDX");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE `LTDX` ( `MANDT` char(3) character set latin1 collate latin1_bin NOT NULL default '000', `RELID` char(2) character set latin1 collate latin1_bin NOT NULL default '', `REPORT` varchar(40) character set latin1 collate latin1_bin NOT NULL default '', `HANDLE` varchar(4) character set latin1 collate latin1_bin NOT NULL default '', `LOG_GROUP` varchar(4) character set latin1 collate latin1_bin NOT NULL default '', `USERNAME` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `VARIANT` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `TYPE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `SRTF2` int(11) NOT NULL default '0', `VERSION` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `ERFDAT` varchar(8) character set latin1 collate latin1_bin NOT NULL default '00000000', `ERFTIME` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `ERFNAME` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `AEDAT` varchar(8) character set latin1 collate latin1_bin NOT NULL default '00000000', `AETIME` varchar(6) character set latin1 collate latin1_bin NOT NULL default '000000', `AENAME` varchar(12) character set latin1 collate latin1_bin NOT NULL default '', `DEPENDVARS` varchar(10) character set latin1 collate latin1_bin NOT NULL default '', `INACTIVE` char(1) character set latin1 collate latin1_bin NOT NULL default '', `CLUSTR` smallint(6) NOT NULL default '0', `CLUSTD` blob, PRIMARY KEY (`MANDT`,`RELID`,`REPORT`,`HANDLE`,`LOG_GROUP`,`USERNAME`,`VARIANT`,`TYPE`,`SRTF2`)) ENGINE=InnoDB DEFAULT CHARSET=latin1");
rc= mysql_query(mysql,
"CREATE TABLE LTDX (MANDT char(3) NOT NULL default '000', "
" RELID char(2) NOT NULL, REPORT varchar(40) NOT NULL,"
" HANDLE varchar(4) NOT NULL, LOG_GROUP varchar(4) NOT NULL,"
" USERNAME varchar(12) NOT NULL,"
" VARIANT varchar(12) NOT NULL,"
" TYPE char(1) NOT NULL, SRTF2 int(11) NOT NULL,"
" VERSION varchar(6) NOT NULL default '000000',"
" ERFDAT varchar(8) NOT NULL default '00000000',"
" ERFTIME varchar(6) NOT NULL default '000000',"
" ERFNAME varchar(12) NOT NULL,"
" AEDAT varchar(8) NOT NULL default '00000000',"
" AETIME varchar(6) NOT NULL default '000000',"
" AENAME varchar(12) NOT NULL,"
" DEPENDVARS varchar(10) NOT NULL,"
" INACTIVE char(1) NOT NULL, CLUSTR smallint(6) NOT NULL,"
" CLUSTD blob,"
" PRIMARY KEY (MANDT, RELID, REPORT, HANDLE, LOG_GROUP, "
"USERNAME, VARIANT, TYPE, SRTF2))"
" CHARSET=latin1 COLLATE latin1_bin");
myquery(rc);
rc= mysql_query(mysql, "CREATE VIEW V_LTDX AS select T0001.MANDT AS `MANDT`,T0001.RELID AS `RELID`,T0001.REPORT AS `REPORT`,T0001.HANDLE AS `HANDLE`,T0001.LOG_GROUP AS `LOG_GROUP`,T0001.USERNAME AS `USERNAME`,T0001.VARIANT AS `VARIANT`,T0001.TYPE AS `TYPE`,T0001.VERSION AS `VERSION`,T0001.ERFDAT AS `ERFDAT`,T0001.ERFTIME AS `ERFTIME`,T0001.ERFNAME AS `ERFNAME`,T0001.AEDAT AS `AEDAT`,T0001.AETIME AS `AETIME`,T0001.AENAME AS `AENAME`,T0001.DEPENDVARS AS `DEPENDVARS`,T0001.INACTIVE AS `INACTIVE` from LTDX T0001 where (T0001.SRTF2 = 0)");
rc= mysql_query(mysql,
"CREATE VIEW V_LTDX AS select T0001.MANDT AS "
" MANDT,T0001.RELID AS RELID,T0001.REPORT AS "
" REPORT,T0001.HANDLE AS HANDLE,T0001.LOG_GROUP AS "
" LOG_GROUP,T0001.USERNAME AS USERNAME,T0001.VARIANT AS "
" VARIANT,T0001.TYPE AS TYPE,T0001.VERSION AS "
" VERSION,T0001.ERFDAT AS ERFDAT,T0001.ERFTIME AS "
" ERFTIME,T0001.ERFNAME AS ERFNAME,T0001.AEDAT AS "
" AEDAT,T0001.AETIME AS AETIME,T0001.AENAME AS "
" AENAME,T0001.DEPENDVARS AS DEPENDVARS,T0001.INACTIVE AS "
" INACTIVE from LTDX T0001 where (T0001.SRTF2 = 0)");
myquery(rc);
for (i=0; i < 8; i++) {
strcpy(parms[i], "1");
......@@ -11085,9 +11145,26 @@ static void test_view_insert_fields()
myquery(rc);
rc= mysql_query(mysql, "DROP VIEW IF EXISTS t1, v1");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE t1 ( K1C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K3C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', F1C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', F2I4 int(11) NOT NULL default '0', F3N5 varchar(5) character set latin1 collate latin1_bin NOT NULL default '00000', F4I4 int(11) NOT NULL default '0', F5C8 varchar(8) character set latin1 collate latin1_bin NOT NULL default '', F6N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', F7F8 double NOT NULL default '0', F8F8 double NOT NULL default '0', F9D8 decimal(8,2) NOT NULL default '0.00', PRIMARY KEY (K1C4,K2C4,K3C4,K4N4)) ENGINE=InnoDB DEFAULT CHARSET=latin1");
rc= mysql_query(mysql,
"CREATE TABLE t1 (K1C4 varchar(4) NOT NULL,"
"K2C4 varchar(4) NOT NULL, K3C4 varchar(4) NOT NULL,"
"K4N4 varchar(4) NOT NULL default '0000',"
"F1C4 varchar(4) NOT NULL, F2I4 int(11) NOT NULL,"
"F3N5 varchar(5) NOT NULL default '00000',"
"F4I4 int(11) NOT NULL default '0', F5C8 varchar(8) NOT NULL,"
"F6N4 varchar(4) NOT NULL default '0000',"
"F7F8 double NOT NULL default '0',"
"F8F8 double NOT NULL default '0',"
"F9D8 decimal(8,2) NOT NULL default '0.00',"
"PRIMARY KEY (K1C4,K2C4,K3C4,K4N4)) "
"CHARSET=latin1 COLLATE latin1_bin");
myquery(rc);
rc= mysql_query(mysql, "CREATE VIEW v1 AS select sql_no_cache K1C4 AS `K1C4`,K2C4 AS `K2C4`,K3C4 AS `K3C4`,K4N4 AS `K4N4`,F1C4 AS `F1C4`,F2I4 AS `F2I4`,F3N5 AS `F3N5`,F7F8 AS `F7F8`,F6N4 AS `F6N4`,F5C8 AS `F5C8`,F9D8 AS `F9D8` from t1 T0001");
rc= mysql_query(mysql,
"CREATE VIEW v1 AS select sql_no_cache "
" K1C4 AS K1C4, K2C4 AS K2C4, K3C4 AS K3C4, K4N4 AS K4N4, "
" F1C4 AS F1C4, F2I4 AS F2I4, F3N5 AS F3N5,"
" F7F8 AS F7F8, F6N4 AS F6N4, F5C8 AS F5C8, F9D8 AS F9D8"
" from t1 T0001");
for (i= 0; i < 11; i++)
{
......@@ -12582,7 +12659,6 @@ static void test_bug7990()
static void test_view_sp_list_fields()
{
MYSQL_STMT *stmt;
int rc;
MYSQL_RES *res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment