~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to conf/subquery_semijoin_nested.yy

initial import from internal tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
query:
 
2
        SELECT select_option grandparent_select_items
 
3
        FROM grandparent_from
 
4
        grandparent_where 
 
5
        grandparent_group_having_order_limit;
 
6
 
 
7
grandparent_select_items:
 
8
        grandparent_select_item;
 
9
 
 
10
grandparent_select_item:
 
11
        GRANDPARENT1 . field_name AS G1;
 
12
 
 
13
grandparent_from:
 
14
        table_name AS GRANDPARENT1 |
 
15
        table_name AS GRANDPARENT1 LEFT JOIN table_name AS GRANDPARENT2 USING ( field_name ) |
 
16
        table_name AS GRANDPARENT1 LEFT JOIN table_name AS GRANDPARENT2 ON ( grandparent_join_condition );
 
17
 
 
18
grandparent_join_condition:
 
19
        GRANDPARENT2 . int_field_name arithmetic_operator GRANDPARENT1 . int_field_name |
 
20
        GRANDPARENT2 . date_field_name arithmetic_operator GRANDPARENT1 . date_field_name |
 
21
        GRANDPARENT2 . char_field_name arithmetic_operator GRANDPARENT1 . char_field_name ;
 
22
 
 
23
grandparent_where:
 
24
        WHERE grandparent_subquery_expr AND grandparent_condition ;
 
25
 
 
26
grandparent_subquery_expr:
 
27
        GRANDPARENT1 . int_field_name IN ( SELECT select_option PARENT1 . int_field_name AS P1 parent_select_body ) |
 
28
        GRANDPARENT1 . char_field_name IN ( SELECT select_option PARENT1 . char_field_name AS P1 parent_select_body ) |
 
29
        ( GRANDPARENT1 . int_field_name , GRANDPARENT1 . int_field_name ) IN ( SELECT select_option PARENT1 . int_field_name AS P1 , PARENT1 . int_field_name AS P2 parent_select_body ) |
 
30
        ( GRANDPARENT1 . char_field_name , GRANDPARENT1 . char_field_name ) IN ( SELECT select_option PARENT1 . char_field_name AS P1 , PARENT1 . char_field_name AS P2 parent_select_body ) ;
 
31
 
 
32
grandparent_group_having_order_limit:
 
33
        grandparent_group_by grandparent_having grandparent_order_by grandparent_limit |
 
34
        grandparent_group_by grandparent_having grandparent_limit |
 
35
        grandparent_having grandparent_order_by grandparent_limit |
 
36
        grandparent_having ;
 
37
 
 
38
grandparent_group_by:
 
39
        GROUP BY GRANDPARENT1 . field_name ;
 
40
 
 
41
grandparent_order_by:
 
42
        ORDER BY GRANDPARENT1 . field_name ;
 
43
 
 
44
grandparent_having:
 
45
        | HAVING G1 arithmetic_operator value;
 
46
 
 
47
grandparent_limit:
 
48
        | LIMIT digit ;
 
49
 
 
50
parent_select_body:
 
51
        FROM parent_from
 
52
        parent_where
 
53
        parent_order_by;
 
54
 
 
55
parent_from:
 
56
        table_name AS PARENT1 |
 
57
        table_name AS PARENT1 LEFT JOIN table_name AS PARENT2 USING ( field_name ) |
 
58
        table_name AS PARENT1 LEFT JOIN table_name AS PARENT2 ON ( parent_join_condition ) ;
 
59
 
 
60
parent_join_condition:
 
61
        PARENT1 . int_field_name arithmetic_operator PARENT2 . int_field_name |
 
62
        PARENT1 . char_field_name arithmetic_operator PARENT2 . char_field_name ;
 
63
 
 
64
parent_where:
 
65
        | WHERE parent_subquery_expr AND parent_condition
 
66
        | WHERE parent_condition ;
 
67
 
 
68
parent_order_by:
 
69
        | ORDER BY PARENT1 . field_name ;
 
70
 
 
71
parent_subquery_expr:
 
72
        PARENT1 . int_field_name IN ( SELECT select_option CHILD1 . int_field_name AS C1 child_select_body ) |
 
73
        GRANDPARENT1 . int_field_name IN ( SELECT select_option CHILD1 . int_field_name AS C1 child_select_body ) |
 
74
 
 
75
        PARENT1 . char_field_name IN ( SELECT select_option CHILD1 . char_field_name AS C1 child_select_body ) |
 
76
        GRANDPARENT1 . char_field_name IN ( SELECT select_option CHILD1 . char_field_name AS C1 child_select_body ) |
 
77
 
 
78
        ( PARENT1 . int_field_name , PARENT1 . int_field_name ) IN ( SELECT select_option CHILD1 . int_field_name AS C1 , CHILD1 . int_field_name AS C2 child_select_body ) |
 
79
        ( PARENT1 . int_field_name , GRANDPARENT1 . int_field_name ) IN ( SELECT select_option CHILD1 . int_field_name AS C1 , CHILD1 . int_field_name AS C2 child_select_body ) |
 
80
 
 
81
        ( PARENT1 . char_field_name , PARENT1 . char_field_name ) IN ( SELECT select_option CHILD1 . char_field_name AS C1 , CHILD1 . char_field_name AS C2 child_select_body ) ;
 
82
        ( PARENT1 . char_field_name , GRANDPARENT1 . char_field_name ) IN ( SELECT select_option CHILD1 . char_field_name AS C1 , CHILD1 . char_field_name AS C2 child_select_body ) ;
 
83
 
 
84
        ( PARENT1 . char_field_name , PARENT1 . char_field_name ) IN ( SELECT select_option CHILD1 . char_field_name AS C1 , CHILD1 . char_field_name AS C2 child_select_body ) ;
 
