2006-11-02 19:01:53 +01:00
|
|
|
#
|
|
|
|
# This file contains tests covering the parser
|
|
|
|
#
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# LEXICAL PARSER (lex)
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
SET @save_sql_mode=@@sql_mode;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Documenting the current behavior, to detect incompatible changes.
|
|
|
|
# In each cases:
|
|
|
|
# - no error is the correct result
|
|
|
|
# - an error is the expected result with the current implementation,
|
|
|
|
# and is a limitation.
|
|
|
|
|
|
|
|
set SQL_MODE='';
|
|
|
|
|
|
|
|
create table ADDDATE(a int);
|
|
|
|
drop table ADDDATE;
|
|
|
|
create table ADDDATE (a int);
|
|
|
|
drop table ADDDATE;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_AND(a int);
|
|
|
|
create table BIT_AND (a int);
|
|
|
|
drop table BIT_AND;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_OR(a int);
|
|
|
|
create table BIT_OR (a int);
|
|
|
|
drop table BIT_OR;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_XOR(a int);
|
|
|
|
create table BIT_XOR (a int);
|
|
|
|
drop table BIT_XOR;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CAST(a int);
|
|
|
|
create table CAST (a int);
|
|
|
|
drop table CAST;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table COUNT(a int);
|
|
|
|
create table COUNT (a int);
|
|
|
|
drop table COUNT;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CURDATE(a int);
|
|
|
|
create table CURDATE (a int);
|
|
|
|
drop table CURDATE;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CURTIME(a int);
|
|
|
|
create table CURTIME (a int);
|
|
|
|
drop table CURTIME;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table DATE_ADD(a int);
|
|
|
|
create table DATE_ADD (a int);
|
|
|
|
drop table DATE_ADD;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table DATE_SUB(a int);
|
|
|
|
create table DATE_SUB (a int);
|
|
|
|
drop table DATE_SUB;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table EXTRACT(a int);
|
|
|
|
create table EXTRACT (a int);
|
|
|
|
drop table EXTRACT;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table GROUP_CONCAT(a int);
|
|
|
|
create table GROUP_CONCAT (a int);
|
|
|
|
drop table GROUP_CONCAT;
|
|
|
|
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
# Limitation removed in 5.1
|
2006-11-02 19:01:53 +01:00
|
|
|
create table GROUP_UNIQUE_USERS(a int);
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
drop table GROUP_UNIQUE_USERS;
|
2006-11-02 19:01:53 +01:00
|
|
|
create table GROUP_UNIQUE_USERS (a int);
|
|
|
|
drop table GROUP_UNIQUE_USERS;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MAX(a int);
|
|
|
|
create table MAX (a int);
|
|
|
|
drop table MAX;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MID(a int);
|
|
|
|
create table MID (a int);
|
|
|
|
drop table MID;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MIN(a int);
|
|
|
|
create table MIN (a int);
|
|
|
|
drop table MIN;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table NOW(a int);
|
|
|
|
create table NOW (a int);
|
|
|
|
drop table NOW;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table POSITION(a int);
|
|
|
|
create table POSITION (a int);
|
|
|
|
drop table POSITION;
|
|
|
|
|
|
|
|
create table SESSION_USER(a int);
|
|
|
|
drop table SESSION_USER;
|
|
|
|
create table SESSION_USER (a int);
|
|
|
|
drop table SESSION_USER;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STD(a int);
|
|
|
|
create table STD (a int);
|
|
|
|
drop table STD;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV(a int);
|
|
|
|
create table STDDEV (a int);
|
|
|
|
drop table STDDEV;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV_POP(a int);
|
|
|
|
create table STDDEV_POP (a int);
|
|
|
|
drop table STDDEV_POP;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV_SAMP(a int);
|
|
|
|
create table STDDEV_SAMP (a int);
|
|
|
|
drop table STDDEV_SAMP;
|
|
|
|
|
|
|
|
create table SUBDATE(a int);
|
|
|
|
drop table SUBDATE;
|
|
|
|
create table SUBDATE (a int);
|
|
|
|
drop table SUBDATE;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUBSTR(a int);
|
|
|
|
create table SUBSTR (a int);
|
|
|
|
drop table SUBSTR;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUBSTRING(a int);
|
|
|
|
create table SUBSTRING (a int);
|
|
|
|
drop table SUBSTRING;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUM(a int);
|
|
|
|
create table SUM (a int);
|
|
|
|
drop table SUM;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SYSDATE(a int);
|
|
|
|
create table SYSDATE (a int);
|
|
|
|
drop table SYSDATE;
|
|
|
|
|
|
|
|
create table SYSTEM_USER(a int);
|
|
|
|
drop table SYSTEM_USER;
|
|
|
|
create table SYSTEM_USER (a int);
|
|
|
|
drop table SYSTEM_USER;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table TRIM(a int);
|
|
|
|
create table TRIM (a int);
|
|
|
|
drop table TRIM;
|
|
|
|
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
# Limitation removed in 5.1
|
2006-11-02 19:01:53 +01:00
|
|
|
create table UNIQUE_USERS(a int);
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
drop table UNIQUE_USERS;
|
2006-11-02 19:01:53 +01:00
|
|
|
create table UNIQUE_USERS (a int);
|
|
|
|
drop table UNIQUE_USERS;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VARIANCE(a int);
|
|
|
|
create table VARIANCE (a int);
|
|
|
|
drop table VARIANCE;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VAR_POP(a int);
|
|
|
|
create table VAR_POP (a int);
|
|
|
|
drop table VAR_POP;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VAR_SAMP(a int);
|
|
|
|
create table VAR_SAMP (a int);
|
|
|
|
drop table VAR_SAMP;
|
|
|
|
|
|
|
|
set SQL_MODE='IGNORE_SPACE';
|
|
|
|
|
|
|
|
create table ADDDATE(a int);
|
|
|
|
drop table ADDDATE;
|
|
|
|
create table ADDDATE (a int);
|
|
|
|
drop table ADDDATE;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_AND(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_AND (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_OR(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_OR (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_XOR(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table BIT_XOR (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CAST(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CAST (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table COUNT(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table COUNT (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CURDATE(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CURDATE (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CURTIME(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table CURTIME (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table DATE_ADD(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table DATE_ADD (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table DATE_SUB(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table DATE_SUB (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table EXTRACT(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table EXTRACT (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table GROUP_CONCAT(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table GROUP_CONCAT (a int);
|
|
|
|
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
# Limitation removed in 5.1
|
2006-11-02 19:01:53 +01:00
|
|
|
create table GROUP_UNIQUE_USERS(a int);
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
drop table GROUP_UNIQUE_USERS;
|
2006-11-02 19:01:53 +01:00
|
|
|
create table GROUP_UNIQUE_USERS (a int);
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
drop table GROUP_UNIQUE_USERS;
|
2006-11-02 19:01:53 +01:00
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MAX(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MAX (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MID(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MID (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MIN(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table MIN (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table NOW(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table NOW (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table POSITION(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table POSITION (a int);
|
|
|
|
|
|
|
|
create table SESSION_USER(a int);
|
|
|
|
drop table SESSION_USER;
|
|
|
|
create table SESSION_USER (a int);
|
|
|
|
drop table SESSION_USER;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STD(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STD (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV_POP(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV_POP (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV_SAMP(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table STDDEV_SAMP (a int);
|
|
|
|
|
|
|
|
create table SUBDATE(a int);
|
|
|
|
drop table SUBDATE;
|
|
|
|
create table SUBDATE (a int);
|
|
|
|
drop table SUBDATE;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUBSTR(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUBSTR (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUBSTRING(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUBSTRING (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUM(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SUM (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SYSDATE(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table SYSDATE (a int);
|
|
|
|
|
|
|
|
create table SYSTEM_USER(a int);
|
|
|
|
drop table SYSTEM_USER;
|
|
|
|
create table SYSTEM_USER (a int);
|
|
|
|
drop table SYSTEM_USER;
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table TRIM(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table TRIM (a int);
|
|
|
|
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
# Limitation removed in 5.1
|
2006-11-02 19:01:53 +01:00
|
|
|
create table UNIQUE_USERS(a int);
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
drop table UNIQUE_USERS;
|
2006-11-02 19:01:53 +01:00
|
|
|
create table UNIQUE_USERS (a int);
|
Bug#22687 (Functions UNIQUE_USERS, GROUP_UNIQUE_USERS)
According to some internal communication, these two functions are place
holders for future enhancements. Because they use a variable number of
parameters, the implementation defined a reserved keyword for them in the
parser grammar.
Unfortunately, doing so creates a bug similar to Bug 21114 reported for the
function FORMAT.
In the 5.1 code base, due to improvements in the code implemented with bug
21114, having a reserved keyword for functions with a variable number of
arguments is not needed any more by the implementation.
As a result, this fix removes the place-holder implementation, and removes
the unnecessary reserved keywords. Should the functions UNIQUE_USERS and
GROUP_UNIQUE_USERS be finally implemented in a later release, the
implementation should sub class Create_native_func in sql/item_create.cc.
For example, see the class Create_func_concat.
BitKeeper/deleted/.del-item_uniq.cc:
Rename: sql/item_uniq.cc -> BitKeeper/deleted/.del-item_uniq.cc
BitKeeper/deleted/.del-item_uniq.h:
Rename: sql/item_uniq.h -> BitKeeper/deleted/.del-item_uniq.h
libmysqld/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/r/parser.result:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
mysql-test/t/parser.test:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/Makefile.am:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/item_sum.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/lex.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/mysql_priv.h:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
sql/sql_yacc.yy:
Remove native functions UNIQUE_USERS() and GROUP_UNIQUE_USERS().
2007-01-11 22:58:05 +01:00
|
|
|
drop table UNIQUE_USERS;
|
2006-11-02 19:01:53 +01:00
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VARIANCE(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VARIANCE (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VAR_POP(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VAR_POP (a int);
|
|
|
|
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VAR_SAMP(a int);
|
|
|
|
--error ER_PARSE_ERROR
|
|
|
|
create table VAR_SAMP (a int);
|
|
|
|
|
2007-08-10 01:31:00 +02:00
|
|
|
#
|
|
|
|
# Bug#25930 (CREATE TABLE x SELECT ... parses columns wrong when ran with
|
|
|
|
# ANSI_QUOTES mode)
|
|
|
|
#
|
|
|
|
|
|
|
|
--disable_warnings
|
|
|
|
DROP TABLE IF EXISTS table_25930_a;
|
|
|
|
DROP TABLE IF EXISTS table_25930_b;
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
SET SQL_MODE = 'ANSI_QUOTES';
|
|
|
|
CREATE TABLE table_25930_a ( "blah" INT );
|
|
|
|
CREATE TABLE table_25930_b SELECT "blah" - 1 FROM table_25930_a;
|
|
|
|
|
|
|
|
# The lexer used to chop the first <">,
|
|
|
|
# not marking the start of the token "blah" correctly.
|
|
|
|
desc table_25930_b;
|
|
|
|
|
|
|
|
DROP TABLE table_25930_a;
|
|
|
|
DROP TABLE table_25930_b;
|
|
|
|
|
|
|
|
|
2006-11-02 19:01:53 +01:00
|
|
|
SET @@sql_mode=@save_sql_mode;
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# SYNTACTIC PARSER (bison)
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Bug#21114 (Foreign key creation fails to table with name format)
|
|
|
|
#
|
|
|
|
|
|
|
|
# Test coverage with edge conditions
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select pi(3.14);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select tan();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select tan(1, 2);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select makedate(1);
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select makedate(1, 2, 3);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select maketime();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select maketime(1);
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select maketime(1, 2);
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select maketime(1, 2, 3, 4);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select atan();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select atan2(1, 2, 3);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select concat();
|
|
|
|
select concat("foo");
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select concat_ws();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select concat_ws("foo");
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select encrypt();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select encrypt(1, 2, 3);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select des_encrypt("p1", "p2", "not expected");
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select des_decrypt("p1", "p2", "not expected");
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select elt();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select elt(1);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select export_set();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select export_set("p1");
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select export_set("p1", "p2");
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select export_set("p1", "p2", "p3", "p4", "p5", "p6");
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select field();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select field("p1");
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select from_unixtime();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select from_unixtime(1, 2, 3);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select unix_timestamp(1, 2);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select greatest();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select greatest(12);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select last_insert_id(1, 2);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select least();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select least(12);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select locate();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select locate(1);
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select locate(1, 2, 3, 4);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select log();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select log(1, 2, 3);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select make_set();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select make_set(1);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select master_pos_wait();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select master_pos_wait(1);
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select master_pos_wait(1, 2, 3, 4);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select rand(1, 2, 3);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select round(1, 2, 3);
|
|
|
|
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select yearweek();
|
|
|
|
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
|
|
select yearweek(1, 2, 3);
|
|
|
|
|
Bug#24736: UDF functions parsed as Stored Functions
Before this fix, a call to a User Defined Function (UDF) could,
under some circumstances, be interpreted as a call to a Stored function
instead. This occurred if a native function was invoked in the parameters
for the UDF, as in "select my_udf(abs(x))".
The root cause of this defect is the introduction, by the fix for Bug 21809,
of st_select_lex::udf_list, and it's usage in the parser in sql_yacc.yy
in the rule function_call_generic (in 5.1).
While the fix itself for Bug 21809 is correct in 5.0, the code change
merged into the 5.1 release created the issue, because the calls in 5.1 to :
- lex->current_select->udf_list.push_front(udf)
- lex->current_select->udf_list.pop()
are not balanced in case of native functions, causing the udf_list,
which is really a stack, to be out of sync with the internal stack
maintained by the bison parser.
Instead of moving the call to udf_list.pop(), which would have fixed the
symptom, this patch goes further and removes the need for udf_list.
This is motivated by two reasons:
a) Maintaining a stack in the MySQL code in sync with the stack maintained
internally in sql_yacc.cc (not .yy) is extremely dependent of the
implementation of yacc/bison, and extremely difficult to maintain.
It's also totally dependent of the structure of the grammar, and has a risk
to break with regression defects each time the grammar itself is changed.
b) The previous code did report construct like "foo(expr AS name)" as
syntax errors (ER_PARSER_ERROR), which is incorrect, and misleading.
The syntax is perfectly valid, as this expression is valid when "foo" is
a UDF. Whether this syntax is legal or not depends of the semantic of "foo".
With this change:
a) There is only one stack (in bison), and no List<udf_func> to maintain.
b) "foo(expr AS name)", when used incorrectly, is reported as semantic error:
- ER_WRONG_PARAMETERS_TO_NATIVE_FCT (for native functions)
- ER_WRONG_PARAMETERS_TO_STORED_FCT (for stored functions)
This is achieved by the changes implemented in item_create.cc
mysql-test/r/parser.result:
New tests
mysql-test/r/udf.result:
New tests
mysql-test/t/parser.test:
New tests
mysql-test/t/udf.test:
New tests
sql/item_create.cc:
Semantic checks for named parameters, as in "foo(expr AS name)".
sql/share/errmsg.txt:
New error message
sql/sql_lex.cc:
Remove usage of udf_list.
sql/sql_lex.h:
Remove usage of udf_list.
sql/sql_yacc.yy:
Remove usage of udf_list.
2006-12-02 03:16:03 +01:00
|
|
|
#
|
|
|
|
# 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);
|
|
|
|
|
2007-11-30 12:34:25 +01:00
|
|
|
#
|
|
|
|
# Bug#22312 Syntax error in expression with INTERVAL()
|
|
|
|
#
|
|
|
|
|
|
|
|
--disable_warnings
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
|
|
|
|
SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE;
|
|
|
|
SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
|
|
|
|
SELECT 1 + INTERVAL(1,0,1,2) + 1;
|
|
|
|
SELECT INTERVAL(1^1,0,1,2) + 1;
|
|
|
|
SELECT INTERVAL(1,0+1,2,3) * 5.5;
|
|
|
|
SELECT INTERVAL(3,3,1+3,4+4) / 0.5;
|
|
|
|
SELECT (INTERVAL(1,0,1,2) + 5) * 7 + INTERVAL(1,0,1,2) / 2;
|
|
|
|
SELECT INTERVAL(1,0,1,2) + 1, 5 * INTERVAL(1,0,1,2);
|
|
|
|
SELECT INTERVAL(0,(1*5)/2) + INTERVAL(5,4,3);
|
|
|
|
|
|
|
|
--disable_warnings
|
|
|
|
SELECT 1^1 + INTERVAL 1+1 SECOND & 1 + INTERVAL 1+1 SECOND;
|
|
|
|
SELECT 1%2 - INTERVAL 1^1 SECOND | 1%2 - INTERVAL 1^1 SECOND;
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
CREATE TABLE t1 (a INT, b DATETIME);
|
|
|
|
INSERT INTO t1 VALUES (INTERVAL(3,2,1) + 1, "1997-12-31 23:59:59" + INTERVAL 1 SECOND);
|
|
|
|
SELECT * FROM t1 WHERE a = INTERVAL(3,2,1) + 1;
|
|
|
|
DROP TABLE t1;
|