-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
sql_yacc.yy
18288 lines (16511 loc) · 551 KB
/
sql_yacc.yy
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have either included with
the program or referenced in the documentation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* sql_yacc.yy */
/**
@defgroup Parser Parser
@{
*/
%{
/*
Note: YYTHD is passed as an argument to yyparse(), and subsequently to yylex().
*/
#define YYP (YYTHD->m_parser_state)
#define YYLIP (& YYTHD->m_parser_state->m_lip)
#define YYPS (& YYTHD->m_parser_state->m_yacc)
#define YYCSCL (YYLIP->query_charset)
#define YYMEM_ROOT (YYTHD->mem_root)
#define YYCLIENT_NO_SCHEMA (YYTHD->get_protocol()->has_client_capability(CLIENT_NO_SCHEMA))
#define YYINITDEPTH 100
#define YYMAXDEPTH 3200 /* Because of 64K stack */
#define Lex (YYTHD->lex)
#define Select Lex->current_query_block()
#include <sys/types.h> // TODO: replace with cstdint
#include <algorithm>
#include <cerrno>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include "field_types.h"
#include "ft_global.h"
#include "lex_string.h"
#include "libbinlogevents/include/binlog_event.h"
#include "m_ctype.h"
#include "m_string.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_check_opt.h"
#include "my_dbug.h"
#include "my_inttypes.h" // TODO: replace with cstdint
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "my_thread_local.h"
#include "my_time.h"
#include "myisam.h"
#include "myisammrg.h"
#include "mysql/mysql_lex_string.h"
#include "mysql/plugin.h"
#include "mysql/udf_registration_types.h"
#include "mysql_com.h"
#include "mysql_time.h"
#include "mysqld_error.h"
#include "prealloced_array.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/binlog.h" // for MAX_LOG_UNIQUE_FN_EXT
#include "sql/create_field.h"
#include "sql/dd/types/abstract_table.h" // TT_BASE_TABLE
#include "sql/dd/types/column.h"
#include "sql/derror.h"
#include "sql/event_parse_data.h"
#include "sql/field.h"
#include "sql/gis/srid.h" // gis::srid_t
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/item_cmpfunc.h"
#include "sql/item_create.h"
#include "sql/item_func.h"
#include "sql/item_geofunc.h"
#include "sql/item_json_func.h"
#include "sql/item_regexp_func.h"
#include "sql/item_row.h"
#include "sql/item_strfunc.h"
#include "sql/item_subselect.h"
#include "sql/item_sum.h"
#include "sql/item_timefunc.h"
#include "sql-common/json_dom.h"
#include "sql-common/json_syntax_check.h" // is_valid_json_syntax
#include "sql/key_spec.h"
#include "sql/keycaches.h"
#include "sql/lex_symbol.h"
#include "sql/lex_token.h"
#include "sql/lexer_yystype.h"
#include "sql/mdl.h"
#include "sql/mem_root_array.h"
#include "sql/mysqld.h"
#include "sql/options_mysqld.h"
#include "sql/parse_location.h"
#include "sql/parse_tree_helpers.h"
#include "sql/parse_tree_node_base.h"
#include "sql/parser_yystype.h"
#include "sql/partition_element.h"
#include "sql/partition_info.h"
#include "sql/protocol.h"
#include "sql/query_options.h"
#include "sql/resourcegroups/platform/thread_attrs_api.h"
#include "sql/resourcegroups/resource_group_basic_types.h"
#include "sql/rpl_filter.h"
#include "sql/rpl_replica.h" // Sql_cmd_change_repl_filter
#include "sql/set_var.h"
#include "sql/sp.h"
#include "sql/sp_head.h"
#include "sql/sp_instr.h"
#include "sql/sp_pcontext.h"
#include "sql/spatial.h"
#include "sql/sql_admin.h" // Sql_cmd_analyze/Check..._table
#include "sql/sql_alter.h" // Sql_cmd_alter_table*
#include "sql/sql_backup_lock.h" // Sql_cmd_lock_instance
#include "sql/sql_class.h" /* Key_part_spec, enum_filetype */
#include "sql/sql_cmd_srs.h"
#include "sql/sql_connect.h"
#include "sql/sql_component.h" // Sql_cmd_uninstall_component
#include "sql/sql_error.h"
#include "sql/sql_exchange.h"
#include "sql/sql_get_diagnostics.h" // Sql_cmd_get_diagnostics
#include "sql/sql_handler.h" // Sql_cmd_handler_*
#include "sql/sql_import.h" // Sql_cmd_import_table
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_parse.h" /* comp_*_creator */
#include "sql/sql_plugin.h" // plugin_is_ready
#include "sql/sql_profile.h"
#include "sql/sql_select.h" // Sql_cmd_select...
#include "sql/sql_servers.h"
#include "sql/sql_signal.h"
#include "sql/sql_table.h" /* primary_key_name */
#include "sql/sql_tablespace.h" // Sql_cmd_alter_tablespace
#include "sql/sql_trigger.h" // Sql_cmd_create_trigger
#include "sql/sql_udf.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/table_function.h"
#include "sql/thr_malloc.h"
#include "sql/trigger_def.h"
#include "sql/window_lex.h"
#include "sql/xa/sql_cmd_xa.h" // Sql_cmd_xa...
#include "sql_chars.h"
#include "sql_string.h"
#include "thr_lock.h"
#include "violite.h"
/* this is to get the bison compilation windows warnings out */
#ifdef _MSC_VER
/* warning C4065: switch statement contains 'default' but no 'case' labels */
#pragma warning (disable : 4065)
#endif
using std::min;
using std::max;
/// The maximum number of histogram buckets.
static const int MAX_NUMBER_OF_HISTOGRAM_BUCKETS= 1024;
/// The default number of histogram buckets when the user does not specify it
/// explicitly. A value of 100 is chosen because the gain in accuracy above this
/// point seems to be generally low.
static const int DEFAULT_NUMBER_OF_HISTOGRAM_BUCKETS= 100;
int yylex(void *yylval, void *yythd);
#define yyoverflow(A,B,C,D,E,F,G,H) \
{ \
ulong val= *(H); \
if (my_yyoverflow((B), (D), (F), &val)) \
{ \
yyerror(NULL, YYTHD, NULL, (const char*) (A));\
return 2; \
} \
else \
{ \
*(H)= (YYSIZE_T)val; \
} \
}
#define MYSQL_YYABORT YYABORT
#define MYSQL_YYABORT_ERROR(...) \
do \
{ \
my_error(__VA_ARGS__); \
MYSQL_YYABORT; \
} while(0)
#define MYSQL_YYABORT_UNLESS(A) \
if (!(A)) \
{ \
YYTHD->syntax_error(); \
MYSQL_YYABORT; \
}
#define NEW_PTN new(YYMEM_ROOT)
/**
Parse_tree_node::contextualize() function call wrapper
*/
#define CONTEXTUALIZE(x) \
do \
{ \
std::remove_reference<decltype(*x)>::type::context_t pc(YYTHD, Select); \
if (YYTHD->is_error() || \
(YYTHD->lex->will_contextualize && (x)->contextualize(&pc))) \
MYSQL_YYABORT; \
} while(0)
#define CONTEXTUALIZE_VIEW(x) \
do \
{ \
std::remove_reference<decltype(*x)>::type::context_t pc(YYTHD, Select); \
if (YYTHD->is_error() || \
(YYTHD->lex->will_contextualize && (x)->contextualize(&pc))) \
MYSQL_YYABORT; \
if (pc.finalize_query_expression()) \
MYSQL_YYABORT; \
} while(0)
/**
Item::itemize() function call wrapper
*/
#define ITEMIZE(x, y) \
do \
{ \
Parse_context pc(YYTHD, Select); \
if (YYTHD->is_error() || \
(YYTHD->lex->will_contextualize && (x)->itemize(&pc, (y)))) \
MYSQL_YYABORT; \
} while(0)
/**
Parse_tree_root::make_cmd() wrapper to raise postponed error message on OOM
@note x may be NULL because of OOM error.
*/
#define MAKE_CMD(x) \
do \
{ \
if (YYTHD->is_error() || Lex->make_sql_cmd(x)) \
MYSQL_YYABORT; \
} while(0)
#ifndef NDEBUG
#define YYDEBUG 1
#else
#define YYDEBUG 0
#endif
/**
@brief Bison callback to report a syntax/OOM error
This function is invoked by the bison-generated parser
when a syntax error or an out-of-memory
condition occurs, then the parser function MYSQLparse()
returns 1 to the caller.
This function is not invoked when the
parser is requested to abort by semantic action code
by means of YYABORT or YYACCEPT macros..
This function is not for use in semantic actions and is internal to
the parser, as it performs some pre-return cleanup.
In semantic actions, please use syntax_error or my_error to
push an error into the error stack and MYSQL_YYABORT
to abort from the parser.
*/
static
void MYSQLerror(YYLTYPE *location, THD *thd, Parse_tree_root **, const char *s)
{
if (strcmp(s, "syntax error") == 0) {
thd->syntax_error_at(*location);
} else if (strcmp(s, "memory exhausted") == 0) {
my_error(ER_DA_OOM, MYF(0));
} else {
// Find omitted error messages in the generated file (sql_yacc.cc) and fix:
assert(false);
my_error(ER_UNKNOWN_ERROR, MYF(0));
}
}
#ifndef NDEBUG
void turn_parser_debug_on()
{
/*
MYSQLdebug is in sql/sql_yacc.cc, in bison generated code.
Turning this option on is **VERY** verbose, and should be
used when investigating a syntax error problem only.
The syntax to run with bison traces is as follows :
- Starting a server manually :
mysqld --debug="d,parser_debug" ...
- Running a test :
mysql-test-run.pl --mysqld="--debug=d,parser_debug" ...
The result will be in the process stderr (var/log/master.err)
*/
extern int yydebug;
yydebug= 1;
}
#endif
static bool is_native_function(const LEX_STRING &name)
{
if (find_native_function_builder(name) != nullptr)
return true;
if (is_lex_native_function(&name))
return true;
return false;
}
/**
Helper action for a case statement (entering the CASE).
This helper is used for both 'simple' and 'searched' cases.
This helper, with the other case_stmt_action_..., is executed when
the following SQL code is parsed:
<pre>
CREATE PROCEDURE proc_19194_simple(i int)
BEGIN
DECLARE str CHAR(10);
CASE i
WHEN 1 THEN SET str="1";
WHEN 2 THEN SET str="2";
WHEN 3 THEN SET str="3";
ELSE SET str="unknown";
END CASE;
SELECT str;
END
</pre>
The actions are used to generate the following code:
<pre>
SHOW PROCEDURE CODE proc_19194_simple;
Pos Instruction
0 set str@1 NULL
1 set_case_expr (12) 0 i@0
2 jump_if_not 5(12) (case_expr@0 = 1)
3 set str@1 _latin1'1'
4 jump 12
5 jump_if_not 8(12) (case_expr@0 = 2)
6 set str@1 _latin1'2'
7 jump 12
8 jump_if_not 11(12) (case_expr@0 = 3)
9 set str@1 _latin1'3'
10 jump 12
11 set str@1 _latin1'unknown'
12 stmt 0 "SELECT str"
</pre>
@param thd thread handler
*/
static void case_stmt_action_case(THD *thd)
{
LEX *lex= thd->lex;
sp_head *sp= lex->sphead;
sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
sp->m_parser_data.new_cont_backpatch();
/*
BACKPATCH: Creating target label for the jump to
"case_stmt_action_end_case"
(Instruction 12 in the example)
*/
pctx->push_label(thd, EMPTY_CSTR, sp->instructions());
}
/**
Helper action for a case then statements.
This helper is used for both 'simple' and 'searched' cases.
@param lex the parser lex context
*/
static bool case_stmt_action_then(THD *thd, LEX *lex)
{
sp_head *sp= lex->sphead;
sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
sp_instr_jump *i =
new (thd->mem_root) sp_instr_jump(sp->instructions(), pctx);
if (!i || sp->add_instr(thd, i))
return true;
/*
BACKPATCH: Resolving forward jump from
"case_stmt_action_when" to "case_stmt_action_then"
(jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
*/
sp->m_parser_data.do_backpatch(pctx->pop_label(), sp->instructions());
/*
BACKPATCH: Registering forward jump from
"case_stmt_action_then" to "case_stmt_action_end_case"
(jump from instruction 4 to 12, 7 to 12 ... in the example)
*/
return sp->m_parser_data.add_backpatch_entry(i, pctx->last_label());
}
/**
Helper action for an end case.
This helper is used for both 'simple' and 'searched' cases.
@param lex the parser lex context
@param simple true for simple cases, false for searched cases
*/
static void case_stmt_action_end_case(LEX *lex, bool simple)
{
sp_head *sp= lex->sphead;
sp_pcontext *pctx= lex->get_sp_current_parsing_ctx();
/*
BACKPATCH: Resolving forward jump from
"case_stmt_action_then" to "case_stmt_action_end_case"
(jump from instruction 4 to 12, 7 to 12 ... in the example)
*/
sp->m_parser_data.do_backpatch(pctx->pop_label(), sp->instructions());
if (simple)
pctx->pop_case_expr_id();
sp->m_parser_data.do_cont_backpatch(sp->instructions());
}
static void init_index_hints(List<Index_hint> *hints, index_hint_type type,
index_clause_map clause)
{
List_iterator<Index_hint> it(*hints);
Index_hint *hint;
while ((hint= it++))
{
hint->type= type;
hint->clause= clause;
}
}
bool my_yyoverflow(short **a, YYSTYPE **b, YYLTYPE **c, ulong *yystacksize);
#include "sql/parse_tree_column_attrs.h"
#include "sql/parse_tree_handler.h"
#include "sql/parse_tree_items.h"
#include "sql/parse_tree_nodes.h"
#include "sql/parse_tree_partitions.h"
void warn_about_deprecated_national(THD *thd)
{
if (native_strcasecmp(national_charset_info->csname, "utf8") == 0 ||
native_strcasecmp(national_charset_info->csname, "utf8mb3") == 0)
push_warning(thd, ER_DEPRECATED_NATIONAL);
}
void warn_about_deprecated_binary(THD *thd)
{
push_deprecated_warn(thd, "BINARY as attribute of a type",
"a CHARACTER SET clause with _bin collation");
}
void warn_on_deprecated_user_defined_collation(
THD *thd, const LEX_STRING collation_name) {
if (collation_name.length == 0)
return;
CHARSET_INFO *collation = mysqld_collation_get_by_name(collation_name.str);
if (collation && !(collation->state & MY_CS_COMPILED)) {
push_warning_printf(thd, Sql_condition::SL_WARNING,
ER_WARN_DEPRECATED_USER_DEFINED_COLLATIONS,
ER_THD(thd, ER_WARN_DEPRECATED_USER_DEFINED_COLLATIONS),
collation->m_coll_name);
}
}
%}
%start start_entry
%parse-param { class THD *YYTHD }
%parse-param { class Parse_tree_root **parse_tree }
%lex-param { class THD *YYTHD }
%define api.pure /* We have threads */
/*
1. We do not accept any reduce/reduce conflicts
2. We should not introduce new shift/reduce conflicts any more.
*/
%expect 63
/*
MAINTAINER:
1) Comments for TOKENS.
For each token, please include in the same line a comment that contains
one or more of the following tags:
SQL-2015-N : Non Reserved keyword as per SQL-2015 draft
SQL-2015-R : Reserved keyword as per SQL-2015 draft
SQL-2003-R : Reserved keyword as per SQL-2003
SQL-2003-N : Non Reserved keyword as per SQL-2003
SQL-1999-R : Reserved keyword as per SQL-1999
SQL-1999-N : Non Reserved keyword as per SQL-1999
MYSQL : MySQL extension (unspecified)
MYSQL-FUNC : MySQL extension, function
INTERNAL : Not a real token, lex optimization
OPERATOR : SQL operator
FUTURE-USE : Reserved for futur use
This makes the code grep-able, and helps maintenance.
2) About token values
Token values are assigned by bison, in order of declaration.
Token values are used in query DIGESTS.
To make DIGESTS stable, it is desirable to avoid changing token values.
In practice, this means adding new tokens at the end of the list,
in the current release section (8.0),
instead of adding them in the middle of the list.
Failing to comply with instructions below will trigger build failure,
as this process is enforced by gen_lex_token.
3) Instructions to add a new token:
Add the new token at the end of the list,
in the MySQL 8.0 section.
4) Instructions to remove an old token:
Do not remove the token, rename it as follows:
%token OBSOLETE_TOKEN_<NNN> / * was: TOKEN_FOO * /
where NNN is the token value (found in sql_yacc.h)
For example, see OBSOLETE_TOKEN_820
*/
/*
Tokens from MySQL 5.7, keep in alphabetical order.
*/
%token ABORT_SYM 258 /* INTERNAL (used in lex) */
%token ACCESSIBLE_SYM 259
%token<lexer.keyword> ACCOUNT_SYM 260
%token<lexer.keyword> ACTION 261 /* SQL-2003-N */
%token ADD 262 /* SQL-2003-R */
%token<lexer.keyword> ADDDATE_SYM 263 /* MYSQL-FUNC */
%token<lexer.keyword> AFTER_SYM 264 /* SQL-2003-N */
%token<lexer.keyword> AGAINST 265
%token<lexer.keyword> AGGREGATE_SYM 266
%token<lexer.keyword> ALGORITHM_SYM 267
%token ALL 268 /* SQL-2003-R */
%token ALTER 269 /* SQL-2003-R */
%token<lexer.keyword> ALWAYS_SYM 270
%token OBSOLETE_TOKEN_271 271 /* was: ANALYSE_SYM */
%token ANALYZE_SYM 272
%token AND_AND_SYM 273 /* OPERATOR */
%token AND_SYM 274 /* SQL-2003-R */
%token<lexer.keyword> ANY_SYM 275 /* SQL-2003-R */
%token AS 276 /* SQL-2003-R */
%token ASC 277 /* SQL-2003-N */
%token<lexer.keyword> ASCII_SYM 278 /* MYSQL-FUNC */
%token ASENSITIVE_SYM 279 /* FUTURE-USE */
%token<lexer.keyword> AT_SYM 280 /* SQL-2003-R */
%token<lexer.keyword> AUTOEXTEND_SIZE_SYM 281
%token<lexer.keyword> AUTO_INC 282
%token<lexer.keyword> AVG_ROW_LENGTH 283
%token<lexer.keyword> AVG_SYM 284 /* SQL-2003-N */
%token<lexer.keyword> BACKUP_SYM 285
%token BEFORE_SYM 286 /* SQL-2003-N */
%token<lexer.keyword> BEGIN_SYM 287 /* SQL-2003-R */
%token BETWEEN_SYM 288 /* SQL-2003-R */
%token BIGINT_SYM 289 /* SQL-2003-R */
%token BINARY_SYM 290 /* SQL-2003-R */
%token<lexer.keyword> BINLOG_SYM 291
%token BIN_NUM 292
%token BIT_AND_SYM 293 /* MYSQL-FUNC */
%token BIT_OR_SYM 294 /* MYSQL-FUNC */
%token<lexer.keyword> BIT_SYM 295 /* MYSQL-FUNC */
%token BIT_XOR_SYM 296 /* MYSQL-FUNC */
%token BLOB_SYM 297 /* SQL-2003-R */
%token<lexer.keyword> BLOCK_SYM 298
%token<lexer.keyword> BOOLEAN_SYM 299 /* SQL-2003-R */
%token<lexer.keyword> BOOL_SYM 300
%token BOTH 301 /* SQL-2003-R */
%token<lexer.keyword> BTREE_SYM 302
%token BY 303 /* SQL-2003-R */
%token<lexer.keyword> BYTE_SYM 304
%token<lexer.keyword> CACHE_SYM 305
%token CALL_SYM 306 /* SQL-2003-R */
%token CASCADE 307 /* SQL-2003-N */
%token<lexer.keyword> CASCADED 308 /* SQL-2003-R */
%token CASE_SYM 309 /* SQL-2003-R */
%token CAST_SYM 310 /* SQL-2003-R */
%token<lexer.keyword> CATALOG_NAME_SYM 311 /* SQL-2003-N */
%token<lexer.keyword> CHAIN_SYM 312 /* SQL-2003-N */
%token CHANGE 313
%token<lexer.keyword> CHANGED 314
%token<lexer.keyword> CHANNEL_SYM 315
%token<lexer.keyword> CHARSET 316
%token CHAR_SYM 317 /* SQL-2003-R */
%token<lexer.keyword> CHECKSUM_SYM 318
%token CHECK_SYM 319 /* SQL-2003-R */
%token<lexer.keyword> CIPHER_SYM 320
%token<lexer.keyword> CLASS_ORIGIN_SYM 321 /* SQL-2003-N */
%token<lexer.keyword> CLIENT_SYM 322
%token<lexer.keyword> CLOSE_SYM 323 /* SQL-2003-R */
%token<lexer.keyword> COALESCE 324 /* SQL-2003-N */
%token<lexer.keyword> CODE_SYM 325
%token COLLATE_SYM 326 /* SQL-2003-R */
%token<lexer.keyword> COLLATION_SYM 327 /* SQL-2003-N */
%token<lexer.keyword> COLUMNS 328
%token COLUMN_SYM 329 /* SQL-2003-R */
%token<lexer.keyword> COLUMN_FORMAT_SYM 330
%token<lexer.keyword> COLUMN_NAME_SYM 331 /* SQL-2003-N */
%token<lexer.keyword> COMMENT_SYM 332
%token<lexer.keyword> COMMITTED_SYM 333 /* SQL-2003-N */
%token<lexer.keyword> COMMIT_SYM 334 /* SQL-2003-R */
%token<lexer.keyword> COMPACT_SYM 335
%token<lexer.keyword> COMPLETION_SYM 336
%token<lexer.keyword> COMPRESSED_SYM 337
%token<lexer.keyword> COMPRESSION_SYM 338
%token<lexer.keyword> ENCRYPTION_SYM 339
%token<lexer.keyword> CONCURRENT 340
%token CONDITION_SYM 341 /* SQL-2003-R, SQL-2008-R */
%token<lexer.keyword> CONNECTION_SYM 342
%token<lexer.keyword> CONSISTENT_SYM 343
%token CONSTRAINT 344 /* SQL-2003-R */
%token<lexer.keyword> CONSTRAINT_CATALOG_SYM 345 /* SQL-2003-N */
%token<lexer.keyword> CONSTRAINT_NAME_SYM 346 /* SQL-2003-N */
%token<lexer.keyword> CONSTRAINT_SCHEMA_SYM 347 /* SQL-2003-N */
%token<lexer.keyword> CONTAINS_SYM 348 /* SQL-2003-N */
%token<lexer.keyword> CONTEXT_SYM 349
%token CONTINUE_SYM 350 /* SQL-2003-R */
%token CONVERT_SYM 351 /* SQL-2003-N */
%token COUNT_SYM 352 /* SQL-2003-N */
%token<lexer.keyword> CPU_SYM 353
%token CREATE 354 /* SQL-2003-R */
%token CROSS 355 /* SQL-2003-R */
%token CUBE_SYM 356 /* SQL-2003-R */
%token CURDATE 357 /* MYSQL-FUNC */
%token<lexer.keyword> CURRENT_SYM 358 /* SQL-2003-R */
%token CURRENT_USER 359 /* SQL-2003-R */
%token CURSOR_SYM 360 /* SQL-2003-R */
%token<lexer.keyword> CURSOR_NAME_SYM 361 /* SQL-2003-N */
%token CURTIME 362 /* MYSQL-FUNC */
%token DATABASE 363
%token DATABASES 364
%token<lexer.keyword> DATAFILE_SYM 365
%token<lexer.keyword> DATA_SYM 366 /* SQL-2003-N */
%token<lexer.keyword> DATETIME_SYM 367 /* MYSQL */
%token DATE_ADD_INTERVAL 368 /* MYSQL-FUNC */
%token DATE_SUB_INTERVAL 369 /* MYSQL-FUNC */
%token<lexer.keyword> DATE_SYM 370 /* SQL-2003-R */
%token DAY_HOUR_SYM 371
%token DAY_MICROSECOND_SYM 372
%token DAY_MINUTE_SYM 373
%token DAY_SECOND_SYM 374
%token<lexer.keyword> DAY_SYM 375 /* SQL-2003-R */
%token<lexer.keyword> DEALLOCATE_SYM 376 /* SQL-2003-R */
%token DECIMAL_NUM 377
%token DECIMAL_SYM 378 /* SQL-2003-R */
%token DECLARE_SYM 379 /* SQL-2003-R */
%token DEFAULT_SYM 380 /* SQL-2003-R */
%token<lexer.keyword> DEFAULT_AUTH_SYM 381 /* INTERNAL */
%token<lexer.keyword> DEFINER_SYM 382
%token DELAYED_SYM 383
%token<lexer.keyword> DELAY_KEY_WRITE_SYM 384
%token DELETE_SYM 385 /* SQL-2003-R */
%token DESC 386 /* SQL-2003-N */
%token DESCRIBE 387 /* SQL-2003-R */
%token OBSOLETE_TOKEN_388 388 /* was: DES_KEY_FILE */
%token DETERMINISTIC_SYM 389 /* SQL-2003-R */
%token<lexer.keyword> DIAGNOSTICS_SYM 390 /* SQL-2003-N */
%token<lexer.keyword> DIRECTORY_SYM 391
%token<lexer.keyword> DISABLE_SYM 392
%token<lexer.keyword> DISCARD_SYM 393 /* MYSQL */
%token<lexer.keyword> DISK_SYM 394
%token DISTINCT 395 /* SQL-2003-R */
%token DIV_SYM 396
%token DOUBLE_SYM 397 /* SQL-2003-R */
%token<lexer.keyword> DO_SYM 398
%token DROP 399 /* SQL-2003-R */
%token DUAL_SYM 400
%token<lexer.keyword> DUMPFILE 401
%token<lexer.keyword> DUPLICATE_SYM 402
%token<lexer.keyword> DYNAMIC_SYM 403 /* SQL-2003-R */
%token EACH_SYM 404 /* SQL-2003-R */
%token ELSE 405 /* SQL-2003-R */
%token ELSEIF_SYM 406
%token<lexer.keyword> ENABLE_SYM 407
%token ENCLOSED 408
%token<lexer.keyword> END 409 /* SQL-2003-R */
%token<lexer.keyword> ENDS_SYM 410
%token END_OF_INPUT 411 /* INTERNAL */
%token<lexer.keyword> ENGINES_SYM 412
%token<lexer.keyword> ENGINE_SYM 413
%token<lexer.keyword> ENUM_SYM 414 /* MYSQL */
%token EQ 415 /* OPERATOR */
%token EQUAL_SYM 416 /* OPERATOR */
%token<lexer.keyword> ERROR_SYM 417
%token<lexer.keyword> ERRORS 418
%token ESCAPED 419
%token<lexer.keyword> ESCAPE_SYM 420 /* SQL-2003-R */
%token<lexer.keyword> EVENTS_SYM 421
%token<lexer.keyword> EVENT_SYM 422
%token<lexer.keyword> EVERY_SYM 423 /* SQL-2003-N */
%token<lexer.keyword> EXCHANGE_SYM 424
%token<lexer.keyword> EXECUTE_SYM 425 /* SQL-2003-R */
%token EXISTS 426 /* SQL-2003-R */
%token EXIT_SYM 427
%token<lexer.keyword> EXPANSION_SYM 428
%token<lexer.keyword> EXPIRE_SYM 429
%token<lexer.keyword> EXPORT_SYM 430
%token<lexer.keyword> EXTENDED_SYM 431
%token<lexer.keyword> EXTENT_SIZE_SYM 432
%token EXTRACT_SYM 433 /* SQL-2003-N */
%token FALSE_SYM 434 /* SQL-2003-R */
%token<lexer.keyword> FAST_SYM 435
%token<lexer.keyword> FAULTS_SYM 436
%token FETCH_SYM 437 /* SQL-2003-R */
%token<lexer.keyword> FILE_SYM 438
%token<lexer.keyword> FILE_BLOCK_SIZE_SYM 439
%token<lexer.keyword> FILTER_SYM 440
%token<lexer.keyword> FIRST_SYM 441 /* SQL-2003-N */
%token<lexer.keyword> FIXED_SYM 442
%token FLOAT_NUM 443
%token FLOAT_SYM 444 /* SQL-2003-R */
%token<lexer.keyword> FLUSH_SYM 445
%token<lexer.keyword> FOLLOWS_SYM 446 /* MYSQL */
%token FORCE_SYM 447
%token FOREIGN 448 /* SQL-2003-R */
%token FOR_SYM 449 /* SQL-2003-R */
%token<lexer.keyword> FORMAT_SYM 450
%token<lexer.keyword> FOUND_SYM 451 /* SQL-2003-R */
%token FROM 452
%token<lexer.keyword> FULL 453 /* SQL-2003-R */
%token FULLTEXT_SYM 454
%token FUNCTION_SYM 455 /* SQL-2003-R */
%token GE 456
%token<lexer.keyword> GENERAL 457
%token GENERATED 458
%token<lexer.keyword> GROUP_REPLICATION 459
%token<lexer.keyword> GEOMETRYCOLLECTION_SYM 460 /* MYSQL */
%token<lexer.keyword> GEOMETRY_SYM 461
%token<lexer.keyword> GET_FORMAT 462 /* MYSQL-FUNC */
%token GET_SYM 463 /* SQL-2003-R */
%token<lexer.keyword> GLOBAL_SYM 464 /* SQL-2003-R */
%token GRANT 465 /* SQL-2003-R */
%token<lexer.keyword> GRANTS 466
%token GROUP_SYM 467 /* SQL-2003-R */
%token GROUP_CONCAT_SYM 468
%token GT_SYM 469 /* OPERATOR */
%token<lexer.keyword> HANDLER_SYM 470
%token<lexer.keyword> HASH_SYM 471
%token HAVING 472 /* SQL-2003-R */
%token<lexer.keyword> HELP_SYM 473
%token HEX_NUM 474
%token HIGH_PRIORITY 475
%token<lexer.keyword> HOST_SYM 476
%token<lexer.keyword> HOSTS_SYM 477
%token HOUR_MICROSECOND_SYM 478
%token HOUR_MINUTE_SYM 479
%token HOUR_SECOND_SYM 480
%token<lexer.keyword> HOUR_SYM 481 /* SQL-2003-R */
%token IDENT 482
%token<lexer.keyword> IDENTIFIED_SYM 483
%token IDENT_QUOTED 484
%token IF 485
%token IGNORE_SYM 486
%token<lexer.keyword> IGNORE_SERVER_IDS_SYM 487
%token<lexer.keyword> IMPORT 488
%token<lexer.keyword> INDEXES 489
%token INDEX_SYM 490
%token INFILE_SYM 491
%token<lexer.keyword> INITIAL_SIZE_SYM 492
%token INNER_SYM 493 /* SQL-2003-R */
%token INOUT_SYM 494 /* SQL-2003-R */
%token INSENSITIVE_SYM 495 /* SQL-2003-R */
%token INSERT_SYM 496 /* SQL-2003-R */
%token<lexer.keyword> INSERT_METHOD 497
%token<lexer.keyword> INSTANCE_SYM 498
%token<lexer.keyword> INSTALL_SYM 499
%token INTERVAL_SYM 500 /* SQL-2003-R */
%token INTO 501 /* SQL-2003-R */
%token INT_SYM 502 /* SQL-2003-R */
%token<lexer.keyword> INVOKER_SYM 503
%token IN_SYM 504 /* SQL-2003-R */
%token IO_AFTER_GTIDS 505 /* MYSQL, FUTURE-USE */
%token IO_BEFORE_GTIDS 506 /* MYSQL, FUTURE-USE */
%token<lexer.keyword> IO_SYM 507
%token<lexer.keyword> IPC_SYM 508
%token IS 509 /* SQL-2003-R */
%token<lexer.keyword> ISOLATION 510 /* SQL-2003-R */
%token<lexer.keyword> ISSUER_SYM 511
%token ITERATE_SYM 512
%token JOIN_SYM 513 /* SQL-2003-R */
%token JSON_SEPARATOR_SYM 514 /* MYSQL */
%token<lexer.keyword> JSON_SYM 515 /* MYSQL */
%token KEYS 516
%token<lexer.keyword> KEY_BLOCK_SIZE 517
%token KEY_SYM 518 /* SQL-2003-N */
%token KILL_SYM 519
%token<lexer.keyword> LANGUAGE_SYM 520 /* SQL-2003-R */
%token<lexer.keyword> LAST_SYM 521 /* SQL-2003-N */
%token LE 522 /* OPERATOR */
%token LEADING 523 /* SQL-2003-R */
%token<lexer.keyword> LEAVES 524
%token LEAVE_SYM 525
%token LEFT 526 /* SQL-2003-R */
%token<lexer.keyword> LESS_SYM 527
%token<lexer.keyword> LEVEL_SYM 528
%token LEX_HOSTNAME 529
%token LIKE 530 /* SQL-2003-R */
%token LIMIT 531
%token LINEAR_SYM 532
%token LINES 533
%token<lexer.keyword> LINESTRING_SYM 534 /* MYSQL */
%token<lexer.keyword> LIST_SYM 535
%token LOAD 536
%token<lexer.keyword> LOCAL_SYM 537 /* SQL-2003-R */
%token OBSOLETE_TOKEN_538 538 /* was: LOCATOR_SYM */
%token<lexer.keyword> LOCKS_SYM 539
%token LOCK_SYM 540
%token<lexer.keyword> LOGFILE_SYM 541
%token<lexer.keyword> LOGS_SYM 542
%token LONGBLOB_SYM 543 /* MYSQL */
%token LONGTEXT_SYM 544 /* MYSQL */
%token LONG_NUM 545
%token LONG_SYM 546
%token LOOP_SYM 547
%token LOW_PRIORITY 548
%token LT 549 /* OPERATOR */
%token<lexer.keyword> MASTER_AUTO_POSITION_SYM 550
%token MASTER_BIND_SYM 551
%token<lexer.keyword> MASTER_CONNECT_RETRY_SYM 552
%token<lexer.keyword> MASTER_DELAY_SYM 553
%token<lexer.keyword> MASTER_HOST_SYM 554
%token<lexer.keyword> MASTER_LOG_FILE_SYM 555
%token<lexer.keyword> MASTER_LOG_POS_SYM 556
%token<lexer.keyword> MASTER_PASSWORD_SYM 557
%token<lexer.keyword> MASTER_PORT_SYM 558
%token<lexer.keyword> MASTER_RETRY_COUNT_SYM 559
/* %token<lexer.keyword> MASTER_SERVER_ID_SYM 560 */ /* UNUSED */
%token<lexer.keyword> MASTER_SSL_CAPATH_SYM 561
%token<lexer.keyword> MASTER_TLS_VERSION_SYM 562
%token<lexer.keyword> MASTER_SSL_CA_SYM 563
%token<lexer.keyword> MASTER_SSL_CERT_SYM 564
%token<lexer.keyword> MASTER_SSL_CIPHER_SYM 565
%token<lexer.keyword> MASTER_SSL_CRL_SYM 566
%token<lexer.keyword> MASTER_SSL_CRLPATH_SYM 567
%token<lexer.keyword> MASTER_SSL_KEY_SYM 568
%token<lexer.keyword> MASTER_SSL_SYM 569
%token MASTER_SSL_VERIFY_SERVER_CERT_SYM 570
%token<lexer.keyword> MASTER_SYM 571
%token<lexer.keyword> MASTER_USER_SYM 572
%token<lexer.keyword> MASTER_HEARTBEAT_PERIOD_SYM 573
%token MATCH 574 /* SQL-2003-R */
%token<lexer.keyword> MAX_CONNECTIONS_PER_HOUR 575
%token<lexer.keyword> MAX_QUERIES_PER_HOUR 576
%token<lexer.keyword> MAX_ROWS 577
%token<lexer.keyword> MAX_SIZE_SYM 578
%token MAX_SYM 579 /* SQL-2003-N */
%token<lexer.keyword> MAX_UPDATES_PER_HOUR 580
%token<lexer.keyword> MAX_USER_CONNECTIONS_SYM 581
%token MAX_VALUE_SYM 582 /* SQL-2003-N */
%token MEDIUMBLOB_SYM 583 /* MYSQL */
%token MEDIUMINT_SYM 584 /* MYSQL */
%token MEDIUMTEXT_SYM 585 /* MYSQL */
%token<lexer.keyword> MEDIUM_SYM 586
%token<lexer.keyword> MEMORY_SYM 587
%token<lexer.keyword> MERGE_SYM 588 /* SQL-2003-R */
%token<lexer.keyword> MESSAGE_TEXT_SYM 589 /* SQL-2003-N */
%token<lexer.keyword> MICROSECOND_SYM 590 /* MYSQL-FUNC */
%token<lexer.keyword> MIGRATE_SYM 591
%token MINUTE_MICROSECOND_SYM 592
%token MINUTE_SECOND_SYM 593
%token<lexer.keyword> MINUTE_SYM 594 /* SQL-2003-R */
%token<lexer.keyword> MIN_ROWS 595
%token MIN_SYM 596 /* SQL-2003-N */
%token<lexer.keyword> MODE_SYM 597
%token MODIFIES_SYM 598 /* SQL-2003-R */
%token<lexer.keyword> MODIFY_SYM 599
%token MOD_SYM 600 /* SQL-2003-N */
%token<lexer.keyword> MONTH_SYM 601 /* SQL-2003-R */
%token<lexer.keyword> MULTILINESTRING_SYM 602 /* MYSQL */
%token<lexer.keyword> MULTIPOINT_SYM 603 /* MYSQL */
%token<lexer.keyword> MULTIPOLYGON_SYM 604 /* MYSQL */
%token<lexer.keyword> MUTEX_SYM 605
%token<lexer.keyword> MYSQL_ERRNO_SYM 606
%token<lexer.keyword> NAMES_SYM 607 /* SQL-2003-N */
%token<lexer.keyword> NAME_SYM 608 /* SQL-2003-N */
%token<lexer.keyword> NATIONAL_SYM 609 /* SQL-2003-R */
%token NATURAL 610 /* SQL-2003-R */
%token NCHAR_STRING 611
%token<lexer.keyword> NCHAR_SYM 612 /* SQL-2003-R */
%token<lexer.keyword> NDBCLUSTER_SYM 613
%token NE 614 /* OPERATOR */
%token NEG 615
%token<lexer.keyword> NEVER_SYM 616
%token<lexer.keyword> NEW_SYM 617 /* SQL-2003-R */
%token<lexer.keyword> NEXT_SYM 618 /* SQL-2003-N */
%token<lexer.keyword> NODEGROUP_SYM 619
%token<lexer.keyword> NONE_SYM 620 /* SQL-2003-R */
%token NOT2_SYM 621
%token NOT_SYM 622 /* SQL-2003-R */
%token NOW_SYM 623
%token<lexer.keyword> NO_SYM 624 /* SQL-2003-R */
%token<lexer.keyword> NO_WAIT_SYM 625
%token NO_WRITE_TO_BINLOG 626
%token NULL_SYM 627 /* SQL-2003-R */
%token NUM 628
%token<lexer.keyword> NUMBER_SYM 629 /* SQL-2003-N */
%token NUMERIC_SYM 630 /* SQL-2003-R */
%token<lexer.keyword> NVARCHAR_SYM 631
%token<lexer.keyword> OFFSET_SYM 632
%token ON_SYM 633 /* SQL-2003-R */
%token<lexer.keyword> ONE_SYM 634
%token<lexer.keyword> ONLY_SYM 635 /* SQL-2003-R */
%token<lexer.keyword> OPEN_SYM 636 /* SQL-2003-R */
%token OPTIMIZE 637
%token OPTIMIZER_COSTS_SYM 638
%token<lexer.keyword> OPTIONS_SYM 639
%token OPTION 640 /* SQL-2003-N */
%token OPTIONALLY 641
%token OR2_SYM 642
%token ORDER_SYM 643 /* SQL-2003-R */
%token OR_OR_SYM 644 /* OPERATOR */
%token OR_SYM 645 /* SQL-2003-R */
%token OUTER_SYM 646
%token OUTFILE 647
%token OUT_SYM 648 /* SQL-2003-R */
%token<lexer.keyword> OWNER_SYM 649
%token<lexer.keyword> PACK_KEYS_SYM 650
%token<lexer.keyword> PAGE_SYM 651
%token PARAM_MARKER 652
%token<lexer.keyword> PARSER_SYM 653
%token OBSOLETE_TOKEN_654 654 /* was: PARSE_GCOL_EXPR_SYM */
%token<lexer.keyword> PARTIAL 655 /* SQL-2003-N */
%token PARTITION_SYM 656 /* SQL-2003-R */
%token<lexer.keyword> PARTITIONS_SYM 657
%token<lexer.keyword> PARTITIONING_SYM 658
%token<lexer.keyword> PASSWORD 659
%token<lexer.keyword> PHASE_SYM 660
%token<lexer.keyword> PLUGIN_DIR_SYM 661 /* INTERNAL */
%token<lexer.keyword> PLUGIN_SYM 662
%token<lexer.keyword> PLUGINS_SYM 663
%token<lexer.keyword> POINT_SYM 664
%token<lexer.keyword> POLYGON_SYM 665 /* MYSQL */
%token<lexer.keyword> PORT_SYM 666
%token POSITION_SYM 667 /* SQL-2003-N */
%token<lexer.keyword> PRECEDES_SYM 668 /* MYSQL */
%token PRECISION 669 /* SQL-2003-R */
%token<lexer.keyword> PREPARE_SYM 670 /* SQL-2003-R */
%token<lexer.keyword> PRESERVE_SYM 671
%token<lexer.keyword> PREV_SYM 672
%token PRIMARY_SYM 673 /* SQL-2003-R */
%token<lexer.keyword> PRIVILEGES 674 /* SQL-2003-N */
%token PROCEDURE_SYM 675 /* SQL-2003-R */