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