1 | /* A Bison parser, made by GNU Bison 3.0.4. */ |
2 | |
3 | /* Bison implementation for Yacc-like parsers in C |
4 | |
5 | Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. |
6 | |
7 | This program is free software: you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. |
11 | |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 | |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | |
20 | /* As a special exception, you may create a larger work that contains |
21 | part or all of the Bison parser skeleton and distribute that work |
22 | under terms of your choice, so long as that work isn't itself a |
23 | parser generator using the skeleton or a modified version thereof |
24 | as a parser skeleton. Alternatively, if you modify or redistribute |
25 | the parser skeleton itself, you may (at your option) remove this |
26 | special exception, which will cause the skeleton and the resulting |
27 | Bison output files to be licensed under the GNU General Public |
28 | License without this special exception. |
29 | |
30 | This special exception was added by the Free Software Foundation in |
31 | version 2.2 of Bison. */ |
32 | |
33 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
34 | simplifying the original so-called "semantic" parser. */ |
35 | |
36 | /* All symbols defined below should begin with yy or YY, to avoid |
37 | infringing on user name space. This should be done even for local |
38 | variables, as they might otherwise be expanded by user macros. |
39 | There are some unavoidable exceptions within include files to |
40 | define necessary library symbols; they are noted "INFRINGES ON |
41 | USER NAME SPACE" below. */ |
42 | |
43 | /* Identify Bison output. */ |
44 | #define YYBISON 1 |
45 | |
46 | /* Bison version. */ |
47 | #define YYBISON_VERSION "3.0.4" |
48 | |
49 | /* Skeleton name. */ |
50 | #define YYSKELETON_NAME "yacc.c" |
51 | |
52 | /* Pure parsers. */ |
53 | #define YYPURE 0 |
54 | |
55 | /* Push parsers. */ |
56 | #define YYPUSH 0 |
57 | |
58 | /* Pull parsers. */ |
59 | #define YYPULL 1 |
60 | |
61 | |
62 | /* Substitute the variable and function names. */ |
63 | #define yyparse replication_yyparse |
64 | #define yylex replication_yylex |
65 | #define yyerror replication_yyerror |
66 | #define yydebug replication_yydebug |
67 | #define yynerrs replication_yynerrs |
68 | |
69 | #define yylval replication_yylval |
70 | #define yychar replication_yychar |
71 | |
72 | /* Copy the first part of user declarations. */ |
73 | #line 1 "repl_gram.y" /* yacc.c:339 */ |
74 | |
75 | /*------------------------------------------------------------------------- |
76 | * |
77 | * repl_gram.y - Parser for the replication commands |
78 | * |
79 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
80 | * Portions Copyright (c) 1994, Regents of the University of California |
81 | * |
82 | * |
83 | * IDENTIFICATION |
84 | * src/backend/replication/repl_gram.y |
85 | * |
86 | *------------------------------------------------------------------------- |
87 | */ |
88 | |
89 | #include "postgres.h" |
90 | |
91 | #include "access/xlogdefs.h" |
92 | #include "nodes/makefuncs.h" |
93 | #include "nodes/replnodes.h" |
94 | #include "replication/walsender.h" |
95 | #include "replication/walsender_private.h" |
96 | |
97 | |
98 | /* Result of the parsing is returned here */ |
99 | Node *replication_parse_result; |
100 | |
101 | static SQLCmd *make_sqlcmd(void); |
102 | |
103 | |
104 | /* |
105 | * Bison doesn't allocate anything that needs to live across parser calls, |
106 | * so we can easily have it use palloc instead of malloc. This prevents |
107 | * memory leaks if we error out during parsing. Note this only works with |
108 | * bison >= 2.0. However, in bison 1.875 the default is to use alloca() |
109 | * if possible, so there's not really much problem anyhow, at least if |
110 | * you're building with gcc. |
111 | */ |
112 | #define YYMALLOC palloc |
113 | #define YYFREE pfree |
114 | |
115 | |
116 | #line 117 "repl_gram.c" /* yacc.c:339 */ |
117 | |
118 | # ifndef YY_NULLPTR |
119 | # if defined __cplusplus && 201103L <= __cplusplus |
120 | # define YY_NULLPTR nullptr |
121 | # else |
122 | # define YY_NULLPTR 0 |
123 | # endif |
124 | # endif |
125 | |
126 | /* Enabling verbose error messages. */ |
127 | #ifdef YYERROR_VERBOSE |
128 | # undef YYERROR_VERBOSE |
129 | # define YYERROR_VERBOSE 1 |
130 | #else |
131 | # define YYERROR_VERBOSE 0 |
132 | #endif |
133 | |
134 | |
135 | /* Debug traces. */ |
136 | #ifndef YYDEBUG |
137 | # define YYDEBUG 0 |
138 | #endif |
139 | #if YYDEBUG |
140 | extern int replication_yydebug; |
141 | #endif |
142 | |
143 | /* Token type. */ |
144 | #ifndef YYTOKENTYPE |
145 | # define YYTOKENTYPE |
146 | enum yytokentype |
147 | { |
148 | SCONST = 258, |
149 | IDENT = 259, |
150 | UCONST = 260, |
151 | RECPTR = 261, |
152 | T_WORD = 262, |
153 | K_BASE_BACKUP = 263, |
154 | K_IDENTIFY_SYSTEM = 264, |
155 | K_SHOW = 265, |
156 | K_START_REPLICATION = 266, |
157 | K_CREATE_REPLICATION_SLOT = 267, |
158 | K_DROP_REPLICATION_SLOT = 268, |
159 | K_TIMELINE_HISTORY = 269, |
160 | K_LABEL = 270, |
161 | K_PROGRESS = 271, |
162 | K_FAST = 272, |
163 | K_WAIT = 273, |
164 | K_NOWAIT = 274, |
165 | K_MAX_RATE = 275, |
166 | K_WAL = 276, |
167 | K_TABLESPACE_MAP = 277, |
168 | K_NOVERIFY_CHECKSUMS = 278, |
169 | K_TIMELINE = 279, |
170 | K_PHYSICAL = 280, |
171 | K_LOGICAL = 281, |
172 | K_SLOT = 282, |
173 | K_RESERVE_WAL = 283, |
174 | K_TEMPORARY = 284, |
175 | K_EXPORT_SNAPSHOT = 285, |
176 | K_NOEXPORT_SNAPSHOT = 286, |
177 | K_USE_SNAPSHOT = 287 |
178 | }; |
179 | #endif |
180 | |
181 | /* Value type. */ |
182 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
183 | |
184 | union YYSTYPE |
185 | { |
186 | #line 47 "repl_gram.y" /* yacc.c:355 */ |
187 | |
188 | char *str; |
189 | bool boolval; |
190 | uint32 uintval; |
191 | |
192 | XLogRecPtr recptr; |
193 | Node *node; |
194 | List *list; |
195 | DefElem *defelt; |
196 | |
197 | #line 198 "repl_gram.c" /* yacc.c:355 */ |
198 | }; |
199 | |
200 | typedef union YYSTYPE YYSTYPE; |
201 | # define YYSTYPE_IS_TRIVIAL 1 |
202 | # define YYSTYPE_IS_DECLARED 1 |
203 | #endif |
204 | |
205 | |
206 | extern YYSTYPE replication_yylval; |
207 | |
208 | int replication_yyparse (void); |
209 | |
210 | |
211 | |
212 | /* Copy the second part of user declarations. */ |
213 | |
214 | #line 215 "repl_gram.c" /* yacc.c:358 */ |
215 | |
216 | #ifdef short |
217 | # undef short |
218 | #endif |
219 | |
220 | #ifdef YYTYPE_UINT8 |
221 | typedef YYTYPE_UINT8 yytype_uint8; |
222 | #else |
223 | typedef unsigned char yytype_uint8; |
224 | #endif |
225 | |
226 | #ifdef YYTYPE_INT8 |
227 | typedef YYTYPE_INT8 yytype_int8; |
228 | #else |
229 | typedef signed char yytype_int8; |
230 | #endif |
231 | |
232 | #ifdef YYTYPE_UINT16 |
233 | typedef YYTYPE_UINT16 yytype_uint16; |
234 | #else |
235 | typedef unsigned short int yytype_uint16; |
236 | #endif |
237 | |
238 | #ifdef YYTYPE_INT16 |
239 | typedef YYTYPE_INT16 yytype_int16; |
240 | #else |
241 | typedef short int yytype_int16; |
242 | #endif |
243 | |
244 | #ifndef YYSIZE_T |
245 | # ifdef __SIZE_TYPE__ |
246 | # define YYSIZE_T __SIZE_TYPE__ |
247 | # elif defined size_t |
248 | # define YYSIZE_T size_t |
249 | # elif ! defined YYSIZE_T |
250 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
251 | # define YYSIZE_T size_t |
252 | # else |
253 | # define YYSIZE_T unsigned int |
254 | # endif |
255 | #endif |
256 | |
257 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
258 | |
259 | #ifndef YY_ |
260 | # if defined YYENABLE_NLS && YYENABLE_NLS |
261 | # if ENABLE_NLS |
262 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
263 | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
264 | # endif |
265 | # endif |
266 | # ifndef YY_ |
267 | # define YY_(Msgid) Msgid |
268 | # endif |
269 | #endif |
270 | |
271 | #ifndef YY_ATTRIBUTE |
272 | # if (defined __GNUC__ \ |
273 | && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ |
274 | || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C |
275 | # define YY_ATTRIBUTE(Spec) __attribute__(Spec) |
276 | # else |
277 | # define YY_ATTRIBUTE(Spec) /* empty */ |
278 | # endif |
279 | #endif |
280 | |
281 | #ifndef YY_ATTRIBUTE_PURE |
282 | # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) |
283 | #endif |
284 | |
285 | #ifndef YY_ATTRIBUTE_UNUSED |
286 | # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) |
287 | #endif |
288 | |
289 | #if !defined _Noreturn \ |
290 | && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) |
291 | # if defined _MSC_VER && 1200 <= _MSC_VER |
292 | # define _Noreturn __declspec (noreturn) |
293 | # else |
294 | # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) |
295 | # endif |
296 | #endif |
297 | |
298 | /* Suppress unused-variable warnings by "using" E. */ |
299 | #if ! defined lint || defined __GNUC__ |
300 | # define YYUSE(E) ((void) (E)) |
301 | #else |
302 | # define YYUSE(E) /* empty */ |
303 | #endif |
304 | |
305 | #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ |
306 | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
307 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
308 | _Pragma ("GCC diagnostic push") \ |
309 | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ |
310 | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
311 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
312 | _Pragma ("GCC diagnostic pop") |
313 | #else |
314 | # define YY_INITIAL_VALUE(Value) Value |
315 | #endif |
316 | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
317 | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
318 | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
319 | #endif |
320 | #ifndef YY_INITIAL_VALUE |
321 | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
322 | #endif |
323 | |
324 | |
325 | #if ! defined yyoverflow || YYERROR_VERBOSE |
326 | |
327 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
328 | |
329 | # ifdef YYSTACK_USE_ALLOCA |
330 | # if YYSTACK_USE_ALLOCA |
331 | # ifdef __GNUC__ |
332 | # define YYSTACK_ALLOC __builtin_alloca |
333 | # elif defined __BUILTIN_VA_ARG_INCR |
334 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
335 | # elif defined _AIX |
336 | # define YYSTACK_ALLOC __alloca |
337 | # elif defined _MSC_VER |
338 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
339 | # define alloca _alloca |
340 | # else |
341 | # define YYSTACK_ALLOC alloca |
342 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
343 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
344 | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
345 | # ifndef EXIT_SUCCESS |
346 | # define EXIT_SUCCESS 0 |
347 | # endif |
348 | # endif |
349 | # endif |
350 | # endif |
351 | # endif |
352 | |
353 | # ifdef YYSTACK_ALLOC |
354 | /* Pacify GCC's 'empty if-body' warning. */ |
355 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
356 | # ifndef YYSTACK_ALLOC_MAXIMUM |
357 | /* The OS might guarantee only one guard page at the bottom of the stack, |
358 | and a page size can be as small as 4096 bytes. So we cannot safely |
359 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
360 | to allow for a few compiler-allocated temporary stack slots. */ |
361 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
362 | # endif |
363 | # else |
364 | # define YYSTACK_ALLOC YYMALLOC |
365 | # define YYSTACK_FREE YYFREE |
366 | # ifndef YYSTACK_ALLOC_MAXIMUM |
367 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
368 | # endif |
369 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
370 | && ! ((defined YYMALLOC || defined malloc) \ |
371 | && (defined YYFREE || defined free))) |
372 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
373 | # ifndef EXIT_SUCCESS |
374 | # define EXIT_SUCCESS 0 |
375 | # endif |
376 | # endif |
377 | # ifndef YYMALLOC |
378 | # define YYMALLOC malloc |
379 | # if ! defined malloc && ! defined EXIT_SUCCESS |
380 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
381 | # endif |
382 | # endif |
383 | # ifndef YYFREE |
384 | # define YYFREE free |
385 | # if ! defined free && ! defined EXIT_SUCCESS |
386 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
387 | # endif |
388 | # endif |
389 | # endif |
390 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
391 | |
392 | |
393 | #if (! defined yyoverflow \ |
394 | && (! defined __cplusplus \ |
395 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
396 | |
397 | /* A type that is properly aligned for any stack member. */ |
398 | union yyalloc |
399 | { |
400 | yytype_int16 yyss_alloc; |
401 | YYSTYPE yyvs_alloc; |
402 | }; |
403 | |
404 | /* The size of the maximum gap between one aligned stack and the next. */ |
405 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
406 | |
407 | /* The size of an array large to enough to hold all stacks, each with |
408 | N elements. */ |
409 | # define YYSTACK_BYTES(N) \ |
410 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
411 | + YYSTACK_GAP_MAXIMUM) |
412 | |
413 | # define YYCOPY_NEEDED 1 |
414 | |
415 | /* Relocate STACK from its old location to the new one. The |
416 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
417 | elements in the stack, and YYPTR gives the new location of the |
418 | stack. Advance YYPTR to a properly aligned location for the next |
419 | stack. */ |
420 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
421 | do \ |
422 | { \ |
423 | YYSIZE_T yynewbytes; \ |
424 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
425 | Stack = &yyptr->Stack_alloc; \ |
426 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
427 | yyptr += yynewbytes / sizeof (*yyptr); \ |
428 | } \ |
429 | while (0) |
430 | |
431 | #endif |
432 | |
433 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
434 | /* Copy COUNT objects from SRC to DST. The source and destination do |
435 | not overlap. */ |
436 | # ifndef YYCOPY |
437 | # if defined __GNUC__ && 1 < __GNUC__ |
438 | # define YYCOPY(Dst, Src, Count) \ |
439 | __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) |
440 | # else |
441 | # define YYCOPY(Dst, Src, Count) \ |
442 | do \ |
443 | { \ |
444 | YYSIZE_T yyi; \ |
445 | for (yyi = 0; yyi < (Count); yyi++) \ |
446 | (Dst)[yyi] = (Src)[yyi]; \ |
447 | } \ |
448 | while (0) |
449 | # endif |
450 | # endif |
451 | #endif /* !YYCOPY_NEEDED */ |
452 | |
453 | /* YYFINAL -- State number of the termination state. */ |
454 | #define YYFINAL 28 |
455 | /* YYLAST -- Last index in YYTABLE. */ |
456 | #define YYLAST 49 |
457 | |
458 | /* YYNTOKENS -- Number of terminals. */ |
459 | #define YYNTOKENS 38 |
460 | /* YYNNTS -- Number of nonterminals. */ |
461 | #define YYNNTS 26 |
462 | /* YYNRULES -- Number of rules. */ |
463 | #define YYNRULES 57 |
464 | /* YYNSTATES -- Number of states. */ |
465 | #define YYNSTATES 76 |
466 | |
467 | /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned |
468 | by yylex, with out-of-bounds checking. */ |
469 | #define YYUNDEFTOK 2 |
470 | #define YYMAXUTOK 287 |
471 | |
472 | #define YYTRANSLATE(YYX) \ |
473 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
474 | |
475 | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
476 | as returned by yylex, without out-of-bounds checking. */ |
477 | static const yytype_uint8 yytranslate[] = |
478 | { |
479 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
480 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
481 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
482 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
483 | 35, 36, 2, 2, 37, 2, 34, 2, 2, 2, |
484 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 33, |
485 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
486 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
487 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
488 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
489 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
490 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
491 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
492 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
493 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
494 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
495 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
496 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
497 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
498 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
499 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
500 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
501 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
502 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
503 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
504 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
505 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
506 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
507 | 25, 26, 27, 28, 29, 30, 31, 32 |
508 | }; |
509 | |
510 | #if YYDEBUG |
511 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
512 | static const yytype_uint16 yyrline[] = |
513 | { |
514 | 0, 108, 108, 114, 115, 119, 120, 121, 122, 123, |
515 | 124, 125, 126, 127, 134, 144, 151, 152, 161, 170, |
516 | 173, 177, 182, 187, 192, 197, 202, 207, 212, 221, |
517 | 232, 246, 249, 253, 258, 263, 268, 277, 285, 299, |
518 | 314, 329, 346, 347, 351, 352, 356, 359, 363, 371, |
519 | 376, 377, 381, 385, 392, 399, 400, 404 |
520 | }; |
521 | #endif |
522 | |
523 | #if YYDEBUG || YYERROR_VERBOSE || 0 |
524 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
525 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
526 | static const char *const yytname[] = |
527 | { |
528 | "$end" , "error" , "$undefined" , "SCONST" , "IDENT" , "UCONST" , "RECPTR" , |
529 | "T_WORD" , "K_BASE_BACKUP" , "K_IDENTIFY_SYSTEM" , "K_SHOW" , |
530 | "K_START_REPLICATION" , "K_CREATE_REPLICATION_SLOT" , |
531 | "K_DROP_REPLICATION_SLOT" , "K_TIMELINE_HISTORY" , "K_LABEL" , "K_PROGRESS" , |
532 | "K_FAST" , "K_WAIT" , "K_NOWAIT" , "K_MAX_RATE" , "K_WAL" , |
533 | "K_TABLESPACE_MAP" , "K_NOVERIFY_CHECKSUMS" , "K_TIMELINE" , "K_PHYSICAL" , |
534 | "K_LOGICAL" , "K_SLOT" , "K_RESERVE_WAL" , "K_TEMPORARY" , |
535 | "K_EXPORT_SNAPSHOT" , "K_NOEXPORT_SNAPSHOT" , "K_USE_SNAPSHOT" , "';'" , |
536 | "'.'" , "'('" , "')'" , "','" , "$accept" , "firstcmd" , "opt_semicolon" , |
537 | "command" , "identify_system" , "show" , "var_name" , "base_backup" , |
538 | "base_backup_opt_list" , "base_backup_opt" , "create_replication_slot" , |
539 | "create_slot_opt_list" , "create_slot_opt" , "drop_replication_slot" , |
540 | "start_replication" , "start_logical_replication" , "timeline_history" , |
541 | "opt_physical" , "opt_temporary" , "opt_slot" , "opt_timeline" , |
542 | "plugin_options" , "plugin_opt_list" , "plugin_opt_elem" , "plugin_opt_arg" , |
543 | "sql_cmd" , YY_NULLPTR |
544 | }; |
545 | #endif |
546 | |
547 | # ifdef YYPRINT |
548 | /* YYTOKNUM[NUM] -- (External) token number corresponding to the |
549 | (internal) symbol number NUM (which must be that of a token). */ |
550 | static const yytype_uint16 yytoknum[] = |
551 | { |
552 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
553 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
554 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
555 | 285, 286, 287, 59, 46, 40, 41, 44 |
556 | }; |
557 | # endif |
558 | |
559 | #define YYPACT_NINF -27 |
560 | |
561 | #define yypact_value_is_default(Yystate) \ |
562 | (!!((Yystate) == (-27))) |
563 | |
564 | #define YYTABLE_NINF -1 |
565 | |
566 | #define yytable_value_is_error(Yytable_value) \ |
567 | 0 |
568 | |
569 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
570 | STATE-NUM. */ |
571 | static const yytype_int8 yypact[] = |
572 | { |
573 | -4, -27, -27, -27, -1, -16, 11, 18, 23, 29, |
574 | -2, -27, -27, -27, -27, -27, -27, -27, -27, -27, |
575 | -3, -27, 0, 26, 7, 4, 17, -27, -27, -27, |
576 | -27, 33, -27, -27, -27, 32, -27, -27, -27, -27, |
577 | 34, 13, -27, 35, -27, -24, -27, -27, -27, -27, |
578 | 36, 16, -27, 39, 9, 40, -27, -7, -27, 42, |
579 | -27, -27, -27, -27, -27, -27, -27, -7, 44, -10, |
580 | -27, -27, -27, -27, 42, -27 |
581 | }; |
582 | |
583 | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
584 | Performed when YYTABLE does not specify something else to do. Zero |
585 | means the default is an error. */ |
586 | static const yytype_uint8 yydefact[] = |
587 | { |
588 | 0, 57, 20, 14, 0, 47, 0, 0, 0, 0, |
589 | 4, 5, 12, 6, 9, 10, 7, 8, 11, 13, |
590 | 18, 16, 15, 0, 43, 45, 37, 41, 1, 3, |
591 | 2, 0, 22, 23, 25, 0, 24, 27, 28, 19, |
592 | 0, 46, 42, 0, 44, 0, 38, 21, 26, 17, |
593 | 0, 49, 32, 0, 51, 0, 39, 29, 32, 0, |
594 | 40, 48, 36, 33, 34, 35, 31, 30, 56, 0, |
595 | 52, 55, 54, 50, 0, 53 |
596 | }; |
597 | |
598 | /* YYPGOTO[NTERM-NUM]. */ |
599 | static const yytype_int8 yypgoto[] = |
600 | { |
601 | -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, |
602 | -27, -9, -27, -27, -27, -27, -27, -27, -27, -27, |
603 | -27, -27, -27, -26, -27, -27 |
604 | }; |
605 | |
606 | /* YYDEFGOTO[NTERM-NUM]. */ |
607 | static const yytype_int8 yydefgoto[] = |
608 | { |
609 | -1, 9, 30, 10, 11, 12, 22, 13, 20, 39, |
610 | 14, 57, 66, 15, 16, 17, 18, 43, 45, 24, |
611 | 56, 60, 69, 70, 72, 19 |
612 | }; |
613 | |
614 | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
615 | positive, shift that token. If negative, reduce the rule whose |
616 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
617 | static const yytype_uint8 yytable[] = |
618 | { |
619 | 1, 52, 53, 21, 2, 3, 4, 5, 6, 7, |
620 | 8, 23, 31, 32, 33, 25, 34, 35, 36, 37, |
621 | 38, 62, 26, 63, 64, 65, 73, 74, 27, 28, |
622 | 41, 29, 42, 44, 40, 46, 47, 48, 49, 50, |
623 | 55, 51, 54, 58, 59, 61, 68, 71, 75, 67 |
624 | }; |
625 | |
626 | static const yytype_uint8 yycheck[] = |
627 | { |
628 | 4, 25, 26, 4, 8, 9, 10, 11, 12, 13, |
629 | 14, 27, 15, 16, 17, 4, 19, 20, 21, 22, |
630 | 23, 28, 4, 30, 31, 32, 36, 37, 5, 0, |
631 | 4, 33, 25, 29, 34, 18, 3, 5, 4, 26, |
632 | 24, 6, 6, 4, 35, 5, 4, 3, 74, 58 |
633 | }; |
634 | |
635 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
636 | symbol of state STATE-NUM. */ |
637 | static const yytype_uint8 yystos[] = |
638 | { |
639 | 0, 4, 8, 9, 10, 11, 12, 13, 14, 39, |
640 | 41, 42, 43, 45, 48, 51, 52, 53, 54, 63, |
641 | 46, 4, 44, 27, 57, 4, 4, 5, 0, 33, |
642 | 40, 15, 16, 17, 19, 20, 21, 22, 23, 47, |
643 | 34, 4, 25, 55, 29, 56, 18, 3, 5, 4, |
644 | 26, 6, 25, 26, 6, 24, 58, 49, 4, 35, |
645 | 59, 5, 28, 30, 31, 32, 50, 49, 4, 60, |
646 | 61, 3, 62, 36, 37, 61 |
647 | }; |
648 | |
649 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
650 | static const yytype_uint8 yyr1[] = |
651 | { |
652 | 0, 38, 39, 40, 40, 41, 41, 41, 41, 41, |
653 | 41, 41, 41, 41, 42, 43, 44, 44, 45, 46, |
654 | 46, 47, 47, 47, 47, 47, 47, 47, 47, 48, |
655 | 48, 49, 49, 50, 50, 50, 50, 51, 51, 52, |
656 | 53, 54, 55, 55, 56, 56, 57, 57, 58, 58, |
657 | 59, 59, 60, 60, 61, 62, 62, 63 |
658 | }; |
659 | |
660 | /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ |
661 | static const yytype_uint8 yyr2[] = |
662 | { |
663 | 0, 2, 2, 1, 0, 1, 1, 1, 1, 1, |
664 | 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, |
665 | 0, 2, 1, 1, 1, 1, 2, 1, 1, 5, |
666 | 6, 2, 0, 1, 1, 1, 1, 2, 3, 5, |
667 | 6, 2, 1, 0, 1, 0, 2, 0, 2, 0, |
668 | 3, 0, 1, 3, 2, 1, 0, 1 |
669 | }; |
670 | |
671 | |
672 | #define yyerrok (yyerrstatus = 0) |
673 | #define yyclearin (yychar = YYEMPTY) |
674 | #define YYEMPTY (-2) |
675 | #define YYEOF 0 |
676 | |
677 | #define YYACCEPT goto yyacceptlab |
678 | #define YYABORT goto yyabortlab |
679 | #define YYERROR goto yyerrorlab |
680 | |
681 | |
682 | #define YYRECOVERING() (!!yyerrstatus) |
683 | |
684 | #define YYBACKUP(Token, Value) \ |
685 | do \ |
686 | if (yychar == YYEMPTY) \ |
687 | { \ |
688 | yychar = (Token); \ |
689 | yylval = (Value); \ |
690 | YYPOPSTACK (yylen); \ |
691 | yystate = *yyssp; \ |
692 | goto yybackup; \ |
693 | } \ |
694 | else \ |
695 | { \ |
696 | yyerror (YY_("syntax error: cannot back up")); \ |
697 | YYERROR; \ |
698 | } \ |
699 | while (0) |
700 | |
701 | /* Error token number */ |
702 | #define YYTERROR 1 |
703 | #define YYERRCODE 256 |
704 | |
705 | |
706 | |
707 | /* Enable debugging if requested. */ |
708 | #if YYDEBUG |
709 | |
710 | # ifndef YYFPRINTF |
711 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
712 | # define YYFPRINTF fprintf |
713 | # endif |
714 | |
715 | # define YYDPRINTF(Args) \ |
716 | do { \ |
717 | if (yydebug) \ |
718 | YYFPRINTF Args; \ |
719 | } while (0) |
720 | |
721 | /* This macro is provided for backward compatibility. */ |
722 | #ifndef YY_LOCATION_PRINT |
723 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
724 | #endif |
725 | |
726 | |
727 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
728 | do { \ |
729 | if (yydebug) \ |
730 | { \ |
731 | YYFPRINTF (stderr, "%s ", Title); \ |
732 | yy_symbol_print (stderr, \ |
733 | Type, Value); \ |
734 | YYFPRINTF (stderr, "\n"); \ |
735 | } \ |
736 | } while (0) |
737 | |
738 | |
739 | /*----------------------------------------. |
740 | | Print this symbol's value on YYOUTPUT. | |
741 | `----------------------------------------*/ |
742 | |
743 | static void |
744 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
745 | { |
746 | FILE *yyo = yyoutput; |
747 | YYUSE (yyo); |
748 | if (!yyvaluep) |
749 | return; |
750 | # ifdef YYPRINT |
751 | if (yytype < YYNTOKENS) |
752 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
753 | # endif |
754 | YYUSE (yytype); |
755 | } |
756 | |
757 | |
758 | /*--------------------------------. |
759 | | Print this symbol on YYOUTPUT. | |
760 | `--------------------------------*/ |
761 | |
762 | static void |
763 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
764 | { |
765 | YYFPRINTF (yyoutput, "%s %s (" , |
766 | yytype < YYNTOKENS ? "token" : "nterm" , yytname[yytype]); |
767 | |
768 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
769 | YYFPRINTF (yyoutput, ")" ); |
770 | } |
771 | |
772 | /*------------------------------------------------------------------. |
773 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
774 | | TOP (included). | |
775 | `------------------------------------------------------------------*/ |
776 | |
777 | static void |
778 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
779 | { |
780 | YYFPRINTF (stderr, "Stack now" ); |
781 | for (; yybottom <= yytop; yybottom++) |
782 | { |
783 | int yybot = *yybottom; |
784 | YYFPRINTF (stderr, " %d" , yybot); |
785 | } |
786 | YYFPRINTF (stderr, "\n" ); |
787 | } |
788 | |
789 | # define YY_STACK_PRINT(Bottom, Top) \ |
790 | do { \ |
791 | if (yydebug) \ |
792 | yy_stack_print ((Bottom), (Top)); \ |
793 | } while (0) |
794 | |
795 | |
796 | /*------------------------------------------------. |
797 | | Report that the YYRULE is going to be reduced. | |
798 | `------------------------------------------------*/ |
799 | |
800 | static void |
801 | yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) |
802 | { |
803 | unsigned long int yylno = yyrline[yyrule]; |
804 | int yynrhs = yyr2[yyrule]; |
805 | int yyi; |
806 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n" , |
807 | yyrule - 1, yylno); |
808 | /* The symbols being reduced. */ |
809 | for (yyi = 0; yyi < yynrhs; yyi++) |
810 | { |
811 | YYFPRINTF (stderr, " $%d = " , yyi + 1); |
812 | yy_symbol_print (stderr, |
813 | yystos[yyssp[yyi + 1 - yynrhs]], |
814 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
815 | ); |
816 | YYFPRINTF (stderr, "\n" ); |
817 | } |
818 | } |
819 | |
820 | # define YY_REDUCE_PRINT(Rule) \ |
821 | do { \ |
822 | if (yydebug) \ |
823 | yy_reduce_print (yyssp, yyvsp, Rule); \ |
824 | } while (0) |
825 | |
826 | /* Nonzero means print parse trace. It is left uninitialized so that |
827 | multiple parsers can coexist. */ |
828 | int yydebug; |
829 | #else /* !YYDEBUG */ |
830 | # define YYDPRINTF(Args) |
831 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
832 | # define YY_STACK_PRINT(Bottom, Top) |
833 | # define YY_REDUCE_PRINT(Rule) |
834 | #endif /* !YYDEBUG */ |
835 | |
836 | |
837 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
838 | #ifndef YYINITDEPTH |
839 | # define YYINITDEPTH 200 |
840 | #endif |
841 | |
842 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
843 | if the built-in stack extension method is used). |
844 | |
845 | Do not make this value too large; the results are undefined if |
846 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
847 | evaluated with infinite-precision integer arithmetic. */ |
848 | |
849 | #ifndef YYMAXDEPTH |
850 | # define YYMAXDEPTH 10000 |
851 | #endif |
852 | |
853 | |
854 | #if YYERROR_VERBOSE |
855 | |
856 | # ifndef yystrlen |
857 | # if defined __GLIBC__ && defined _STRING_H |
858 | # define yystrlen strlen |
859 | # else |
860 | /* Return the length of YYSTR. */ |
861 | static YYSIZE_T |
862 | yystrlen (const char *yystr) |
863 | { |
864 | YYSIZE_T yylen; |
865 | for (yylen = 0; yystr[yylen]; yylen++) |
866 | continue; |
867 | return yylen; |
868 | } |
869 | # endif |
870 | # endif |
871 | |
872 | # ifndef yystpcpy |
873 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
874 | # define yystpcpy stpcpy |
875 | # else |
876 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
877 | YYDEST. */ |
878 | static char * |
879 | yystpcpy (char *yydest, const char *yysrc) |
880 | { |
881 | char *yyd = yydest; |
882 | const char *yys = yysrc; |
883 | |
884 | while ((*yyd++ = *yys++) != '\0') |
885 | continue; |
886 | |
887 | return yyd - 1; |
888 | } |
889 | # endif |
890 | # endif |
891 | |
892 | # ifndef yytnamerr |
893 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
894 | quotes and backslashes, so that it's suitable for yyerror. The |
895 | heuristic is that double-quoting is unnecessary unless the string |
896 | contains an apostrophe, a comma, or backslash (other than |
897 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
898 | null, do not copy; instead, return the length of what the result |
899 | would have been. */ |
900 | static YYSIZE_T |
901 | yytnamerr (char *yyres, const char *yystr) |
902 | { |
903 | if (*yystr == '"') |
904 | { |
905 | YYSIZE_T yyn = 0; |
906 | char const *yyp = yystr; |
907 | |
908 | for (;;) |
909 | switch (*++yyp) |
910 | { |
911 | case '\'': |
912 | case ',': |
913 | goto do_not_strip_quotes; |
914 | |
915 | case '\\': |
916 | if (*++yyp != '\\') |
917 | goto do_not_strip_quotes; |
918 | /* Fall through. */ |
919 | default: |
920 | if (yyres) |
921 | yyres[yyn] = *yyp; |
922 | yyn++; |
923 | break; |
924 | |
925 | case '"': |
926 | if (yyres) |
927 | yyres[yyn] = '\0'; |
928 | return yyn; |
929 | } |
930 | do_not_strip_quotes: ; |
931 | } |
932 | |
933 | if (! yyres) |
934 | return yystrlen (yystr); |
935 | |
936 | return yystpcpy (yyres, yystr) - yyres; |
937 | } |
938 | # endif |
939 | |
940 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
941 | about the unexpected token YYTOKEN for the state stack whose top is |
942 | YYSSP. |
943 | |
944 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is |
945 | not large enough to hold the message. In that case, also set |
946 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the |
947 | required number of bytes is too large to store. */ |
948 | static int |
949 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, |
950 | yytype_int16 *yyssp, int yytoken) |
951 | { |
952 | YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); |
953 | YYSIZE_T yysize = yysize0; |
954 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
955 | /* Internationalized format string. */ |
956 | const char *yyformat = YY_NULLPTR; |
957 | /* Arguments of yyformat. */ |
958 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
959 | /* Number of reported tokens (one for the "unexpected", one per |
960 | "expected"). */ |
961 | int yycount = 0; |
962 | |
963 | /* There are many possibilities here to consider: |
964 | - If this state is a consistent state with a default action, then |
965 | the only way this function was invoked is if the default action |
966 | is an error action. In that case, don't check for expected |
967 | tokens because there are none. |
968 | - The only way there can be no lookahead present (in yychar) is if |
969 | this state is a consistent state with a default action. Thus, |
970 | detecting the absence of a lookahead is sufficient to determine |
971 | that there is no unexpected or expected token to report. In that |
972 | case, just report a simple "syntax error". |
973 | - Don't assume there isn't a lookahead just because this state is a |
974 | consistent state with a default action. There might have been a |
975 | previous inconsistent state, consistent state with a non-default |
976 | action, or user semantic action that manipulated yychar. |
977 | - Of course, the expected token list depends on states to have |
978 | correct lookahead information, and it depends on the parser not |
979 | to perform extra reductions after fetching a lookahead from the |
980 | scanner and before detecting a syntax error. Thus, state merging |
981 | (from LALR or IELR) and default reductions corrupt the expected |
982 | token list. However, the list is correct for canonical LR with |
983 | one exception: it will still contain any token that will not be |
984 | accepted due to an error action in a later state. |
985 | */ |
986 | if (yytoken != YYEMPTY) |
987 | { |
988 | int yyn = yypact[*yyssp]; |
989 | yyarg[yycount++] = yytname[yytoken]; |
990 | if (!yypact_value_is_default (yyn)) |
991 | { |
992 | /* Start YYX at -YYN if negative to avoid negative indexes in |
993 | YYCHECK. In other words, skip the first -YYN actions for |
994 | this state because they are default actions. */ |
995 | int yyxbegin = yyn < 0 ? -yyn : 0; |
996 | /* Stay within bounds of both yycheck and yytname. */ |
997 | int yychecklim = YYLAST - yyn + 1; |
998 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
999 | int yyx; |
1000 | |
1001 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
1002 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR |
1003 | && !yytable_value_is_error (yytable[yyx + yyn])) |
1004 | { |
1005 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
1006 | { |
1007 | yycount = 1; |
1008 | yysize = yysize0; |
1009 | break; |
1010 | } |
1011 | yyarg[yycount++] = yytname[yyx]; |
1012 | { |
1013 | YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); |
1014 | if (! (yysize <= yysize1 |
1015 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1016 | return 2; |
1017 | yysize = yysize1; |
1018 | } |
1019 | } |
1020 | } |
1021 | } |
1022 | |
1023 | switch (yycount) |
1024 | { |
1025 | # define YYCASE_(N, S) \ |
1026 | case N: \ |
1027 | yyformat = S; \ |
1028 | break |
1029 | YYCASE_(0, YY_("syntax error" )); |
1030 | YYCASE_(1, YY_("syntax error, unexpected %s" )); |
1031 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s" )); |
1032 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s" )); |
1033 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s" )); |
1034 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s" )); |
1035 | # undef YYCASE_ |
1036 | } |
1037 | |
1038 | { |
1039 | YYSIZE_T yysize1 = yysize + yystrlen (yyformat); |
1040 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) |
1041 | return 2; |
1042 | yysize = yysize1; |
1043 | } |
1044 | |
1045 | if (*yymsg_alloc < yysize) |
1046 | { |
1047 | *yymsg_alloc = 2 * yysize; |
1048 | if (! (yysize <= *yymsg_alloc |
1049 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1050 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1051 | return 1; |
1052 | } |
1053 | |
1054 | /* Avoid sprintf, as that infringes on the user's name space. |
1055 | Don't have undefined behavior even if the translation |
1056 | produced a string with the wrong number of "%s"s. */ |
1057 | { |
1058 | char *yyp = *yymsg; |
1059 | int yyi = 0; |
1060 | while ((*yyp = *yyformat) != '\0') |
1061 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
1062 | { |
1063 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
1064 | yyformat += 2; |
1065 | } |
1066 | else |
1067 | { |
1068 | yyp++; |
1069 | yyformat++; |
1070 | } |
1071 | } |
1072 | return 0; |
1073 | } |
1074 | #endif /* YYERROR_VERBOSE */ |
1075 | |
1076 | /*-----------------------------------------------. |
1077 | | Release the memory associated to this symbol. | |
1078 | `-----------------------------------------------*/ |
1079 | |
1080 | static void |
1081 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
1082 | { |
1083 | YYUSE (yyvaluep); |
1084 | if (!yymsg) |
1085 | yymsg = "Deleting" ; |
1086 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
1087 | |
1088 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1089 | YYUSE (yytype); |
1090 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1091 | } |
1092 | |
1093 | |
1094 | |
1095 | |
1096 | /* The lookahead symbol. */ |
1097 | int yychar; |
1098 | |
1099 | /* The semantic value of the lookahead symbol. */ |
1100 | YYSTYPE yylval; |
1101 | /* Number of syntax errors so far. */ |
1102 | int yynerrs; |
1103 | |
1104 | |
1105 | /*----------. |
1106 | | yyparse. | |
1107 | `----------*/ |
1108 | |
1109 | int |
1110 | yyparse (void) |
1111 | { |
1112 | int yystate; |
1113 | /* Number of tokens to shift before error messages enabled. */ |
1114 | int yyerrstatus; |
1115 | |
1116 | /* The stacks and their tools: |
1117 | 'yyss': related to states. |
1118 | 'yyvs': related to semantic values. |
1119 | |
1120 | Refer to the stacks through separate pointers, to allow yyoverflow |
1121 | to reallocate them elsewhere. */ |
1122 | |
1123 | /* The state stack. */ |
1124 | yytype_int16 yyssa[YYINITDEPTH]; |
1125 | yytype_int16 *yyss; |
1126 | yytype_int16 *yyssp; |
1127 | |
1128 | /* The semantic value stack. */ |
1129 | YYSTYPE yyvsa[YYINITDEPTH]; |
1130 | YYSTYPE *yyvs; |
1131 | YYSTYPE *yyvsp; |
1132 | |
1133 | YYSIZE_T yystacksize; |
1134 | |
1135 | int yyn; |
1136 | int yyresult; |
1137 | /* Lookahead token as an internal (translated) token number. */ |
1138 | int yytoken = 0; |
1139 | /* The variables used to return semantic value and location from the |
1140 | action routines. */ |
1141 | YYSTYPE yyval; |
1142 | |
1143 | #if YYERROR_VERBOSE |
1144 | /* Buffer for error messages, and its allocated size. */ |
1145 | char yymsgbuf[128]; |
1146 | char *yymsg = yymsgbuf; |
1147 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
1148 | #endif |
1149 | |
1150 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
1151 | |
1152 | /* The number of symbols on the RHS of the reduced rule. |
1153 | Keep to zero when no symbol should be popped. */ |
1154 | int yylen = 0; |
1155 | |
1156 | yyssp = yyss = yyssa; |
1157 | yyvsp = yyvs = yyvsa; |
1158 | yystacksize = YYINITDEPTH; |
1159 | |
1160 | YYDPRINTF ((stderr, "Starting parse\n" )); |
1161 | |
1162 | yystate = 0; |
1163 | yyerrstatus = 0; |
1164 | yynerrs = 0; |
1165 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1166 | goto yysetstate; |
1167 | |
1168 | /*------------------------------------------------------------. |
1169 | | yynewstate -- Push a new state, which is found in yystate. | |
1170 | `------------------------------------------------------------*/ |
1171 | yynewstate: |
1172 | /* In all cases, when you get here, the value and location stacks |
1173 | have just been pushed. So pushing a state here evens the stacks. */ |
1174 | yyssp++; |
1175 | |
1176 | yysetstate: |
1177 | *yyssp = yystate; |
1178 | |
1179 | if (yyss + yystacksize - 1 <= yyssp) |
1180 | { |
1181 | /* Get the current used size of the three stacks, in elements. */ |
1182 | YYSIZE_T yysize = yyssp - yyss + 1; |
1183 | |
1184 | #ifdef yyoverflow |
1185 | { |
1186 | /* Give user a chance to reallocate the stack. Use copies of |
1187 | these so that the &'s don't force the real ones into |
1188 | memory. */ |
1189 | YYSTYPE *yyvs1 = yyvs; |
1190 | yytype_int16 *yyss1 = yyss; |
1191 | |
1192 | /* Each stack pointer address is followed by the size of the |
1193 | data in use in that stack, in bytes. This used to be a |
1194 | conditional around just the two extra args, but that might |
1195 | be undefined if yyoverflow is a macro. */ |
1196 | yyoverflow (YY_("memory exhausted" ), |
1197 | &yyss1, yysize * sizeof (*yyssp), |
1198 | &yyvs1, yysize * sizeof (*yyvsp), |
1199 | &yystacksize); |
1200 | |
1201 | yyss = yyss1; |
1202 | yyvs = yyvs1; |
1203 | } |
1204 | #else /* no yyoverflow */ |
1205 | # ifndef YYSTACK_RELOCATE |
1206 | goto yyexhaustedlab; |
1207 | # else |
1208 | /* Extend the stack our own way. */ |
1209 | if (YYMAXDEPTH <= yystacksize) |
1210 | goto yyexhaustedlab; |
1211 | yystacksize *= 2; |
1212 | if (YYMAXDEPTH < yystacksize) |
1213 | yystacksize = YYMAXDEPTH; |
1214 | |
1215 | { |
1216 | yytype_int16 *yyss1 = yyss; |
1217 | union yyalloc *yyptr = |
1218 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1219 | if (! yyptr) |
1220 | goto yyexhaustedlab; |
1221 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1222 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1223 | # undef YYSTACK_RELOCATE |
1224 | if (yyss1 != yyssa) |
1225 | YYSTACK_FREE (yyss1); |
1226 | } |
1227 | # endif |
1228 | #endif /* no yyoverflow */ |
1229 | |
1230 | yyssp = yyss + yysize - 1; |
1231 | yyvsp = yyvs + yysize - 1; |
1232 | |
1233 | YYDPRINTF ((stderr, "Stack size increased to %lu\n" , |
1234 | (unsigned long int) yystacksize)); |
1235 | |
1236 | if (yyss + yystacksize - 1 <= yyssp) |
1237 | YYABORT; |
1238 | } |
1239 | |
1240 | YYDPRINTF ((stderr, "Entering state %d\n" , yystate)); |
1241 | |
1242 | if (yystate == YYFINAL) |
1243 | YYACCEPT; |
1244 | |
1245 | goto yybackup; |
1246 | |
1247 | /*-----------. |
1248 | | yybackup. | |
1249 | `-----------*/ |
1250 | yybackup: |
1251 | |
1252 | /* Do appropriate processing given the current state. Read a |
1253 | lookahead token if we need one and don't already have one. */ |
1254 | |
1255 | /* First try to decide what to do without reference to lookahead token. */ |
1256 | yyn = yypact[yystate]; |
1257 | if (yypact_value_is_default (yyn)) |
1258 | goto yydefault; |
1259 | |
1260 | /* Not known => get a lookahead token if don't already have one. */ |
1261 | |
1262 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1263 | if (yychar == YYEMPTY) |
1264 | { |
1265 | YYDPRINTF ((stderr, "Reading a token: " )); |
1266 | yychar = yylex (); |
1267 | } |
1268 | |
1269 | if (yychar <= YYEOF) |
1270 | { |
1271 | yychar = yytoken = YYEOF; |
1272 | YYDPRINTF ((stderr, "Now at end of input.\n" )); |
1273 | } |
1274 | else |
1275 | { |
1276 | yytoken = YYTRANSLATE (yychar); |
1277 | YY_SYMBOL_PRINT ("Next token is" , yytoken, &yylval, &yylloc); |
1278 | } |
1279 | |
1280 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1281 | detect an error, take that action. */ |
1282 | yyn += yytoken; |
1283 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
1284 | goto yydefault; |
1285 | yyn = yytable[yyn]; |
1286 | if (yyn <= 0) |
1287 | { |
1288 | if (yytable_value_is_error (yyn)) |
1289 | goto yyerrlab; |
1290 | yyn = -yyn; |
1291 | goto yyreduce; |
1292 | } |
1293 | |
1294 | /* Count tokens shifted since error; after three, turn off error |
1295 | status. */ |
1296 | if (yyerrstatus) |
1297 | yyerrstatus--; |
1298 | |
1299 | /* Shift the lookahead token. */ |
1300 | YY_SYMBOL_PRINT ("Shifting" , yytoken, &yylval, &yylloc); |
1301 | |
1302 | /* Discard the shifted token. */ |
1303 | yychar = YYEMPTY; |
1304 | |
1305 | yystate = yyn; |
1306 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1307 | *++yyvsp = yylval; |
1308 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1309 | |
1310 | goto yynewstate; |
1311 | |
1312 | |
1313 | /*-----------------------------------------------------------. |
1314 | | yydefault -- do the default action for the current state. | |
1315 | `-----------------------------------------------------------*/ |
1316 | yydefault: |
1317 | yyn = yydefact[yystate]; |
1318 | if (yyn == 0) |
1319 | goto yyerrlab; |
1320 | goto yyreduce; |
1321 | |
1322 | |
1323 | /*-----------------------------. |
1324 | | yyreduce -- Do a reduction. | |
1325 | `-----------------------------*/ |
1326 | yyreduce: |
1327 | /* yyn is the number of a rule to reduce with. */ |
1328 | yylen = yyr2[yyn]; |
1329 | |
1330 | /* If YYLEN is nonzero, implement the default value of the action: |
1331 | '$$ = $1'. |
1332 | |
1333 | Otherwise, the following line sets YYVAL to garbage. |
1334 | This behavior is undocumented and Bison |
1335 | users should not rely upon it. Assigning to YYVAL |
1336 | unconditionally makes the parser a bit smaller, and it avoids a |
1337 | GCC warning that YYVAL may be used uninitialized. */ |
1338 | yyval = yyvsp[1-yylen]; |
1339 | |
1340 | |
1341 | YY_REDUCE_PRINT (yyn); |
1342 | switch (yyn) |
1343 | { |
1344 | case 2: |
1345 | #line 109 "repl_gram.y" /* yacc.c:1646 */ |
1346 | { |
1347 | replication_parse_result = (yyvsp[-1].node); |
1348 | } |
1349 | #line 1350 "repl_gram.c" /* yacc.c:1646 */ |
1350 | break; |
1351 | |
1352 | case 14: |
1353 | #line 135 "repl_gram.y" /* yacc.c:1646 */ |
1354 | { |
1355 | (yyval.node) = (Node *) makeNode(IdentifySystemCmd); |
1356 | } |
1357 | #line 1358 "repl_gram.c" /* yacc.c:1646 */ |
1358 | break; |
1359 | |
1360 | case 15: |
1361 | #line 145 "repl_gram.y" /* yacc.c:1646 */ |
1362 | { |
1363 | VariableShowStmt *n = makeNode(VariableShowStmt); |
1364 | n->name = (yyvsp[0].str); |
1365 | (yyval.node) = (Node *) n; |
1366 | } |
1367 | #line 1368 "repl_gram.c" /* yacc.c:1646 */ |
1368 | break; |
1369 | |
1370 | case 16: |
1371 | #line 151 "repl_gram.y" /* yacc.c:1646 */ |
1372 | { (yyval.str) = (yyvsp[0].str); } |
1373 | #line 1374 "repl_gram.c" /* yacc.c:1646 */ |
1374 | break; |
1375 | |
1376 | case 17: |
1377 | #line 153 "repl_gram.y" /* yacc.c:1646 */ |
1378 | { (yyval.str) = psprintf("%s.%s" , (yyvsp[-2].str), (yyvsp[0].str)); } |
1379 | #line 1380 "repl_gram.c" /* yacc.c:1646 */ |
1380 | break; |
1381 | |
1382 | case 18: |
1383 | #line 162 "repl_gram.y" /* yacc.c:1646 */ |
1384 | { |
1385 | BaseBackupCmd *cmd = makeNode(BaseBackupCmd); |
1386 | cmd->options = (yyvsp[0].list); |
1387 | (yyval.node) = (Node *) cmd; |
1388 | } |
1389 | #line 1390 "repl_gram.c" /* yacc.c:1646 */ |
1390 | break; |
1391 | |
1392 | case 19: |
1393 | #line 171 "repl_gram.y" /* yacc.c:1646 */ |
1394 | { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].defelt)); } |
1395 | #line 1396 "repl_gram.c" /* yacc.c:1646 */ |
1396 | break; |
1397 | |
1398 | case 20: |
1399 | #line 173 "repl_gram.y" /* yacc.c:1646 */ |
1400 | { (yyval.list) = NIL; } |
1401 | #line 1402 "repl_gram.c" /* yacc.c:1646 */ |
1402 | break; |
1403 | |
1404 | case 21: |
1405 | #line 178 "repl_gram.y" /* yacc.c:1646 */ |
1406 | { |
1407 | (yyval.defelt) = makeDefElem("label" , |
1408 | (Node *)makeString((yyvsp[0].str)), -1); |
1409 | } |
1410 | #line 1411 "repl_gram.c" /* yacc.c:1646 */ |
1411 | break; |
1412 | |
1413 | case 22: |
1414 | #line 183 "repl_gram.y" /* yacc.c:1646 */ |
1415 | { |
1416 | (yyval.defelt) = makeDefElem("progress" , |
1417 | (Node *)makeInteger(true), -1); |
1418 | } |
1419 | #line 1420 "repl_gram.c" /* yacc.c:1646 */ |
1420 | break; |
1421 | |
1422 | case 23: |
1423 | #line 188 "repl_gram.y" /* yacc.c:1646 */ |
1424 | { |
1425 | (yyval.defelt) = makeDefElem("fast" , |
1426 | (Node *)makeInteger(true), -1); |
1427 | } |
1428 | #line 1429 "repl_gram.c" /* yacc.c:1646 */ |
1429 | break; |
1430 | |
1431 | case 24: |
1432 | #line 193 "repl_gram.y" /* yacc.c:1646 */ |
1433 | { |
1434 | (yyval.defelt) = makeDefElem("wal" , |
1435 | (Node *)makeInteger(true), -1); |
1436 | } |
1437 | #line 1438 "repl_gram.c" /* yacc.c:1646 */ |
1438 | break; |
1439 | |
1440 | case 25: |
1441 | #line 198 "repl_gram.y" /* yacc.c:1646 */ |
1442 | { |
1443 | (yyval.defelt) = makeDefElem("nowait" , |
1444 | (Node *)makeInteger(true), -1); |
1445 | } |
1446 | #line 1447 "repl_gram.c" /* yacc.c:1646 */ |
1447 | break; |
1448 | |
1449 | case 26: |
1450 | #line 203 "repl_gram.y" /* yacc.c:1646 */ |
1451 | { |
1452 | (yyval.defelt) = makeDefElem("max_rate" , |
1453 | (Node *)makeInteger((yyvsp[0].uintval)), -1); |
1454 | } |
1455 | #line 1456 "repl_gram.c" /* yacc.c:1646 */ |
1456 | break; |
1457 | |
1458 | case 27: |
1459 | #line 208 "repl_gram.y" /* yacc.c:1646 */ |
1460 | { |
1461 | (yyval.defelt) = makeDefElem("tablespace_map" , |
1462 | (Node *)makeInteger(true), -1); |
1463 | } |
1464 | #line 1465 "repl_gram.c" /* yacc.c:1646 */ |
1465 | break; |
1466 | |
1467 | case 28: |
1468 | #line 213 "repl_gram.y" /* yacc.c:1646 */ |
1469 | { |
1470 | (yyval.defelt) = makeDefElem("noverify_checksums" , |
1471 | (Node *)makeInteger(true), -1); |
1472 | } |
1473 | #line 1474 "repl_gram.c" /* yacc.c:1646 */ |
1474 | break; |
1475 | |
1476 | case 29: |
1477 | #line 222 "repl_gram.y" /* yacc.c:1646 */ |
1478 | { |
1479 | CreateReplicationSlotCmd *cmd; |
1480 | cmd = makeNode(CreateReplicationSlotCmd); |
1481 | cmd->kind = REPLICATION_KIND_PHYSICAL; |
1482 | cmd->slotname = (yyvsp[-3].str); |
1483 | cmd->temporary = (yyvsp[-2].boolval); |
1484 | cmd->options = (yyvsp[0].list); |
1485 | (yyval.node) = (Node *) cmd; |
1486 | } |
1487 | #line 1488 "repl_gram.c" /* yacc.c:1646 */ |
1488 | break; |
1489 | |
1490 | case 30: |
1491 | #line 233 "repl_gram.y" /* yacc.c:1646 */ |
1492 | { |
1493 | CreateReplicationSlotCmd *cmd; |
1494 | cmd = makeNode(CreateReplicationSlotCmd); |
1495 | cmd->kind = REPLICATION_KIND_LOGICAL; |
1496 | cmd->slotname = (yyvsp[-4].str); |
1497 | cmd->temporary = (yyvsp[-3].boolval); |
1498 | cmd->plugin = (yyvsp[-1].str); |
1499 | cmd->options = (yyvsp[0].list); |
1500 | (yyval.node) = (Node *) cmd; |
1501 | } |
1502 | #line 1503 "repl_gram.c" /* yacc.c:1646 */ |
1503 | break; |
1504 | |
1505 | case 31: |
1506 | #line 247 "repl_gram.y" /* yacc.c:1646 */ |
1507 | { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].defelt)); } |
1508 | #line 1509 "repl_gram.c" /* yacc.c:1646 */ |
1509 | break; |
1510 | |
1511 | case 32: |
1512 | #line 249 "repl_gram.y" /* yacc.c:1646 */ |
1513 | { (yyval.list) = NIL; } |
1514 | #line 1515 "repl_gram.c" /* yacc.c:1646 */ |
1515 | break; |
1516 | |
1517 | case 33: |
1518 | #line 254 "repl_gram.y" /* yacc.c:1646 */ |
1519 | { |
1520 | (yyval.defelt) = makeDefElem("export_snapshot" , |
1521 | (Node *)makeInteger(true), -1); |
1522 | } |
1523 | #line 1524 "repl_gram.c" /* yacc.c:1646 */ |
1524 | break; |
1525 | |
1526 | case 34: |
1527 | #line 259 "repl_gram.y" /* yacc.c:1646 */ |
1528 | { |
1529 | (yyval.defelt) = makeDefElem("export_snapshot" , |
1530 | (Node *)makeInteger(false), -1); |
1531 | } |
1532 | #line 1533 "repl_gram.c" /* yacc.c:1646 */ |
1533 | break; |
1534 | |
1535 | case 35: |
1536 | #line 264 "repl_gram.y" /* yacc.c:1646 */ |
1537 | { |
1538 | (yyval.defelt) = makeDefElem("use_snapshot" , |
1539 | (Node *)makeInteger(true), -1); |
1540 | } |
1541 | #line 1542 "repl_gram.c" /* yacc.c:1646 */ |
1542 | break; |
1543 | |
1544 | case 36: |
1545 | #line 269 "repl_gram.y" /* yacc.c:1646 */ |
1546 | { |
1547 | (yyval.defelt) = makeDefElem("reserve_wal" , |
1548 | (Node *)makeInteger(true), -1); |
1549 | } |
1550 | #line 1551 "repl_gram.c" /* yacc.c:1646 */ |
1551 | break; |
1552 | |
1553 | case 37: |
1554 | #line 278 "repl_gram.y" /* yacc.c:1646 */ |
1555 | { |
1556 | DropReplicationSlotCmd *cmd; |
1557 | cmd = makeNode(DropReplicationSlotCmd); |
1558 | cmd->slotname = (yyvsp[0].str); |
1559 | cmd->wait = false; |
1560 | (yyval.node) = (Node *) cmd; |
1561 | } |
1562 | #line 1563 "repl_gram.c" /* yacc.c:1646 */ |
1563 | break; |
1564 | |
1565 | case 38: |
1566 | #line 286 "repl_gram.y" /* yacc.c:1646 */ |
1567 | { |
1568 | DropReplicationSlotCmd *cmd; |
1569 | cmd = makeNode(DropReplicationSlotCmd); |
1570 | cmd->slotname = (yyvsp[-1].str); |
1571 | cmd->wait = true; |
1572 | (yyval.node) = (Node *) cmd; |
1573 | } |
1574 | #line 1575 "repl_gram.c" /* yacc.c:1646 */ |
1575 | break; |
1576 | |
1577 | case 39: |
1578 | #line 300 "repl_gram.y" /* yacc.c:1646 */ |
1579 | { |
1580 | StartReplicationCmd *cmd; |
1581 | |
1582 | cmd = makeNode(StartReplicationCmd); |
1583 | cmd->kind = REPLICATION_KIND_PHYSICAL; |
1584 | cmd->slotname = (yyvsp[-3].str); |
1585 | cmd->startpoint = (yyvsp[-1].recptr); |
1586 | cmd->timeline = (yyvsp[0].uintval); |
1587 | (yyval.node) = (Node *) cmd; |
1588 | } |
1589 | #line 1590 "repl_gram.c" /* yacc.c:1646 */ |
1590 | break; |
1591 | |
1592 | case 40: |
1593 | #line 315 "repl_gram.y" /* yacc.c:1646 */ |
1594 | { |
1595 | StartReplicationCmd *cmd; |
1596 | cmd = makeNode(StartReplicationCmd); |
1597 | cmd->kind = REPLICATION_KIND_LOGICAL; |
1598 | cmd->slotname = (yyvsp[-3].str); |
1599 | cmd->startpoint = (yyvsp[-1].recptr); |
1600 | cmd->options = (yyvsp[0].list); |
1601 | (yyval.node) = (Node *) cmd; |
1602 | } |
1603 | #line 1604 "repl_gram.c" /* yacc.c:1646 */ |
1604 | break; |
1605 | |
1606 | case 41: |
1607 | #line 330 "repl_gram.y" /* yacc.c:1646 */ |
1608 | { |
1609 | TimeLineHistoryCmd *cmd; |
1610 | |
1611 | if ((yyvsp[0].uintval) <= 0) |
1612 | ereport(ERROR, |
1613 | (errcode(ERRCODE_SYNTAX_ERROR), |
1614 | (errmsg("invalid timeline %u" , (yyvsp[0].uintval))))); |
1615 | |
1616 | cmd = makeNode(TimeLineHistoryCmd); |
1617 | cmd->timeline = (yyvsp[0].uintval); |
1618 | |
1619 | (yyval.node) = (Node *) cmd; |
1620 | } |
1621 | #line 1622 "repl_gram.c" /* yacc.c:1646 */ |
1622 | break; |
1623 | |
1624 | case 44: |
1625 | #line 351 "repl_gram.y" /* yacc.c:1646 */ |
1626 | { (yyval.boolval) = true; } |
1627 | #line 1628 "repl_gram.c" /* yacc.c:1646 */ |
1628 | break; |
1629 | |
1630 | case 45: |
1631 | #line 352 "repl_gram.y" /* yacc.c:1646 */ |
1632 | { (yyval.boolval) = false; } |
1633 | #line 1634 "repl_gram.c" /* yacc.c:1646 */ |
1634 | break; |
1635 | |
1636 | case 46: |
1637 | #line 357 "repl_gram.y" /* yacc.c:1646 */ |
1638 | { (yyval.str) = (yyvsp[0].str); } |
1639 | #line 1640 "repl_gram.c" /* yacc.c:1646 */ |
1640 | break; |
1641 | |
1642 | case 47: |
1643 | #line 359 "repl_gram.y" /* yacc.c:1646 */ |
1644 | { (yyval.str) = NULL; } |
1645 | #line 1646 "repl_gram.c" /* yacc.c:1646 */ |
1646 | break; |
1647 | |
1648 | case 48: |
1649 | #line 364 "repl_gram.y" /* yacc.c:1646 */ |
1650 | { |
1651 | if ((yyvsp[0].uintval) <= 0) |
1652 | ereport(ERROR, |
1653 | (errcode(ERRCODE_SYNTAX_ERROR), |
1654 | (errmsg("invalid timeline %u" , (yyvsp[0].uintval))))); |
1655 | (yyval.uintval) = (yyvsp[0].uintval); |
1656 | } |
1657 | #line 1658 "repl_gram.c" /* yacc.c:1646 */ |
1658 | break; |
1659 | |
1660 | case 49: |
1661 | #line 371 "repl_gram.y" /* yacc.c:1646 */ |
1662 | { (yyval.uintval) = 0; } |
1663 | #line 1664 "repl_gram.c" /* yacc.c:1646 */ |
1664 | break; |
1665 | |
1666 | case 50: |
1667 | #line 376 "repl_gram.y" /* yacc.c:1646 */ |
1668 | { (yyval.list) = (yyvsp[-1].list); } |
1669 | #line 1670 "repl_gram.c" /* yacc.c:1646 */ |
1670 | break; |
1671 | |
1672 | case 51: |
1673 | #line 377 "repl_gram.y" /* yacc.c:1646 */ |
1674 | { (yyval.list) = NIL; } |
1675 | #line 1676 "repl_gram.c" /* yacc.c:1646 */ |
1676 | break; |
1677 | |
1678 | case 52: |
1679 | #line 382 "repl_gram.y" /* yacc.c:1646 */ |
1680 | { |
1681 | (yyval.list) = list_make1((yyvsp[0].defelt)); |
1682 | } |
1683 | #line 1684 "repl_gram.c" /* yacc.c:1646 */ |
1684 | break; |
1685 | |
1686 | case 53: |
1687 | #line 386 "repl_gram.y" /* yacc.c:1646 */ |
1688 | { |
1689 | (yyval.list) = lappend((yyvsp[-2].list), (yyvsp[0].defelt)); |
1690 | } |
1691 | #line 1692 "repl_gram.c" /* yacc.c:1646 */ |
1692 | break; |
1693 | |
1694 | case 54: |
1695 | #line 393 "repl_gram.y" /* yacc.c:1646 */ |
1696 | { |
1697 | (yyval.defelt) = makeDefElem((yyvsp[-1].str), (yyvsp[0].node), -1); |
1698 | } |
1699 | #line 1700 "repl_gram.c" /* yacc.c:1646 */ |
1700 | break; |
1701 | |
1702 | case 55: |
1703 | #line 399 "repl_gram.y" /* yacc.c:1646 */ |
1704 | { (yyval.node) = (Node *) makeString((yyvsp[0].str)); } |
1705 | #line 1706 "repl_gram.c" /* yacc.c:1646 */ |
1706 | break; |
1707 | |
1708 | case 56: |
1709 | #line 400 "repl_gram.y" /* yacc.c:1646 */ |
1710 | { (yyval.node) = NULL; } |
1711 | #line 1712 "repl_gram.c" /* yacc.c:1646 */ |
1712 | break; |
1713 | |
1714 | case 57: |
1715 | #line 404 "repl_gram.y" /* yacc.c:1646 */ |
1716 | { (yyval.node) = (Node *) make_sqlcmd(); } |
1717 | #line 1718 "repl_gram.c" /* yacc.c:1646 */ |
1718 | break; |
1719 | |
1720 | |
1721 | #line 1722 "repl_gram.c" /* yacc.c:1646 */ |
1722 | default: break; |
1723 | } |
1724 | /* User semantic actions sometimes alter yychar, and that requires |
1725 | that yytoken be updated with the new translation. We take the |
1726 | approach of translating immediately before every use of yytoken. |
1727 | One alternative is translating here after every semantic action, |
1728 | but that translation would be missed if the semantic action invokes |
1729 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
1730 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
1731 | incorrect destructor might then be invoked immediately. In the |
1732 | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
1733 | to an incorrect destructor call or verbose syntax error message |
1734 | before the lookahead is translated. */ |
1735 | YY_SYMBOL_PRINT ("-> $$ =" , yyr1[yyn], &yyval, &yyloc); |
1736 | |
1737 | YYPOPSTACK (yylen); |
1738 | yylen = 0; |
1739 | YY_STACK_PRINT (yyss, yyssp); |
1740 | |
1741 | *++yyvsp = yyval; |
1742 | |
1743 | /* Now 'shift' the result of the reduction. Determine what state |
1744 | that goes to, based on the state we popped back to and the rule |
1745 | number reduced by. */ |
1746 | |
1747 | yyn = yyr1[yyn]; |
1748 | |
1749 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
1750 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
1751 | yystate = yytable[yystate]; |
1752 | else |
1753 | yystate = yydefgoto[yyn - YYNTOKENS]; |
1754 | |
1755 | goto yynewstate; |
1756 | |
1757 | |
1758 | /*--------------------------------------. |
1759 | | yyerrlab -- here on detecting error. | |
1760 | `--------------------------------------*/ |
1761 | yyerrlab: |
1762 | /* Make sure we have latest lookahead translation. See comments at |
1763 | user semantic actions for why this is necessary. */ |
1764 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); |
1765 | |
1766 | /* If not already recovering from an error, report this error. */ |
1767 | if (!yyerrstatus) |
1768 | { |
1769 | ++yynerrs; |
1770 | #if ! YYERROR_VERBOSE |
1771 | yyerror (YY_("syntax error" )); |
1772 | #else |
1773 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ |
1774 | yyssp, yytoken) |
1775 | { |
1776 | char const *yymsgp = YY_("syntax error" ); |
1777 | int yysyntax_error_status; |
1778 | yysyntax_error_status = YYSYNTAX_ERROR; |
1779 | if (yysyntax_error_status == 0) |
1780 | yymsgp = yymsg; |
1781 | else if (yysyntax_error_status == 1) |
1782 | { |
1783 | if (yymsg != yymsgbuf) |
1784 | YYSTACK_FREE (yymsg); |
1785 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); |
1786 | if (!yymsg) |
1787 | { |
1788 | yymsg = yymsgbuf; |
1789 | yymsg_alloc = sizeof yymsgbuf; |
1790 | yysyntax_error_status = 2; |
1791 | } |
1792 | else |
1793 | { |
1794 | yysyntax_error_status = YYSYNTAX_ERROR; |
1795 | yymsgp = yymsg; |
1796 | } |
1797 | } |
1798 | yyerror (yymsgp); |
1799 | if (yysyntax_error_status == 2) |
1800 | goto yyexhaustedlab; |
1801 | } |
1802 | # undef YYSYNTAX_ERROR |
1803 | #endif |
1804 | } |
1805 | |
1806 | |
1807 | |
1808 | if (yyerrstatus == 3) |
1809 | { |
1810 | /* If just tried and failed to reuse lookahead token after an |
1811 | error, discard it. */ |
1812 | |
1813 | if (yychar <= YYEOF) |
1814 | { |
1815 | /* Return failure if at end of input. */ |
1816 | if (yychar == YYEOF) |
1817 | YYABORT; |
1818 | } |
1819 | else |
1820 | { |
1821 | yydestruct ("Error: discarding" , |
1822 | yytoken, &yylval); |
1823 | yychar = YYEMPTY; |
1824 | } |
1825 | } |
1826 | |
1827 | /* Else will try to reuse lookahead token after shifting the error |
1828 | token. */ |
1829 | goto yyerrlab1; |
1830 | |
1831 | |
1832 | /*---------------------------------------------------. |
1833 | | yyerrorlab -- error raised explicitly by YYERROR. | |
1834 | `---------------------------------------------------*/ |
1835 | yyerrorlab: |
1836 | |
1837 | /* Pacify compilers like GCC when the user code never invokes |
1838 | YYERROR and the label yyerrorlab therefore never appears in user |
1839 | code. */ |
1840 | if (/*CONSTCOND*/ 0) |
1841 | goto yyerrorlab; |
1842 | |
1843 | /* Do not reclaim the symbols of the rule whose action triggered |
1844 | this YYERROR. */ |
1845 | YYPOPSTACK (yylen); |
1846 | yylen = 0; |
1847 | YY_STACK_PRINT (yyss, yyssp); |
1848 | yystate = *yyssp; |
1849 | goto yyerrlab1; |
1850 | |
1851 | |
1852 | /*-------------------------------------------------------------. |
1853 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
1854 | `-------------------------------------------------------------*/ |
1855 | yyerrlab1: |
1856 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
1857 | |
1858 | for (;;) |
1859 | { |
1860 | yyn = yypact[yystate]; |
1861 | if (!yypact_value_is_default (yyn)) |
1862 | { |
1863 | yyn += YYTERROR; |
1864 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
1865 | { |
1866 | yyn = yytable[yyn]; |
1867 | if (0 < yyn) |
1868 | break; |
1869 | } |
1870 | } |
1871 | |
1872 | /* Pop the current state because it cannot handle the error token. */ |
1873 | if (yyssp == yyss) |
1874 | YYABORT; |
1875 | |
1876 | |
1877 | yydestruct ("Error: popping" , |
1878 | yystos[yystate], yyvsp); |
1879 | YYPOPSTACK (1); |
1880 | yystate = *yyssp; |
1881 | YY_STACK_PRINT (yyss, yyssp); |
1882 | } |
1883 | |
1884 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1885 | *++yyvsp = yylval; |
1886 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1887 | |
1888 | |
1889 | /* Shift the error token. */ |
1890 | YY_SYMBOL_PRINT ("Shifting" , yystos[yyn], yyvsp, yylsp); |
1891 | |
1892 | yystate = yyn; |
1893 | goto yynewstate; |
1894 | |
1895 | |
1896 | /*-------------------------------------. |
1897 | | yyacceptlab -- YYACCEPT comes here. | |
1898 | `-------------------------------------*/ |
1899 | yyacceptlab: |
1900 | yyresult = 0; |
1901 | goto yyreturn; |
1902 | |
1903 | /*-----------------------------------. |
1904 | | yyabortlab -- YYABORT comes here. | |
1905 | `-----------------------------------*/ |
1906 | yyabortlab: |
1907 | yyresult = 1; |
1908 | goto yyreturn; |
1909 | |
1910 | #if !defined yyoverflow || YYERROR_VERBOSE |
1911 | /*-------------------------------------------------. |
1912 | | yyexhaustedlab -- memory exhaustion comes here. | |
1913 | `-------------------------------------------------*/ |
1914 | yyexhaustedlab: |
1915 | yyerror (YY_("memory exhausted" )); |
1916 | yyresult = 2; |
1917 | /* Fall through. */ |
1918 | #endif |
1919 | |
1920 | yyreturn: |
1921 | if (yychar != YYEMPTY) |
1922 | { |
1923 | /* Make sure we have latest lookahead translation. See comments at |
1924 | user semantic actions for why this is necessary. */ |
1925 | yytoken = YYTRANSLATE (yychar); |
1926 | yydestruct ("Cleanup: discarding lookahead" , |
1927 | yytoken, &yylval); |
1928 | } |
1929 | /* Do not reclaim the symbols of the rule whose action triggered |
1930 | this YYABORT or YYACCEPT. */ |
1931 | YYPOPSTACK (yylen); |
1932 | YY_STACK_PRINT (yyss, yyssp); |
1933 | while (yyssp != yyss) |
1934 | { |
1935 | yydestruct ("Cleanup: popping" , |
1936 | yystos[*yyssp], yyvsp); |
1937 | YYPOPSTACK (1); |
1938 | } |
1939 | #ifndef yyoverflow |
1940 | if (yyss != yyssa) |
1941 | YYSTACK_FREE (yyss); |
1942 | #endif |
1943 | #if YYERROR_VERBOSE |
1944 | if (yymsg != yymsgbuf) |
1945 | YYSTACK_FREE (yymsg); |
1946 | #endif |
1947 | return yyresult; |
1948 | } |
1949 | #line 406 "repl_gram.y" /* yacc.c:1906 */ |
1950 | |
1951 | |
1952 | static SQLCmd * |
1953 | make_sqlcmd(void) |
1954 | { |
1955 | SQLCmd *cmd = makeNode(SQLCmd); |
1956 | int tok; |
1957 | |
1958 | /* Just move lexer to the end of command. */ |
1959 | for (;;) |
1960 | { |
1961 | tok = yylex(); |
1962 | if (tok == ';' || tok == 0) |
1963 | break; |
1964 | } |
1965 | return cmd; |
1966 | } |
1967 | |
1968 | #include "repl_scanner.c" |
1969 | |