Skip to content

Commit 62c242c

Browse files
author
malff/marcsql@weblab.(none)
committed
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.
1 parent e2d8d52 commit 62c242c

19 files changed

+7756
-1591
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#
2+
# Bug#21114 (Foreign key creation fails to table with name format)
3+
#
4+
# Trying to trick the parser into thinking $FCT(...) is a function call,
5+
# which is not in the CREATE TABLE and FOREIGN KEY ... REFERENCES syntax
6+
#
7+
# Usage :
8+
#
9+
# let $engine_type=InnoDb;
10+
# let $verbose=1;
11+
# let $FCT= <value_1>;
12+
# -- source parser_stress_func.inc
13+
# let $FCT= <value_2>;
14+
# -- source parser_stress_func.inc
15+
# let $verbose=0;
16+
# let $FCT= <value_3>;
17+
# -- source parser_stress_func.inc
18+
# let $FCT= <value_4>;
19+
# -- source parser_stress_func.inc
20+
21+
-- disable_warnings
22+
eval drop table if exists $FCT;
23+
drop table if exists bug21114_child;
24+
-- enable_warnings
25+
26+
--disable_query_log
27+
--disable_result_log
28+
29+
eval CREATE TABLE $FCT(
30+
col1 int not null,
31+
col2 int not null,
32+
col3 varchar(10),
33+
CONSTRAINT pk PRIMARY KEY (col1, col2)
34+
) ENGINE $engine_type;
35+
36+
eval CREATE TABLE bug21114_child(
37+
pk int not null,
38+
fk_col1 int not null,
39+
fk_col2 int not null,
40+
fk_col3 int not null,
41+
fk_col4 int not null,
42+
CONSTRAINT fk_fct FOREIGN KEY (fk_col1, fk_col2)
43+
REFERENCES $FCT(col1, col2),
44+
CONSTRAINT fk_fct_space FOREIGN KEY (fk_col3, fk_col4)
45+
REFERENCES $FCT (col1, col2)
46+
) ENGINE $engine_type;
47+
48+
--enable_query_log
49+
--enable_result_log
50+
51+
if ($verbose)
52+
{
53+
eval SHOW CREATE TABLE $FCT;
54+
SHOW CREATE TABLE bug21114_child;
55+
}
56+
57+
DROP TABLE bug21114_child;
58+
eval DROP TABLE $FCT;
59+

mysql-test/r/func_math.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2)
102102
select degrees(pi()),radians(360);
103103
degrees(pi()) radians(360)
104104
180 6.2831853071796
105+
select format(atan(-2, 2), 6);
106+
format(atan(-2, 2), 6)
107+
-0.785398
108+
select format(atan(pi(), 0), 6);
109+
format(atan(pi(), 0), 6)
110+
1.570796
111+
select format(atan2(-2, 2), 6);
112+
format(atan2(-2, 2), 6)
113+
-0.785398
114+
select format(atan2(pi(), 0), 6);
115+
format(atan2(pi(), 0), 6)
116+
1.570796
105117
SELECT ACOS(1.0);
106118
ACOS(1.0)
107119
0

mysql-test/r/parser.result

Lines changed: 388 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)