File: parser_bug21114.inc

package info (click to toggle)
mysql-5.5 5.5.47-0%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 201,920 kB
  • ctags: 94,437
  • sloc: cpp: 646,401; ansic: 551,652; perl: 53,254; pascal: 25,099; yacc: 13,069; sh: 10,332; cs: 4,647; xml: 4,178; sql: 3,346; makefile: 1,361; lex: 639; awk: 54
file content (59 lines) | stat: -rw-r--r-- 1,352 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# 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;