diff options
author | unknown <pem@mysql.com> | 2004-03-17 12:11:04 +0100 |
---|---|---|
committer | unknown <pem@mysql.com> | 2004-03-17 12:11:04 +0100 |
commit | b440d2cf76b126045e3d79679fce1b458016028e (patch) | |
tree | 7dba75bc949799583db8937e0ab1a6076dca1891 | |
parent | 6022c31a262881fecc4cd837a41e036489aab8f5 (diff) | |
parent | 36dd97239a7b3e84badb7fdc79b221c20cbfe38f (diff) | |
download | mariadb-git-b440d2cf76b126045e3d79679fce1b458016028e.tar.gz |
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0-merge
-rw-r--r-- | mysql-test/r/sp.result | 6 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 10 | ||||
-rw-r--r-- | sql/sp.cc | 15 |
3 files changed, 30 insertions, 1 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index bf515e4b4cd..2b91e8de270 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -989,6 +989,12 @@ call bug2614()| call bug2614()| drop table t3| drop procedure bug2614| +create function bug2674 () returns int +return @@sort_buffer_size| +select bug2674()| +bug2674() +262136 +drop function bug2674| drop table if exists fac| create table fac (n int unsigned not null primary key, f bigint unsigned)| create procedure ifac(n int unsigned) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 3cb88ec5717..fd6cb4a300a 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1138,6 +1138,16 @@ call bug2614()| drop table t3| drop procedure bug2614| +# +# BUG#2674 +# + +create function bug2674 () returns int + return @@sort_buffer_size| + +select bug2674()| +drop function bug2674| + # # Some "real" examples diff --git a/sql/sp.cc b/sql/sp.cc index 83fbd8c5173..f517504e1f5 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -230,7 +230,20 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp) goto done; } - lex_start(thd, (uchar*)defstr, deflen); + { + /* This is something of a kludge. We need to initialize some fields + * in thd->lex (the unit and master stuff), and the easiest way to + * do it is, is to call mysql_init_query(), but this unfortunately + * resets teh value_list where we keep the CALL parameters. So we + * copy the list and then restore it. + */ + List<Item> vals= thd->lex->value_list; + + mysql_init_query(thd, TRUE); + lex_start(thd, (uchar*)defstr, deflen); + thd->lex->value_list= vals; + } + if (yyparse(thd) || thd->is_fatal_error || thd->lex->sphead == NULL) { LEX *newlex= thd->lex; |