85
        ( PARENT1 . int_field_name , PARENT1 . int_field_name ) IN ( SELECT select_option CHILD1 . int_field_name AS C1 , CHILD1 . int_field_name AS C2 child_select_body ) ;
 
86
 
 
87
child_select_body:
 
88
        FROM child_from
 
89
        child_where
 
90
        child_order_by;
 
91
 
 
92
child_from:
 
93
        table_name AS CHILD1 |
 
94
        table_name AS CHILD1 LEFT JOIN table_name AS CHILD2 USING ( field_name ) |
 
95
        table_name AS CHILD1 LEFT JOIN table_name AS CHILD2 ON ( child_join_condition ) ;
 
96
 
 
97
child_join_condition:
 
98
        CHILD1 . int_field_name arithmetic_operator CHILD2 . int_field_name |
 
99
        CHILD1 . char_field_name arithmetic_operator CHILD2 . char_field_name ;
 
100
 
 
101
child_where:
 
102
        | WHERE child_condition ;
 
103
 
 
104
child_order_by:
 
105
        | ORDER BY CHILD1 . field_name ;
 
106
 
 
107
child_condition:
 
108
        ( GRANDPARENT1 . expression ) |
 
109
        ( PARENT1 . expression ) |
 
110
        ( CHILD1 . expression ) |
 
111
        ( child_condition_bottom logical_operator child_condition ) |
 
112
        ( child_condition_bottom logical_operator parent_condition ) |
 
113
        ( child_condition_bottom logical_operator grandparent_condition ) ;
 
114
 
 
115
child_condition_bottom:
 
116
 
 
117
        ( CHILD1 . expression ) |
 
118
 
 
119
        ( CHILD1 . int_field_name arithmetic_operator CHILD1 . int_field_name ) |
 
120
        ( CHILD1 . date_field_name arithmetic_operator CHILD1 . date_field_name ) |
 
121
        ( CHILD1 . char_field_name arithmetic_operator CHILD1 . char_field_name ) |
 
122
 
 
123
        ( CHILD1 . int_field_name arithmetic_operator PARENT1 . int_field_name ) |
 
124
        ( CHILD1 . date_field_name arithmetic_operator PARENT1 . date_field_name ) |
 
125
        ( CHILD1 . char_field_name arithmetic_operator PARENT1 . char_field_name ) |
 
126
 
 
127
        ( CHILD1 . int_field_name arithmetic_operator GRANDPARENT1 . int_field_name ) |
 
128
        ( CHILD1 . date_field_name arithmetic_operator GRANDPARENT1 . date_field_name ) |
 
129
        ( CHILD1 . char_field_name arithmetic_operator GRANDPARENT1 . char_field_name ) ;
 
130
 
 
131
grandparent_condition:
 
132
        grandparent_condition_bottom |
 
133
        ( grandparent_condition logical_operator grandparent_condition_bottom ) ;
 
134
 
 
135
grandparent_condition_bottom:
 
136
        GRANDPARENT1 . expression ;
 
137
        
 
138
expression:
 
139
        field_name null_operator |
 
140
        int_field_name int_expression |
 
141
        date_field_name date_expression |
 
142
        char_field_name char_expression ;
 
143
 
 
144
int_expression:
 
145
        arithmetic_operator digit ;
 
146
 
 
147
date_expression:
 
148
        arithmetic_operator date | BETWEEN date AND date;
 
149
 
 
150
char_expression:
 
151
        arithmetic_operator _varchar(1);
 
152
 
 
153
parent_condition:
 
154
        ( GRANDPARENT1 . expression ) |
 
155
        ( PARENT1 . expression ) |
 
156
        ( parent_condition_bottom logical_operator parent_condition ) |
 
157
        ( parent_condition_bottom logical_operator grandparent_condition ) ;
 
158
 
 
159
parent_condition_bottom:
 
160
        ( PARENT1 . expression ) |
 
161
 
 
162
        ( PARENT1 . int_field_name arithmetic_operator PARENT1 . int_field_name ) |
 
163
        ( PARENT1 . date_field_name arithmetic_operator PARENT1 . date_field_name ) |
 
164
        ( PARENT1 . char_field_name arithmetic_operator PARENT1 . char_field_name ) |
 
165
 
 
166
        ( PARENT1 . int_field_name arithmetic_operator GRANDPARENT1 . int_field_name ) |
 
167
        ( PARENT1 . date_field_name arithmetic_operator GRANDPARENT1 . date_field_name ) |
 
168
        ( PARENT1 . char_field_name arithmetic_operator GRANDPARENT1 . char_field_name ) ;
 
169
 
 
170
null_operator: IS NULL | IS NOT NULL | IS UNKNOWN ;
 
171
 
 
172
logical_operator:
 
173
        AND | OR | OR NOT;
 
174
 
 
175
arithmetic_operator: = | > | < | <> | >= | <= ;
 
176
 
 
177
field_name:
 
178
        int_field_name | char_field_name | date_field_name;
 
179
 
 
180
int_field_name:
 
181
        `pk` | `int_key` | `int_nokey` ;
 
182
 
 
183
date_field_name:
 
184
        `date_key` | `date_nokey` | `datetime_key` | `datetime_nokey` | `time_key` | `time_nokey` ;
 
185
 
 
186
char_field_name:
 
187
        `varchar_key` | `varchar_nokey` ;
 
188
 
 
189
table_name:
 
190
        B | C | BB | CC;
 
191
 
 
192
value: _digit | _date | _time | _datetime | _varchar(1) | NULL ;
 
193
 
 
194
select_option: 
 
195
        | DISTINCT ;