mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/Users/kent/mysql/bk/mysql-5.0-new
This commit is contained in:
commit
013259eaf4
39 changed files with 576 additions and 278 deletions
|
@ -1342,7 +1342,7 @@ static uint dump_routines_for_db(char *db)
|
|||
|
||||
query_str_tail= strnmov(query_str, row[2],
|
||||
definer_begin - row[2]);
|
||||
query_str_tail= strmov(query_str_tail, "*/ /*!50019");
|
||||
query_str_tail= strmov(query_str_tail, "*/ /*!50020");
|
||||
query_str_tail= strnmov(query_str_tail, definer_begin,
|
||||
definer_end - definer_begin);
|
||||
query_str_tail= strxmov(query_str_tail, "*/ /*!50003",
|
||||
|
|
|
@ -236,7 +236,7 @@ AC_PROG_INSTALL
|
|||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
|
||||
# Not critical since the generated file is distributed
|
||||
AC_PROG_YACC
|
||||
AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
|
||||
AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
|
||||
AC_CHECK_PROG(DVIS, tex, manual.dvi)
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ enum ha_base_keytype {
|
|||
#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */
|
||||
#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */
|
||||
#define HA_STATE_EXTEND_BLOCK 2048
|
||||
#define HA_STATE_RNEXT_SAME 4096 /* rnext_same was called */
|
||||
#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */
|
||||
|
||||
/* myisampack expects no more than 32 field types. */
|
||||
enum en_fieldtype {
|
||||
|
|
|
@ -14,15 +14,34 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#if !defined(_my_no_pthread_h) && !defined(THREAD)
|
||||
#define _my_no_pthread_h
|
||||
|
||||
|
||||
/*
|
||||
This block is to access some thread-related type definitions
|
||||
even in builds which do not need thread functions,
|
||||
as some variables (based on these types) are declared
|
||||
even in non-threaded builds.
|
||||
Case in point: 'mf_keycache.c'
|
||||
*/
|
||||
#if defined(__WIN__) || defined(OS2)
|
||||
|
||||
#elif defined(HAVE_UNIXWARE7_THREADS)
|
||||
/* #include <thread.h> Currently, not relevant. Enable if needed. */
|
||||
|
||||
#else /* Normal threads */
|
||||
#include <pthread.h>
|
||||
|
||||
#endif /* defined(__WIN__) */
|
||||
|
||||
|
||||
/*
|
||||
This undefs some pthread mutex locks when one isn't using threads
|
||||
to make thread safe code, that should also work in single thread
|
||||
environment, easier to use.
|
||||
*/
|
||||
|
||||
#if !defined(_my_no_pthread_h) && !defined(THREAD)
|
||||
#define _my_no_pthread_h
|
||||
|
||||
#define pthread_mutex_init(A,B)
|
||||
#define pthread_mutex_lock(A)
|
||||
#define pthread_mutex_unlock(A)
|
||||
|
@ -32,4 +51,5 @@
|
|||
#define rw_wrlock(A)
|
||||
#define rw_unlock(A)
|
||||
#define rwlock_destroy(A)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2822,7 +2822,7 @@ my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt,
|
|||
{
|
||||
switch (attr_type) {
|
||||
case STMT_ATTR_UPDATE_MAX_LENGTH:
|
||||
*(my_bool*) value= stmt->update_max_length;
|
||||
*(unsigned long *) value= stmt->update_max_length;
|
||||
break;
|
||||
case STMT_ATTR_CURSOR_TYPE:
|
||||
*(ulong*) value= stmt->flags;
|
||||
|
|
|
@ -88,6 +88,8 @@ int mi_delete(MI_INFO *info,const byte *record)
|
|||
_mi_make_key(info,i,old_key,record,info->lastpos)))
|
||||
goto err;
|
||||
}
|
||||
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
|
||||
info->update&= ~HA_STATE_RNEXT_SAME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -444,6 +444,10 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
|
|||
(char*) &blob_ptr,sizeof(char*));
|
||||
memcpy(blob_ptr,key,length);
|
||||
blob_ptr+=length;
|
||||
|
||||
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
|
||||
info->update&= ~HA_STATE_RNEXT_SAME;
|
||||
|
||||
_my_store_blob_length(record+keyseg->start,
|
||||
(uint) keyseg->bit_start,length);
|
||||
key+=length;
|
||||
|
|
|
@ -102,4 +102,4 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
DBUG_RETURN(my_errno);
|
||||
} /* mi_rnext */
|
||||
} /* mi_rnext_same */
|
||||
|
|
|
@ -30,6 +30,9 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
|
|||
mi_unique_store(record+key->seg->start, unique_hash);
|
||||
_mi_make_key(info,def->key,key_buff,record,0);
|
||||
|
||||
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
|
||||
info->update&= ~HA_STATE_RNEXT_SAME;
|
||||
|
||||
if (_mi_search(info,info->s->keyinfo+def->key,key_buff,MI_UNIQUE_HASH_LENGTH,
|
||||
SEARCH_FIND,info->s->state.key_root[def->key]))
|
||||
{
|
||||
|
|
|
@ -111,6 +111,10 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
|
|||
{
|
||||
uint new_length=_mi_make_key(info,i,new_key,newrec,pos);
|
||||
uint old_length=_mi_make_key(info,i,old_key,oldrec,pos);
|
||||
|
||||
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
|
||||
info->update&= ~HA_STATE_RNEXT_SAME;
|
||||
|
||||
if (new_length != old_length ||
|
||||
memcmp((byte*) old_key,(byte*) new_key,new_length))
|
||||
{
|
||||
|
|
|
@ -132,6 +132,10 @@ int mi_write(MI_INFO *info, byte *record)
|
|||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
/* The above changed info->lastkey2. Inform mi_rnext_same(). */
|
||||
info->update&= ~HA_STATE_RNEXT_SAME;
|
||||
|
||||
if (local_lock_tree)
|
||||
rw_unlock(&share->key_root_lock[i]);
|
||||
}
|
||||
|
|
|
@ -729,6 +729,24 @@ select * from t1 where bob is null and cip=1;
|
|||
cip time score bob
|
||||
1 00:01:00 0 NULL
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
id1 int not null auto_increment,
|
||||
id2 int not null default '0',
|
||||
t text not null,
|
||||
primary key (id1),
|
||||
key x (id2, t(32))
|
||||
) engine=myisam;
|
||||
insert into t1 (id2, t) values
|
||||
(10, 'abc'), (10, 'abc'), (10, 'abc'),
|
||||
(20, 'abc'), (20, 'abc'), (20, 'def'),
|
||||
(10, 'abc'), (10, 'abc');
|
||||
select count(*) from t1 where id2 = 10;
|
||||
count(*)
|
||||
5
|
||||
select count(id1) from t1 where id2 = 10;
|
||||
count(id1)
|
||||
5
|
||||
drop table t1;
|
||||
set storage_engine=MyISAM;
|
||||
drop table if exists t1,t2,t3;
|
||||
--- Testing varchar ---
|
||||
|
|
|
@ -2210,12 +2210,12 @@ UNLOCK TABLES;
|
|||
DELIMITER ;;
|
||||
/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
|
||||
RETURN a+b */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1)
|
||||
begin
|
||||
set f1= concat( 'hello', f1 );
|
||||
return f1;
|
||||
|
@ -2223,17 +2223,17 @@ end */;;
|
|||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `a'b` */;;
|
||||
/*!50003 SET SESSION SQL_MODE="REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI"*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER="root"@"localhost"*/ /*!50003 PROCEDURE "a'b"()
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER="root"@"localhost"*/ /*!50003 PROCEDURE "a'b"()
|
||||
select 1 */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
|
||||
BEGIN SELECT a+b INTO c; end */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT)
|
||||
BEGIN
|
||||
select sum(id) from t1 into a;
|
||||
END */;;
|
||||
|
|
|
@ -1,30 +1,60 @@
|
|||
drop table if exists t1,v1;
|
||||
drop view if exists t1,v1;
|
||||
drop procedure if exists f1;
|
||||
use test;
|
||||
create procedure f1() select 1;
|
||||
drop procedure f1;
|
||||
create table t1 (a int);
|
||||
create definer='user'@'host' sql security definer view v1 as select * from t1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop function if exists f1;
|
||||
Warnings:
|
||||
Note 1305 FUNCTION f1 does not exist
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP VIEW IF EXISTS v2;
|
||||
DROP VIEW IF EXISTS v3;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
CREATE TABLE t1(c INT);
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @a = 1;
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
CREATE PROCEDURE p1()
|
||||
SELECT 1;
|
||||
CREATE FUNCTION f1() RETURNS INT
|
||||
RETURN 1;
|
||||
CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @b = 1;
|
||||
CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
|
||||
CREATE DEFINER=a@b PROCEDURE p2()
|
||||
SELECT 2;
|
||||
CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
|
||||
RETURN 2;
|
||||
CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @c = 1;
|
||||
CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
|
||||
CREATE DEFINER=a@'' PROCEDURE p3()
|
||||
SELECT 3;
|
||||
CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
|
||||
RETURN 3;
|
||||
SHOW CREATE VIEW v3;
|
||||
View Create View
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1`
|
||||
SHOW CREATE PROCEDURE p3;
|
||||
Procedure sql_mode Create Procedure
|
||||
p3 CREATE DEFINER=`a`@`` PROCEDURE `p3`()
|
||||
SELECT 3
|
||||
SHOW CREATE FUNCTION f3;
|
||||
Function sql_mode Create Function
|
||||
f3 CREATE DEFINER=`a`@`` FUNCTION `f3`() RETURNS int(11)
|
||||
RETURN 3
|
||||
DROP TRIGGER t1_bi;
|
||||
DROP TRIGGER ti_ai;
|
||||
DROP TRIGGER ti_bu;
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
|
|
|
@ -2197,35 +2197,6 @@ select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
|
|||
2 01-01-1970 03:16:40
|
||||
drop procedure bug3426|
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
create table t4 (
|
||||
b int primary key ,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'ach' at row 1
|
||||
Warning 1265 Data truncated for column 'ach' at row 2
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'bch' at row 1
|
||||
drop procedure if exists bug3448|
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
create table t3 (
|
||||
id int unsigned auto_increment not null primary key,
|
||||
title VARCHAR(200),
|
||||
body text,
|
||||
|
@ -4005,48 +3976,6 @@ DROP VIEW bug13095_v1
|
|||
DROP PROCEDURE IF EXISTS bug13095;
|
||||
DROP VIEW IF EXISTS bug13095_v1;
|
||||
DROP TABLE IF EXISTS bug13095_t1;
|
||||
drop procedure if exists bug14210|
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
@@session.max_heap_table_size
|
||||
16384
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
count(*)
|
||||
256
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
drop function if exists bug14723|
|
||||
drop procedure if exists bug14723|
|
||||
/*!50003 create function bug14723()
|
||||
|
@ -4857,4 +4786,20 @@ i
|
|||
0
|
||||
drop table t3|
|
||||
drop procedure bug16887|
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
f1 bug13575(f1)
|
||||
1 aaa
|
||||
2 bbb
|
||||
3 ccc
|
||||
drop function bug13575;
|
||||
drop table t3|
|
||||
drop table t1,t2;
|
||||
|
|
|
@ -425,3 +425,108 @@ x y
|
|||
drop procedure bug14840_1|
|
||||
drop procedure bug14840_2|
|
||||
drop table t3|
|
||||
drop procedure if exists bug10656_create_index|
|
||||
drop procedure if exists bug10656_myjoin|
|
||||
drop procedure if exists bug10656_truncate_table|
|
||||
CREATE TABLE t3 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
INSERT INTO t3 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
CREATE TABLE t4 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
INSERT INTO t4 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
create procedure bug10656_create_index()
|
||||
begin
|
||||
create index bug10656_my_index on t3 (ID);
|
||||
end|
|
||||
call bug10656_create_index()|
|
||||
create procedure bug10656_myjoin()
|
||||
begin
|
||||
update t3, t4 set t3.txt = t4.txt where t3.id = t4.id;
|
||||
end|
|
||||
call bug10656_myjoin()|
|
||||
create procedure bug10656_truncate_table()
|
||||
begin
|
||||
truncate table t3;
|
||||
end|
|
||||
call bug10656_truncate_table()|
|
||||
drop procedure bug10656_create_index|
|
||||
drop procedure bug10656_myjoin|
|
||||
drop procedure bug10656_truncate_table|
|
||||
drop table t3, t4|
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
create table t4 (
|
||||
b int primary key,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'ach' at row 1
|
||||
Warning 1265 Data truncated for column 'ach' at row 2
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'bch' at row 1
|
||||
drop procedure if exists bug3448|
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
drop procedure if exists bug14210|
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
@@session.max_heap_table_size
|
||||
16384
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
count(*)
|
||||
256
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
|
|
@ -2539,3 +2539,17 @@ drop view v1;
|
|||
//
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache `test`.`t1`.`id` AS `id` from `t1`
|
||||
create table t1(f1 int, f2 int);
|
||||
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
|
||||
.f1 and ta.f2=tb.f2;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
create view v2 as select * from v1 where a > 1 with check option;
|
||||
select * from v2;
|
||||
a b
|
||||
2 2
|
||||
update v2 set b=3 where a=2;
|
||||
select * from v2;
|
||||
a b
|
||||
3 3
|
||||
drop view v2, v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -520,11 +520,16 @@ use test;
|
|||
drop user mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
||||
create definer=some_user@`` sql security invoker view v1 as select 1;
|
||||
ERROR HY000: Definer is not fully qualified
|
||||
create definer=some_user@localhost sql security invoker view v1 as select 1;
|
||||
Warnings:
|
||||
Note 1449 There is no 'some_user'@'' registered
|
||||
create definer=some_user@localhost sql security invoker view v2 as select 1;
|
||||
Warnings:
|
||||
Note 1449 There is no 'some_user'@'localhost' registered
|
||||
show create view v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1`
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1`
|
||||
show create view v2;
|
||||
View Create View
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1`
|
||||
drop view v1;
|
||||
drop view v2;
|
||||
|
|
|
@ -678,6 +678,25 @@ select * from t1 where bob is null and cip=1;
|
|||
create index bug on t1 (bob(22), cip, time);
|
||||
select * from t1 where bob is null and cip=1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
|
||||
#
|
||||
create table t1 (
|
||||
id1 int not null auto_increment,
|
||||
id2 int not null default '0',
|
||||
t text not null,
|
||||
primary key (id1),
|
||||
key x (id2, t(32))
|
||||
) engine=myisam;
|
||||
insert into t1 (id2, t) values
|
||||
(10, 'abc'), (10, 'abc'), (10, 'abc'),
|
||||
(20, 'abc'), (20, 'abc'), (20, 'def'),
|
||||
(10, 'abc'), (10, 'abc');
|
||||
select count(*) from t1 where id2 = 10;
|
||||
select count(id1) from t1 where id2 = 10;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
# ----------------------------------------------------------------------------
|
||||
# $mysql_errno contains the return code of the last command
|
||||
# send to the server.
|
||||
# sent to the server.
|
||||
# ----------------------------------------------------------------------------
|
||||
# get $mysql_errno before the first statement
|
||||
# $mysql_errno should be -1
|
||||
|
@ -50,7 +50,7 @@ select otto from (select 1 as otto) as t1;
|
|||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Negative case(statement):
|
||||
# The dervied table t1 does not contain a column named 'friedrich' .
|
||||
# The derived table t1 does not contain a column named 'friedrich' .
|
||||
# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
|
||||
# --> 1054: Unknown column 'friedrich' in 'field list'
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -68,7 +68,7 @@ select friedrich from (select 1 as otto) as t1;
|
|||
# The following unmasked unsuccessful statement must give
|
||||
# 1. mysqltest gives a 'failed'
|
||||
# 2. does not produce a r/<test case>.reject file !!!
|
||||
# PLEASE uncomment it and check it's effect
|
||||
# PLEASE uncomment it and check its effect
|
||||
#select friedrich from (select 1 as otto) as t1;
|
||||
|
||||
|
||||
|
@ -114,7 +114,7 @@ select friedrich from (select 1 as otto) as t1;
|
|||
# test cases for $mysql_errno
|
||||
#
|
||||
# $mysql_errno is a builtin variable of mysqltest and contains the return code
|
||||
# of the last command send to the server.
|
||||
# of the last command sent to the server.
|
||||
#
|
||||
# The following test cases often initialize $mysql_errno to 1064 by
|
||||
# a command with wrong syntax.
|
||||
|
@ -217,7 +217,7 @@ garbage ;
|
|||
execute stmt;
|
||||
eval select $mysql_errno as "after_successful_execute" ;
|
||||
|
||||
# failing execute (table dropped)
|
||||
# failing execute (table has been dropped)
|
||||
drop table t1;
|
||||
--error 1064
|
||||
garbage ;
|
||||
|
@ -249,8 +249,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
|
|||
# ----------------------------------------------------------------------------
|
||||
# test cases for "--disable_abort_on_error"
|
||||
#
|
||||
# "--disable_abort_on_error" switches the abort of mysqltest
|
||||
# after "unmasked" failing statements off.
|
||||
# "--disable_abort_on_error" switches off the abort of mysqltest
|
||||
# after "unmasked" failing statements.
|
||||
#
|
||||
# The default is "--enable_abort_on_error".
|
||||
#
|
||||
|
@ -258,13 +258,13 @@ eval select $mysql_errno as "after_failing_deallocate" ;
|
|||
# --error <error number> and --error <error number>
|
||||
# in the line before the failing statement.
|
||||
#
|
||||
# There are some additional test case for $mysql_errno
|
||||
# There are some additional test cases for $mysql_errno
|
||||
# because "--disable_abort_on_error" enables a new situation.
|
||||
# Example: "unmasked" statement fails + analysis of $mysql_errno
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Switch the abort on error off and check the effect on $mysql_errno
|
||||
# Switch off the abort on error and check the effect on $mysql_errno
|
||||
# ----------------------------------------------------------------------------
|
||||
--error 1064
|
||||
garbage ;
|
||||
|
@ -345,7 +345,7 @@ select 3 from t1 ;
|
|||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test detect end of line "junk"
|
||||
# Most likely causes by a missing delimiter
|
||||
# Most likely caused by a missing delimiter
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Too many parameters to function
|
||||
|
@ -1043,7 +1043,7 @@ let $message= . Here comes a very very long message that
|
|||
--source include/show_msg80.inc
|
||||
|
||||
#
|
||||
# Test --enable_parsning / disable_parsning
|
||||
# Test --enable_parsing / disable_parsing
|
||||
#
|
||||
--disable_query_log
|
||||
--disable_parsing
|
||||
|
@ -1070,9 +1070,9 @@ select "this will be executed";
|
|||
|
||||
#
|
||||
# Test that mysqltest fails when there are no queries executed
|
||||
# but a result file exist
|
||||
# but a result file exists
|
||||
# NOTE! This will never happen as long as it's not allowed to have
|
||||
# test files that does not produce any output
|
||||
# test files that produce no output
|
||||
#--exec echo "something" > $MYSQLTEST_VARDIR/tmp/result_file.result
|
||||
#--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
|
||||
#--error 1
|
||||
|
|
|
@ -1,37 +1,18 @@
|
|||
# This tests not performed with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,v1;
|
||||
drop view if exists t1,v1;
|
||||
drop procedure if exists f1;
|
||||
--enable_warnings
|
||||
use test;
|
||||
|
||||
#
|
||||
# Test that we can create and drop procedure without warnings
|
||||
# see bug#9993
|
||||
#
|
||||
create procedure f1() select 1;
|
||||
drop procedure f1;
|
||||
|
||||
#
|
||||
# BUG#13504: creation view with DEFINER clause if --skip-grant-tables
|
||||
#
|
||||
create table t1 (a int);
|
||||
create definer='user'@'host' sql security definer view v1 as select * from t1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
# BUG#17595: DROP FUNCTION IF EXISTS f1 crashes server
|
||||
drop function if exists f1;
|
||||
|
||||
#
|
||||
# BUG#16777: Can not create trigger nor view w/o definer if --skip-grant-tables
|
||||
# specified
|
||||
#
|
||||
# Also, a test that we can create VIEW if privileges check switched off has
|
||||
# been moved here.
|
||||
# Also, the following test cases have been moved here:
|
||||
# - test that we can create VIEW if privileges check switched off has been
|
||||
# moved here;
|
||||
# - test that we can create and drop procedure without warnings (BUG#9993);
|
||||
# - BUG#17595: "DROP FUNCTION IF EXISTS" crashes server;
|
||||
# - BUG#13504: creation view with DEFINER clause if --skip-grant-tables
|
||||
#
|
||||
|
||||
# Prepare.
|
||||
|
@ -40,33 +21,90 @@ drop function if exists f1;
|
|||
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP VIEW IF EXISTS v2;
|
||||
DROP VIEW IF EXISTS v3;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
|
||||
--enable_warnings
|
||||
|
||||
# Test case.
|
||||
|
||||
CREATE TABLE t1(c INT);
|
||||
|
||||
# - try to create with implicit definer (definer would be ''@'');
|
||||
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @a = 1;
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
SELECT 1;
|
||||
|
||||
CREATE FUNCTION f1() RETURNS INT
|
||||
RETURN 1;
|
||||
|
||||
# - try to create with explicit definer;
|
||||
|
||||
CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @b = 1;
|
||||
|
||||
CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
|
||||
|
||||
CREATE DEFINER=a@b PROCEDURE p2()
|
||||
SELECT 2;
|
||||
|
||||
CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
|
||||
RETURN 2;
|
||||
|
||||
# - try to create with explicit definer with empty host;
|
||||
|
||||
CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @c = 1;
|
||||
|
||||
CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
|
||||
|
||||
CREATE DEFINER=a@'' PROCEDURE p3()
|
||||
SELECT 3;
|
||||
|
||||
CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
|
||||
RETURN 3;
|
||||
|
||||
# - check that empty host name is treated correctly;
|
||||
|
||||
SHOW CREATE VIEW v3;
|
||||
|
||||
SHOW CREATE PROCEDURE p3;
|
||||
|
||||
SHOW CREATE FUNCTION f3;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP TRIGGER t1_bi;
|
||||
DROP TRIGGER ti_ai;
|
||||
DROP TRIGGER ti_bu;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
|
|
|
@ -2602,38 +2602,6 @@ select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
|
|||
|
||||
drop procedure bug3426|
|
||||
|
||||
#
|
||||
# BUG#3448
|
||||
#
|
||||
--disable_warnings
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
|
||||
create table t4 (
|
||||
b int primary key ,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
--enable_warnings
|
||||
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug3448|
|
||||
--enable_warnings
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
call bug3448()|
|
||||
call bug3448()|
|
||||
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
|
||||
|
||||
#
|
||||
# BUG#3734
|
||||
#
|
||||
|
@ -4853,60 +4821,6 @@ DROP TABLE IF EXISTS bug13095_t1;
|
|||
|
||||
delimiter |;
|
||||
|
||||
#
|
||||
# BUG#14210: "Simple query with > operator on large table gives server
|
||||
# crash"
|
||||
# Check that cursors work in case when HEAP tables are converted to
|
||||
# MyISAM
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14210|
|
||||
--enable_warnings
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
# To trigger the memory corruption the original table must be InnoDB.
|
||||
# No harm if it's not, so don't warn if the suite is run with --skip-innodb
|
||||
--disable_warnings
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
--enable_warnings
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
||||
|
||||
#
|
||||
# BUG#1473: Dumping of stored functions seems to cause corruption in
|
||||
# the function body
|
||||
|
@ -5716,6 +5630,22 @@ call bug16887()|
|
|||
drop table t3|
|
||||
drop procedure bug16887|
|
||||
|
||||
#
|
||||
# Bug#13575 SP funcs in select with distinct/group and order by can
|
||||
# produce bad data
|
||||
#
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
drop function bug13575;
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
|
|
|
@ -419,6 +419,140 @@ drop procedure bug14840_2|
|
|||
drop table t3|
|
||||
|
||||
|
||||
#
|
||||
# BUG#10656: Stored Procedure - Create index and Truncate table command error
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug10656_create_index|
|
||||
drop procedure if exists bug10656_myjoin|
|
||||
drop procedure if exists bug10656_truncate_table|
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t3 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
|
||||
INSERT INTO t3 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
|
||||
CREATE TABLE t4 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
|
||||
INSERT INTO t4 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
|
||||
create procedure bug10656_create_index()
|
||||
begin
|
||||
create index bug10656_my_index on t3 (ID);
|
||||
end|
|
||||
call bug10656_create_index()|
|
||||
|
||||
create procedure bug10656_myjoin()
|
||||
begin
|
||||
update t3, t4 set t3.txt = t4.txt where t3.id = t4.id;
|
||||
end|
|
||||
call bug10656_myjoin()|
|
||||
|
||||
create procedure bug10656_truncate_table()
|
||||
begin
|
||||
truncate table t3;
|
||||
end|
|
||||
call bug10656_truncate_table()|
|
||||
|
||||
|
||||
drop procedure bug10656_create_index|
|
||||
drop procedure bug10656_myjoin|
|
||||
drop procedure bug10656_truncate_table|
|
||||
drop table t3, t4|
|
||||
|
||||
#
|
||||
# BUG#3448
|
||||
#
|
||||
--disable_warnings
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
|
||||
create table t4 (
|
||||
b int primary key,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
--enable_warnings
|
||||
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug3448|
|
||||
--enable_warnings
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
call bug3448()|
|
||||
call bug3448()|
|
||||
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
|
||||
#
|
||||
# BUG#14210: "Simple query with > operator on large table gives server
|
||||
# crash"
|
||||
# Check that cursors work in case when HEAP tables are converted to
|
||||
# MyISAM
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14210|
|
||||
--enable_warnings
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
# To trigger the memory corruption the original table must be InnoDB.
|
||||
# No harm if it's not, so don't warn if the suite is run with --skip-innodb
|
||||
--disable_warnings
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
--enable_warnings
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
|
|
@ -2385,3 +2385,17 @@ show create view v1;
|
|||
drop view v1;
|
||||
//
|
||||
delimiter ;//
|
||||
|
||||
#
|
||||
# Bug#17726 Not checked empty list caused endless loop
|
||||
#
|
||||
create table t1(f1 int, f2 int);
|
||||
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
|
||||
.f1 and ta.f2=tb.f2;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
create view v2 as select * from v1 where a > 1 with check option;
|
||||
select * from v2;
|
||||
update v2 set b=3 where a=2;
|
||||
select * from v2;
|
||||
drop view v2, v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -706,10 +706,9 @@ connection default;
|
|||
#
|
||||
# DEFINER information check
|
||||
#
|
||||
-- error ER_MALFORMED_DEFINER
|
||||
create definer=some_user@`` sql security invoker view v1 as select 1;
|
||||
create definer=some_user@localhost sql security invoker view v1 as select 1;
|
||||
create definer=some_user@localhost sql security invoker view v2 as select 1;
|
||||
show create view v1;
|
||||
show create view v2;
|
||||
drop view v1;
|
||||
|
||||
|
||||
drop view v2;
|
||||
|
|
|
@ -2547,7 +2547,8 @@ Item_cond::fix_fields(THD *thd, Item **ref)
|
|||
{
|
||||
table_map tmp_table_map;
|
||||
while (item->type() == Item::COND_ITEM &&
|
||||
((Item_cond*) item)->functype() == functype())
|
||||
((Item_cond*) item)->functype() == functype() &&
|
||||
!((Item_cond*) item)->list.is_empty())
|
||||
{ // Identical function
|
||||
li.replace(((Item_cond*) item)->list);
|
||||
((Item_cond*) item)->list.empty();
|
||||
|
|
|
@ -1421,9 +1421,21 @@ public:
|
|||
|
||||
String *val_str(String *str)
|
||||
{
|
||||
String buf;
|
||||
char buff[20];
|
||||
buf.set(buff, 20, str->charset());
|
||||
buf.length(0);
|
||||
if (execute(&result_field))
|
||||
return NULL;
|
||||
return result_field->val_str(str);
|
||||
/*
|
||||
result_field will set buf pointing to internal buffer
|
||||
of the resul_field. Due to this it will change any time
|
||||
when SP is executed. In order to prevent occasional
|
||||
corruption of returned value, we make here a copy.
|
||||
*/
|
||||
result_field->val_str(&buf);
|
||||
str->copy(buf);
|
||||
return str;
|
||||
}
|
||||
|
||||
virtual bool change_context_processor(byte *cntx)
|
||||
|
|
|
@ -1093,7 +1093,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
|
|||
const char **errmsg);
|
||||
|
||||
/* mysqld.cc */
|
||||
extern void yyerror(const char*);
|
||||
extern void MYSQLerror(const char*);
|
||||
|
||||
/* item_func.cc */
|
||||
extern bool check_reserved_words(LEX_STRING *name);
|
||||
|
@ -1415,7 +1415,7 @@ void free_list(I_List <i_string_pair> *list);
|
|||
void free_list(I_List <i_string> *list);
|
||||
|
||||
/* sql_yacc.cc */
|
||||
extern int yyparse(void *thd);
|
||||
extern int MYSQLparse(void *thd);
|
||||
|
||||
/* frm_crypt.cc */
|
||||
#ifdef HAVE_CRYPTED_FRM
|
||||
|
|
|
@ -1524,7 +1524,7 @@ static void network_init(void)
|
|||
|
||||
#endif /*!EMBEDDED_LIBRARY*/
|
||||
|
||||
void yyerror(const char *s)
|
||||
void MYSQLerror(const char *s)
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
char *yytext= (char*) thd->lex->tok_start;
|
||||
|
|
|
@ -269,7 +269,7 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, TABLE *table)
|
|||
static int
|
||||
db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
|
||||
{
|
||||
extern int yyparse(void *thd);
|
||||
extern int MYSQLparse(void *thd);
|
||||
TABLE *table;
|
||||
const char *params, *returns, *body;
|
||||
int ret;
|
||||
|
@ -459,7 +459,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||
lex_start(thd, (uchar*)defstr.c_ptr(), defstr.length());
|
||||
|
||||
thd->spcont= 0;
|
||||
if (yyparse(thd) || thd->is_fatal_error || newlex.sphead == NULL)
|
||||
if (MYSQLparse(thd) || thd->is_fatal_error || newlex.sphead == NULL)
|
||||
{
|
||||
sp_head *sp= newlex.sphead;
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
#define MYSQL_LEX 1
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "procedure.h"
|
||||
#include "sql_analyse.h"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
/* A lexical scanner on a temporary buffer with a yacc interface */
|
||||
|
||||
#define MYSQL_LEX 1
|
||||
#include "mysql_priv.h"
|
||||
#include "item_create.h"
|
||||
#include <m_ctype.h>
|
||||
|
@ -506,14 +507,14 @@ static inline uint int_token(const char *str,uint length)
|
|||
}
|
||||
|
||||
/*
|
||||
yylex remember the following states from the following yylex()
|
||||
MYSQLlex remember the following states from the following MYSQLlex()
|
||||
|
||||
- MY_LEX_EOQ Found end of query
|
||||
- MY_LEX_OPERATOR_OR_IDENT Last state was an ident, text or number
|
||||
(which can't be followed by a signed number)
|
||||
*/
|
||||
|
||||
int yylex(void *arg, void *yythd)
|
||||
int MYSQLlex(void *arg, void *yythd)
|
||||
{
|
||||
reg1 uchar c;
|
||||
int tokval, result_state;
|
||||
|
|
|
@ -37,8 +37,12 @@ class sp_pcontext;
|
|||
#define LEX_YYSTYPE void *
|
||||
#else
|
||||
#include "lex_symbol.h"
|
||||
#if MYSQL_LEX
|
||||
#include "sql_yacc.h"
|
||||
#define LEX_YYSTYPE YYSTYPE *
|
||||
#else
|
||||
#define LEX_YYSTYPE void *
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -712,7 +716,7 @@ typedef struct st_lex
|
|||
uchar *buf; /* The beginning of string, used by SPs */
|
||||
uchar *ptr,*tok_start,*tok_end,*end_of_query;
|
||||
|
||||
/* The values of tok_start/tok_end as they were one call of yylex before */
|
||||
/* The values of tok_start/tok_end as they were one call of MYSQLlex before */
|
||||
uchar *tok_start_prev, *tok_end_prev;
|
||||
|
||||
char *length,*dec,*change,*name;
|
||||
|
@ -1061,7 +1065,7 @@ extern void lex_init(void);
|
|||
extern void lex_free(void);
|
||||
extern void lex_start(THD *thd, uchar *buf,uint length);
|
||||
extern void lex_end(LEX *lex);
|
||||
extern int yylex(void *arg, void *yythd);
|
||||
extern int MYSQLlex(void *arg, void *yythd);
|
||||
|
||||
extern pthread_key(LEX*,THR_LEX);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define MYSQL_LEX 1
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_repl.h"
|
||||
#include "repl_failsafe.h"
|
||||
|
@ -4243,7 +4244,7 @@ end_with_restore_list:
|
|||
/*
|
||||
We must cleanup the unit and the lex here because
|
||||
sp_grant_privileges calls (indirectly) db_find_routine,
|
||||
which in turn may call yyparse with THD::lex.
|
||||
which in turn may call MYSQLparse with THD::lex.
|
||||
TODO: fix db_find_routine to use a temporary lex.
|
||||
*/
|
||||
lex->unit.cleanup();
|
||||
|
@ -5658,7 +5659,7 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
|
|||
sp_cache_flush_obsolete(&thd->sp_proc_cache);
|
||||
sp_cache_flush_obsolete(&thd->sp_func_cache);
|
||||
|
||||
if (!yyparse((void *)thd) && ! thd->is_fatal_error)
|
||||
if (!MYSQLparse((void *)thd) && ! thd->is_fatal_error)
|
||||
{
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (mqh_used && thd->user_connect &&
|
||||
|
@ -5738,7 +5739,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
|
|||
DBUG_ENTER("mysql_test_parse_for_slave");
|
||||
|
||||
mysql_init_query(thd, (uchar*) inBuf, length);
|
||||
if (!yyparse((void*) thd) && ! thd->is_fatal_error &&
|
||||
if (!MYSQLparse((void*) thd) && ! thd->is_fatal_error &&
|
||||
all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first))
|
||||
error= 1; /* Ignore question */
|
||||
thd->end_statement();
|
||||
|
@ -7299,8 +7300,7 @@ LEX_USER *create_default_definer(THD *thd)
|
|||
|
||||
|
||||
/*
|
||||
Create definer with the given user and host names. Also check that the user
|
||||
and host names satisfy definers requirements.
|
||||
Create definer with the given user and host names.
|
||||
|
||||
SYNOPSIS
|
||||
create_definer()
|
||||
|
@ -7318,14 +7318,6 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name)
|
|||
{
|
||||
LEX_USER *definer;
|
||||
|
||||
/* Check that specified host name is valid. */
|
||||
|
||||
if (host_name->length == 0)
|
||||
{
|
||||
my_error(ER_MALFORMED_DEFINER, MYF(0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create and initialize. */
|
||||
|
||||
if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER))))
|
||||
|
|
|
@ -2757,7 +2757,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
|
|||
lex->safe_to_cache_query= FALSE;
|
||||
lex->stmt_prepare_mode= TRUE;
|
||||
|
||||
error= yyparse((void *)thd) || thd->is_fatal_error ||
|
||||
error= MYSQLparse((void *)thd) || thd->is_fatal_error ||
|
||||
thd->net.report_error || init_param_array(this);
|
||||
/*
|
||||
While doing context analysis of the query (in check_prepared_statement)
|
||||
|
|
|
@ -648,6 +648,18 @@ static const char *require_quotes(const char *name, uint name_length)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Quote the given identifier if needed and append it to the target string.
|
||||
If the given identifier is empty, it will be quoted.
|
||||
|
||||
SYNOPSIS
|
||||
append_identifier()
|
||||
thd thread handler
|
||||
packet target string
|
||||
name the identifier to be appended
|
||||
name_length length of the appending identifier
|
||||
*/
|
||||
|
||||
void
|
||||
append_identifier(THD *thd, String *packet, const char *name, uint length)
|
||||
{
|
||||
|
@ -701,8 +713,11 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
|
|||
length length of name
|
||||
|
||||
IMPLEMENTATION
|
||||
If name is a keyword or includes a special character, then force
|
||||
quoting.
|
||||
Force quoting in the following cases:
|
||||
- name is empty (for one, it is possible when we use this function for
|
||||
quoting user and host names for DEFINER clause);
|
||||
- name is a keyword;
|
||||
- name includes a special character;
|
||||
Otherwise identifier is quoted only if the option OPTION_QUOTE_SHOW_CREATE
|
||||
is set.
|
||||
|
||||
|
@ -713,7 +728,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
|
|||
|
||||
int get_quote_char_for_identifier(THD *thd, const char *name, uint length)
|
||||
{
|
||||
if (!length ||
|
||||
if (length &&
|
||||
!is_keyword(name,length) &&
|
||||
!require_quotes(name, length) &&
|
||||
!(thd->options & OPTION_QUOTE_SHOW_CREATE))
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#define MYSQL_LEX 1
|
||||
#include "mysql_priv.h"
|
||||
#include "sp_head.h"
|
||||
#include "sql_trigger.h"
|
||||
|
@ -932,7 +933,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
|||
lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length);
|
||||
|
||||
thd->spcont= 0;
|
||||
if (yyparse((void *)thd) || thd->is_fatal_error)
|
||||
if (MYSQLparse((void *)thd) || thd->is_fatal_error)
|
||||
{
|
||||
/*
|
||||
Free lex associated resources.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define MYSQL_LEX 1
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_select.h"
|
||||
#include "parse_file.h"
|
||||
|
@ -889,7 +890,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table)
|
|||
MODE_IGNORE_SPACE | MODE_NO_BACKSLASH_ESCAPES);
|
||||
CHARSET_INFO *save_cs= thd->variables.character_set_client;
|
||||
thd->variables.character_set_client= system_charset_info;
|
||||
res= yyparse((void *)thd);
|
||||
res= MYSQLparse((void *)thd);
|
||||
thd->variables.character_set_client= save_cs;
|
||||
thd->variables.sql_mode= save_mode;
|
||||
}
|
||||
|
|
|
@ -14758,24 +14758,6 @@ static void test_bug16143()
|
|||
}
|
||||
|
||||
|
||||
/* Bug #16144: mysql_stmt_attr_get type error */
|
||||
|
||||
static void test_bug16144()
|
||||
{
|
||||
const my_bool flag_orig= (my_bool) 0xde;
|
||||
my_bool flag= flag_orig;
|
||||
MYSQL_STMT *stmt;
|
||||
myheader("test_bug16144");
|
||||
|
||||
/* Check that attr_get returns correct data on little and big endian CPUs */
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (const void*) &flag);
|
||||
mysql_stmt_attr_get(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &flag);
|
||||
DIE_UNLESS(flag == flag_orig);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
}
|
||||
|
||||
/*
|
||||
Bug #15613: "libmysqlclient API function mysql_stmt_prepare returns wrong
|
||||
field length"
|
||||
|
@ -15137,7 +15119,6 @@ static struct my_tests_st my_tests[]= {
|
|||
{ "test_opt_reconnect", test_opt_reconnect },
|
||||
{ "test_bug12744", test_bug12744 },
|
||||
{ "test_bug16143", test_bug16143 },
|
||||
{ "test_bug16144", test_bug16144 },
|
||||
{ "test_bug15613", test_bug15613 },
|
||||
{ "test_bug14169", test_bug14169 },
|
||||
{ 0, 0 }
|
||||
|
|
Loading…
Reference in a new issue