diff --git a/src/parser/bison_parser.cpp b/src/parser/bison_parser.cpp index 9e231a61..c5ee60fc 100644 --- a/src/parser/bison_parser.cpp +++ b/src/parser/bison_parser.cpp @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.5. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -46,10 +46,10 @@ USER NAME SPACE" below. */ /* Identify Bison output, and Bison version. */ -#define YYBISON 30705 +#define YYBISON 30802 /* Bison version string. */ -#define YYBISON_VERSION "3.7.5" +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -64,20 +64,20 @@ #define YYPULL 1 /* Substitute the type names. */ -#define YYSTYPE HSQL_STYPE -#define YYLTYPE HSQL_LTYPE +#define YYSTYPE HSQL_STYPE +#define YYLTYPE HSQL_LTYPE /* Substitute the variable and function names. */ -#define yyparse hsql_parse -#define yylex hsql_lex -#define yyerror hsql_error -#define yydebug hsql_debug -#define yynerrs hsql_nerrs +#define yyparse hsql_parse +#define yylex hsql_lex +#define yyerror hsql_error +#define yydebug hsql_debug +#define yynerrs hsql_nerrs /* First part of user prologue. */ #line 2 "bison_parser.y" - // clang-format on - /** +// clang-format on +/** * bison_parser.y * defines bison_parser.h * outputs bison_parser.c @@ -85,7 +85,7 @@ * Grammar File Spec: http://dinosaur.compilertools.net/bison/bison_6.html * */ - /********************************* +/********************************* ** Section 1: C Declarations *********************************/ @@ -95,14 +95,14 @@ #include #include - using namespace hsql; +using namespace hsql; - int yyerror(YYLTYPE * llocp, SQLParserResult * result, yyscan_t scanner, const char* msg) { - result->setIsValid(false); - result->setErrorDetails(strdup(msg), llocp->first_line, llocp->first_column); - return 0; - } - // clang-format off +int yyerror(YYLTYPE* llocp, SQLParserResult* result, yyscan_t scanner, const char* msg) { + result->setIsValid(false); + result->setErrorDetails(strdup(msg), llocp->first_line, llocp->first_column); + return 0; +} +// clang-format off #line 108 "bison_parser.cpp" @@ -589,12 +589,18 @@ typedef int yy_state_fast_t; # define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else @@ -827,7 +833,7 @@ static const yytype_uint8 yytranslate[] = }; #if HSQL_DEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 293, 293, 312, 318, 325, 329, 333, 334, 335, @@ -840,27 +846,27 @@ static const yytype_int16 yyrline[] = 557, 559, 560, 562, 563, 564, 566, 567, 569, 573, 578, 579, 580, 581, 583, 584, 592, 598, 604, 610, 616, 617, 624, 630, 632, 642, 649, 660, 667, 675, - 676, 683, 690, 694, 699, 709, 713, 717, 729, 729, - 731, 732, 741, 742, 744, 754, 765, 770, 774, 778, - 783, 784, 786, 796, 797, 799, 801, 802, 804, 806, - 807, 809, 814, 816, 817, 819, 820, 822, 826, 831, - 833, 834, 835, 839, 840, 842, 843, 844, 845, 846, - 847, 852, 856, 861, 862, 864, 868, 873, 881, 881, - 881, 881, 881, 883, 884, 884, 884, 884, 884, 884, - 884, 884, 885, 885, 889, 889, 891, 892, 893, 894, - 895, 897, 897, 898, 899, 900, 901, 902, 903, 904, - 905, 906, 908, 909, 911, 912, 913, 914, 918, 919, - 920, 921, 923, 924, 926, 927, 929, 930, 931, 932, - 933, 934, 935, 937, 938, 940, 942, 944, 945, 946, - 947, 948, 949, 951, 952, 953, 954, 955, 956, 958, - 958, 960, 962, 964, 966, 967, 968, 969, 971, 971, - 971, 971, 971, 971, 971, 973, 975, 976, 978, 979, - 981, 983, 985, 996, 1000, 1011, 1043, 1052, 1052, 1059, - 1059, 1061, 1061, 1068, 1072, 1077, 1085, 1091, 1095, 1100, - 1101, 1103, 1103, 1105, 1105, 1107, 1108, 1110, 1110, 1116, - 1116, 1118, 1120, 1124, 1129, 1139, 1146, 1154, 1170, 1171, - 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1181, 1187, - 1187, 1190, 1194 + 676, 683, 690, 694, 699, 709, 713, 717, 726, 726, + 728, 729, 735, 736, 738, 748, 756, 761, 765, 769, + 774, 775, 777, 787, 788, 790, 792, 793, 795, 797, + 798, 800, 805, 807, 808, 810, 811, 813, 817, 822, + 824, 825, 826, 830, 831, 833, 834, 835, 836, 837, + 838, 843, 847, 852, 853, 855, 859, 864, 872, 872, + 872, 872, 872, 874, 875, 875, 875, 875, 875, 875, + 875, 875, 876, 876, 880, 880, 882, 883, 884, 885, + 886, 888, 888, 889, 890, 891, 892, 893, 894, 895, + 896, 897, 899, 900, 902, 903, 904, 905, 909, 910, + 911, 912, 914, 915, 917, 918, 920, 921, 922, 923, + 924, 925, 926, 928, 929, 931, 933, 935, 936, 937, + 938, 939, 940, 942, 943, 944, 945, 946, 947, 949, + 949, 951, 953, 955, 957, 958, 959, 960, 962, 962, + 962, 962, 962, 962, 962, 964, 966, 967, 969, 970, + 972, 974, 976, 987, 991, 1002, 1034, 1043, 1043, 1050, + 1050, 1052, 1052, 1059, 1063, 1068, 1076, 1082, 1086, 1091, + 1092, 1094, 1094, 1096, 1096, 1098, 1099, 1101, 1101, 1107, + 1107, 1109, 1111, 1115, 1120, 1130, 1137, 1145, 1161, 1162, + 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1172, 1178, + 1178, 1181, 1185 }; #endif @@ -942,32 +948,6 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_int16 yytoknum[] = -{ - 0, 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, 61, 410, 411, 60, 62, - 412, 413, 414, 415, 416, 43, 45, 42, 47, 37, - 94, 417, 91, 93, 40, 41, 46, 59, 44, 63 -}; -#endif - #define YYPACT_NINF (-321) #define yypact_value_is_default(Yyn) \ @@ -978,8 +958,8 @@ static const yytype_int16 yytoknum[] = #define yytable_value_is_error(Yyn) \ ((Yyn) == YYTABLE_NINF) - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { 618, 65, 87, 127, 142, 87, 104, 68, 95, 60, @@ -1039,9 +1019,9 @@ static const yytype_int16 yypact[] = -321, 13, -68, -321, -321, -68, 366, 364, -321 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_int16 yydefact[] = { 280, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1101,7 +1081,7 @@ static const yytype_int16 yydefact[] = 73, 0, 298, 286, 272, 133, 234, 0, 287 }; - /* YYPGOTO[NTERM-NUM]. */ +/* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -321, -321, -321, 475, -321, 523, -321, 227, -321, 48, @@ -1118,7 +1098,7 @@ static const yytype_int16 yypgoto[] = -321, -321, -321, -321, 480, -321, -321, -321, -321, -320 }; - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { 0, 19, 20, 21, 22, 71, 246, 247, 23, 64, @@ -1135,9 +1115,9 @@ static const yytype_int16 yydefgoto[] = 331, 37, 38, 61, 62, 419, 474, 543, 69, 233 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 213, 106, 154, 154, 41, 155, 265, 44, 95, 96, @@ -1324,8 +1304,8 @@ static const yytype_int16 yycheck[] = 166, 167, 168, 169, 170, -1, 172 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ static const yytype_int16 yystos[] = { 0, 7, 15, 22, 26, 36, 39, 40, 51, 52, @@ -1385,7 +1365,7 @@ static const yytype_int16 yystos[] = 175, 174, 249, 297, 175, 249, 3, 269, 175 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int16 yyr1[] = { 0, 180, 181, 182, 182, 183, 183, 183, 183, 183, @@ -1421,7 +1401,7 @@ static const yytype_int16 yyr1[] = 298, 299, 299 }; - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ static const yytype_int8 yyr2[] = { 0, 2, 2, 1, 3, 2, 2, 1, 1, 1, @@ -1466,6 +1446,7 @@ enum { YYENOMEM = -2 }; #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) @@ -1533,12 +1514,19 @@ do { \ } while (0) -/* YY_LOCATION_PRINT -- Print the location on the stream. +/* YYLOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ -# ifndef YY_LOCATION_PRINT -# if defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL +# ifndef YYLOCATION_PRINT + +# if defined YY_LOCATION_PRINT + + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) + +# elif defined HSQL_LTYPE_IS_TRIVIAL && HSQL_LTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ @@ -1566,15 +1554,23 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) res += YYFPRINTF (yyo, "-%d", end_col); } return res; - } +} + +# define YYLOCATION_PRINT yy_location_print_ -# define YY_LOCATION_PRINT(File, Loc) \ - yy_location_print_ (File, &(Loc)) + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) # else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) + +# define YYLOCATION_PRINT(File, Loc) ((void) 0) + /* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +# define YY_LOCATION_PRINT YYLOCATION_PRINT + # endif -# endif /* !defined YY_LOCATION_PRINT */ +# endif /* !defined YYLOCATION_PRINT */ # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ @@ -1604,10 +1600,6 @@ yy_symbol_value_print (FILE *yyo, YY_USE (scanner); if (!yyvaluep) return; -# ifdef YYPRINT - if (yykind < YYNTOKENS) - YYPRINT (yyo, yytoknum[yykind], *yyvaluep); -# endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END @@ -1625,7 +1617,7 @@ yy_symbol_print (FILE *yyo, YYFPRINTF (yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - YY_LOCATION_PRINT (yyo, *yylocationp); + YYLOCATION_PRINT (yyo, yylocationp); YYFPRINTF (yyo, ": "); yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, result, scanner); YYFPRINTF (yyo, ")"); @@ -2008,25 +2000,25 @@ yydestruct (const char *yymsg, case YYSYMBOL_IDENTIFIER: /* IDENTIFIER */ #line 162 "bison_parser.y" { free( (((*yyvaluep).sval)) ); } -#line 2012 "bison_parser.cpp" +#line 2004 "bison_parser.cpp" break; case YYSYMBOL_STRING: /* STRING */ #line 162 "bison_parser.y" { free( (((*yyvaluep).sval)) ); } -#line 2018 "bison_parser.cpp" +#line 2010 "bison_parser.cpp" break; case YYSYMBOL_FLOATVAL: /* FLOATVAL */ #line 160 "bison_parser.y" { } -#line 2024 "bison_parser.cpp" +#line 2016 "bison_parser.cpp" break; case YYSYMBOL_INTVAL: /* INTVAL */ #line 160 "bison_parser.y" { } -#line 2030 "bison_parser.cpp" +#line 2022 "bison_parser.cpp" break; case YYSYMBOL_statement_list: /* statement_list */ @@ -2039,19 +2031,19 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).stmt_vec)); } -#line 2043 "bison_parser.cpp" +#line 2035 "bison_parser.cpp" break; case YYSYMBOL_statement: /* statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).statement)); } -#line 2049 "bison_parser.cpp" +#line 2041 "bison_parser.cpp" break; case YYSYMBOL_preparable_statement: /* preparable_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).statement)); } -#line 2055 "bison_parser.cpp" +#line 2047 "bison_parser.cpp" break; case YYSYMBOL_opt_hints: /* opt_hints */ @@ -2064,7 +2056,7 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).expr_vec)); } -#line 2068 "bison_parser.cpp" +#line 2060 "bison_parser.cpp" break; case YYSYMBOL_hint_list: /* hint_list */ @@ -2077,85 +2069,85 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).expr_vec)); } -#line 2081 "bison_parser.cpp" +#line 2073 "bison_parser.cpp" break; case YYSYMBOL_hint: /* hint */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2087 "bison_parser.cpp" +#line 2079 "bison_parser.cpp" break; case YYSYMBOL_transaction_statement: /* transaction_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).transaction_stmt)); } -#line 2093 "bison_parser.cpp" +#line 2085 "bison_parser.cpp" break; case YYSYMBOL_prepare_statement: /* prepare_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).prep_stmt)); } -#line 2099 "bison_parser.cpp" +#line 2091 "bison_parser.cpp" break; case YYSYMBOL_prepare_target_query: /* prepare_target_query */ #line 162 "bison_parser.y" { free( (((*yyvaluep).sval)) ); } -#line 2105 "bison_parser.cpp" +#line 2097 "bison_parser.cpp" break; case YYSYMBOL_execute_statement: /* execute_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).exec_stmt)); } -#line 2111 "bison_parser.cpp" +#line 2103 "bison_parser.cpp" break; case YYSYMBOL_import_statement: /* import_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).import_stmt)); } -#line 2117 "bison_parser.cpp" +#line 2109 "bison_parser.cpp" break; case YYSYMBOL_file_type: /* file_type */ #line 160 "bison_parser.y" { } -#line 2123 "bison_parser.cpp" +#line 2115 "bison_parser.cpp" break; case YYSYMBOL_file_path: /* file_path */ #line 162 "bison_parser.y" { free( (((*yyvaluep).sval)) ); } -#line 2129 "bison_parser.cpp" +#line 2121 "bison_parser.cpp" break; case YYSYMBOL_opt_file_type: /* opt_file_type */ #line 160 "bison_parser.y" { } -#line 2135 "bison_parser.cpp" +#line 2127 "bison_parser.cpp" break; case YYSYMBOL_export_statement: /* export_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).export_stmt)); } -#line 2141 "bison_parser.cpp" +#line 2133 "bison_parser.cpp" break; case YYSYMBOL_show_statement: /* show_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).show_stmt)); } -#line 2147 "bison_parser.cpp" +#line 2139 "bison_parser.cpp" break; case YYSYMBOL_create_statement: /* create_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).create_stmt)); } -#line 2153 "bison_parser.cpp" +#line 2145 "bison_parser.cpp" break; case YYSYMBOL_opt_not_exists: /* opt_not_exists */ #line 160 "bison_parser.y" { } -#line 2159 "bison_parser.cpp" +#line 2151 "bison_parser.cpp" break; case YYSYMBOL_table_elem_commalist: /* table_elem_commalist */ @@ -2168,109 +2160,109 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).table_element_vec)); } -#line 2172 "bison_parser.cpp" +#line 2164 "bison_parser.cpp" break; case YYSYMBOL_table_elem: /* table_elem */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table_element_t)); } -#line 2178 "bison_parser.cpp" +#line 2170 "bison_parser.cpp" break; case YYSYMBOL_column_def: /* column_def */ #line 171 "bison_parser.y" { delete (((*yyvaluep).column_t)); } -#line 2184 "bison_parser.cpp" +#line 2176 "bison_parser.cpp" break; case YYSYMBOL_column_type: /* column_type */ #line 160 "bison_parser.y" { } -#line 2190 "bison_parser.cpp" +#line 2182 "bison_parser.cpp" break; case YYSYMBOL_opt_time_specification: /* opt_time_specification */ #line 160 "bison_parser.y" { } -#line 2196 "bison_parser.cpp" +#line 2188 "bison_parser.cpp" break; case YYSYMBOL_opt_decimal_specification: /* opt_decimal_specification */ #line 160 "bison_parser.y" { } -#line 2202 "bison_parser.cpp" +#line 2194 "bison_parser.cpp" break; case YYSYMBOL_opt_column_constraints: /* opt_column_constraints */ #line 160 "bison_parser.y" { } -#line 2208 "bison_parser.cpp" +#line 2200 "bison_parser.cpp" break; case YYSYMBOL_column_constraint_list: /* column_constraint_list */ #line 160 "bison_parser.y" { } -#line 2214 "bison_parser.cpp" +#line 2206 "bison_parser.cpp" break; case YYSYMBOL_column_constraint: /* column_constraint */ #line 160 "bison_parser.y" { } -#line 2220 "bison_parser.cpp" +#line 2212 "bison_parser.cpp" break; case YYSYMBOL_table_constraint: /* table_constraint */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table_constraint_t)); } -#line 2226 "bison_parser.cpp" +#line 2218 "bison_parser.cpp" break; case YYSYMBOL_drop_statement: /* drop_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).drop_stmt)); } -#line 2232 "bison_parser.cpp" +#line 2224 "bison_parser.cpp" break; case YYSYMBOL_opt_exists: /* opt_exists */ #line 160 "bison_parser.y" { } -#line 2238 "bison_parser.cpp" +#line 2230 "bison_parser.cpp" break; case YYSYMBOL_alter_statement: /* alter_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).alter_stmt)); } -#line 2244 "bison_parser.cpp" +#line 2236 "bison_parser.cpp" break; case YYSYMBOL_alter_action: /* alter_action */ #line 171 "bison_parser.y" { delete (((*yyvaluep).alter_action_t)); } -#line 2250 "bison_parser.cpp" +#line 2242 "bison_parser.cpp" break; case YYSYMBOL_drop_action: /* drop_action */ #line 171 "bison_parser.y" { delete (((*yyvaluep).drop_action_t)); } -#line 2256 "bison_parser.cpp" +#line 2248 "bison_parser.cpp" break; case YYSYMBOL_delete_statement: /* delete_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).delete_stmt)); } -#line 2262 "bison_parser.cpp" +#line 2254 "bison_parser.cpp" break; case YYSYMBOL_truncate_statement: /* truncate_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).delete_stmt)); } -#line 2268 "bison_parser.cpp" +#line 2260 "bison_parser.cpp" break; case YYSYMBOL_insert_statement: /* insert_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).insert_stmt)); } -#line 2274 "bison_parser.cpp" +#line 2266 "bison_parser.cpp" break; case YYSYMBOL_opt_column_list: /* opt_column_list */ @@ -2283,13 +2275,13 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).str_vec)); } -#line 2287 "bison_parser.cpp" +#line 2279 "bison_parser.cpp" break; case YYSYMBOL_update_statement: /* update_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).update_stmt)); } -#line 2293 "bison_parser.cpp" +#line 2285 "bison_parser.cpp" break; case YYSYMBOL_update_clause_commalist: /* update_clause_commalist */ @@ -2302,73 +2294,73 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).update_vec)); } -#line 2306 "bison_parser.cpp" +#line 2298 "bison_parser.cpp" break; case YYSYMBOL_update_clause: /* update_clause */ #line 171 "bison_parser.y" { delete (((*yyvaluep).update_t)); } -#line 2312 "bison_parser.cpp" +#line 2304 "bison_parser.cpp" break; case YYSYMBOL_select_statement: /* select_statement */ #line 171 "bison_parser.y" { delete (((*yyvaluep).select_stmt)); } -#line 2318 "bison_parser.cpp" +#line 2310 "bison_parser.cpp" break; case YYSYMBOL_select_within_set_operation: /* select_within_set_operation */ #line 171 "bison_parser.y" { delete (((*yyvaluep).select_stmt)); } -#line 2324 "bison_parser.cpp" +#line 2316 "bison_parser.cpp" break; case YYSYMBOL_select_within_set_operation_no_parentheses: /* select_within_set_operation_no_parentheses */ #line 171 "bison_parser.y" { delete (((*yyvaluep).select_stmt)); } -#line 2330 "bison_parser.cpp" +#line 2322 "bison_parser.cpp" break; case YYSYMBOL_select_with_paren: /* select_with_paren */ #line 171 "bison_parser.y" { delete (((*yyvaluep).select_stmt)); } -#line 2336 "bison_parser.cpp" +#line 2328 "bison_parser.cpp" break; case YYSYMBOL_select_no_paren: /* select_no_paren */ #line 171 "bison_parser.y" { delete (((*yyvaluep).select_stmt)); } -#line 2342 "bison_parser.cpp" +#line 2334 "bison_parser.cpp" break; case YYSYMBOL_set_operator: /* set_operator */ #line 171 "bison_parser.y" { delete (((*yyvaluep).set_operator_t)); } -#line 2348 "bison_parser.cpp" +#line 2340 "bison_parser.cpp" break; case YYSYMBOL_set_type: /* set_type */ #line 171 "bison_parser.y" { delete (((*yyvaluep).set_operator_t)); } -#line 2354 "bison_parser.cpp" +#line 2346 "bison_parser.cpp" break; case YYSYMBOL_opt_all: /* opt_all */ #line 160 "bison_parser.y" { } -#line 2360 "bison_parser.cpp" +#line 2352 "bison_parser.cpp" break; case YYSYMBOL_select_clause: /* select_clause */ #line 171 "bison_parser.y" { delete (((*yyvaluep).select_stmt)); } -#line 2366 "bison_parser.cpp" +#line 2358 "bison_parser.cpp" break; case YYSYMBOL_opt_distinct: /* opt_distinct */ #line 160 "bison_parser.y" { } -#line 2372 "bison_parser.cpp" +#line 2364 "bison_parser.cpp" break; case YYSYMBOL_select_list: /* select_list */ @@ -2381,37 +2373,37 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).expr_vec)); } -#line 2385 "bison_parser.cpp" +#line 2377 "bison_parser.cpp" break; case YYSYMBOL_opt_from_clause: /* opt_from_clause */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2391 "bison_parser.cpp" +#line 2383 "bison_parser.cpp" break; case YYSYMBOL_from_clause: /* from_clause */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2397 "bison_parser.cpp" +#line 2389 "bison_parser.cpp" break; case YYSYMBOL_opt_where: /* opt_where */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2403 "bison_parser.cpp" +#line 2395 "bison_parser.cpp" break; case YYSYMBOL_opt_group: /* opt_group */ #line 171 "bison_parser.y" { delete (((*yyvaluep).group_t)); } -#line 2409 "bison_parser.cpp" +#line 2401 "bison_parser.cpp" break; case YYSYMBOL_opt_having: /* opt_having */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2415 "bison_parser.cpp" +#line 2407 "bison_parser.cpp" break; case YYSYMBOL_opt_order: /* opt_order */ @@ -2424,7 +2416,7 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).order_vec)); } -#line 2428 "bison_parser.cpp" +#line 2420 "bison_parser.cpp" break; case YYSYMBOL_order_list: /* order_list */ @@ -2437,31 +2429,31 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).order_vec)); } -#line 2441 "bison_parser.cpp" +#line 2433 "bison_parser.cpp" break; case YYSYMBOL_order_desc: /* order_desc */ #line 171 "bison_parser.y" { delete (((*yyvaluep).order)); } -#line 2447 "bison_parser.cpp" +#line 2439 "bison_parser.cpp" break; case YYSYMBOL_opt_order_type: /* opt_order_type */ #line 160 "bison_parser.y" { } -#line 2453 "bison_parser.cpp" +#line 2445 "bison_parser.cpp" break; case YYSYMBOL_opt_top: /* opt_top */ #line 171 "bison_parser.y" { delete (((*yyvaluep).limit)); } -#line 2459 "bison_parser.cpp" +#line 2451 "bison_parser.cpp" break; case YYSYMBOL_opt_limit: /* opt_limit */ #line 171 "bison_parser.y" { delete (((*yyvaluep).limit)); } -#line 2465 "bison_parser.cpp" +#line 2457 "bison_parser.cpp" break; case YYSYMBOL_expr_list: /* expr_list */ @@ -2474,7 +2466,7 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).expr_vec)); } -#line 2478 "bison_parser.cpp" +#line 2470 "bison_parser.cpp" break; case YYSYMBOL_opt_literal_list: /* opt_literal_list */ @@ -2487,7 +2479,7 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).expr_vec)); } -#line 2491 "bison_parser.cpp" +#line 2483 "bison_parser.cpp" break; case YYSYMBOL_literal_list: /* literal_list */ @@ -2500,211 +2492,211 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).expr_vec)); } -#line 2504 "bison_parser.cpp" +#line 2496 "bison_parser.cpp" break; case YYSYMBOL_expr_alias: /* expr_alias */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2510 "bison_parser.cpp" +#line 2502 "bison_parser.cpp" break; case YYSYMBOL_expr: /* expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2516 "bison_parser.cpp" +#line 2508 "bison_parser.cpp" break; case YYSYMBOL_operand: /* operand */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2522 "bison_parser.cpp" +#line 2514 "bison_parser.cpp" break; case YYSYMBOL_scalar_expr: /* scalar_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2528 "bison_parser.cpp" +#line 2520 "bison_parser.cpp" break; case YYSYMBOL_unary_expr: /* unary_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2534 "bison_parser.cpp" +#line 2526 "bison_parser.cpp" break; case YYSYMBOL_binary_expr: /* binary_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2540 "bison_parser.cpp" +#line 2532 "bison_parser.cpp" break; case YYSYMBOL_logic_expr: /* logic_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2546 "bison_parser.cpp" +#line 2538 "bison_parser.cpp" break; case YYSYMBOL_in_expr: /* in_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2552 "bison_parser.cpp" +#line 2544 "bison_parser.cpp" break; case YYSYMBOL_case_expr: /* case_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2558 "bison_parser.cpp" +#line 2550 "bison_parser.cpp" break; case YYSYMBOL_case_list: /* case_list */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2564 "bison_parser.cpp" +#line 2556 "bison_parser.cpp" break; case YYSYMBOL_exists_expr: /* exists_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2570 "bison_parser.cpp" +#line 2562 "bison_parser.cpp" break; case YYSYMBOL_comp_expr: /* comp_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2576 "bison_parser.cpp" +#line 2568 "bison_parser.cpp" break; case YYSYMBOL_function_expr: /* function_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2582 "bison_parser.cpp" +#line 2574 "bison_parser.cpp" break; case YYSYMBOL_extract_expr: /* extract_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2588 "bison_parser.cpp" +#line 2580 "bison_parser.cpp" break; case YYSYMBOL_cast_expr: /* cast_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2594 "bison_parser.cpp" +#line 2586 "bison_parser.cpp" break; case YYSYMBOL_datetime_field: /* datetime_field */ #line 160 "bison_parser.y" { } -#line 2600 "bison_parser.cpp" +#line 2592 "bison_parser.cpp" break; case YYSYMBOL_datetime_field_plural: /* datetime_field_plural */ #line 160 "bison_parser.y" { } -#line 2606 "bison_parser.cpp" +#line 2598 "bison_parser.cpp" break; case YYSYMBOL_duration_field: /* duration_field */ #line 160 "bison_parser.y" { } -#line 2612 "bison_parser.cpp" +#line 2604 "bison_parser.cpp" break; case YYSYMBOL_array_expr: /* array_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2618 "bison_parser.cpp" +#line 2610 "bison_parser.cpp" break; case YYSYMBOL_array_index: /* array_index */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2624 "bison_parser.cpp" +#line 2616 "bison_parser.cpp" break; case YYSYMBOL_between_expr: /* between_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2630 "bison_parser.cpp" +#line 2622 "bison_parser.cpp" break; case YYSYMBOL_column_name: /* column_name */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2636 "bison_parser.cpp" +#line 2628 "bison_parser.cpp" break; case YYSYMBOL_literal: /* literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2642 "bison_parser.cpp" +#line 2634 "bison_parser.cpp" break; case YYSYMBOL_string_literal: /* string_literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2648 "bison_parser.cpp" +#line 2640 "bison_parser.cpp" break; case YYSYMBOL_bool_literal: /* bool_literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2654 "bison_parser.cpp" +#line 2646 "bison_parser.cpp" break; case YYSYMBOL_num_literal: /* num_literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2660 "bison_parser.cpp" +#line 2652 "bison_parser.cpp" break; case YYSYMBOL_int_literal: /* int_literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2666 "bison_parser.cpp" +#line 2658 "bison_parser.cpp" break; case YYSYMBOL_null_literal: /* null_literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2672 "bison_parser.cpp" +#line 2664 "bison_parser.cpp" break; case YYSYMBOL_date_literal: /* date_literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2678 "bison_parser.cpp" +#line 2670 "bison_parser.cpp" break; case YYSYMBOL_interval_literal: /* interval_literal */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2684 "bison_parser.cpp" +#line 2676 "bison_parser.cpp" break; case YYSYMBOL_param_expr: /* param_expr */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2690 "bison_parser.cpp" +#line 2682 "bison_parser.cpp" break; case YYSYMBOL_table_ref: /* table_ref */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2696 "bison_parser.cpp" +#line 2688 "bison_parser.cpp" break; case YYSYMBOL_table_ref_atomic: /* table_ref_atomic */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2702 "bison_parser.cpp" +#line 2694 "bison_parser.cpp" break; case YYSYMBOL_nonjoin_table_ref_atomic: /* nonjoin_table_ref_atomic */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2708 "bison_parser.cpp" +#line 2700 "bison_parser.cpp" break; case YYSYMBOL_table_ref_commalist: /* table_ref_commalist */ @@ -2717,97 +2709,97 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).table_vec)); } -#line 2721 "bison_parser.cpp" +#line 2713 "bison_parser.cpp" break; case YYSYMBOL_table_ref_name: /* table_ref_name */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2727 "bison_parser.cpp" +#line 2719 "bison_parser.cpp" break; case YYSYMBOL_table_ref_name_no_alias: /* table_ref_name_no_alias */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2733 "bison_parser.cpp" +#line 2725 "bison_parser.cpp" break; case YYSYMBOL_table_name: /* table_name */ #line 161 "bison_parser.y" { free( (((*yyvaluep).table_name).name) ); free( (((*yyvaluep).table_name).schema) ); } -#line 2739 "bison_parser.cpp" +#line 2731 "bison_parser.cpp" break; case YYSYMBOL_opt_index_name: /* opt_index_name */ #line 162 "bison_parser.y" { free( (((*yyvaluep).sval)) ); } -#line 2745 "bison_parser.cpp" +#line 2737 "bison_parser.cpp" break; case YYSYMBOL_table_alias: /* table_alias */ #line 171 "bison_parser.y" { delete (((*yyvaluep).alias_t)); } -#line 2751 "bison_parser.cpp" +#line 2743 "bison_parser.cpp" break; case YYSYMBOL_opt_table_alias: /* opt_table_alias */ #line 171 "bison_parser.y" { delete (((*yyvaluep).alias_t)); } -#line 2757 "bison_parser.cpp" +#line 2749 "bison_parser.cpp" break; case YYSYMBOL_alias: /* alias */ #line 171 "bison_parser.y" { delete (((*yyvaluep).alias_t)); } -#line 2763 "bison_parser.cpp" +#line 2755 "bison_parser.cpp" break; case YYSYMBOL_opt_alias: /* opt_alias */ #line 171 "bison_parser.y" { delete (((*yyvaluep).alias_t)); } -#line 2769 "bison_parser.cpp" +#line 2761 "bison_parser.cpp" break; case YYSYMBOL_opt_with_clause: /* opt_with_clause */ #line 171 "bison_parser.y" { delete (((*yyvaluep).with_description_vec)); } -#line 2775 "bison_parser.cpp" +#line 2767 "bison_parser.cpp" break; case YYSYMBOL_with_clause: /* with_clause */ #line 171 "bison_parser.y" { delete (((*yyvaluep).with_description_vec)); } -#line 2781 "bison_parser.cpp" +#line 2773 "bison_parser.cpp" break; case YYSYMBOL_with_description_list: /* with_description_list */ #line 171 "bison_parser.y" { delete (((*yyvaluep).with_description_vec)); } -#line 2787 "bison_parser.cpp" +#line 2779 "bison_parser.cpp" break; case YYSYMBOL_with_description: /* with_description */ #line 171 "bison_parser.y" { delete (((*yyvaluep).with_description_t)); } -#line 2793 "bison_parser.cpp" +#line 2785 "bison_parser.cpp" break; case YYSYMBOL_join_clause: /* join_clause */ #line 171 "bison_parser.y" { delete (((*yyvaluep).table)); } -#line 2799 "bison_parser.cpp" +#line 2791 "bison_parser.cpp" break; case YYSYMBOL_opt_join_type: /* opt_join_type */ #line 160 "bison_parser.y" { } -#line 2805 "bison_parser.cpp" +#line 2797 "bison_parser.cpp" break; case YYSYMBOL_join_condition: /* join_condition */ #line 171 "bison_parser.y" { delete (((*yyvaluep).expr)); } -#line 2811 "bison_parser.cpp" +#line 2803 "bison_parser.cpp" break; case YYSYMBOL_ident_commalist: /* ident_commalist */ @@ -2820,7 +2812,7 @@ yydestruct (const char *yymsg, } delete (((*yyvaluep).str_vec)); } -#line 2824 "bison_parser.cpp" +#line 2816 "bison_parser.cpp" break; default: @@ -2915,6 +2907,7 @@ YYLTYPE yylloc = yyloc_default; yychar = SQL_HSQL_EMPTY; /* Cause a token to be read. */ + /* User initialization code. */ #line 77 "bison_parser.y" { @@ -2927,7 +2920,7 @@ YYLTYPE yylloc = yyloc_default; yylloc.string_length = 0; } -#line 2931 "bison_parser.cpp" +#line 2924 "bison_parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -2955,7 +2948,7 @@ YYLTYPE yylloc = yyloc_default; if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; + YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ @@ -2986,7 +2979,7 @@ YYLTYPE yylloc = yyloc_default; # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; @@ -2997,7 +2990,7 @@ YYLTYPE yylloc = yyloc_default; YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - goto yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); @@ -3021,6 +3014,7 @@ YYLTYPE yylloc = yyloc_default; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + if (yystate == YYFINAL) YYACCEPT; @@ -3155,7 +3149,7 @@ YYLTYPE yylloc = yyloc_default; } delete (yyvsp[-1].stmt_vec); } -#line 3159 "bison_parser.cpp" +#line 3153 "bison_parser.cpp" break; case 3: /* statement_list: statement */ @@ -3166,7 +3160,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.stmt_vec) = new std::vector(); (yyval.stmt_vec)->push_back((yyvsp[0].statement)); } -#line 3170 "bison_parser.cpp" +#line 3164 "bison_parser.cpp" break; case 4: /* statement_list: statement_list ';' statement */ @@ -3177,7 +3171,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].stmt_vec)->push_back((yyvsp[0].statement)); (yyval.stmt_vec) = (yyvsp[-2].stmt_vec); } -#line 3181 "bison_parser.cpp" +#line 3175 "bison_parser.cpp" break; case 5: /* statement: prepare_statement opt_hints */ @@ -3186,7 +3180,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.statement) = (yyvsp[-1].prep_stmt); (yyval.statement)->hints = (yyvsp[0].expr_vec); } -#line 3190 "bison_parser.cpp" +#line 3184 "bison_parser.cpp" break; case 6: /* statement: preparable_statement opt_hints */ @@ -3195,97 +3189,97 @@ YYLTYPE yylloc = yyloc_default; (yyval.statement) = (yyvsp[-1].statement); (yyval.statement)->hints = (yyvsp[0].expr_vec); } -#line 3199 "bison_parser.cpp" +#line 3193 "bison_parser.cpp" break; case 7: /* statement: show_statement */ #line 333 "bison_parser.y" { (yyval.statement) = (yyvsp[0].show_stmt); } -#line 3205 "bison_parser.cpp" +#line 3199 "bison_parser.cpp" break; case 8: /* statement: import_statement */ #line 334 "bison_parser.y" { (yyval.statement) = (yyvsp[0].import_stmt); } -#line 3211 "bison_parser.cpp" +#line 3205 "bison_parser.cpp" break; case 9: /* statement: export_statement */ #line 335 "bison_parser.y" { (yyval.statement) = (yyvsp[0].export_stmt); } -#line 3217 "bison_parser.cpp" +#line 3211 "bison_parser.cpp" break; case 10: /* preparable_statement: select_statement */ #line 337 "bison_parser.y" { (yyval.statement) = (yyvsp[0].select_stmt); } -#line 3223 "bison_parser.cpp" +#line 3217 "bison_parser.cpp" break; case 11: /* preparable_statement: create_statement */ #line 338 "bison_parser.y" { (yyval.statement) = (yyvsp[0].create_stmt); } -#line 3229 "bison_parser.cpp" +#line 3223 "bison_parser.cpp" break; case 12: /* preparable_statement: insert_statement */ #line 339 "bison_parser.y" { (yyval.statement) = (yyvsp[0].insert_stmt); } -#line 3235 "bison_parser.cpp" +#line 3229 "bison_parser.cpp" break; case 13: /* preparable_statement: delete_statement */ #line 340 "bison_parser.y" { (yyval.statement) = (yyvsp[0].delete_stmt); } -#line 3241 "bison_parser.cpp" +#line 3235 "bison_parser.cpp" break; case 14: /* preparable_statement: truncate_statement */ #line 341 "bison_parser.y" { (yyval.statement) = (yyvsp[0].delete_stmt); } -#line 3247 "bison_parser.cpp" +#line 3241 "bison_parser.cpp" break; case 15: /* preparable_statement: update_statement */ #line 342 "bison_parser.y" { (yyval.statement) = (yyvsp[0].update_stmt); } -#line 3253 "bison_parser.cpp" +#line 3247 "bison_parser.cpp" break; case 16: /* preparable_statement: drop_statement */ #line 343 "bison_parser.y" { (yyval.statement) = (yyvsp[0].drop_stmt); } -#line 3259 "bison_parser.cpp" +#line 3253 "bison_parser.cpp" break; case 17: /* preparable_statement: alter_statement */ #line 344 "bison_parser.y" { (yyval.statement) = (yyvsp[0].alter_stmt); } -#line 3265 "bison_parser.cpp" +#line 3259 "bison_parser.cpp" break; case 18: /* preparable_statement: execute_statement */ #line 345 "bison_parser.y" { (yyval.statement) = (yyvsp[0].exec_stmt); } -#line 3271 "bison_parser.cpp" +#line 3265 "bison_parser.cpp" break; case 19: /* preparable_statement: transaction_statement */ #line 346 "bison_parser.y" { (yyval.statement) = (yyvsp[0].transaction_stmt); } -#line 3277 "bison_parser.cpp" +#line 3271 "bison_parser.cpp" break; case 20: /* opt_hints: WITH HINT '(' hint_list ')' */ #line 352 "bison_parser.y" { (yyval.expr_vec) = (yyvsp[-1].expr_vec); } -#line 3283 "bison_parser.cpp" +#line 3277 "bison_parser.cpp" break; case 21: /* opt_hints: %empty */ #line 353 "bison_parser.y" { (yyval.expr_vec) = nullptr; } -#line 3289 "bison_parser.cpp" +#line 3283 "bison_parser.cpp" break; case 22: /* hint_list: hint */ @@ -3294,7 +3288,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } -#line 3298 "bison_parser.cpp" +#line 3292 "bison_parser.cpp" break; case 23: /* hint_list: hint_list ',' hint */ @@ -3303,7 +3297,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } -#line 3307 "bison_parser.cpp" +#line 3301 "bison_parser.cpp" break; case 24: /* hint: IDENTIFIER */ @@ -3312,7 +3306,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr) = Expr::make(kExprHint); (yyval.expr)->name = (yyvsp[0].sval); } -#line 3316 "bison_parser.cpp" +#line 3310 "bison_parser.cpp" break; case 25: /* hint: IDENTIFIER '(' literal_list ')' */ @@ -3322,25 +3316,25 @@ YYLTYPE yylloc = yyloc_default; (yyval.expr)->name = (yyvsp[-3].sval); (yyval.expr)->exprList = (yyvsp[-1].expr_vec); } -#line 3326 "bison_parser.cpp" +#line 3320 "bison_parser.cpp" break; case 26: /* transaction_statement: BEGIN opt_transaction_keyword */ #line 378 "bison_parser.y" { (yyval.transaction_stmt) = new TransactionStatement(kBeginTransaction); } -#line 3332 "bison_parser.cpp" +#line 3326 "bison_parser.cpp" break; case 27: /* transaction_statement: ROLLBACK opt_transaction_keyword */ #line 379 "bison_parser.y" { (yyval.transaction_stmt) = new TransactionStatement(kRollbackTransaction); } -#line 3338 "bison_parser.cpp" +#line 3332 "bison_parser.cpp" break; case 28: /* transaction_statement: COMMIT opt_transaction_keyword */ #line 380 "bison_parser.y" { (yyval.transaction_stmt) = new TransactionStatement(kCommitTransaction); } -#line 3344 "bison_parser.cpp" +#line 3338 "bison_parser.cpp" break; case 31: /* prepare_statement: PREPARE IDENTIFIER FROM prepare_target_query */ @@ -3350,7 +3344,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.prep_stmt)->name = (yyvsp[-2].sval); (yyval.prep_stmt)->query = (yyvsp[0].sval); } -#line 3354 "bison_parser.cpp" +#line 3348 "bison_parser.cpp" break; case 33: /* execute_statement: EXECUTE IDENTIFIER */ @@ -3359,7 +3353,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.exec_stmt) = new ExecuteStatement(); (yyval.exec_stmt)->name = (yyvsp[0].sval); } -#line 3363 "bison_parser.cpp" +#line 3357 "bison_parser.cpp" break; case 34: /* execute_statement: EXECUTE IDENTIFIER '(' opt_literal_list ')' */ @@ -3369,7 +3363,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.exec_stmt)->name = (yyvsp[-3].sval); (yyval.exec_stmt)->parameters = (yyvsp[-1].expr_vec); } -#line 3373 "bison_parser.cpp" +#line 3367 "bison_parser.cpp" break; case 35: /* import_statement: IMPORT FROM file_type FILE file_path INTO table_name */ @@ -3380,7 +3374,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.import_stmt)->schema = (yyvsp[0].table_name).schema; (yyval.import_stmt)->tableName = (yyvsp[0].table_name).name; } -#line 3384 "bison_parser.cpp" +#line 3378 "bison_parser.cpp" break; case 36: /* import_statement: COPY table_name FROM file_path opt_file_type */ @@ -3391,7 +3385,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.import_stmt)->schema = (yyvsp[-3].table_name).schema; (yyval.import_stmt)->tableName = (yyvsp[-3].table_name).name; } -#line 3395 "bison_parser.cpp" +#line 3389 "bison_parser.cpp" break; case 37: /* file_type: IDENTIFIER */ @@ -3410,7 +3404,7 @@ YYLTYPE yylloc = yyloc_default; } free((yyvsp[0].sval)); } -#line 3414 "bison_parser.cpp" +#line 3408 "bison_parser.cpp" break; case 38: /* file_path: string_literal */ @@ -3419,19 +3413,19 @@ YYLTYPE yylloc = yyloc_default; (yyval.sval) = strdup((yyvsp[0].expr)->name); delete (yyvsp[0].expr); } -#line 3423 "bison_parser.cpp" +#line 3417 "bison_parser.cpp" break; case 39: /* opt_file_type: WITH FORMAT file_type */ #line 444 "bison_parser.y" { (yyval.import_type_t) = (yyvsp[0].import_type_t); } -#line 3429 "bison_parser.cpp" +#line 3423 "bison_parser.cpp" break; case 40: /* opt_file_type: %empty */ #line 445 "bison_parser.y" { (yyval.import_type_t) = kImportAuto; } -#line 3435 "bison_parser.cpp" +#line 3429 "bison_parser.cpp" break; case 41: /* export_statement: COPY table_name TO file_path opt_file_type */ @@ -3442,13 +3436,13 @@ YYLTYPE yylloc = yyloc_default; (yyval.export_stmt)->schema = (yyvsp[-3].table_name).schema; (yyval.export_stmt)->tableName = (yyvsp[-3].table_name).name; } -#line 3446 "bison_parser.cpp" +#line 3440 "bison_parser.cpp" break; case 42: /* show_statement: SHOW TABLES */ #line 463 "bison_parser.y" { (yyval.show_stmt) = new ShowStatement(kShowTables); } -#line 3452 "bison_parser.cpp" +#line 3446 "bison_parser.cpp" break; case 43: /* show_statement: SHOW COLUMNS table_name */ @@ -3458,7 +3452,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt)->schema = (yyvsp[0].table_name).schema; (yyval.show_stmt)->name = (yyvsp[0].table_name).name; } -#line 3462 "bison_parser.cpp" +#line 3456 "bison_parser.cpp" break; case 44: /* show_statement: DESCRIBE table_name */ @@ -3468,7 +3462,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.show_stmt)->schema = (yyvsp[0].table_name).schema; (yyval.show_stmt)->name = (yyvsp[0].table_name).name; } -#line 3472 "bison_parser.cpp" +#line 3466 "bison_parser.cpp" break; case 45: /* create_statement: CREATE TABLE opt_not_exists table_name FROM IDENTIFIER FILE file_path */ @@ -3486,7 +3480,7 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-2].sval)); (yyval.create_stmt)->filePath = (yyvsp[0].sval); } -#line 3490 "bison_parser.cpp" +#line 3484 "bison_parser.cpp" break; case 46: /* create_statement: CREATE TABLE opt_not_exists table_name '(' table_elem_commalist ')' */ @@ -3499,7 +3493,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt)->setColumnDefsAndConstraints((yyvsp[-1].table_element_vec)); delete (yyvsp[-1].table_element_vec); } -#line 3503 "bison_parser.cpp" +#line 3497 "bison_parser.cpp" break; case 47: /* create_statement: CREATE TABLE opt_not_exists table_name AS select_statement */ @@ -3511,7 +3505,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt)->tableName = (yyvsp[-2].table_name).name; (yyval.create_stmt)->select = (yyvsp[0].select_stmt); } -#line 3515 "bison_parser.cpp" +#line 3509 "bison_parser.cpp" break; case 48: /* create_statement: CREATE INDEX opt_not_exists opt_index_name ON table_name '(' ident_commalist ')' */ @@ -3523,7 +3517,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt)->tableName = (yyvsp[-3].table_name).name; (yyval.create_stmt)->indexColumns = (yyvsp[-1].str_vec); } -#line 3527 "bison_parser.cpp" +#line 3521 "bison_parser.cpp" break; case 49: /* create_statement: CREATE VIEW opt_not_exists table_name opt_column_list AS select_statement */ @@ -3536,19 +3530,19 @@ YYLTYPE yylloc = yyloc_default; (yyval.create_stmt)->viewColumns = (yyvsp[-2].str_vec); (yyval.create_stmt)->select = (yyvsp[0].select_stmt); } -#line 3540 "bison_parser.cpp" +#line 3534 "bison_parser.cpp" break; case 50: /* opt_not_exists: IF NOT EXISTS */ #line 524 "bison_parser.y" { (yyval.bval) = true; } -#line 3546 "bison_parser.cpp" +#line 3540 "bison_parser.cpp" break; case 51: /* opt_not_exists: %empty */ #line 525 "bison_parser.y" { (yyval.bval) = false; } -#line 3552 "bison_parser.cpp" +#line 3546 "bison_parser.cpp" break; case 52: /* table_elem_commalist: table_elem */ @@ -3557,7 +3551,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.table_element_vec) = new std::vector(); (yyval.table_element_vec)->push_back((yyvsp[0].table_element_t)); } -#line 3561 "bison_parser.cpp" +#line 3555 "bison_parser.cpp" break; case 53: /* table_elem_commalist: table_elem_commalist ',' table_elem */ @@ -3566,19 +3560,19 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].table_element_vec)->push_back((yyvsp[0].table_element_t)); (yyval.table_element_vec) = (yyvsp[-2].table_element_vec); } -#line 3570 "bison_parser.cpp" +#line 3564 "bison_parser.cpp" break; case 54: /* table_elem: column_def */ #line 536 "bison_parser.y" { (yyval.table_element_t) = (yyvsp[0].column_t); } -#line 3576 "bison_parser.cpp" +#line 3570 "bison_parser.cpp" break; case 55: /* table_elem: table_constraint */ #line 537 "bison_parser.y" { (yyval.table_element_t) = (yyvsp[0].table_constraint_t); } -#line 3582 "bison_parser.cpp" +#line 3576 "bison_parser.cpp" break; case 56: /* column_def: IDENTIFIER column_type opt_column_constraints */ @@ -3587,133 +3581,133 @@ YYLTYPE yylloc = yyloc_default; (yyval.column_t) = new ColumnDefinition((yyvsp[-2].sval), (yyvsp[-1].column_type_t), (yyvsp[0].column_constraint_vec)); (yyval.column_t)->setNullableExplicit(); } -#line 3591 "bison_parser.cpp" +#line 3585 "bison_parser.cpp" break; case 57: /* column_type: INT */ #line 544 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::INT}; } -#line 3597 "bison_parser.cpp" +#line 3591 "bison_parser.cpp" break; case 58: /* column_type: INTEGER */ #line 545 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::INT}; } -#line 3603 "bison_parser.cpp" +#line 3597 "bison_parser.cpp" break; case 59: /* column_type: LONG */ #line 546 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::LONG}; } -#line 3609 "bison_parser.cpp" +#line 3603 "bison_parser.cpp" break; case 60: /* column_type: FLOAT */ #line 547 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::FLOAT}; } -#line 3615 "bison_parser.cpp" +#line 3609 "bison_parser.cpp" break; case 61: /* column_type: DECIMAL opt_decimal_specification */ #line 548 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::DECIMAL, 0, (yyvsp[0].column_specification_t)}; } -#line 3621 "bison_parser.cpp" +#line 3615 "bison_parser.cpp" break; case 62: /* column_type: DOUBLE */ #line 549 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::DOUBLE}; } -#line 3627 "bison_parser.cpp" +#line 3621 "bison_parser.cpp" break; case 63: /* column_type: REAL */ #line 550 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::REAL}; } -#line 3633 "bison_parser.cpp" +#line 3627 "bison_parser.cpp" break; case 64: /* column_type: VARCHAR '(' INTVAL ')' */ #line 551 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::VARCHAR, (yyvsp[-1].ival)}; } -#line 3639 "bison_parser.cpp" +#line 3633 "bison_parser.cpp" break; case 65: /* column_type: CHARACTER VARYING '(' INTVAL ')' */ #line 552 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::VARCHAR, (yyvsp[-1].ival)}; } -#line 3645 "bison_parser.cpp" +#line 3639 "bison_parser.cpp" break; case 66: /* column_type: CHAR '(' INTVAL ')' */ #line 553 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::CHAR, (yyvsp[-1].ival)}; } -#line 3651 "bison_parser.cpp" +#line 3645 "bison_parser.cpp" break; case 67: /* column_type: TEXT */ #line 554 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::TEXT}; } -#line 3657 "bison_parser.cpp" +#line 3651 "bison_parser.cpp" break; case 68: /* column_type: TIME opt_time_specification */ #line 555 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::TIME, 0, (yyvsp[0].column_specification_t)}; } -#line 3663 "bison_parser.cpp" +#line 3657 "bison_parser.cpp" break; case 69: /* column_type: DATETIME */ #line 556 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::DATETIME}; } -#line 3669 "bison_parser.cpp" +#line 3663 "bison_parser.cpp" break; case 70: /* column_type: DATE */ #line 557 "bison_parser.y" { (yyval.column_type_t) = ColumnType{DataType::DATE}; } -#line 3675 "bison_parser.cpp" +#line 3669 "bison_parser.cpp" break; case 71: /* opt_time_specification: '(' INTVAL ')' */ #line 559 "bison_parser.y" { (yyval.column_specification_t) = ColumnSpecification{(yyvsp[-1].ival)}; } -#line 3681 "bison_parser.cpp" +#line 3675 "bison_parser.cpp" break; case 72: /* opt_time_specification: %empty */ #line 560 "bison_parser.y" { (yyval.column_specification_t) = ColumnSpecification{}; } -#line 3687 "bison_parser.cpp" +#line 3681 "bison_parser.cpp" break; case 73: /* opt_decimal_specification: '(' INTVAL ',' INTVAL ')' */ #line 562 "bison_parser.y" { (yyval.column_specification_t) = ColumnSpecification{(yyvsp[-3].ival), (yyvsp[-1].ival)}; } -#line 3693 "bison_parser.cpp" +#line 3687 "bison_parser.cpp" break; case 74: /* opt_decimal_specification: '(' INTVAL ')' */ #line 563 "bison_parser.y" { (yyval.column_specification_t) = ColumnSpecification{(yyvsp[-1].ival)}; } -#line 3699 "bison_parser.cpp" +#line 3693 "bison_parser.cpp" break; case 75: /* opt_decimal_specification: %empty */ #line 564 "bison_parser.y" { (yyval.column_specification_t) = ColumnSpecification{}; } -#line 3705 "bison_parser.cpp" +#line 3699 "bison_parser.cpp" break; case 76: /* opt_column_constraints: column_constraint_list */ #line 566 "bison_parser.y" { (yyval.column_constraint_vec) = (yyvsp[0].column_constraint_vec); } -#line 3711 "bison_parser.cpp" +#line 3705 "bison_parser.cpp" break; case 77: /* opt_column_constraints: %empty */ #line 567 "bison_parser.y" { (yyval.column_constraint_vec) = new std::vector(); } -#line 3717 "bison_parser.cpp" +#line 3711 "bison_parser.cpp" break; case 78: /* column_constraint_list: column_constraint */ @@ -3722,7 +3716,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.column_constraint_vec) = new std::vector(); (yyval.column_constraint_vec)->push_back((yyvsp[0].column_constraint_t)); } -#line 3726 "bison_parser.cpp" +#line 3720 "bison_parser.cpp" break; case 79: /* column_constraint_list: column_constraint_list column_constraint */ @@ -3731,43 +3725,43 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-1].column_constraint_vec)->push_back((yyvsp[0].column_constraint_t)); (yyval.column_constraint_vec) = (yyvsp[-1].column_constraint_vec); } -#line 3735 "bison_parser.cpp" +#line 3729 "bison_parser.cpp" break; case 80: /* column_constraint: PRIMARY KEY */ #line 578 "bison_parser.y" { (yyval.column_constraint_t) = ConstraintType::PrimaryKey; } -#line 3741 "bison_parser.cpp" +#line 3735 "bison_parser.cpp" break; case 81: /* column_constraint: UNIQUE */ #line 579 "bison_parser.y" { (yyval.column_constraint_t) = ConstraintType::Unique; } -#line 3747 "bison_parser.cpp" +#line 3741 "bison_parser.cpp" break; case 82: /* column_constraint: NULL */ #line 580 "bison_parser.y" { (yyval.column_constraint_t) = ConstraintType::Null; } -#line 3753 "bison_parser.cpp" +#line 3747 "bison_parser.cpp" break; case 83: /* column_constraint: NOT NULL */ #line 581 "bison_parser.y" { (yyval.column_constraint_t) = ConstraintType::NotNull; } -#line 3759 "bison_parser.cpp" +#line 3753 "bison_parser.cpp" break; case 84: /* table_constraint: PRIMARY KEY '(' ident_commalist ')' */ #line 583 "bison_parser.y" { (yyval.table_constraint_t) = new TableConstraint(ConstraintType::PrimaryKey, (yyvsp[-1].str_vec)); } -#line 3765 "bison_parser.cpp" +#line 3759 "bison_parser.cpp" break; case 85: /* table_constraint: UNIQUE '(' ident_commalist ')' */ #line 584 "bison_parser.y" { (yyval.table_constraint_t) = new TableConstraint(ConstraintType::Unique, (yyvsp[-1].str_vec)); } -#line 3771 "bison_parser.cpp" +#line 3765 "bison_parser.cpp" break; case 86: /* drop_statement: DROP TABLE opt_exists table_name */ @@ -3778,7 +3772,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->schema = (yyvsp[0].table_name).schema; (yyval.drop_stmt)->name = (yyvsp[0].table_name).name; } -#line 3782 "bison_parser.cpp" +#line 3776 "bison_parser.cpp" break; case 87: /* drop_statement: DROP VIEW opt_exists table_name */ @@ -3789,7 +3783,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->schema = (yyvsp[0].table_name).schema; (yyval.drop_stmt)->name = (yyvsp[0].table_name).name; } -#line 3793 "bison_parser.cpp" +#line 3787 "bison_parser.cpp" break; case 88: /* drop_statement: DEALLOCATE PREPARE IDENTIFIER */ @@ -3799,7 +3793,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->ifExists = false; (yyval.drop_stmt)->name = (yyvsp[0].sval); } -#line 3803 "bison_parser.cpp" +#line 3797 "bison_parser.cpp" break; case 89: /* drop_statement: DROP INDEX opt_exists IDENTIFIER */ @@ -3809,19 +3803,19 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_stmt)->ifExists = (yyvsp[-1].bval); (yyval.drop_stmt)->indexName = (yyvsp[0].sval); } -#line 3813 "bison_parser.cpp" +#line 3807 "bison_parser.cpp" break; case 90: /* opt_exists: IF EXISTS */ #line 616 "bison_parser.y" { (yyval.bval) = true; } -#line 3819 "bison_parser.cpp" +#line 3813 "bison_parser.cpp" break; case 91: /* opt_exists: %empty */ #line 617 "bison_parser.y" { (yyval.bval) = false; } -#line 3825 "bison_parser.cpp" +#line 3819 "bison_parser.cpp" break; case 92: /* alter_statement: ALTER TABLE opt_exists table_name alter_action */ @@ -3831,13 +3825,13 @@ YYLTYPE yylloc = yyloc_default; (yyval.alter_stmt)->ifTableExists = (yyvsp[-2].bval); (yyval.alter_stmt)->schema = (yyvsp[-1].table_name).schema; } -#line 3835 "bison_parser.cpp" +#line 3829 "bison_parser.cpp" break; case 93: /* alter_action: drop_action */ #line 630 "bison_parser.y" { (yyval.alter_action_t) = (yyvsp[0].drop_action_t); } -#line 3841 "bison_parser.cpp" +#line 3835 "bison_parser.cpp" break; case 94: /* drop_action: DROP COLUMN opt_exists IDENTIFIER */ @@ -3846,7 +3840,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.drop_action_t) = new DropColumnAction((yyvsp[0].sval)); (yyval.drop_action_t)->ifExists = (yyvsp[-1].bval); } -#line 3850 "bison_parser.cpp" +#line 3844 "bison_parser.cpp" break; case 95: /* delete_statement: DELETE FROM table_name opt_where */ @@ -3857,7 +3851,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.delete_stmt)->tableName = (yyvsp[-1].table_name).name; (yyval.delete_stmt)->expr = (yyvsp[0].expr); } -#line 3861 "bison_parser.cpp" +#line 3855 "bison_parser.cpp" break; case 96: /* truncate_statement: TRUNCATE table_name */ @@ -3867,7 +3861,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.delete_stmt)->schema = (yyvsp[0].table_name).schema; (yyval.delete_stmt)->tableName = (yyvsp[0].table_name).name; } -#line 3871 "bison_parser.cpp" +#line 3865 "bison_parser.cpp" break; case 97: /* insert_statement: INSERT INTO table_name opt_column_list VALUES '(' literal_list ')' */ @@ -3879,7 +3873,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.insert_stmt)->columns = (yyvsp[-4].str_vec); (yyval.insert_stmt)->values = (yyvsp[-1].expr_vec); } -#line 3883 "bison_parser.cpp" +#line 3877 "bison_parser.cpp" break; case 98: /* insert_statement: INSERT INTO table_name opt_column_list select_no_paren */ @@ -3891,19 +3885,19 @@ YYLTYPE yylloc = yyloc_default; (yyval.insert_stmt)->columns = (yyvsp[-1].str_vec); (yyval.insert_stmt)->select = (yyvsp[0].select_stmt); } -#line 3895 "bison_parser.cpp" +#line 3889 "bison_parser.cpp" break; case 99: /* opt_column_list: '(' ident_commalist ')' */ #line 675 "bison_parser.y" { (yyval.str_vec) = (yyvsp[-1].str_vec); } -#line 3901 "bison_parser.cpp" +#line 3895 "bison_parser.cpp" break; case 100: /* opt_column_list: %empty */ #line 676 "bison_parser.y" { (yyval.str_vec) = nullptr; } -#line 3907 "bison_parser.cpp" +#line 3901 "bison_parser.cpp" break; case 101: /* update_statement: UPDATE table_ref_name_no_alias SET update_clause_commalist opt_where */ @@ -3914,7 +3908,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.update_stmt)->updates = (yyvsp[-1].update_vec); (yyval.update_stmt)->where = (yyvsp[0].expr); } -#line 3918 "bison_parser.cpp" +#line 3912 "bison_parser.cpp" break; case 102: /* update_clause_commalist: update_clause */ @@ -3923,7 +3917,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.update_vec) = new std::vector(); (yyval.update_vec)->push_back((yyvsp[0].update_t)); } -#line 3927 "bison_parser.cpp" +#line 3921 "bison_parser.cpp" break; case 103: /* update_clause_commalist: update_clause_commalist ',' update_clause */ @@ -3932,7 +3926,7 @@ YYLTYPE yylloc = yyloc_default; (yyvsp[-2].update_vec)->push_back((yyvsp[0].update_t)); (yyval.update_vec) = (yyvsp[-2].update_vec); } -#line 3936 "bison_parser.cpp" +#line 3930 "bison_parser.cpp" break; case 104: /* update_clause: IDENTIFIER '=' expr */ @@ -3942,7 +3936,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.update_t)->column = (yyvsp[-2].sval); (yyval.update_t)->value = (yyvsp[0].expr); } -#line 3946 "bison_parser.cpp" +#line 3940 "bison_parser.cpp" break; case 105: /* select_statement: opt_with_clause select_with_paren */ @@ -3951,7 +3945,7 @@ YYLTYPE yylloc = yyloc_default; (yyval.select_stmt) = (yyvsp[0].select_stmt); (yyval.select_stmt)->withDescriptions = (yyvsp[-1].with_description_vec); } -#line 3955 "bison_parser.cpp" +#line 3949 "bison_parser.cpp" break; case 106: /* select_statement: opt_with_clause select_no_paren */ @@ -3960,58 +3954,52 @@ YYLTYPE yylloc = yyloc_default; (yyval.select_stmt) = (yyvsp[0].select_stmt); (yyval.select_stmt)->withDescriptions = (yyvsp[-1].with_description_vec); } -#line 3964 "bison_parser.cpp" +#line 3958 "bison_parser.cpp" break; case 107: /* select_statement: opt_with_clause select_with_paren set_operator select_within_set_operation opt_order opt_limit */ #line 717 "bison_parser.y" { (yyval.select_stmt) = (yyvsp[-4].select_stmt); - if ((yyval.select_stmt)->setOperations == nullptr) { - (yyval.select_stmt)->setOperations = new std::vector(); - } - (yyval.select_stmt)->setOperations->push_back((yyvsp[-3].set_operator_t)); - (yyval.select_stmt)->setOperations->back()->nestedSelectStatement = (yyvsp[-2].select_stmt); - (yyval.select_stmt)->setOperations->back()->resultOrder = (yyvsp[-1].order_vec); - (yyval.select_stmt)->setOperations->back()->resultLimit = (yyvsp[0].limit); + (yyval.select_stmt)->setOperation = (yyvsp[-3].set_operator_t); + (yyval.select_stmt)->setOperation->nestedSelectStatement = (yyvsp[-2].select_stmt); + (yyval.select_stmt)->setOperation->resultOrder = (yyvsp[-1].order_vec); + (yyval.select_stmt)->setOperation->resultLimit = (yyvsp[0].limit); (yyval.select_stmt)->withDescriptions = (yyvsp[-5].with_description_vec); } -#line 3980 "bison_parser.cpp" +#line 3971 "bison_parser.cpp" break; case 110: /* select_within_set_operation_no_parentheses: select_clause */ -#line 731 "bison_parser.y" +#line 728 "bison_parser.y" { (yyval.select_stmt) = (yyvsp[0].select_stmt); } -#line 3986 "bison_parser.cpp" +#line 3977 "bison_parser.cpp" break; case 111: /* select_within_set_operation_no_parentheses: select_clause set_operator select_within_set_operation */ -#line 732 "bison_parser.y" +#line 729 "bison_parser.y" { (yyval.select_stmt) = (yyvsp[-2].select_stmt); - if ((yyval.select_stmt)->setOperations == nullptr) { - (yyval.select_stmt)->setOperations = new std::vector(); - } - (yyval.select_stmt)->setOperations->push_back((yyvsp[-1].set_operator_t)); - (yyval.select_stmt)->setOperations->back()->nestedSelectStatement = (yyvsp[0].select_stmt); + (yyval.select_stmt)->setOperation = (yyvsp[-1].set_operator_t); + (yyval.select_stmt)->setOperation->nestedSelectStatement = (yyvsp[0].select_stmt); } -#line 3999 "bison_parser.cpp" +#line 3987 "bison_parser.cpp" break; case 112: /* select_with_paren: '(' select_no_paren ')' */ -#line 741 "bison_parser.y" +#line 735 "bison_parser.y" { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 4005 "bison_parser.cpp" +#line 3993 "bison_parser.cpp" break; case 113: /* select_with_paren: '(' select_with_paren ')' */ -#line 742 "bison_parser.y" +#line 736 "bison_parser.y" { (yyval.select_stmt) = (yyvsp[-1].select_stmt); } -#line 4011 "bison_parser.cpp" +#line 3999 "bison_parser.cpp" break; case 114: /* select_no_paren: select_clause opt_order opt_limit */ -#line 744 "bison_parser.y" +#line 738 "bison_parser.y" { (yyval.select_stmt) = (yyvsp[-2].select_stmt); (yyval.select_stmt)->order = (yyvsp[-1].order_vec); @@ -4022,74 +4010,71 @@ YYLTYPE yylloc = yyloc_default; (yyval.select_stmt)->limit = (yyvsp[0].limit); } } -#line 4026 "bison_parser.cpp" +#line 4014 "bison_parser.cpp" break; case 115: /* select_no_paren: select_clause set_operator select_within_set_operation opt_order opt_limit */ -#line 754 "bison_parser.y" +#line 748 "bison_parser.y" { (yyval.select_stmt) = (yyvsp[-4].select_stmt); - if ((yyval.select_stmt)->setOperations == nullptr) { - (yyval.select_stmt)->setOperations = new std::vector(); - } - (yyval.select_stmt)->setOperations->push_back((yyvsp[-3].set_operator_t)); - (yyval.select_stmt)->setOperations->back()->nestedSelectStatement = (yyvsp[-2].select_stmt); - (yyval.select_stmt)->setOperations->back()->resultOrder = (yyvsp[-1].order_vec); - (yyval.select_stmt)->setOperations->back()->resultLimit = (yyvsp[0].limit); + (yyval.select_stmt)->setOperation = (yyvsp[-3].set_operator_t); + (yyval.select_stmt)->setOperation->nestedSelectStatement = (yyvsp[-2].select_stmt); + (yyval.select_stmt)->setOperation->resultOrder = (yyvsp[-1].order_vec); + (yyval.select_stmt)->setOperation->resultLimit = (yyvsp[0].limit); } -#line 4041 "bison_parser.cpp" +#line 4026 "bison_parser.cpp" break; case 116: /* set_operator: set_type opt_all */ -#line 765 "bison_parser.y" +#line 756 "bison_parser.y" { (yyval.set_operator_t) = (yyvsp[-1].set_operator_t); (yyval.set_operator_t)->isAll = (yyvsp[0].bval); } -#line 4050 "bison_parser.cpp" +#line 4035 "bison_parser.cpp" break; case 117: /* set_type: UNION */ -#line 770 "bison_parser.y" +#line 761 "bison_parser.y" { (yyval.set_operator_t) = new SetOperation(); (yyval.set_operator_t)->setType = SetType::kSetUnion; } -#line 4059 "bison_parser.cpp" +#line 4044 "bison_parser.cpp" break; case 118: /* set_type: INTERSECT */ -#line 774 "bison_parser.y" +#line 765 "bison_parser.y" { (yyval.set_operator_t) = new SetOperation(); (yyval.set_operator_t)->setType = SetType::kSetIntersect; } -#line 4068 "bison_parser.cpp" +#line 4053 "bison_parser.cpp" break; case 119: /* set_type: EXCEPT */ -#line 778 "bison_parser.y" +#line 769 "bison_parser.y" { (yyval.set_operator_t) = new SetOperation(); (yyval.set_operator_t)->setType = SetType::kSetExcept; } -#line 4077 "bison_parser.cpp" +#line 4062 "bison_parser.cpp" break; case 120: /* opt_all: ALL */ -#line 783 "bison_parser.y" +#line 774 "bison_parser.y" { (yyval.bval) = true; } -#line 4083 "bison_parser.cpp" +#line 4068 "bison_parser.cpp" break; case 121: /* opt_all: %empty */ -#line 784 "bison_parser.y" +#line 775 "bison_parser.y" { (yyval.bval) = false; } -#line 4089 "bison_parser.cpp" +#line 4074 "bison_parser.cpp" break; case 122: /* select_clause: SELECT opt_top opt_distinct select_list opt_from_clause opt_where opt_group */ -#line 786 "bison_parser.y" +#line 777 "bison_parser.y" { (yyval.select_stmt) = new SelectStatement(); (yyval.select_stmt)->limit = (yyvsp[-5].limit); @@ -4099,231 +4084,231 @@ YYLTYPE yylloc = yyloc_default; (yyval.select_stmt)->whereClause = (yyvsp[-1].expr); (yyval.select_stmt)->groupBy = (yyvsp[0].group_t); } -#line 4103 "bison_parser.cpp" +#line 4088 "bison_parser.cpp" break; case 123: /* opt_distinct: DISTINCT */ -#line 796 "bison_parser.y" +#line 787 "bison_parser.y" { (yyval.bval) = true; } -#line 4109 "bison_parser.cpp" +#line 4094 "bison_parser.cpp" break; case 124: /* opt_distinct: %empty */ -#line 797 "bison_parser.y" +#line 788 "bison_parser.y" { (yyval.bval) = false; } -#line 4115 "bison_parser.cpp" +#line 4100 "bison_parser.cpp" break; case 126: /* opt_from_clause: from_clause */ -#line 801 "bison_parser.y" +#line 792 "bison_parser.y" { (yyval.table) = (yyvsp[0].table); } -#line 4121 "bison_parser.cpp" +#line 4106 "bison_parser.cpp" break; case 127: /* opt_from_clause: %empty */ -#line 802 "bison_parser.y" +#line 793 "bison_parser.y" { (yyval.table) = nullptr; } -#line 4127 "bison_parser.cpp" +#line 4112 "bison_parser.cpp" break; case 128: /* from_clause: FROM table_ref */ -#line 804 "bison_parser.y" +#line 795 "bison_parser.y" { (yyval.table) = (yyvsp[0].table); } -#line 4133 "bison_parser.cpp" +#line 4118 "bison_parser.cpp" break; case 129: /* opt_where: WHERE expr */ -#line 806 "bison_parser.y" +#line 797 "bison_parser.y" { (yyval.expr) = (yyvsp[0].expr); } -#line 4139 "bison_parser.cpp" +#line 4124 "bison_parser.cpp" break; case 130: /* opt_where: %empty */ -#line 807 "bison_parser.y" +#line 798 "bison_parser.y" { (yyval.expr) = nullptr; } -#line 4145 "bison_parser.cpp" +#line 4130 "bison_parser.cpp" break; case 131: /* opt_group: GROUP BY expr_list opt_having */ -#line 809 "bison_parser.y" +#line 800 "bison_parser.y" { (yyval.group_t) = new GroupByDescription(); (yyval.group_t)->columns = (yyvsp[-1].expr_vec); (yyval.group_t)->having = (yyvsp[0].expr); } -#line 4155 "bison_parser.cpp" +#line 4140 "bison_parser.cpp" break; case 132: /* opt_group: %empty */ -#line 814 "bison_parser.y" +#line 805 "bison_parser.y" { (yyval.group_t) = nullptr; } -#line 4161 "bison_parser.cpp" +#line 4146 "bison_parser.cpp" break; case 133: /* opt_having: HAVING expr */ -#line 816 "bison_parser.y" +#line 807 "bison_parser.y" { (yyval.expr) = (yyvsp[0].expr); } -#line 4167 "bison_parser.cpp" +#line 4152 "bison_parser.cpp" break; case 134: /* opt_having: %empty */ -#line 817 "bison_parser.y" +#line 808 "bison_parser.y" { (yyval.expr) = nullptr; } -#line 4173 "bison_parser.cpp" +#line 4158 "bison_parser.cpp" break; case 135: /* opt_order: ORDER BY order_list */ -#line 819 "bison_parser.y" +#line 810 "bison_parser.y" { (yyval.order_vec) = (yyvsp[0].order_vec); } -#line 4179 "bison_parser.cpp" +#line 4164 "bison_parser.cpp" break; case 136: /* opt_order: %empty */ -#line 820 "bison_parser.y" +#line 811 "bison_parser.y" { (yyval.order_vec) = nullptr; } -#line 4185 "bison_parser.cpp" +#line 4170 "bison_parser.cpp" break; case 137: /* order_list: order_desc */ -#line 822 "bison_parser.y" +#line 813 "bison_parser.y" { (yyval.order_vec) = new std::vector(); (yyval.order_vec)->push_back((yyvsp[0].order)); } -#line 4194 "bison_parser.cpp" +#line 4179 "bison_parser.cpp" break; case 138: /* order_list: order_list ',' order_desc */ -#line 826 "bison_parser.y" +#line 817 "bison_parser.y" { (yyvsp[-2].order_vec)->push_back((yyvsp[0].order)); (yyval.order_vec) = (yyvsp[-2].order_vec); } -#line 4203 "bison_parser.cpp" +#line 4188 "bison_parser.cpp" break; case 139: /* order_desc: expr opt_order_type */ -#line 831 "bison_parser.y" +#line 822 "bison_parser.y" { (yyval.order) = new OrderDescription((yyvsp[0].order_type), (yyvsp[-1].expr)); } -#line 4209 "bison_parser.cpp" +#line 4194 "bison_parser.cpp" break; case 140: /* opt_order_type: ASC */ -#line 833 "bison_parser.y" +#line 824 "bison_parser.y" { (yyval.order_type) = kOrderAsc; } -#line 4215 "bison_parser.cpp" +#line 4200 "bison_parser.cpp" break; case 141: /* opt_order_type: DESC */ -#line 834 "bison_parser.y" +#line 825 "bison_parser.y" { (yyval.order_type) = kOrderDesc; } -#line 4221 "bison_parser.cpp" +#line 4206 "bison_parser.cpp" break; case 142: /* opt_order_type: %empty */ -#line 835 "bison_parser.y" +#line 826 "bison_parser.y" { (yyval.order_type) = kOrderAsc; } -#line 4227 "bison_parser.cpp" +#line 4212 "bison_parser.cpp" break; case 143: /* opt_top: TOP int_literal */ -#line 839 "bison_parser.y" +#line 830 "bison_parser.y" { (yyval.limit) = new LimitDescription((yyvsp[0].expr), nullptr); } -#line 4233 "bison_parser.cpp" +#line 4218 "bison_parser.cpp" break; case 144: /* opt_top: %empty */ -#line 840 "bison_parser.y" +#line 831 "bison_parser.y" { (yyval.limit) = nullptr; } -#line 4239 "bison_parser.cpp" +#line 4224 "bison_parser.cpp" break; case 145: /* opt_limit: LIMIT expr */ -#line 842 "bison_parser.y" +#line 833 "bison_parser.y" { (yyval.limit) = new LimitDescription((yyvsp[0].expr), nullptr); } -#line 4245 "bison_parser.cpp" +#line 4230 "bison_parser.cpp" break; case 146: /* opt_limit: OFFSET expr */ -#line 843 "bison_parser.y" +#line 834 "bison_parser.y" { (yyval.limit) = new LimitDescription(nullptr, (yyvsp[0].expr)); } -#line 4251 "bison_parser.cpp" +#line 4236 "bison_parser.cpp" break; case 147: /* opt_limit: LIMIT expr OFFSET expr */ -#line 844 "bison_parser.y" +#line 835 "bison_parser.y" { (yyval.limit) = new LimitDescription((yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 4257 "bison_parser.cpp" +#line 4242 "bison_parser.cpp" break; case 148: /* opt_limit: LIMIT ALL */ -#line 845 "bison_parser.y" +#line 836 "bison_parser.y" { (yyval.limit) = new LimitDescription(nullptr, nullptr); } -#line 4263 "bison_parser.cpp" +#line 4248 "bison_parser.cpp" break; case 149: /* opt_limit: LIMIT ALL OFFSET expr */ -#line 846 "bison_parser.y" +#line 837 "bison_parser.y" { (yyval.limit) = new LimitDescription(nullptr, (yyvsp[0].expr)); } -#line 4269 "bison_parser.cpp" +#line 4254 "bison_parser.cpp" break; case 150: /* opt_limit: %empty */ -#line 847 "bison_parser.y" +#line 838 "bison_parser.y" { (yyval.limit) = nullptr; } -#line 4275 "bison_parser.cpp" +#line 4260 "bison_parser.cpp" break; case 151: /* expr_list: expr_alias */ -#line 852 "bison_parser.y" +#line 843 "bison_parser.y" { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } -#line 4284 "bison_parser.cpp" +#line 4269 "bison_parser.cpp" break; case 152: /* expr_list: expr_list ',' expr_alias */ -#line 856 "bison_parser.y" +#line 847 "bison_parser.y" { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } -#line 4293 "bison_parser.cpp" +#line 4278 "bison_parser.cpp" break; case 153: /* opt_literal_list: literal_list */ -#line 861 "bison_parser.y" +#line 852 "bison_parser.y" { (yyval.expr_vec) = (yyvsp[0].expr_vec); } -#line 4299 "bison_parser.cpp" +#line 4284 "bison_parser.cpp" break; case 154: /* opt_literal_list: %empty */ -#line 862 "bison_parser.y" +#line 853 "bison_parser.y" { (yyval.expr_vec) = nullptr; } -#line 4305 "bison_parser.cpp" +#line 4290 "bison_parser.cpp" break; case 155: /* literal_list: literal */ -#line 864 "bison_parser.y" +#line 855 "bison_parser.y" { (yyval.expr_vec) = new std::vector(); (yyval.expr_vec)->push_back((yyvsp[0].expr)); } -#line 4314 "bison_parser.cpp" +#line 4299 "bison_parser.cpp" break; case 156: /* literal_list: literal_list ',' literal */ -#line 868 "bison_parser.y" +#line 859 "bison_parser.y" { (yyvsp[-2].expr_vec)->push_back((yyvsp[0].expr)); (yyval.expr_vec) = (yyvsp[-2].expr_vec); } -#line 4323 "bison_parser.cpp" +#line 4308 "bison_parser.cpp" break; case 157: /* expr_alias: expr opt_alias */ -#line 873 "bison_parser.y" +#line 864 "bison_parser.y" { (yyval.expr) = (yyvsp[-1].expr); if ((yyvsp[0].alias_t)) { @@ -4331,415 +4316,415 @@ YYLTYPE yylloc = yyloc_default; delete (yyvsp[0].alias_t); } } -#line 4335 "bison_parser.cpp" +#line 4320 "bison_parser.cpp" break; case 163: /* operand: '(' expr ')' */ -#line 883 "bison_parser.y" +#line 874 "bison_parser.y" { (yyval.expr) = (yyvsp[-1].expr); } -#line 4341 "bison_parser.cpp" +#line 4326 "bison_parser.cpp" break; case 173: /* operand: '(' select_no_paren ')' */ -#line 885 "bison_parser.y" +#line 876 "bison_parser.y" { (yyval.expr) = Expr::makeSelect((yyvsp[-1].select_stmt)); } -#line 4349 "bison_parser.cpp" +#line 4334 "bison_parser.cpp" break; case 176: /* unary_expr: '-' operand */ -#line 891 "bison_parser.y" +#line 882 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpUnaryMinus, (yyvsp[0].expr)); } -#line 4355 "bison_parser.cpp" +#line 4340 "bison_parser.cpp" break; case 177: /* unary_expr: NOT operand */ -#line 892 "bison_parser.y" +#line 883 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpNot, (yyvsp[0].expr)); } -#line 4361 "bison_parser.cpp" +#line 4346 "bison_parser.cpp" break; case 178: /* unary_expr: operand ISNULL */ -#line 893 "bison_parser.y" +#line 884 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-1].expr)); } -#line 4367 "bison_parser.cpp" +#line 4352 "bison_parser.cpp" break; case 179: /* unary_expr: operand IS NULL */ -#line 894 "bison_parser.y" +#line 885 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpIsNull, (yyvsp[-2].expr)); } -#line 4373 "bison_parser.cpp" +#line 4358 "bison_parser.cpp" break; case 180: /* unary_expr: operand IS NOT NULL */ -#line 895 "bison_parser.y" +#line 886 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeOpUnary(kOpIsNull, (yyvsp[-3].expr))); } -#line 4379 "bison_parser.cpp" +#line 4364 "bison_parser.cpp" break; case 182: /* binary_expr: operand '-' operand */ -#line 897 "bison_parser.y" +#line 888 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpMinus, (yyvsp[0].expr)); } -#line 4385 "bison_parser.cpp" +#line 4370 "bison_parser.cpp" break; case 183: /* binary_expr: operand '+' operand */ -#line 898 "bison_parser.y" +#line 889 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPlus, (yyvsp[0].expr)); } -#line 4391 "bison_parser.cpp" +#line 4376 "bison_parser.cpp" break; case 184: /* binary_expr: operand '/' operand */ -#line 899 "bison_parser.y" +#line 890 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpSlash, (yyvsp[0].expr)); } -#line 4397 "bison_parser.cpp" +#line 4382 "bison_parser.cpp" break; case 185: /* binary_expr: operand '*' operand */ -#line 900 "bison_parser.y" +#line 891 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAsterisk, (yyvsp[0].expr)); } -#line 4403 "bison_parser.cpp" +#line 4388 "bison_parser.cpp" break; case 186: /* binary_expr: operand '%' operand */ -#line 901 "bison_parser.y" +#line 892 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpPercentage, (yyvsp[0].expr)); } -#line 4409 "bison_parser.cpp" +#line 4394 "bison_parser.cpp" break; case 187: /* binary_expr: operand '^' operand */ -#line 902 "bison_parser.y" +#line 893 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpCaret, (yyvsp[0].expr)); } -#line 4415 "bison_parser.cpp" +#line 4400 "bison_parser.cpp" break; case 188: /* binary_expr: operand LIKE operand */ -#line 903 "bison_parser.y" +#line 894 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLike, (yyvsp[0].expr)); } -#line 4421 "bison_parser.cpp" +#line 4406 "bison_parser.cpp" break; case 189: /* binary_expr: operand NOT LIKE operand */ -#line 904 "bison_parser.y" +#line 895 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-3].expr), kOpNotLike, (yyvsp[0].expr)); } -#line 4427 "bison_parser.cpp" +#line 4412 "bison_parser.cpp" break; case 190: /* binary_expr: operand ILIKE operand */ -#line 905 "bison_parser.y" +#line 896 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpILike, (yyvsp[0].expr)); } -#line 4433 "bison_parser.cpp" +#line 4418 "bison_parser.cpp" break; case 191: /* binary_expr: operand CONCAT operand */ -#line 906 "bison_parser.y" +#line 897 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpConcat, (yyvsp[0].expr)); } -#line 4439 "bison_parser.cpp" +#line 4424 "bison_parser.cpp" break; case 192: /* logic_expr: expr AND expr */ -#line 908 "bison_parser.y" +#line 899 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpAnd, (yyvsp[0].expr)); } -#line 4445 "bison_parser.cpp" +#line 4430 "bison_parser.cpp" break; case 193: /* logic_expr: expr OR expr */ -#line 909 "bison_parser.y" +#line 900 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpOr, (yyvsp[0].expr)); } -#line 4451 "bison_parser.cpp" +#line 4436 "bison_parser.cpp" break; case 194: /* in_expr: operand IN '(' expr_list ')' */ -#line 911 "bison_parser.y" +#line 902 "bison_parser.y" { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].expr_vec)); } -#line 4457 "bison_parser.cpp" +#line 4442 "bison_parser.cpp" break; case 195: /* in_expr: operand NOT IN '(' expr_list ')' */ -#line 912 "bison_parser.y" +#line 903 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].expr_vec))); } -#line 4463 "bison_parser.cpp" +#line 4448 "bison_parser.cpp" break; case 196: /* in_expr: operand IN '(' select_no_paren ')' */ -#line 913 "bison_parser.y" +#line 904 "bison_parser.y" { (yyval.expr) = Expr::makeInOperator((yyvsp[-4].expr), (yyvsp[-1].select_stmt)); } -#line 4469 "bison_parser.cpp" +#line 4454 "bison_parser.cpp" break; case 197: /* in_expr: operand NOT IN '(' select_no_paren ')' */ -#line 914 "bison_parser.y" +#line 905 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeInOperator((yyvsp[-5].expr), (yyvsp[-1].select_stmt))); } -#line 4475 "bison_parser.cpp" +#line 4460 "bison_parser.cpp" break; case 198: /* case_expr: CASE expr case_list END */ -#line 918 "bison_parser.y" +#line 909 "bison_parser.y" { (yyval.expr) = Expr::makeCase((yyvsp[-2].expr), (yyvsp[-1].expr), nullptr); } -#line 4481 "bison_parser.cpp" +#line 4466 "bison_parser.cpp" break; case 199: /* case_expr: CASE expr case_list ELSE expr END */ -#line 919 "bison_parser.y" +#line 910 "bison_parser.y" { (yyval.expr) = Expr::makeCase((yyvsp[-4].expr), (yyvsp[-3].expr), (yyvsp[-1].expr)); } -#line 4487 "bison_parser.cpp" +#line 4472 "bison_parser.cpp" break; case 200: /* case_expr: CASE case_list END */ -#line 920 "bison_parser.y" +#line 911 "bison_parser.y" { (yyval.expr) = Expr::makeCase(nullptr, (yyvsp[-1].expr), nullptr); } -#line 4493 "bison_parser.cpp" +#line 4478 "bison_parser.cpp" break; case 201: /* case_expr: CASE case_list ELSE expr END */ -#line 921 "bison_parser.y" +#line 912 "bison_parser.y" { (yyval.expr) = Expr::makeCase(nullptr, (yyvsp[-3].expr), (yyvsp[-1].expr)); } -#line 4499 "bison_parser.cpp" +#line 4484 "bison_parser.cpp" break; case 202: /* case_list: WHEN expr THEN expr */ -#line 923 "bison_parser.y" +#line 914 "bison_parser.y" { (yyval.expr) = Expr::makeCaseList(Expr::makeCaseListElement((yyvsp[-2].expr), (yyvsp[0].expr))); } -#line 4505 "bison_parser.cpp" +#line 4490 "bison_parser.cpp" break; case 203: /* case_list: case_list WHEN expr THEN expr */ -#line 924 "bison_parser.y" +#line 915 "bison_parser.y" { (yyval.expr) = Expr::caseListAppend((yyvsp[-4].expr), Expr::makeCaseListElement((yyvsp[-2].expr), (yyvsp[0].expr))); } -#line 4511 "bison_parser.cpp" +#line 4496 "bison_parser.cpp" break; case 204: /* exists_expr: EXISTS '(' select_no_paren ')' */ -#line 926 "bison_parser.y" +#line 917 "bison_parser.y" { (yyval.expr) = Expr::makeExists((yyvsp[-1].select_stmt)); } -#line 4517 "bison_parser.cpp" +#line 4502 "bison_parser.cpp" break; case 205: /* exists_expr: NOT EXISTS '(' select_no_paren ')' */ -#line 927 "bison_parser.y" +#line 918 "bison_parser.y" { (yyval.expr) = Expr::makeOpUnary(kOpNot, Expr::makeExists((yyvsp[-1].select_stmt))); } -#line 4523 "bison_parser.cpp" +#line 4508 "bison_parser.cpp" break; case 206: /* comp_expr: operand '=' operand */ -#line 929 "bison_parser.y" +#line 920 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpEquals, (yyvsp[0].expr)); } -#line 4529 "bison_parser.cpp" +#line 4514 "bison_parser.cpp" break; case 207: /* comp_expr: operand EQUALS operand */ -#line 930 "bison_parser.y" +#line 921 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpEquals, (yyvsp[0].expr)); } -#line 4535 "bison_parser.cpp" +#line 4520 "bison_parser.cpp" break; case 208: /* comp_expr: operand NOTEQUALS operand */ -#line 931 "bison_parser.y" +#line 922 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpNotEquals, (yyvsp[0].expr)); } -#line 4541 "bison_parser.cpp" +#line 4526 "bison_parser.cpp" break; case 209: /* comp_expr: operand '<' operand */ -#line 932 "bison_parser.y" +#line 923 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLess, (yyvsp[0].expr)); } -#line 4547 "bison_parser.cpp" +#line 4532 "bison_parser.cpp" break; case 210: /* comp_expr: operand '>' operand */ -#line 933 "bison_parser.y" +#line 924 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreater, (yyvsp[0].expr)); } -#line 4553 "bison_parser.cpp" +#line 4538 "bison_parser.cpp" break; case 211: /* comp_expr: operand LESSEQ operand */ -#line 934 "bison_parser.y" +#line 925 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpLessEq, (yyvsp[0].expr)); } -#line 4559 "bison_parser.cpp" +#line 4544 "bison_parser.cpp" break; case 212: /* comp_expr: operand GREATEREQ operand */ -#line 935 "bison_parser.y" +#line 926 "bison_parser.y" { (yyval.expr) = Expr::makeOpBinary((yyvsp[-2].expr), kOpGreaterEq, (yyvsp[0].expr)); } -#line 4565 "bison_parser.cpp" +#line 4550 "bison_parser.cpp" break; case 213: /* function_expr: IDENTIFIER '(' ')' */ -#line 937 "bison_parser.y" +#line 928 "bison_parser.y" { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-2].sval), new std::vector(), false); } -#line 4571 "bison_parser.cpp" +#line 4556 "bison_parser.cpp" break; case 214: /* function_expr: IDENTIFIER '(' opt_distinct expr_list ')' */ -#line 938 "bison_parser.y" +#line 929 "bison_parser.y" { (yyval.expr) = Expr::makeFunctionRef((yyvsp[-4].sval), (yyvsp[-1].expr_vec), (yyvsp[-2].bval)); } -#line 4577 "bison_parser.cpp" +#line 4562 "bison_parser.cpp" break; case 215: /* extract_expr: EXTRACT '(' datetime_field FROM expr ')' */ -#line 940 "bison_parser.y" +#line 931 "bison_parser.y" { (yyval.expr) = Expr::makeExtract((yyvsp[-3].datetime_field), (yyvsp[-1].expr)); } -#line 4583 "bison_parser.cpp" +#line 4568 "bison_parser.cpp" break; case 216: /* cast_expr: CAST '(' expr AS column_type ')' */ -#line 942 "bison_parser.y" +#line 933 "bison_parser.y" { (yyval.expr) = Expr::makeCast((yyvsp[-3].expr), (yyvsp[-1].column_type_t)); } -#line 4589 "bison_parser.cpp" +#line 4574 "bison_parser.cpp" break; case 217: /* datetime_field: SECOND */ -#line 944 "bison_parser.y" +#line 935 "bison_parser.y" { (yyval.datetime_field) = kDatetimeSecond; } -#line 4595 "bison_parser.cpp" +#line 4580 "bison_parser.cpp" break; case 218: /* datetime_field: MINUTE */ -#line 945 "bison_parser.y" +#line 936 "bison_parser.y" { (yyval.datetime_field) = kDatetimeMinute; } -#line 4601 "bison_parser.cpp" +#line 4586 "bison_parser.cpp" break; case 219: /* datetime_field: HOUR */ -#line 946 "bison_parser.y" +#line 937 "bison_parser.y" { (yyval.datetime_field) = kDatetimeHour; } -#line 4607 "bison_parser.cpp" +#line 4592 "bison_parser.cpp" break; case 220: /* datetime_field: DAY */ -#line 947 "bison_parser.y" +#line 938 "bison_parser.y" { (yyval.datetime_field) = kDatetimeDay; } -#line 4613 "bison_parser.cpp" +#line 4598 "bison_parser.cpp" break; case 221: /* datetime_field: MONTH */ -#line 948 "bison_parser.y" +#line 939 "bison_parser.y" { (yyval.datetime_field) = kDatetimeMonth; } -#line 4619 "bison_parser.cpp" +#line 4604 "bison_parser.cpp" break; case 222: /* datetime_field: YEAR */ -#line 949 "bison_parser.y" +#line 940 "bison_parser.y" { (yyval.datetime_field) = kDatetimeYear; } -#line 4625 "bison_parser.cpp" +#line 4610 "bison_parser.cpp" break; case 223: /* datetime_field_plural: SECONDS */ -#line 951 "bison_parser.y" +#line 942 "bison_parser.y" { (yyval.datetime_field) = kDatetimeSecond; } -#line 4631 "bison_parser.cpp" +#line 4616 "bison_parser.cpp" break; case 224: /* datetime_field_plural: MINUTES */ -#line 952 "bison_parser.y" +#line 943 "bison_parser.y" { (yyval.datetime_field) = kDatetimeMinute; } -#line 4637 "bison_parser.cpp" +#line 4622 "bison_parser.cpp" break; case 225: /* datetime_field_plural: HOURS */ -#line 953 "bison_parser.y" +#line 944 "bison_parser.y" { (yyval.datetime_field) = kDatetimeHour; } -#line 4643 "bison_parser.cpp" +#line 4628 "bison_parser.cpp" break; case 226: /* datetime_field_plural: DAYS */ -#line 954 "bison_parser.y" +#line 945 "bison_parser.y" { (yyval.datetime_field) = kDatetimeDay; } -#line 4649 "bison_parser.cpp" +#line 4634 "bison_parser.cpp" break; case 227: /* datetime_field_plural: MONTHS */ -#line 955 "bison_parser.y" +#line 946 "bison_parser.y" { (yyval.datetime_field) = kDatetimeMonth; } -#line 4655 "bison_parser.cpp" +#line 4640 "bison_parser.cpp" break; case 228: /* datetime_field_plural: YEARS */ -#line 956 "bison_parser.y" +#line 947 "bison_parser.y" { (yyval.datetime_field) = kDatetimeYear; } -#line 4661 "bison_parser.cpp" +#line 4646 "bison_parser.cpp" break; case 231: /* array_expr: ARRAY '[' expr_list ']' */ -#line 960 "bison_parser.y" +#line 951 "bison_parser.y" { (yyval.expr) = Expr::makeArray((yyvsp[-1].expr_vec)); } -#line 4667 "bison_parser.cpp" +#line 4652 "bison_parser.cpp" break; case 232: /* array_index: operand '[' int_literal ']' */ -#line 962 "bison_parser.y" +#line 953 "bison_parser.y" { (yyval.expr) = Expr::makeArrayIndex((yyvsp[-3].expr), (yyvsp[-1].expr)->ival); } -#line 4673 "bison_parser.cpp" +#line 4658 "bison_parser.cpp" break; case 233: /* between_expr: operand BETWEEN operand AND operand */ -#line 964 "bison_parser.y" +#line 955 "bison_parser.y" { (yyval.expr) = Expr::makeBetween((yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); } -#line 4679 "bison_parser.cpp" +#line 4664 "bison_parser.cpp" break; case 234: /* column_name: IDENTIFIER */ -#line 966 "bison_parser.y" +#line 957 "bison_parser.y" { (yyval.expr) = Expr::makeColumnRef((yyvsp[0].sval)); } -#line 4685 "bison_parser.cpp" +#line 4670 "bison_parser.cpp" break; case 235: /* column_name: IDENTIFIER '.' IDENTIFIER */ -#line 967 "bison_parser.y" +#line 958 "bison_parser.y" { (yyval.expr) = Expr::makeColumnRef((yyvsp[-2].sval), (yyvsp[0].sval)); } -#line 4691 "bison_parser.cpp" +#line 4676 "bison_parser.cpp" break; case 236: /* column_name: '*' */ -#line 968 "bison_parser.y" +#line 959 "bison_parser.y" { (yyval.expr) = Expr::makeStar(); } -#line 4697 "bison_parser.cpp" +#line 4682 "bison_parser.cpp" break; case 237: /* column_name: IDENTIFIER '.' '*' */ -#line 969 "bison_parser.y" +#line 960 "bison_parser.y" { (yyval.expr) = Expr::makeStar((yyvsp[-2].sval)); } -#line 4703 "bison_parser.cpp" +#line 4688 "bison_parser.cpp" break; case 245: /* string_literal: STRING */ -#line 973 "bison_parser.y" +#line 964 "bison_parser.y" { (yyval.expr) = Expr::makeLiteral((yyvsp[0].sval)); } -#line 4709 "bison_parser.cpp" +#line 4694 "bison_parser.cpp" break; case 246: /* bool_literal: TRUE */ -#line 975 "bison_parser.y" +#line 966 "bison_parser.y" { (yyval.expr) = Expr::makeLiteral(true); } -#line 4715 "bison_parser.cpp" +#line 4700 "bison_parser.cpp" break; case 247: /* bool_literal: FALSE */ -#line 976 "bison_parser.y" +#line 967 "bison_parser.y" { (yyval.expr) = Expr::makeLiteral(false); } -#line 4721 "bison_parser.cpp" +#line 4706 "bison_parser.cpp" break; case 248: /* num_literal: FLOATVAL */ -#line 978 "bison_parser.y" +#line 969 "bison_parser.y" { (yyval.expr) = Expr::makeLiteral((yyvsp[0].fval)); } -#line 4727 "bison_parser.cpp" +#line 4712 "bison_parser.cpp" break; case 250: /* int_literal: INTVAL */ -#line 981 "bison_parser.y" +#line 972 "bison_parser.y" { (yyval.expr) = Expr::makeLiteral((yyvsp[0].ival)); } -#line 4733 "bison_parser.cpp" +#line 4718 "bison_parser.cpp" break; case 251: /* null_literal: NULL */ -#line 983 "bison_parser.y" +#line 974 "bison_parser.y" { (yyval.expr) = Expr::makeNullLiteral(); } -#line 4739 "bison_parser.cpp" +#line 4724 "bison_parser.cpp" break; case 252: /* date_literal: DATE STRING */ -#line 985 "bison_parser.y" +#line 976 "bison_parser.y" { int day{0}, month{0}, year{0}, chars_parsed{0}; // If the whole string is parsed, chars_parsed points to the terminating null byte after the last character @@ -4750,20 +4735,20 @@ YYLTYPE yylloc = yyloc_default; } (yyval.expr) = Expr::makeDateLiteral((yyvsp[0].sval)); } -#line 4754 "bison_parser.cpp" +#line 4739 "bison_parser.cpp" break; case 253: /* interval_literal: int_literal duration_field */ -#line 996 "bison_parser.y" +#line 987 "bison_parser.y" { (yyval.expr) = Expr::makeIntervalLiteral((yyvsp[-1].expr)->ival, (yyvsp[0].datetime_field)); delete (yyvsp[-1].expr); } -#line 4763 "bison_parser.cpp" +#line 4748 "bison_parser.cpp" break; case 254: /* interval_literal: INTERVAL STRING datetime_field */ -#line 1000 "bison_parser.y" +#line 991 "bison_parser.y" { int duration{0}, chars_parsed{0}; // If the whole string is parsed, chars_parsed points to the terminating null byte after the last character @@ -4775,11 +4760,11 @@ YYLTYPE yylloc = yyloc_default; free((yyvsp[-1].sval)); (yyval.expr) = Expr::makeIntervalLiteral(duration, (yyvsp[0].datetime_field)); } -#line 4779 "bison_parser.cpp" +#line 4764 "bison_parser.cpp" break; case 255: /* interval_literal: INTERVAL STRING */ -#line 1011 "bison_parser.y" +#line 1002 "bison_parser.y" { int duration{0}, chars_parsed{0}; // 'seconds' and 'minutes' are the longest accepted interval qualifiers (7 chars) + null byte @@ -4811,61 +4796,61 @@ YYLTYPE yylloc = yyloc_default; } (yyval.expr) = Expr::makeIntervalLiteral(duration, unit); } -#line 4815 "bison_parser.cpp" +#line 4800 "bison_parser.cpp" break; case 256: /* param_expr: '?' */ -#line 1043 "bison_parser.y" +#line 1034 "bison_parser.y" { (yyval.expr) = Expr::makeParameter(yylloc.total_column); (yyval.expr)->ival2 = yyloc.param_list.size(); yyloc.param_list.push_back((yyval.expr)); } -#line 4825 "bison_parser.cpp" +#line 4810 "bison_parser.cpp" break; case 258: /* table_ref: table_ref_commalist ',' table_ref_atomic */ -#line 1052 "bison_parser.y" +#line 1043 "bison_parser.y" { (yyvsp[-2].table_vec)->push_back((yyvsp[0].table)); auto tbl = new TableRef(kTableCrossProduct); tbl->list = (yyvsp[-2].table_vec); (yyval.table) = tbl; } -#line 4836 "bison_parser.cpp" +#line 4821 "bison_parser.cpp" break; case 262: /* nonjoin_table_ref_atomic: '(' select_statement ')' opt_table_alias */ -#line 1061 "bison_parser.y" +#line 1052 "bison_parser.y" { auto tbl = new TableRef(kTableSelect); tbl->select = (yyvsp[-2].select_stmt); tbl->alias = (yyvsp[0].alias_t); (yyval.table) = tbl; } -#line 4847 "bison_parser.cpp" +#line 4832 "bison_parser.cpp" break; case 263: /* table_ref_commalist: table_ref_atomic */ -#line 1068 "bison_parser.y" +#line 1059 "bison_parser.y" { (yyval.table_vec) = new std::vector(); (yyval.table_vec)->push_back((yyvsp[0].table)); } -#line 4856 "bison_parser.cpp" +#line 4841 "bison_parser.cpp" break; case 264: /* table_ref_commalist: table_ref_commalist ',' table_ref_atomic */ -#line 1072 "bison_parser.y" +#line 1063 "bison_parser.y" { (yyvsp[-2].table_vec)->push_back((yyvsp[0].table)); (yyval.table_vec) = (yyvsp[-2].table_vec); } -#line 4865 "bison_parser.cpp" +#line 4850 "bison_parser.cpp" break; case 265: /* table_ref_name: table_name opt_table_alias */ -#line 1077 "bison_parser.y" +#line 1068 "bison_parser.y" { auto tbl = new TableRef(kTableName); tbl->schema = (yyvsp[-1].table_name).schema; @@ -4873,121 +4858,121 @@ YYLTYPE yylloc = yyloc_default; tbl->alias = (yyvsp[0].alias_t); (yyval.table) = tbl; } -#line 4877 "bison_parser.cpp" +#line 4862 "bison_parser.cpp" break; case 266: /* table_ref_name_no_alias: table_name */ -#line 1085 "bison_parser.y" +#line 1076 "bison_parser.y" { (yyval.table) = new TableRef(kTableName); (yyval.table)->schema = (yyvsp[0].table_name).schema; (yyval.table)->name = (yyvsp[0].table_name).name; } -#line 4887 "bison_parser.cpp" +#line 4872 "bison_parser.cpp" break; case 267: /* table_name: IDENTIFIER */ -#line 1091 "bison_parser.y" +#line 1082 "bison_parser.y" { (yyval.table_name).schema = nullptr; (yyval.table_name).name = (yyvsp[0].sval); } -#line 4896 "bison_parser.cpp" +#line 4881 "bison_parser.cpp" break; case 268: /* table_name: IDENTIFIER '.' IDENTIFIER */ -#line 1095 "bison_parser.y" +#line 1086 "bison_parser.y" { (yyval.table_name).schema = (yyvsp[-2].sval); (yyval.table_name).name = (yyvsp[0].sval); } -#line 4905 "bison_parser.cpp" +#line 4890 "bison_parser.cpp" break; case 269: /* opt_index_name: IDENTIFIER */ -#line 1100 "bison_parser.y" +#line 1091 "bison_parser.y" { (yyval.sval) = (yyvsp[0].sval); } -#line 4911 "bison_parser.cpp" +#line 4896 "bison_parser.cpp" break; case 270: /* opt_index_name: %empty */ -#line 1101 "bison_parser.y" +#line 1092 "bison_parser.y" { (yyval.sval) = nullptr; } -#line 4917 "bison_parser.cpp" +#line 4902 "bison_parser.cpp" break; case 272: /* table_alias: AS IDENTIFIER '(' ident_commalist ')' */ -#line 1103 "bison_parser.y" +#line 1094 "bison_parser.y" { (yyval.alias_t) = new Alias((yyvsp[-3].sval), (yyvsp[-1].str_vec)); } -#line 4923 "bison_parser.cpp" +#line 4908 "bison_parser.cpp" break; case 274: /* opt_table_alias: %empty */ -#line 1105 "bison_parser.y" +#line 1096 "bison_parser.y" { (yyval.alias_t) = nullptr; } -#line 4929 "bison_parser.cpp" +#line 4914 "bison_parser.cpp" break; case 275: /* alias: AS IDENTIFIER */ -#line 1107 "bison_parser.y" +#line 1098 "bison_parser.y" { (yyval.alias_t) = new Alias((yyvsp[0].sval)); } -#line 4935 "bison_parser.cpp" +#line 4920 "bison_parser.cpp" break; case 276: /* alias: IDENTIFIER */ -#line 1108 "bison_parser.y" +#line 1099 "bison_parser.y" { (yyval.alias_t) = new Alias((yyvsp[0].sval)); } -#line 4941 "bison_parser.cpp" +#line 4926 "bison_parser.cpp" break; case 278: /* opt_alias: %empty */ -#line 1110 "bison_parser.y" +#line 1101 "bison_parser.y" { (yyval.alias_t) = nullptr; } -#line 4947 "bison_parser.cpp" +#line 4932 "bison_parser.cpp" break; case 280: /* opt_with_clause: %empty */ -#line 1116 "bison_parser.y" +#line 1107 "bison_parser.y" { (yyval.with_description_vec) = nullptr; } -#line 4953 "bison_parser.cpp" +#line 4938 "bison_parser.cpp" break; case 281: /* with_clause: WITH with_description_list */ -#line 1118 "bison_parser.y" +#line 1109 "bison_parser.y" { (yyval.with_description_vec) = (yyvsp[0].with_description_vec); } -#line 4959 "bison_parser.cpp" +#line 4944 "bison_parser.cpp" break; case 282: /* with_description_list: with_description */ -#line 1120 "bison_parser.y" +#line 1111 "bison_parser.y" { (yyval.with_description_vec) = new std::vector(); (yyval.with_description_vec)->push_back((yyvsp[0].with_description_t)); } -#line 4968 "bison_parser.cpp" +#line 4953 "bison_parser.cpp" break; case 283: /* with_description_list: with_description_list ',' with_description */ -#line 1124 "bison_parser.y" +#line 1115 "bison_parser.y" { (yyvsp[-2].with_description_vec)->push_back((yyvsp[0].with_description_t)); (yyval.with_description_vec) = (yyvsp[-2].with_description_vec); } -#line 4977 "bison_parser.cpp" +#line 4962 "bison_parser.cpp" break; case 284: /* with_description: IDENTIFIER AS select_with_paren */ -#line 1129 "bison_parser.y" +#line 1120 "bison_parser.y" { (yyval.with_description_t) = new WithDescription(); (yyval.with_description_t)->alias = (yyvsp[-2].sval); (yyval.with_description_t)->select = (yyvsp[0].select_stmt); } -#line 4987 "bison_parser.cpp" +#line 4972 "bison_parser.cpp" break; case 285: /* join_clause: table_ref_atomic NATURAL JOIN nonjoin_table_ref_atomic */ -#line 1139 "bison_parser.y" +#line 1130 "bison_parser.y" { (yyval.table) = new TableRef(kTableJoin); (yyval.table)->join = new JoinDefinition(); @@ -4995,11 +4980,11 @@ YYLTYPE yylloc = yyloc_default; (yyval.table)->join->left = (yyvsp[-3].table); (yyval.table)->join->right = (yyvsp[0].table); } -#line 4999 "bison_parser.cpp" +#line 4984 "bison_parser.cpp" break; case 286: /* join_clause: table_ref_atomic opt_join_type JOIN table_ref_atomic ON join_condition */ -#line 1146 "bison_parser.y" +#line 1137 "bison_parser.y" { (yyval.table) = new TableRef(kTableJoin); (yyval.table)->join = new JoinDefinition(); @@ -5008,11 +4993,11 @@ YYLTYPE yylloc = yyloc_default; (yyval.table)->join->right = (yyvsp[-2].table); (yyval.table)->join->condition = (yyvsp[0].expr); } -#line 5012 "bison_parser.cpp" +#line 4997 "bison_parser.cpp" break; case 287: /* join_clause: table_ref_atomic opt_join_type JOIN table_ref_atomic USING '(' column_name ')' */ -#line 1154 "bison_parser.y" +#line 1145 "bison_parser.y" { (yyval.table) = new TableRef(kTableJoin); (yyval.table)->join = new JoinDefinition(); @@ -5028,89 +5013,89 @@ YYLTYPE yylloc = yyloc_default; (yyval.table)->join->condition = Expr::makeOpBinary(left_col, kOpEquals, right_col); delete (yyvsp[-1].expr); } -#line 5032 "bison_parser.cpp" +#line 5017 "bison_parser.cpp" break; case 288: /* opt_join_type: INNER */ -#line 1170 "bison_parser.y" +#line 1161 "bison_parser.y" { (yyval.join_type) = kJoinInner; } -#line 5038 "bison_parser.cpp" +#line 5023 "bison_parser.cpp" break; case 289: /* opt_join_type: LEFT OUTER */ -#line 1171 "bison_parser.y" +#line 1162 "bison_parser.y" { (yyval.join_type) = kJoinLeft; } -#line 5044 "bison_parser.cpp" +#line 5029 "bison_parser.cpp" break; case 290: /* opt_join_type: LEFT */ -#line 1172 "bison_parser.y" +#line 1163 "bison_parser.y" { (yyval.join_type) = kJoinLeft; } -#line 5050 "bison_parser.cpp" +#line 5035 "bison_parser.cpp" break; case 291: /* opt_join_type: RIGHT OUTER */ -#line 1173 "bison_parser.y" +#line 1164 "bison_parser.y" { (yyval.join_type) = kJoinRight; } -#line 5056 "bison_parser.cpp" +#line 5041 "bison_parser.cpp" break; case 292: /* opt_join_type: RIGHT */ -#line 1174 "bison_parser.y" +#line 1165 "bison_parser.y" { (yyval.join_type) = kJoinRight; } -#line 5062 "bison_parser.cpp" +#line 5047 "bison_parser.cpp" break; case 293: /* opt_join_type: FULL OUTER */ -#line 1175 "bison_parser.y" +#line 1166 "bison_parser.y" { (yyval.join_type) = kJoinFull; } -#line 5068 "bison_parser.cpp" +#line 5053 "bison_parser.cpp" break; case 294: /* opt_join_type: OUTER */ -#line 1176 "bison_parser.y" +#line 1167 "bison_parser.y" { (yyval.join_type) = kJoinFull; } -#line 5074 "bison_parser.cpp" +#line 5059 "bison_parser.cpp" break; case 295: /* opt_join_type: FULL */ -#line 1177 "bison_parser.y" +#line 1168 "bison_parser.y" { (yyval.join_type) = kJoinFull; } -#line 5080 "bison_parser.cpp" +#line 5065 "bison_parser.cpp" break; case 296: /* opt_join_type: CROSS */ -#line 1178 "bison_parser.y" +#line 1169 "bison_parser.y" { (yyval.join_type) = kJoinCross; } -#line 5086 "bison_parser.cpp" +#line 5071 "bison_parser.cpp" break; case 297: /* opt_join_type: %empty */ -#line 1179 "bison_parser.y" +#line 1170 "bison_parser.y" { (yyval.join_type) = kJoinInner; } -#line 5092 "bison_parser.cpp" +#line 5077 "bison_parser.cpp" break; case 301: /* ident_commalist: IDENTIFIER */ -#line 1190 "bison_parser.y" +#line 1181 "bison_parser.y" { (yyval.str_vec) = new std::vector(); (yyval.str_vec)->push_back((yyvsp[0].sval)); } -#line 5101 "bison_parser.cpp" +#line 5086 "bison_parser.cpp" break; case 302: /* ident_commalist: ident_commalist ',' IDENTIFIER */ -#line 1194 "bison_parser.y" +#line 1185 "bison_parser.y" { (yyvsp[-2].str_vec)->push_back((yyvsp[0].sval)); (yyval.str_vec) = (yyvsp[-2].str_vec); } -#line 5110 "bison_parser.cpp" +#line 5095 "bison_parser.cpp" break; -#line 5114 "bison_parser.cpp" +#line 5099 "bison_parser.cpp" default: break; } @@ -5187,7 +5172,7 @@ YYLTYPE yylloc = yyloc_default; } yyerror (&yylloc, result, scanner, yymsgp); if (yysyntax_error_status == YYENOMEM) - goto yyexhaustedlab; + YYNOMEM; } } @@ -5224,6 +5209,7 @@ YYLTYPE yylloc = yyloc_default; label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -5287,7 +5273,7 @@ YYLTYPE yylloc = yyloc_default; `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; /*-----------------------------------. @@ -5295,24 +5281,22 @@ YYLTYPE yylloc = yyloc_default; `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; -#if 1 -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: yyerror (&yylloc, result, scanner, YY_("memory exhausted")); yyresult = 2; - goto yyreturn; -#endif + goto yyreturnlab; -/*-------------------------------------------------------. -| yyreturn -- parsing is finished, clean up and return. | -`-------------------------------------------------------*/ -yyreturn: +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: if (yychar != SQL_HSQL_EMPTY) { /* Make sure we have latest lookahead translation. See comments at @@ -5340,11 +5324,11 @@ YYLTYPE yylloc = yyloc_default; return yyresult; } -#line 1200 "bison_parser.y" +#line 1191 "bison_parser.y" - // clang-format on - /********************************* +// clang-format on +/********************************* ** Section 4: Additional C code *********************************/ - /* empty */ +/* empty */ diff --git a/src/parser/bison_parser.h b/src/parser/bison_parser.h index 31ea8bd5..060b41ad 100644 --- a/src/parser/bison_parser.h +++ b/src/parser/bison_parser.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.5. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -36,27 +36,27 @@ private implementation details that can be changed or removed. */ #ifndef YY_HSQL_BISON_PARSER_H_INCLUDED -# define YY_HSQL_BISON_PARSER_H_INCLUDED +#define YY_HSQL_BISON_PARSER_H_INCLUDED /* Debug traces. */ #ifndef HSQL_DEBUG -# if defined YYDEBUG +#if defined YYDEBUG #if YYDEBUG -# define HSQL_DEBUG 1 -# else -# define HSQL_DEBUG 0 -# endif -# else /* ! defined YYDEBUG */ -# define HSQL_DEBUG 0 -# endif /* ! defined YYDEBUG */ -#endif /* ! defined HSQL_DEBUG */ +#define HSQL_DEBUG 1 +#else +#define HSQL_DEBUG 0 +#endif +#else /* ! defined YYDEBUG */ +#define HSQL_DEBUG 0 +#endif /* ! defined YYDEBUG */ +#endif /* ! defined HSQL_DEBUG */ #if HSQL_DEBUG extern int hsql_debug; #endif /* "%code requires" blocks. */ #line 38 "bison_parser.y" - // clang-format on - // %code requires block +// clang-format on +// %code requires block #include "../SQLParserResult.h" #include "../sql/statements.h" @@ -81,181 +81,179 @@ extern int hsql_debug; /* Token kinds. */ #ifndef HSQL_TOKENTYPE -# define HSQL_TOKENTYPE - enum hsql_tokentype - { - SQL_HSQL_EMPTY = -2, - SQL_YYEOF = 0, /* "end of file" */ - SQL_HSQL_error = 256, /* error */ - SQL_HSQL_UNDEF = 257, /* "invalid token" */ - SQL_IDENTIFIER = 258, /* IDENTIFIER */ - SQL_STRING = 259, /* STRING */ - SQL_FLOATVAL = 260, /* FLOATVAL */ - SQL_INTVAL = 261, /* INTVAL */ - SQL_DEALLOCATE = 262, /* DEALLOCATE */ - SQL_PARAMETERS = 263, /* PARAMETERS */ - SQL_INTERSECT = 264, /* INTERSECT */ - SQL_TEMPORARY = 265, /* TEMPORARY */ - SQL_TIMESTAMP = 266, /* TIMESTAMP */ - SQL_DISTINCT = 267, /* DISTINCT */ - SQL_NVARCHAR = 268, /* NVARCHAR */ - SQL_RESTRICT = 269, /* RESTRICT */ - SQL_TRUNCATE = 270, /* TRUNCATE */ - SQL_ANALYZE = 271, /* ANALYZE */ - SQL_BETWEEN = 272, /* BETWEEN */ - SQL_CASCADE = 273, /* CASCADE */ - SQL_COLUMNS = 274, /* COLUMNS */ - SQL_CONTROL = 275, /* CONTROL */ - SQL_DEFAULT = 276, /* DEFAULT */ - SQL_EXECUTE = 277, /* EXECUTE */ - SQL_EXPLAIN = 278, /* EXPLAIN */ - SQL_INTEGER = 279, /* INTEGER */ - SQL_NATURAL = 280, /* NATURAL */ - SQL_PREPARE = 281, /* PREPARE */ - SQL_PRIMARY = 282, /* PRIMARY */ - SQL_SCHEMAS = 283, /* SCHEMAS */ - SQL_CHARACTER = 284, /* CHARACTER */ - SQL_VARYING = 285, /* VARYING */ - SQL_REAL = 286, /* REAL */ - SQL_DECIMAL = 287, /* DECIMAL */ - SQL_SPATIAL = 288, /* SPATIAL */ - SQL_VARCHAR = 289, /* VARCHAR */ - SQL_VIRTUAL = 290, /* VIRTUAL */ - SQL_DESCRIBE = 291, /* DESCRIBE */ - SQL_BEFORE = 292, /* BEFORE */ - SQL_COLUMN = 293, /* COLUMN */ - SQL_CREATE = 294, /* CREATE */ - SQL_DELETE = 295, /* DELETE */ - SQL_DIRECT = 296, /* DIRECT */ - SQL_DOUBLE = 297, /* DOUBLE */ - SQL_ESCAPE = 298, /* ESCAPE */ - SQL_EXCEPT = 299, /* EXCEPT */ - SQL_EXISTS = 300, /* EXISTS */ - SQL_EXTRACT = 301, /* EXTRACT */ - SQL_CAST = 302, /* CAST */ - SQL_FORMAT = 303, /* FORMAT */ - SQL_GLOBAL = 304, /* GLOBAL */ - SQL_HAVING = 305, /* HAVING */ - SQL_IMPORT = 306, /* IMPORT */ - SQL_INSERT = 307, /* INSERT */ - SQL_ISNULL = 308, /* ISNULL */ - SQL_OFFSET = 309, /* OFFSET */ - SQL_RENAME = 310, /* RENAME */ - SQL_SCHEMA = 311, /* SCHEMA */ - SQL_SELECT = 312, /* SELECT */ - SQL_SORTED = 313, /* SORTED */ - SQL_TABLES = 314, /* TABLES */ - SQL_UNIQUE = 315, /* UNIQUE */ - SQL_UNLOAD = 316, /* UNLOAD */ - SQL_UPDATE = 317, /* UPDATE */ - SQL_VALUES = 318, /* VALUES */ - SQL_AFTER = 319, /* AFTER */ - SQL_ALTER = 320, /* ALTER */ - SQL_CROSS = 321, /* CROSS */ - SQL_DELTA = 322, /* DELTA */ - SQL_FLOAT = 323, /* FLOAT */ - SQL_GROUP = 324, /* GROUP */ - SQL_INDEX = 325, /* INDEX */ - SQL_INNER = 326, /* INNER */ - SQL_LIMIT = 327, /* LIMIT */ - SQL_LOCAL = 328, /* LOCAL */ - SQL_MERGE = 329, /* MERGE */ - SQL_MINUS = 330, /* MINUS */ - SQL_ORDER = 331, /* ORDER */ - SQL_OUTER = 332, /* OUTER */ - SQL_RIGHT = 333, /* RIGHT */ - SQL_TABLE = 334, /* TABLE */ - SQL_UNION = 335, /* UNION */ - SQL_USING = 336, /* USING */ - SQL_WHERE = 337, /* WHERE */ - SQL_CALL = 338, /* CALL */ - SQL_CASE = 339, /* CASE */ - SQL_CHAR = 340, /* CHAR */ - SQL_COPY = 341, /* COPY */ - SQL_DATE = 342, /* DATE */ - SQL_DATETIME = 343, /* DATETIME */ - SQL_DESC = 344, /* DESC */ - SQL_DROP = 345, /* DROP */ - SQL_ELSE = 346, /* ELSE */ - SQL_FILE = 347, /* FILE */ - SQL_FROM = 348, /* FROM */ - SQL_FULL = 349, /* FULL */ - SQL_HASH = 350, /* HASH */ - SQL_HINT = 351, /* HINT */ - SQL_INTO = 352, /* INTO */ - SQL_JOIN = 353, /* JOIN */ - SQL_LEFT = 354, /* LEFT */ - SQL_LIKE = 355, /* LIKE */ - SQL_LOAD = 356, /* LOAD */ - SQL_LONG = 357, /* LONG */ - SQL_NULL = 358, /* NULL */ - SQL_PLAN = 359, /* PLAN */ - SQL_SHOW = 360, /* SHOW */ - SQL_TEXT = 361, /* TEXT */ - SQL_THEN = 362, /* THEN */ - SQL_TIME = 363, /* TIME */ - SQL_VIEW = 364, /* VIEW */ - SQL_WHEN = 365, /* WHEN */ - SQL_WITH = 366, /* WITH */ - SQL_ADD = 367, /* ADD */ - SQL_ALL = 368, /* ALL */ - SQL_AND = 369, /* AND */ - SQL_ASC = 370, /* ASC */ - SQL_END = 371, /* END */ - SQL_FOR = 372, /* FOR */ - SQL_INT = 373, /* INT */ - SQL_KEY = 374, /* KEY */ - SQL_NOT = 375, /* NOT */ - SQL_OFF = 376, /* OFF */ - SQL_SET = 377, /* SET */ - SQL_TOP = 378, /* TOP */ - SQL_AS = 379, /* AS */ - SQL_BY = 380, /* BY */ - SQL_IF = 381, /* IF */ - SQL_IN = 382, /* IN */ - SQL_IS = 383, /* IS */ - SQL_OF = 384, /* OF */ - SQL_ON = 385, /* ON */ - SQL_OR = 386, /* OR */ - SQL_TO = 387, /* TO */ - SQL_ARRAY = 388, /* ARRAY */ - SQL_CONCAT = 389, /* CONCAT */ - SQL_ILIKE = 390, /* ILIKE */ - SQL_SECOND = 391, /* SECOND */ - SQL_MINUTE = 392, /* MINUTE */ - SQL_HOUR = 393, /* HOUR */ - SQL_DAY = 394, /* DAY */ - SQL_MONTH = 395, /* MONTH */ - SQL_YEAR = 396, /* YEAR */ - SQL_SECONDS = 397, /* SECONDS */ - SQL_MINUTES = 398, /* MINUTES */ - SQL_HOURS = 399, /* HOURS */ - SQL_DAYS = 400, /* DAYS */ - SQL_MONTHS = 401, /* MONTHS */ - SQL_YEARS = 402, /* YEARS */ - SQL_INTERVAL = 403, /* INTERVAL */ - SQL_TRUE = 404, /* TRUE */ - SQL_FALSE = 405, /* FALSE */ - SQL_TRANSACTION = 406, /* TRANSACTION */ - SQL_BEGIN = 407, /* BEGIN */ - SQL_COMMIT = 408, /* COMMIT */ - SQL_ROLLBACK = 409, /* ROLLBACK */ - SQL_EQUALS = 410, /* EQUALS */ - SQL_NOTEQUALS = 411, /* NOTEQUALS */ - SQL_LESS = 412, /* LESS */ - SQL_GREATER = 413, /* GREATER */ - SQL_LESSEQ = 414, /* LESSEQ */ - SQL_GREATEREQ = 415, /* GREATEREQ */ - SQL_NOTNULL = 416, /* NOTNULL */ - SQL_UMINUS = 417 /* UMINUS */ - }; - typedef enum hsql_tokentype hsql_token_kind_t; +#define HSQL_TOKENTYPE +enum hsql_tokentype { + SQL_HSQL_EMPTY = -2, + SQL_YYEOF = 0, /* "end of file" */ + SQL_HSQL_error = 256, /* error */ + SQL_HSQL_UNDEF = 257, /* "invalid token" */ + SQL_IDENTIFIER = 258, /* IDENTIFIER */ + SQL_STRING = 259, /* STRING */ + SQL_FLOATVAL = 260, /* FLOATVAL */ + SQL_INTVAL = 261, /* INTVAL */ + SQL_DEALLOCATE = 262, /* DEALLOCATE */ + SQL_PARAMETERS = 263, /* PARAMETERS */ + SQL_INTERSECT = 264, /* INTERSECT */ + SQL_TEMPORARY = 265, /* TEMPORARY */ + SQL_TIMESTAMP = 266, /* TIMESTAMP */ + SQL_DISTINCT = 267, /* DISTINCT */ + SQL_NVARCHAR = 268, /* NVARCHAR */ + SQL_RESTRICT = 269, /* RESTRICT */ + SQL_TRUNCATE = 270, /* TRUNCATE */ + SQL_ANALYZE = 271, /* ANALYZE */ + SQL_BETWEEN = 272, /* BETWEEN */ + SQL_CASCADE = 273, /* CASCADE */ + SQL_COLUMNS = 274, /* COLUMNS */ + SQL_CONTROL = 275, /* CONTROL */ + SQL_DEFAULT = 276, /* DEFAULT */ + SQL_EXECUTE = 277, /* EXECUTE */ + SQL_EXPLAIN = 278, /* EXPLAIN */ + SQL_INTEGER = 279, /* INTEGER */ + SQL_NATURAL = 280, /* NATURAL */ + SQL_PREPARE = 281, /* PREPARE */ + SQL_PRIMARY = 282, /* PRIMARY */ + SQL_SCHEMAS = 283, /* SCHEMAS */ + SQL_CHARACTER = 284, /* CHARACTER */ + SQL_VARYING = 285, /* VARYING */ + SQL_REAL = 286, /* REAL */ + SQL_DECIMAL = 287, /* DECIMAL */ + SQL_SPATIAL = 288, /* SPATIAL */ + SQL_VARCHAR = 289, /* VARCHAR */ + SQL_VIRTUAL = 290, /* VIRTUAL */ + SQL_DESCRIBE = 291, /* DESCRIBE */ + SQL_BEFORE = 292, /* BEFORE */ + SQL_COLUMN = 293, /* COLUMN */ + SQL_CREATE = 294, /* CREATE */ + SQL_DELETE = 295, /* DELETE */ + SQL_DIRECT = 296, /* DIRECT */ + SQL_DOUBLE = 297, /* DOUBLE */ + SQL_ESCAPE = 298, /* ESCAPE */ + SQL_EXCEPT = 299, /* EXCEPT */ + SQL_EXISTS = 300, /* EXISTS */ + SQL_EXTRACT = 301, /* EXTRACT */ + SQL_CAST = 302, /* CAST */ + SQL_FORMAT = 303, /* FORMAT */ + SQL_GLOBAL = 304, /* GLOBAL */ + SQL_HAVING = 305, /* HAVING */ + SQL_IMPORT = 306, /* IMPORT */ + SQL_INSERT = 307, /* INSERT */ + SQL_ISNULL = 308, /* ISNULL */ + SQL_OFFSET = 309, /* OFFSET */ + SQL_RENAME = 310, /* RENAME */ + SQL_SCHEMA = 311, /* SCHEMA */ + SQL_SELECT = 312, /* SELECT */ + SQL_SORTED = 313, /* SORTED */ + SQL_TABLES = 314, /* TABLES */ + SQL_UNIQUE = 315, /* UNIQUE */ + SQL_UNLOAD = 316, /* UNLOAD */ + SQL_UPDATE = 317, /* UPDATE */ + SQL_VALUES = 318, /* VALUES */ + SQL_AFTER = 319, /* AFTER */ + SQL_ALTER = 320, /* ALTER */ + SQL_CROSS = 321, /* CROSS */ + SQL_DELTA = 322, /* DELTA */ + SQL_FLOAT = 323, /* FLOAT */ + SQL_GROUP = 324, /* GROUP */ + SQL_INDEX = 325, /* INDEX */ + SQL_INNER = 326, /* INNER */ + SQL_LIMIT = 327, /* LIMIT */ + SQL_LOCAL = 328, /* LOCAL */ + SQL_MERGE = 329, /* MERGE */ + SQL_MINUS = 330, /* MINUS */ + SQL_ORDER = 331, /* ORDER */ + SQL_OUTER = 332, /* OUTER */ + SQL_RIGHT = 333, /* RIGHT */ + SQL_TABLE = 334, /* TABLE */ + SQL_UNION = 335, /* UNION */ + SQL_USING = 336, /* USING */ + SQL_WHERE = 337, /* WHERE */ + SQL_CALL = 338, /* CALL */ + SQL_CASE = 339, /* CASE */ + SQL_CHAR = 340, /* CHAR */ + SQL_COPY = 341, /* COPY */ + SQL_DATE = 342, /* DATE */ + SQL_DATETIME = 343, /* DATETIME */ + SQL_DESC = 344, /* DESC */ + SQL_DROP = 345, /* DROP */ + SQL_ELSE = 346, /* ELSE */ + SQL_FILE = 347, /* FILE */ + SQL_FROM = 348, /* FROM */ + SQL_FULL = 349, /* FULL */ + SQL_HASH = 350, /* HASH */ + SQL_HINT = 351, /* HINT */ + SQL_INTO = 352, /* INTO */ + SQL_JOIN = 353, /* JOIN */ + SQL_LEFT = 354, /* LEFT */ + SQL_LIKE = 355, /* LIKE */ + SQL_LOAD = 356, /* LOAD */ + SQL_LONG = 357, /* LONG */ + SQL_NULL = 358, /* NULL */ + SQL_PLAN = 359, /* PLAN */ + SQL_SHOW = 360, /* SHOW */ + SQL_TEXT = 361, /* TEXT */ + SQL_THEN = 362, /* THEN */ + SQL_TIME = 363, /* TIME */ + SQL_VIEW = 364, /* VIEW */ + SQL_WHEN = 365, /* WHEN */ + SQL_WITH = 366, /* WITH */ + SQL_ADD = 367, /* ADD */ + SQL_ALL = 368, /* ALL */ + SQL_AND = 369, /* AND */ + SQL_ASC = 370, /* ASC */ + SQL_END = 371, /* END */ + SQL_FOR = 372, /* FOR */ + SQL_INT = 373, /* INT */ + SQL_KEY = 374, /* KEY */ + SQL_NOT = 375, /* NOT */ + SQL_OFF = 376, /* OFF */ + SQL_SET = 377, /* SET */ + SQL_TOP = 378, /* TOP */ + SQL_AS = 379, /* AS */ + SQL_BY = 380, /* BY */ + SQL_IF = 381, /* IF */ + SQL_IN = 382, /* IN */ + SQL_IS = 383, /* IS */ + SQL_OF = 384, /* OF */ + SQL_ON = 385, /* ON */ + SQL_OR = 386, /* OR */ + SQL_TO = 387, /* TO */ + SQL_ARRAY = 388, /* ARRAY */ + SQL_CONCAT = 389, /* CONCAT */ + SQL_ILIKE = 390, /* ILIKE */ + SQL_SECOND = 391, /* SECOND */ + SQL_MINUTE = 392, /* MINUTE */ + SQL_HOUR = 393, /* HOUR */ + SQL_DAY = 394, /* DAY */ + SQL_MONTH = 395, /* MONTH */ + SQL_YEAR = 396, /* YEAR */ + SQL_SECONDS = 397, /* SECONDS */ + SQL_MINUTES = 398, /* MINUTES */ + SQL_HOURS = 399, /* HOURS */ + SQL_DAYS = 400, /* DAYS */ + SQL_MONTHS = 401, /* MONTHS */ + SQL_YEARS = 402, /* YEARS */ + SQL_INTERVAL = 403, /* INTERVAL */ + SQL_TRUE = 404, /* TRUE */ + SQL_FALSE = 405, /* FALSE */ + SQL_TRANSACTION = 406, /* TRANSACTION */ + SQL_BEGIN = 407, /* BEGIN */ + SQL_COMMIT = 408, /* COMMIT */ + SQL_ROLLBACK = 409, /* ROLLBACK */ + SQL_EQUALS = 410, /* EQUALS */ + SQL_NOTEQUALS = 411, /* NOTEQUALS */ + SQL_LESS = 412, /* LESS */ + SQL_GREATER = 413, /* GREATER */ + SQL_LESSEQ = 414, /* LESSEQ */ + SQL_GREATEREQ = 415, /* GREATEREQ */ + SQL_NOTNULL = 416, /* NOTNULL */ + SQL_UMINUS = 417 /* UMINUS */ +}; +typedef enum hsql_tokentype hsql_token_kind_t; #endif /* Value type. */ -#if ! defined HSQL_STYPE && ! defined HSQL_STYPE_IS_DECLARED -union HSQL_STYPE -{ +#if !defined HSQL_STYPE && !defined HSQL_STYPE_IS_DECLARED +union HSQL_STYPE { #line 98 "bison_parser.y" // clang-format on @@ -315,29 +313,25 @@ union HSQL_STYPE std::vector* with_description_vec; #line 318 "bison_parser.h" - }; typedef union HSQL_STYPE HSQL_STYPE; -# define HSQL_STYPE_IS_TRIVIAL 1 -# define HSQL_STYPE_IS_DECLARED 1 +#define HSQL_STYPE_IS_TRIVIAL 1 +#define HSQL_STYPE_IS_DECLARED 1 #endif /* Location type. */ -#if ! defined HSQL_LTYPE && ! defined HSQL_LTYPE_IS_DECLARED +#if !defined HSQL_LTYPE && !defined HSQL_LTYPE_IS_DECLARED typedef struct HSQL_LTYPE HSQL_LTYPE; -struct HSQL_LTYPE -{ +struct HSQL_LTYPE { int first_line; int first_column; int last_line; int last_column; }; -# define HSQL_LTYPE_IS_DECLARED 1 -# define HSQL_LTYPE_IS_TRIVIAL 1 +#define HSQL_LTYPE_IS_DECLARED 1 +#define HSQL_LTYPE_IS_TRIVIAL 1 #endif - - -int hsql_parse (hsql::SQLParserResult* result, yyscan_t scanner); +int hsql_parse(hsql::SQLParserResult* result, yyscan_t scanner); #endif /* !YY_HSQL_BISON_PARSER_H_INCLUDED */ diff --git a/src/parser/bison_parser.y b/src/parser/bison_parser.y index 0527c0da..535846ad 100644 --- a/src/parser/bison_parser.y +++ b/src/parser/bison_parser.y @@ -716,13 +716,10 @@ select_statement : opt_with_clause select_with_paren { } | opt_with_clause select_with_paren set_operator select_within_set_operation opt_order opt_limit { $$ = $2; - if ($$->setOperations == nullptr) { - $$->setOperations = new std::vector(); - } - $$->setOperations->push_back($3); - $$->setOperations->back()->nestedSelectStatement = $4; - $$->setOperations->back()->resultOrder = $5; - $$->setOperations->back()->resultLimit = $6; + $$->setOperation = $3; + $$->setOperation->nestedSelectStatement = $4; + $$->setOperation->resultOrder = $5; + $$->setOperation->resultLimit = $6; $$->withDescriptions = $1; }; @@ -731,11 +728,8 @@ select_within_set_operation : select_with_paren | select_within_set_operation_no select_within_set_operation_no_parentheses : select_clause { $$ = $1; } | select_clause set_operator select_within_set_operation { $$ = $1; - if ($$->setOperations == nullptr) { - $$->setOperations = new std::vector(); - } - $$->setOperations->push_back($2); - $$->setOperations->back()->nestedSelectStatement = $3; + $$->setOperation = $2; + $$->setOperation->nestedSelectStatement = $3; }; select_with_paren : '(' select_no_paren ')' { $$ = $2; } @@ -753,13 +747,10 @@ select_no_paren : select_clause opt_order opt_limit { } | select_clause set_operator select_within_set_operation opt_order opt_limit { $$ = $1; - if ($$->setOperations == nullptr) { - $$->setOperations = new std::vector(); - } - $$->setOperations->push_back($2); - $$->setOperations->back()->nestedSelectStatement = $3; - $$->setOperations->back()->resultOrder = $4; - $$->setOperations->back()->resultLimit = $5; + $$->setOperation = $2; + $$->setOperation->nestedSelectStatement = $3; + $$->setOperation->resultOrder = $4; + $$->setOperation->resultLimit = $5; }; set_operator : set_type opt_all { diff --git a/src/sql/SelectStatement.h b/src/sql/SelectStatement.h index 66fc2dcd..c1fab741 100644 --- a/src/sql/SelectStatement.h +++ b/src/sql/SelectStatement.h @@ -67,31 +67,26 @@ struct SelectStatement : SQLStatement { Expr* whereClause; GroupByDescription* groupBy; - // Note that a SetOperation is always connected to a - // different SelectStatement. This statement can itself - // have SetOperation connections to other SelectStatements. - // To evaluate the operations in the correct order: - // Iterate over the setOperations vector: - // 1. Fully evaluate the nestedSelectStatement within the SetOperation - // 2. Connect the original statement with the - // evaluated nestedSelectStatement - // 3. Apply the resultOrder and the resultLimit - // 4. The result now functions as the the original statement - // for the next iteration + // Note that a SetOperation is always connected to a different SelectStatement. This statement can itself have + // a SetOperation connection to another SelectStatement. Thus, SelectStatements connected via SetOperations form a + // linked list. To evaluate the operations, the linked list of SelectStatements has to be traversed. The evaluation + // order of set operations depends on the DBMS. Postgres (14), for example, specifies the following order: + // "Without parentheses, UNION and EXCEPT associate left-to-right, but INTERSECT binds more tightly than those two + // operators" [https://www.postgresql.org/docs/14/queries-union.html]. // - // Example: + // Evaluation example: // // (SELECT * FROM students INTERSECT SELECT * FROM students_2) UNION SELECT * FROM students_3 ORDER BY grade ASC; // - // 1. We evaluate `Select * FROM students` - // 2. Then we iterate over the setOperations vector - // 3. We evalute the nestedSelectStatement of the first entry, which is: `SELECT * FROM students_2` - // 4. We connect the result of 1. with the results of 3. using the setType, which is INTERSECT - // 5. We continue the iteration of the setOperations vector - // 6. We evaluate the new nestedSelectStatement which is: `SELECT * FROM students_3` - // 7. We apply a Union-Operation to connect the results of 4. and 6. - // 8. Finally, we apply the resultOrder of the last SetOperation (ORDER BY grade ASC) - std::vector* setOperations; + // 1. Evaluate `Select * FROM students` + // 2. Traverse down to the next SelectStatement via the setOperation + // 3. Evalute the nestedSelectStatement, which is: `SELECT * FROM students_2` + // 4. Connect the result of step 1 with the results of step 3 using the setType, which is INTERSECT + // 5. Continue traversing down to the next SelectStatement via the setOperation + // 6. Evaluate the new nestedSelectStatement which is: `SELECT * FROM students_3` + // 7. Apply a Union-Operation to connect the results of 4. and 6. + // 8. Finally, apply the resultOrder of the last SetOperation (ORDER BY grade ASC) + SetOperation* setOperation; std::vector* order; std::vector* withDescriptions; diff --git a/src/sql/statements.cpp b/src/sql/statements.cpp index 37d7764b..7a8a28cf 100755 --- a/src/sql/statements.cpp +++ b/src/sql/statements.cpp @@ -298,7 +298,7 @@ SelectStatement::SelectStatement() selectList(nullptr), whereClause(nullptr), groupBy(nullptr), - setOperations(nullptr), + setOperation(nullptr), order(nullptr), withDescriptions(nullptr), limit(nullptr){}; @@ -331,11 +331,8 @@ SelectStatement::~SelectStatement() { delete withDescriptions; } - if (setOperations != nullptr) { - for (SetOperation* setOperation : *setOperations) { - delete setOperation; - } - delete setOperations; + if (setOperation != nullptr) { + delete setOperation; } } diff --git a/src/util/sqlhelper.cpp b/src/util/sqlhelper.cpp index 0caf169d..26961828 100755 --- a/src/util/sqlhelper.cpp +++ b/src/util/sqlhelper.cpp @@ -194,37 +194,36 @@ void printSelectStatementInfo(const SelectStatement* stmt, uintmax_t numIndent) } } - if (stmt->setOperations != nullptr) { - for (SetOperation* setOperation : *stmt->setOperations) { - switch (setOperation->setType) { - case SetType::kSetIntersect: - inprint("Intersect:", numIndent + 1); - break; - case SetType::kSetUnion: - inprint("Union:", numIndent + 1); - break; - case SetType::kSetExcept: - inprint("Except:", numIndent + 1); - break; - } + if (stmt->setOperation != nullptr) { + auto& setOperation = stmt->setOperation; + switch (setOperation->setType) { + case SetType::kSetIntersect: + inprint("Intersect:", numIndent + 1); + break; + case SetType::kSetUnion: + inprint("Union:", numIndent + 1); + break; + case SetType::kSetExcept: + inprint("Except:", numIndent + 1); + break; + } - printSelectStatementInfo(setOperation->nestedSelectStatement, numIndent + 2); + printSelectStatementInfo(setOperation->nestedSelectStatement, numIndent + 2); - if (setOperation->resultOrder != nullptr) { - inprint("SetResultOrderBy:", numIndent + 1); - printOrderBy(setOperation->resultOrder, numIndent + 2); - } + if (setOperation->resultOrder != nullptr) { + inprint("SetResultOrderBy:", numIndent + 1); + printOrderBy(setOperation->resultOrder, numIndent + 2); + } - if (setOperation->resultLimit != nullptr) { - if (setOperation->resultLimit->limit != nullptr) { - inprint("SetResultLimit:", numIndent + 1); - printExpression(setOperation->resultLimit->limit, numIndent + 2); - } + if (setOperation->resultLimit != nullptr) { + if (setOperation->resultLimit->limit != nullptr) { + inprint("SetResultLimit:", numIndent + 1); + printExpression(setOperation->resultLimit->limit, numIndent + 2); + } - if (setOperation->resultLimit->offset != nullptr) { - inprint("SetResultOffset:", numIndent + 1); - printExpression(setOperation->resultLimit->offset, numIndent + 2); - } + if (setOperation->resultLimit->offset != nullptr) { + inprint("SetResultOffset:", numIndent + 1); + printExpression(setOperation->resultLimit->offset, numIndent + 2); } } } diff --git a/test/sql_tests.cpp b/test/sql_tests.cpp index 43ca0ea1..b9b1f2c3 100644 --- a/test/sql_tests.cpp +++ b/test/sql_tests.cpp @@ -324,51 +324,50 @@ TEST(ExceptOperatorTest) { TEST_PARSE_SINGLE_SQL("SELECT * FROM students EXCEPT SELECT * FROM students_2;", kStmtSelect, SelectStatement, result, stmt); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->name, "students_2"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->name, "students_2"); ASSERT_STREQ(stmt->fromTable->name, "students"); - ASSERT_EQ(stmt->setOperations->back()->setType, kSetExcept); + ASSERT_EQ(stmt->setOperation->setType, kSetExcept); } TEST(IntersectOperatorTest) { TEST_PARSE_SINGLE_SQL("SELECT * FROM students INTERSECT SELECT * FROM students_2;", kStmtSelect, SelectStatement, result, stmt); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->name, "students_2"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->name, "students_2"); ASSERT_STREQ(stmt->fromTable->name, "students"); - ASSERT_EQ(stmt->setOperations->back()->setType, kSetIntersect); + ASSERT_EQ(stmt->setOperation->setType, kSetIntersect); } TEST(UnionOperatorTest) { TEST_PARSE_SINGLE_SQL("SELECT * FROM students UNION SELECT * FROM students_2;", kStmtSelect, SelectStatement, result, stmt); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->name, "students_2"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->name, "students_2"); ASSERT_STREQ(stmt->fromTable->name, "students"); - ASSERT_EQ(stmt->setOperations->back()->setType, kSetUnion); - ASSERT_FALSE(stmt->setOperations->back()->isAll); + ASSERT_EQ(stmt->setOperation->setType, kSetUnion); + ASSERT_FALSE(stmt->setOperation->isAll); } TEST(UnionAllOperatorTest) { TEST_PARSE_SINGLE_SQL("SELECT * FROM students UNION ALL SELECT * FROM students_2;", kStmtSelect, SelectStatement, result, stmt); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->name, "students_2"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->name, "students_2"); ASSERT_STREQ(stmt->fromTable->name, "students"); - ASSERT_TRUE(stmt->setOperations->back()->isAll); + ASSERT_TRUE(stmt->setOperation->isAll); } TEST(NestedSetOperationTest) { TEST_PARSE_SINGLE_SQL("SELECT * FROM students INTERSECT SELECT grade FROM students_2 UNION SELECT * FROM employees;", kStmtSelect, SelectStatement, result, stmt); - ASSERT_STREQ( - stmt->setOperations->back()->nestedSelectStatement->setOperations->back()->nestedSelectStatement->fromTable->name, - "employees"); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->name, "students_2"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->setOperation->nestedSelectStatement->fromTable->name, + "employees"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->name, "students_2"); ASSERT_STREQ(stmt->fromTable->name, "students"); - ASSERT_EQ(stmt->setOperations->back()->setType, kSetIntersect); - ASSERT_EQ(stmt->setOperations->back()->nestedSelectStatement->setOperations->back()->setType, kSetUnion); - ASSERT_FALSE(stmt->setOperations->back()->isAll); + ASSERT_EQ(stmt->setOperation->setType, kSetIntersect); + ASSERT_EQ(stmt->setOperation->nestedSelectStatement->setOperation->setType, kSetUnion); + ASSERT_FALSE(stmt->setOperation->isAll); } TEST(OrderByFullStatementTest) { @@ -376,9 +375,9 @@ TEST(OrderByFullStatementTest) { "SELECT * FROM students INTERSECT SELECT grade FROM students_2 UNION SELECT * FROM employees ORDER BY grade ASC;", kStmtSelect, SelectStatement, result, stmt); - ASSERT_EQ(stmt->setOperations->back()->resultOrder->at(0)->type, kOrderAsc); - ASSERT_STREQ(stmt->setOperations->back()->resultOrder->at(0)->expr->name, "grade"); - ASSERT_FALSE(stmt->setOperations->back()->isAll); + ASSERT_EQ(stmt->setOperation->resultOrder->at(0)->type, kOrderAsc); + ASSERT_STREQ(stmt->setOperation->resultOrder->at(0)->expr->name, "grade"); + ASSERT_FALSE(stmt->setOperation->isAll); } TEST(SetOperationSubQueryOrder) { @@ -390,9 +389,9 @@ TEST(SetOperationSubQueryOrder) { ASSERT_EQ(stmt->order->at(0)->type, kOrderDesc); ASSERT_STREQ(stmt->order->at(0)->expr->name, "name"); - ASSERT_EQ(stmt->setOperations->back()->resultOrder->at(0)->type, kOrderAsc); - ASSERT_STREQ(stmt->setOperations->back()->resultOrder->at(0)->expr->name, "grade"); - ASSERT_FALSE(stmt->setOperations->back()->isAll); + ASSERT_EQ(stmt->setOperation->resultOrder->at(0)->type, kOrderAsc); + ASSERT_STREQ(stmt->setOperation->resultOrder->at(0)->expr->name, "grade"); + ASSERT_FALSE(stmt->setOperation->isAll); } TEST(SetOperationLastSubQueryOrder) { @@ -401,20 +400,14 @@ TEST(SetOperationLastSubQueryOrder) { "DESC) ORDER BY grade ASC;", kStmtSelect, SelectStatement, result, stmt); - ASSERT_EQ(stmt->setOperations->back() - ->nestedSelectStatement->setOperations->back() - ->nestedSelectStatement->order->at(0) - ->type, + ASSERT_EQ(stmt->setOperation->nestedSelectStatement->setOperation->nestedSelectStatement->order->at(0)->type, kOrderDesc); - ASSERT_STREQ(stmt->setOperations->back() - ->nestedSelectStatement->setOperations->back() - ->nestedSelectStatement->order->at(0) - ->expr->name, + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->setOperation->nestedSelectStatement->order->at(0)->expr->name, "name"); - ASSERT_EQ(stmt->setOperations->back()->resultOrder->at(0)->type, kOrderAsc); - ASSERT_STREQ(stmt->setOperations->back()->resultOrder->at(0)->expr->name, "grade"); - ASSERT_FALSE(stmt->setOperations->back()->isAll); + ASSERT_EQ(stmt->setOperation->resultOrder->at(0)->type, kOrderAsc); + ASSERT_STREQ(stmt->setOperation->resultOrder->at(0)->expr->name, "grade"); + ASSERT_FALSE(stmt->setOperation->isAll); } TEST(NestedDifferentSetOperationsWithWithClause) { @@ -423,14 +416,13 @@ TEST(NestedDifferentSetOperationsWithWithClause) { kStmtSelect, SelectStatement, result, stmt); ASSERT_STREQ(stmt->withDescriptions->back()->alias, "UNION_FIRST"); - ASSERT_EQ(stmt->withDescriptions->back()->select->setOperations->back()->setType, kSetUnion); + ASSERT_EQ(stmt->withDescriptions->back()->select->setOperation->setType, kSetUnion); ASSERT_STREQ(stmt->withDescriptions->back()->select->fromTable->name, "A"); - ASSERT_STREQ(stmt->withDescriptions->back()->select->setOperations->back()->nestedSelectStatement->fromTable->name, - "B"); + ASSERT_STREQ(stmt->withDescriptions->back()->select->setOperation->nestedSelectStatement->fromTable->name, "B"); - ASSERT_EQ(stmt->setOperations->back()->setType, kSetExcept); + ASSERT_EQ(stmt->setOperation->setType, kSetExcept); ASSERT_STREQ(stmt->fromTable->name, "UNION_FIRST"); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->name, "C"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->name, "C"); } TEST(NestedAllSetOperationsWithWithClause) { @@ -440,19 +432,16 @@ TEST(NestedAllSetOperationsWithWithClause) { kStmtSelect, SelectStatement, result, stmt); ASSERT_STREQ(stmt->withDescriptions->back()->alias, "UNION_FIRST"); - ASSERT_EQ(stmt->withDescriptions->back()->select->setOperations->back()->setType, kSetUnion); + ASSERT_EQ(stmt->withDescriptions->back()->select->setOperation->setType, kSetUnion); ASSERT_STREQ(stmt->withDescriptions->back()->select->fromTable->name, "A"); - ASSERT_STREQ(stmt->withDescriptions->back()->select->setOperations->back()->nestedSelectStatement->fromTable->name, - "B"); + ASSERT_STREQ(stmt->withDescriptions->back()->select->setOperation->nestedSelectStatement->fromTable->name, "B"); - ASSERT_EQ(stmt->setOperations->back()->setType, kSetExcept); + ASSERT_EQ(stmt->setOperation->setType, kSetExcept); ASSERT_STREQ(stmt->fromTable->name, "UNION_FIRST"); - ASSERT_EQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->select->setOperations->back()->setType, - kSetIntersect); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->select->fromTable->name, "C"); - ASSERT_STREQ(stmt->setOperations->back() - ->nestedSelectStatement->fromTable->select->setOperations->back() - ->nestedSelectStatement->fromTable->name, + ASSERT_EQ(stmt->setOperation->nestedSelectStatement->fromTable->select->setOperation->setType, kSetIntersect); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->select->fromTable->name, "C"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->select->setOperation->nestedSelectStatement + ->fromTable->name, "D"); } @@ -465,19 +454,17 @@ TEST(NestedSetOperationsWithMultipleWithClauses) { ASSERT_STREQ(stmt->withDescriptions->at(0)->alias, "UNION_FIRST"); ASSERT_STREQ(stmt->withDescriptions->back()->alias, "INTERSECT_SECOND"); - ASSERT_EQ(stmt->withDescriptions->at(0)->select->setOperations->back()->setType, kSetUnion); + ASSERT_EQ(stmt->withDescriptions->at(0)->select->setOperation->setType, kSetUnion); ASSERT_STREQ(stmt->withDescriptions->at(0)->select->fromTable->name, "A"); - ASSERT_STREQ(stmt->withDescriptions->at(0)->select->setOperations->back()->nestedSelectStatement->fromTable->name, - "B"); + ASSERT_STREQ(stmt->withDescriptions->at(0)->select->setOperation->nestedSelectStatement->fromTable->name, "B"); - ASSERT_EQ(stmt->withDescriptions->back()->select->setOperations->back()->setType, kSetIntersect); + ASSERT_EQ(stmt->withDescriptions->back()->select->setOperation->setType, kSetIntersect); ASSERT_STREQ(stmt->withDescriptions->back()->select->fromTable->name, "UNION_FIRST"); - ASSERT_STREQ(stmt->withDescriptions->back()->select->setOperations->back()->nestedSelectStatement->fromTable->name, - "C"); + ASSERT_STREQ(stmt->withDescriptions->back()->select->setOperation->nestedSelectStatement->fromTable->name, "C"); - ASSERT_EQ(stmt->setOperations->back()->setType, kSetExcept); + ASSERT_EQ(stmt->setOperation->setType, kSetExcept); ASSERT_STREQ(stmt->fromTable->name, "UNION_FIRST"); - ASSERT_STREQ(stmt->setOperations->back()->nestedSelectStatement->fromTable->name, "INTERSECT_SECOND"); + ASSERT_STREQ(stmt->setOperation->nestedSelectStatement->fromTable->name, "INTERSECT_SECOND"); } TEST(WrongOrderByStatementTest) {