Commit 384407aa authored by unknown's avatar unknown
Browse files

Bug#21114 (Foreign key creation fails to table with name format)

Due to the complexity of this change, everything is documented in WL#3565

This patch is the third iteration, it takes into account the comments
received to date.


mysql-test/r/func_math.result:
  Improved test coverage
mysql-test/r/view.result:
  Name collision, x() is a geometry native in function
mysql-test/t/func_math.test:
  Improved test coverage
mysql-test/t/view.test:
  Name collision, x() is a geometry native in function
sql/item_create.cc:
  Revised the create_func implementation
sql/item_create.h:
  Revised the create_func implementation
sql/item_geofunc.h:
  Explicit Item allocation in the thread memory pool.
sql/lex.h:
  Removed function parsing from the lexical parser
sql/lex_symbol.h:
  Removed function parsing from the lexical parser
sql/mysql_priv.h:
  Server initialization and shutdown
sql/mysqld.cc:
  Server initialization and shutdown
sql/share/errmsg.txt:
  New error messages
sql/sql_yacc.yy:
  Removed function parsing from the lexical parser
tests/mysql_client_test.c:
  Spaces are no longer significant for function calls
mysql-test/include/parser_bug21114.inc:
  New tests
mysql-test/r/parser.result:
  New tests
mysql-test/r/parser_bug21114_innodb.result:
  New tests
mysql-test/t/parser.test:
  New tests
mysql-test/t/parser_bug21114_innodb.test:
  New tests
parent 83d5beec
Loading
Loading
Loading
Loading
+59 −0
Original line number Diff line number Diff line
#
# Bug#21114 (Foreign key creation fails to table with name format)
#
# Trying to trick the parser into thinking $FCT(...) is a function call,
# which is not in the CREATE TABLE and FOREIGN KEY ... REFERENCES syntax
#
# Usage :
#
# let $engine_type=InnoDb;
# let $verbose=1;
# let $FCT= <value_1>;
# -- source parser_stress_func.inc
# let $FCT= <value_2>;
# -- source parser_stress_func.inc
# let $verbose=0;
# let $FCT= <value_3>;
# -- source parser_stress_func.inc
# let $FCT= <value_4>;
# -- source parser_stress_func.inc

-- disable_warnings
eval drop table if exists $FCT;
drop table if exists bug21114_child;
-- enable_warnings

--disable_query_log
--disable_result_log

eval CREATE TABLE $FCT(
  col1 int not null,
  col2 int not null,
  col3 varchar(10),
  CONSTRAINT pk PRIMARY KEY (col1, col2)
) ENGINE $engine_type;

eval CREATE TABLE bug21114_child(
  pk int not null,
  fk_col1 int not null,
  fk_col2 int not null,
  fk_col3 int not null,
  fk_col4 int not null,
  CONSTRAINT fk_fct FOREIGN KEY (fk_col1, fk_col2)
    REFERENCES $FCT(col1, col2),
  CONSTRAINT fk_fct_space FOREIGN KEY (fk_col3, fk_col4)
    REFERENCES $FCT (col1, col2)
) ENGINE $engine_type;

--enable_query_log
--enable_result_log

if ($verbose)
{
  eval SHOW CREATE TABLE $FCT;
  SHOW CREATE TABLE bug21114_child;
}

DROP TABLE bug21114_child;
eval DROP TABLE $FCT;
+12 −0
Original line number Diff line number Diff line
@@ -102,6 +102,18 @@ Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2)
select degrees(pi()),radians(360);
degrees(pi())	radians(360)
180	6.2831853071796
select format(atan(-2, 2), 6);
format(atan(-2, 2), 6)
-0.785398
select format(atan(pi(), 0), 6);
format(atan(pi(), 0), 6)
1.570796
select format(atan2(-2, 2), 6);
format(atan2(-2, 2), 6)
-0.785398
select format(atan2(pi(), 0), 6);
format(atan2(pi(), 0), 6)
1.570796
SELECT ACOS(1.0);
ACOS(1.0)
0
+388 −0

File added.

Preview size limit exceeded, changes collapsed.

+867 −0

File added.

Preview size limit exceeded, changes collapsed.

+4 −4
Original line number Diff line number Diff line
@@ -791,13 +791,13 @@ test.`f``1` ()
5
drop view v1;
drop function `f``1`;
create function x () returns int return 5;
create view v1 as select x ();
create function a() returns int return 5;
create view v1 as select a();
select * from v1;
x ()
a()
5
drop view v1;
drop function x;
drop function a;
create table t2 (col1 char collate latin1_german2_ci);
create view v2 as select col1 collate latin1_german1_ci from t2;
show create view v2;
Loading