Commit 37f7e29d authored by baker@bk-internal.mysql.com's avatar baker@bk-internal.mysql.com

Merge bk-internal.mysql.com:/data0/bk/mysql-5.1

into  bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
parents dbe5f0ac 21435418
...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) ...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.1.14-beta) AM_INIT_AUTOMAKE(mysql, 5.1.15-beta)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
......
...@@ -786,6 +786,9 @@ sub command_line_setup () { ...@@ -786,6 +786,9 @@ sub command_line_setup () {
{ {
# Only platforms that have native symlinks can use the vardir trick # Only platforms that have native symlinks can use the vardir trick
$opt_mem= $opt_vardir; $opt_mem= $opt_vardir;
# Delete the default directory in case it exists since we're going to create
# a new one later anyway, and the mkpath below throws a fatal error otherwise
eval { rmtree($default_vardir, 1, 1); };
mtr_report("Using 4.1 vardir trick"); mtr_report("Using 4.1 vardir trick");
} }
......
...@@ -373,3 +373,104 @@ select yearweek(); ...@@ -373,3 +373,104 @@ select yearweek();
ERROR 42000: Incorrect parameter count in the call to native function 'yearweek' ERROR 42000: Incorrect parameter count in the call to native function 'yearweek'
select yearweek(1, 2, 3); select yearweek(1, 2, 3);
ERROR 42000: Incorrect parameter count in the call to native function 'yearweek' ERROR 42000: Incorrect parameter count in the call to native function 'yearweek'
select abs(3);
abs(3)
3
select abs(3 AS three);
ERROR 42000: Incorrect parameters in the call to native function 'abs'
select abs(3 three);
ERROR 42000: Incorrect parameters in the call to native function 'abs'
select abs(3 AS "three");
ERROR 42000: Incorrect parameters in the call to native function 'abs'
select abs(3 "three");
ERROR 42000: Incorrect parameters in the call to native function 'abs'
set @bar="bar";
set @foobar="foobar";
select instr("foobar", "bar");
instr("foobar", "bar")
4
select instr("foobar" AS p1, "bar");
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar" p1, "bar");
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar" AS "p1", "bar");
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar" "p1", "bar");
instr("foobar" "p1", "bar")
4
select instr(@foobar "p1", "bar");
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar", "bar" AS p2);
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar", "bar" p2);
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar", "bar" AS "p2");
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar", "bar" "p2");
instr("foobar", "bar" "p2")
0
select instr("foobar", @bar "p2");
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select instr("foobar" AS p1, "bar" AS p2);
ERROR 42000: Incorrect parameters in the call to native function 'instr'
select conv(255, 10, 16);
conv(255, 10, 16)
FF
select conv(255 AS p1, 10, 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255 p1, 10, 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255 AS "p1", 10, 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255 "p1", 10, 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10 AS p2, 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10 p2, 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10 AS "p2", 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10 "p2", 16);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10, 16 AS p3);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10, 16 p3);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10, 16 AS "p3");
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255, 10, 16 "p3");
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select conv(255 AS p1, 10 AS p2, 16 AS p3);
ERROR 42000: Incorrect parameters in the call to native function 'conv'
select atan(10);
atan(10)
1.4711276743037
select atan(10 AS p1);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10 p1);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10 AS "p1");
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10 "p1");
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10, 20);
atan(10, 20)
0.46364760900081
select atan(10 AS p1, 20);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10 p1, 20);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10 AS "p1", 20);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10 "p1", 20);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10, 20 AS p2);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10, 20 p2);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10, 20 AS "p2");
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10, 20 "p2");
ERROR 42000: Incorrect parameters in the call to native function 'atan'
select atan(10 AS p1, 20 AS p2);
ERROR 42000: Incorrect parameters in the call to native function 'atan'
...@@ -5633,7 +5633,7 @@ drop function if exists pi; ...@@ -5633,7 +5633,7 @@ drop function if exists pi;
create function pi() returns varchar(50) create function pi() returns varchar(50)
return "pie, my favorite desert."; return "pie, my favorite desert.";
Warnings: Warnings:
Note 1578 This function 'pi' has the same name as a native function. Note 1579 This function 'pi' has the same name as a native function.
SET @save_sql_mode=@@sql_mode; SET @save_sql_mode=@@sql_mode;
SET SQL_MODE='IGNORE_SPACE'; SET SQL_MODE='IGNORE_SPACE';
select pi(), pi (); select pi(), pi ();
...@@ -5682,15 +5682,15 @@ use test; ...@@ -5682,15 +5682,15 @@ use test;
create function `database`() returns varchar(50) create function `database`() returns varchar(50)
return "Stored function database"; return "Stored function database";
Warnings: Warnings:
Note 1578 This function 'database' has the same name as a native function. Note 1579 This function 'database' has the same name as a native function.
create function `current_user`() returns varchar(50) create function `current_user`() returns varchar(50)
return "Stored function current_user"; return "Stored function current_user";
Warnings: Warnings:
Note 1578 This function 'current_user' has the same name as a native function. Note 1579 This function 'current_user' has the same name as a native function.
create function md5(x varchar(50)) returns varchar(50) create function md5(x varchar(50)) returns varchar(50)
return "Stored function md5"; return "Stored function md5";
Warnings: Warnings:
Note 1578 This function 'md5' has the same name as a native function. Note 1579 This function 'md5' has the same name as a native function.
SET SQL_MODE='IGNORE_SPACE'; SET SQL_MODE='IGNORE_SPACE';
select database(), database (); select database(), database ();
database() database () database() database ()
......
...@@ -7,11 +7,11 @@ return 1; ...@@ -7,11 +7,11 @@ return 1;
create function x() returns int create function x() returns int
return 2; return 2;
Warnings: Warnings:
Note 1578 This function 'x' has the same name as a native function. Note 1579 This function 'x' has the same name as a native function.
create function y() returns int create function y() returns int
return 3; return 3;
Warnings: Warnings:
Note 1578 This function 'y' has the same name as a native function. Note 1579 This function 'y' has the same name as a native function.
select a(); select a();
a() a()
1 1
......
...@@ -488,3 +488,4 @@ t 0 ...@@ -488,3 +488,4 @@ t 0
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1a' Warning 1292 Truncated incorrect INTEGER value: '1a'
Warning 1292 Truncated incorrect INTEGER value: 't' Warning 1292 Truncated incorrect INTEGER value: 't'
DROP TABLE t1;
...@@ -132,9 +132,9 @@ a c ...@@ -132,9 +132,9 @@ a c
1 1 1 1
2 2 2 2
SELECT a, fn(MIN(b) xx) as c FROM t1 GROUP BY a; SELECT a, fn(MIN(b) xx) as c FROM t1 GROUP BY a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xx) as c FROM t1 GROUP BY a' at line 1 ERROR 42000: Incorrect parameters in the call to stored function 'fn'
SELECT myfunc_int(fn(MIN(b) xx)) as c FROM t1 GROUP BY a; SELECT myfunc_int(fn(MIN(b) xx)) as c FROM t1 GROUP BY a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xx)) as c FROM t1 GROUP BY a' at line 1 ERROR 42000: Incorrect parameters in the call to stored function 'fn'
SELECT myfunc_int(test.fn(MIN(b) xx)) as c FROM t1 GROUP BY a; SELECT myfunc_int(test.fn(MIN(b) xx)) as c FROM t1 GROUP BY a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xx)) as c FROM t1 GROUP BY a' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xx)) as c FROM t1 GROUP BY a' at line 1
SELECT myfunc_int(fn(MIN(b)) xx) as c FROM t1 GROUP BY a; SELECT myfunc_int(fn(MIN(b)) xx) as c FROM t1 GROUP BY a;
...@@ -185,6 +185,28 @@ DROP VIEW v1; ...@@ -185,6 +185,28 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
DROP FUNCTION fn; DROP FUNCTION fn;
End of 5.0 tests. End of 5.0 tests.
select myfunc_double(3);
myfunc_double(3)
51.00
select myfunc_double(3 AS three);
myfunc_double(3 AS three)
51.00
select myfunc_double(abs(3));
myfunc_double(abs(3))
51.00
select myfunc_double(abs(3) AS named_param);
myfunc_double(abs(3) AS named_param)
51.00
select abs(myfunc_double(3));
abs(myfunc_double(3))
51.00
select abs(myfunc_double(3 AS three));
abs(myfunc_double(3 AS three))
51.00
select myfunc_double(abs(3 AS wrong));
ERROR 42000: Incorrect parameters in the call to native function 'abs'
select abs(myfunc_double(3) AS wrong);
ERROR 42000: Incorrect parameters in the call to native function 'abs'
drop function if exists pi; drop function if exists pi;
CREATE FUNCTION pi RETURNS STRING SONAME "should_not_parse.so"; CREATE FUNCTION pi RETURNS STRING SONAME "should_not_parse.so";
ERROR HY000: This function 'pi' has the same name as a native function. ERROR HY000: This function 'pi' has the same name as a native function.
......
...@@ -493,3 +493,113 @@ select yearweek(); ...@@ -493,3 +493,113 @@ select yearweek();
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select yearweek(1, 2, 3); select yearweek(1, 2, 3);
#
# Bug#24736: UDF functions parsed as Stored Functions
#
# Verify that the syntax for calling UDF : foo(expr AS param, ...)
# can not be used when calling native functions
# Native function with 1 argument
select abs(3);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select abs(3 AS three);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select abs(3 three);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select abs(3 AS "three");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select abs(3 "three");
# Native function with 2 arguments
set @bar="bar";
set @foobar="foobar";
select instr("foobar", "bar");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar" AS p1, "bar");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar" p1, "bar");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar" AS "p1", "bar");
## String concatenation, valid syntax
select instr("foobar" "p1", "bar");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr(@foobar "p1", "bar");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar", "bar" AS p2);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar", "bar" p2);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar", "bar" AS "p2");
## String concatenation, valid syntax
select instr("foobar", "bar" "p2");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar", @bar "p2");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select instr("foobar" AS p1, "bar" AS p2);
# Native function with 3 arguments
select conv(255, 10, 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255 AS p1, 10, 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255 p1, 10, 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255 AS "p1", 10, 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255 "p1", 10, 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10 AS p2, 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10 p2, 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10 AS "p2", 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10 "p2", 16);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10, 16 AS p3);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10, 16 p3);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10, 16 AS "p3");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255, 10, 16 "p3");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select conv(255 AS p1, 10 AS p2, 16 AS p3);
# Native function with a variable number of arguments
select atan(10);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 AS p1);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 p1);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 AS "p1");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 "p1");
select atan(10, 20);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 AS p1, 20);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 p1, 20);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 AS "p1", 20);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 "p1", 20);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10, 20 AS p2);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10, 20 p2);
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10, 20 AS "p2");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10, 20 "p2");
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select atan(10 AS p1, 20 AS p2);
...@@ -196,3 +196,4 @@ INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t'); ...@@ -196,3 +196,4 @@ INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t');
SELECT a,(a + 0) FROM t1 ORDER BY a; SELECT a,(a + 0) FROM t1 ORDER BY a;
SELECT a,(a DIV 2) FROM t1 ORDER BY a; SELECT a,(a DIV 2) FROM t1 ORDER BY a;
SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a; SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a;
DROP TABLE t1;
...@@ -149,9 +149,9 @@ EXPLAIN EXTENDED SELECT myfunc_int(a AS attr_name) FROM t1; ...@@ -149,9 +149,9 @@ EXPLAIN EXTENDED SELECT myfunc_int(a AS attr_name) FROM t1;
EXPLAIN EXTENDED SELECT myfunc_int(a) FROM t1; EXPLAIN EXTENDED SELECT myfunc_int(a) FROM t1;
SELECT a,c FROM v1; SELECT a,c FROM v1;
--error ER_PARSE_ERROR --error ER_WRONG_PARAMETERS_TO_STORED_FCT
SELECT a, fn(MIN(b) xx) as c FROM t1 GROUP BY a; SELECT a, fn(MIN(b) xx) as c FROM t1 GROUP BY a;
--error ER_PARSE_ERROR --error ER_WRONG_PARAMETERS_TO_STORED_FCT
SELECT myfunc_int(fn(MIN(b) xx)) as c FROM t1 GROUP BY a; SELECT myfunc_int(fn(MIN(b) xx)) as c FROM t1 GROUP BY a;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
SELECT myfunc_int(test.fn(MIN(b) xx)) as c FROM t1 GROUP BY a; SELECT myfunc_int(test.fn(MIN(b) xx)) as c FROM t1 GROUP BY a;
...@@ -173,6 +173,22 @@ DROP FUNCTION fn; ...@@ -173,6 +173,22 @@ DROP FUNCTION fn;
--echo End of 5.0 tests. --echo End of 5.0 tests.
#
# Bug#24736: UDF functions parsed as Stored Functions
#
select myfunc_double(3);
select myfunc_double(3 AS three);
select myfunc_double(abs(3));
select myfunc_double(abs(3) AS named_param);
select abs(myfunc_double(3));
select abs(myfunc_double(3 AS three));
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select myfunc_double(abs(3 AS wrong));
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
select abs(myfunc_double(3) AS wrong);
# #
# BUG#18239: Possible to overload internal functions with stored functions # BUG#18239: Possible to overload internal functions with stored functions
# #
......
This diff is collapsed.
...@@ -897,7 +897,8 @@ void Item_func_signed::print(String *str) ...@@ -897,7 +897,8 @@ void Item_func_signed::print(String *str)
longlong Item_func_signed::val_int_from_str(int *error) longlong Item_func_signed::val_int_from_str(int *error)
{ {
char buff[MAX_FIELD_WIDTH], *end; char buff[MAX_FIELD_WIDTH], *end, *start;
uint32 length;
String tmp(buff,sizeof(buff), &my_charset_bin), *res; String tmp(buff,sizeof(buff), &my_charset_bin), *res;
longlong value; longlong value;
...@@ -913,13 +914,21 @@ longlong Item_func_signed::val_int_from_str(int *error) ...@@ -913,13 +914,21 @@ longlong Item_func_signed::val_int_from_str(int *error)
return 0; return 0;
} }
null_value= 0; null_value= 0;
end= (char*) res->ptr()+ res->length(); start= (char *)res->ptr();
value= my_strtoll10(res->ptr(), &end, error); length= res->length();
if (*error > 0 || end != res->ptr()+ res->length())
end= start + length;
value= my_strtoll10(start, &end, error);
if (*error > 0 || end != start+ length)
{
char err_buff[128];
String err_tmp(err_buff,(uint32) sizeof(err_buff), system_charset_info);
err_tmp.copy(start, length, system_charset_info);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE, ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER", ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER",
res->c_ptr()); err_tmp.c_ptr());
}
return value; return value;
} }
......
...@@ -6010,6 +6010,8 @@ ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 42000 ...@@ -6010,6 +6010,8 @@ ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 42000
eng "Incorrect parameter count in the call to native function '%-.64s'" eng "Incorrect parameter count in the call to native function '%-.64s'"
ER_WRONG_PARAMETERS_TO_NATIVE_FCT 42000 ER_WRONG_PARAMETERS_TO_NATIVE_FCT 42000
eng "Incorrect parameters in the call to native function '%-.64s'" eng "Incorrect parameters in the call to native function '%-.64s'"
ER_WRONG_PARAMETERS_TO_STORED_FCT 42000
eng "Incorrect parameters in the call to stored function '%-.64s'"
ER_NATIVE_FCT_NAME_COLLISION ER_NATIVE_FCT_NAME_COLLISION
eng "This function '%-.64s' has the same name as a native function." eng "This function '%-.64s' has the same name as a native function."
ER_BINLOG_PURGE_EMFILE ER_BINLOG_PURGE_EMFILE
......
...@@ -164,7 +164,6 @@ void lex_start(THD *thd, const uchar *buf, uint length) ...@@ -164,7 +164,6 @@ void lex_start(THD *thd, const uchar *buf, uint length)
lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc; lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc;
lex->select_lex.group_list.empty(); lex->select_lex.group_list.empty();
lex->select_lex.order_list.empty(); lex->select_lex.order_list.empty();
lex->select_lex.udf_list.empty();
lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE); lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
lex->sql_command= SQLCOM_END; lex->sql_command= SQLCOM_END;
lex->duplicates= DUP_ERROR; lex->duplicates= DUP_ERROR;
...@@ -1182,7 +1181,6 @@ void st_select_lex::init_select() ...@@ -1182,7 +1181,6 @@ void st_select_lex::init_select()
braces= 0; braces= 0;
when_list.empty(); when_list.empty();
expr_list.empty(); expr_list.empty();
udf_list.empty();
interval_list.empty(); interval_list.empty();
use_index.empty(); use_index.empty();
ftfunc_list_alloc.empty(); ftfunc_list_alloc.empty();
......
...@@ -609,8 +609,6 @@ class st_select_lex: public st_select_lex_node ...@@ -609,8 +609,6 @@ class st_select_lex: public st_select_lex_node
/* exclude this select from check of unique_table() */ /* exclude this select from check of unique_table() */
bool exclude_from_table_unique_test; bool exclude_from_table_unique_test;
List<udf_func> udf_list; /* udf function calls stack */
void init_query(); void init_query();
void init_select(); void init_select();
st_select_lex_unit* master_unit(); st_select_lex_unit* master_unit();
......
...@@ -6426,7 +6426,7 @@ function_call_generic: ...@@ -6426,7 +6426,7 @@ function_call_generic:
} }
} }
/* Temporary placing the result of find_udf in $3 */ /* Temporary placing the result of find_udf in $3 */
lex->current_select->udf_list.push_front(udf); $<udf>$= udf;
#endif #endif
} }
udf_expr_list ')' udf_expr_list ')'
...@@ -6454,10 +6454,10 @@ function_call_generic: ...@@ -6454,10 +6454,10 @@ function_call_generic:
{ {
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
/* Retrieving the result of find_udf */ /* Retrieving the result of find_udf */
udf_func *udf; udf_func *udf= $<udf>3;
LEX *lex= Lex; LEX *lex= Lex;
if (NULL != (udf= lex->current_select->udf_list.pop())) if (udf)
{ {
if (udf->type == UDFTYPE_AGGREGATE) if (udf->type == UDFTYPE_AGGREGATE)
{ {
...@@ -6553,7 +6553,6 @@ udf_expr_list3: ...@@ -6553,7 +6553,6 @@ udf_expr_list3:
udf_expr: udf_expr:
remember_name expr remember_end select_alias remember_name expr remember_end select_alias
{ {
udf_func *udf= Select->udf_list.head();
/* /*
Use Item::name as a storage for the attribute value of user Use Item::name as a storage for the attribute value of user
defined function argument. It is safe to use Item::name defined function argument. It is safe to use Item::name
...@@ -6562,20 +6561,10 @@ udf_expr: ...@@ -6562,20 +6561,10 @@ udf_expr:
*/ */
if ($4.str) if ($4.str)
{ {
if (!udf)
{
/*
Disallow using AS to specify explicit names for the arguments
of stored routine calls
*/
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
$2->is_autogenerated_name= FALSE; $2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info); $2->set_name($4.str, $4.length, system_charset_info);
} }
else if (udf) else
$2->set_name($1, (uint) ($3 - $1), YYTHD->charset()); $2->set_name($1, (uint) ($3 - $1), YYTHD->charset());
$$= $2; $$= $2;
} }
......
...@@ -51,7 +51,7 @@ File_class::size(FILE* f) ...@@ -51,7 +51,7 @@ File_class::size(FILE* f)
MY_STAT s; MY_STAT s;
// Note that my_fstat behaves *differently* than my_stat. ARGGGHH! // Note that my_fstat behaves *differently* than my_stat. ARGGGHH!
if(my_fstat(::fileno(f), &s, MYF(0))) if (my_fstat(fileno(f), &s, MYF(0)))
return 0; return 0;
return s.st_size; return s.st_size;
......
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