1 /* header */
2 /* src/interfaces/ecpg/preproc/ecpg.header */
3
4 /* Copyright comment */
5 %{
6 #include "postgres_fe.h"
7
8 #include "preproc_extern.h"
9 #include "ecpg_config.h"
10 #include <unistd.h>
11
12 /* Location tracking support --- simpler than bison's default */
13 #define YYLLOC_DEFAULT(Current, Rhs, N) \
14 do { \
15 if (N) \
16 (Current) = (Rhs)[1]; \
17 else \
18 (Current) = (Rhs)[0]; \
19 } while (0)
20
21 /*
22 * The %name-prefix option below will make bison call base_yylex, but we
23 * really want it to call filtered_base_yylex (see parser.c).
24 */
25 #define base_yylex filtered_base_yylex
26
27 /*
28 * This is only here so the string gets into the POT. Bison uses it
29 * internally.
30 */
31 #define bison_gettext_dummy gettext_noop("syntax error")
32
33 /*
34 * Variables containing simple states.
35 */
36 int struct_level = 0;
37 int braces_open; /* brace level counter */
38 char *current_function;
39 int ecpg_internal_var = 0;
40 char *connection = NULL;
41 char *input_filename = NULL;
42
43 static int FoundInto = 0;
44 static int initializer = 0;
45 static int pacounter = 1;
46 static char pacounter_buffer[sizeof(int) * CHAR_BIT * 10 / 3]; /* a rough guess at the size we need */
47 static struct this_type actual_type[STRUCT_DEPTH];
48 static char *actual_startline[STRUCT_DEPTH];
49 static int varchar_counter = 1;
50 static int bytea_counter = 1;
51
52 /* temporarily store struct members while creating the data structure */
53 struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH] = { NULL };
54
55 /* also store struct type so we can do a sizeof() later */
56 static char *ECPGstruct_sizeof = NULL;
57
58 /* for forward declarations we have to store some data as well */
59 static char *forward_name = NULL;
60
61 struct ECPGtype ecpg_no_indicator = {ECPGt_NO_INDICATOR, NULL, NULL, NULL, {NULL}, 0};
62 struct variable no_indicator = {"no_indicator", &ecpg_no_indicator, 0, NULL};
63
64 static struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, NULL, {NULL}, 0};
65
66 static void vmmerror(int error_code, enum errortype type, const char *error, va_list ap) pg_attribute_printf(3, 0);
67
68 static bool check_declared_list(const char*);
69
70 /*
71 * Handle parsing errors and warnings
72 */
73 static void
vmmerror(int error_code,enum errortype type,const char * error,va_list ap)74 vmmerror(int error_code, enum errortype type, const char *error, va_list ap)
75 {
76 /* localize the error message string */
77 error = _(error);
78
79 fprintf(stderr, "%s:%d: ", input_filename, base_yylineno);
80
81 switch(type)
82 {
83 case ET_WARNING:
84 fprintf(stderr, _("WARNING: "));
85 break;
86 case ET_ERROR:
87 fprintf(stderr, _("ERROR: "));
88 break;
89 }
90
91 vfprintf(stderr, error, ap);
92
93 fprintf(stderr, "\n");
94
95 switch(type)
96 {
97 case ET_WARNING:
98 break;
99 case ET_ERROR:
100 ret_value = error_code;
101 break;
102 }
103 }
104
105 void
mmerror(int error_code,enum errortype type,const char * error,...)106 mmerror(int error_code, enum errortype type, const char *error, ...)
107 {
108 va_list ap;
109
110 va_start(ap, error);
111 vmmerror(error_code, type, error, ap);
112 va_end(ap);
113 }
114
115 void
mmfatal(int error_code,const char * error,...)116 mmfatal(int error_code, const char *error, ...)
117 {
118 va_list ap;
119
120 va_start(ap, error);
121 vmmerror(error_code, ET_ERROR, error, ap);
122 va_end(ap);
123
124 if (base_yyin)
125 fclose(base_yyin);
126 if (base_yyout)
127 fclose(base_yyout);
128
129 if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0)
130 fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);
131 exit(error_code);
132 }
133
134 /*
135 * string concatenation
136 */
137
138 static char *
cat2_str(char * str1,char * str2)139 cat2_str(char *str1, char *str2)
140 {
141 char * res_str = (char *)mm_alloc(strlen(str1) + strlen(str2) + 2);
142
143 strcpy(res_str, str1);
144 if (strlen(str1) != 0 && strlen(str2) != 0)
145 strcat(res_str, " ");
146 strcat(res_str, str2);
147 free(str1);
148 free(str2);
149 return res_str;
150 }
151
152 static char *
cat_str(int count,...)153 cat_str(int count, ...)
154 {
155 va_list args;
156 int i;
157 char *res_str;
158
159 va_start(args, count);
160
161 res_str = va_arg(args, char *);
162
163 /* now add all other strings */
164 for (i = 1; i < count; i++)
165 res_str = cat2_str(res_str, va_arg(args, char *));
166
167 va_end(args);
168
169 return res_str;
170 }
171
172 static char *
make2_str(char * str1,char * str2)173 make2_str(char *str1, char *str2)
174 {
175 char * res_str = (char *)mm_alloc(strlen(str1) + strlen(str2) + 1);
176
177 strcpy(res_str, str1);
178 strcat(res_str, str2);
179 free(str1);
180 free(str2);
181 return res_str;
182 }
183
184 static char *
make3_str(char * str1,char * str2,char * str3)185 make3_str(char *str1, char *str2, char *str3)
186 {
187 char * res_str = (char *)mm_alloc(strlen(str1) + strlen(str2) +strlen(str3) + 1);
188
189 strcpy(res_str, str1);
190 strcat(res_str, str2);
191 strcat(res_str, str3);
192 free(str1);
193 free(str2);
194 free(str3);
195 return res_str;
196 }
197
198 /* and the rest */
199 static char *
make_name(void)200 make_name(void)
201 {
202 return mm_strdup(base_yytext);
203 }
204
205 static char *
create_questionmarks(char * name,bool array)206 create_questionmarks(char *name, bool array)
207 {
208 struct variable *p = find_variable(name);
209 int count;
210 char *result = EMPTY;
211
212 /* In case we have a struct, we have to print as many "?" as there are attributes in the struct
213 * An array is only allowed together with an element argument
214 * This is essentially only used for inserts, but using a struct as input parameter is an error anywhere else
215 * so we don't have to worry here. */
216
217 if (p->type->type == ECPGt_struct || (array && p->type->type == ECPGt_array && p->type->u.element->type == ECPGt_struct))
218 {
219 struct ECPGstruct_member *m;
220
221 if (p->type->type == ECPGt_struct)
222 m = p->type->u.members;
223 else
224 m = p->type->u.element->u.members;
225
226 for (count = 0; m != NULL; m=m->next, count++);
227 }
228 else
229 count = 1;
230
231 for (; count > 0; count --)
232 {
233 sprintf(pacounter_buffer, "$%d", pacounter++);
234 result = cat_str(3, result, mm_strdup(pacounter_buffer), mm_strdup(" , "));
235 }
236
237 /* removed the trailing " ," */
238
239 result[strlen(result)-3] = '\0';
240 return result;
241 }
242
243 static char *
adjust_outofscope_cursor_vars(struct cursor * cur)244 adjust_outofscope_cursor_vars(struct cursor *cur)
245 {
246 /* Informix accepts DECLARE with variables that are out of scope when OPEN is called.
247 * For instance you can DECLARE a cursor in one function, and OPEN/FETCH/CLOSE
248 * it in another functions. This is very useful for e.g. event-driver programming,
249 * but may also lead to dangerous programming. The limitation when this is allowed
250 * and doesn't cause problems have to be documented, like the allocated variables
251 * must not be realloc()'ed.
252 *
253 * We have to change the variables to our own struct and just store the pointer
254 * instead of the variable. Do it only for local variables, not for globals.
255 */
256
257 char *result = EMPTY;
258 int insert;
259
260 for (insert = 1; insert >= 0; insert--)
261 {
262 struct arguments *list;
263 struct arguments *ptr;
264 struct arguments *newlist = NULL;
265 struct variable *newvar, *newind;
266
267 list = (insert ? cur->argsinsert : cur->argsresult);
268
269 for (ptr = list; ptr != NULL; ptr = ptr->next)
270 {
271 char var_text[20];
272 char *original_var;
273 bool skip_set_var = false;
274 bool var_ptr = false;
275
276 /* change variable name to "ECPGget_var(<counter>)" */
277 original_var = ptr->variable->name;
278 sprintf(var_text, "%d))", ecpg_internal_var);
279
280 /* Don't emit ECPGset_var() calls for global variables */
281 if (ptr->variable->brace_level == 0)
282 {
283 newvar = ptr->variable;
284 skip_set_var = true;
285 }
286 else if ((ptr->variable->type->type == ECPGt_char_variable)
287 && (strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement")) == 0))
288 {
289 newvar = ptr->variable;
290 skip_set_var = true;
291 }
292 else if ((ptr->variable->type->type != ECPGt_varchar
293 && ptr->variable->type->type != ECPGt_char
294 && ptr->variable->type->type != ECPGt_unsigned_char
295 && ptr->variable->type->type != ECPGt_string
296 && ptr->variable->type->type != ECPGt_bytea)
297 && atoi(ptr->variable->type->size) > 1)
298 {
299 newvar = new_variable(cat_str(4, mm_strdup("("),
300 mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)),
301 mm_strdup(" *)(ECPGget_var("),
302 mm_strdup(var_text)),
303 ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
304 mm_strdup("1"),
305 ptr->variable->type->u.element->counter),
306 ptr->variable->type->size),
307 0);
308 }
309 else if ((ptr->variable->type->type == ECPGt_varchar
310 || ptr->variable->type->type == ECPGt_char
311 || ptr->variable->type->type == ECPGt_unsigned_char
312 || ptr->variable->type->type == ECPGt_string
313 || ptr->variable->type->type == ECPGt_bytea)
314 && atoi(ptr->variable->type->size) > 1)
315 {
316 newvar = new_variable(cat_str(4, mm_strdup("("),
317 mm_strdup(ecpg_type_name(ptr->variable->type->type)),
318 mm_strdup(" *)(ECPGget_var("),
319 mm_strdup(var_text)),
320 ECPGmake_simple_type(ptr->variable->type->type,
321 ptr->variable->type->size,
322 ptr->variable->type->counter),
323 0);
324 if (ptr->variable->type->type == ECPGt_varchar ||
325 ptr->variable->type->type == ECPGt_bytea)
326 var_ptr = true;
327 }
328 else if (ptr->variable->type->type == ECPGt_struct
329 || ptr->variable->type->type == ECPGt_union)
330 {
331 newvar = new_variable(cat_str(5, mm_strdup("(*("),
332 mm_strdup(ptr->variable->type->type_name),
333 mm_strdup(" *)(ECPGget_var("),
334 mm_strdup(var_text),
335 mm_strdup(")")),
336 ECPGmake_struct_type(ptr->variable->type->u.members,
337 ptr->variable->type->type,
338 ptr->variable->type->type_name,
339 ptr->variable->type->struct_sizeof),
340 0);
341 var_ptr = true;
342 }
343 else if (ptr->variable->type->type == ECPGt_array)
344 {
345 if (ptr->variable->type->u.element->type == ECPGt_struct
346 || ptr->variable->type->u.element->type == ECPGt_union)
347 {
348 newvar = new_variable(cat_str(5, mm_strdup("(*("),
349 mm_strdup(ptr->variable->type->u.element->type_name),
350 mm_strdup(" *)(ECPGget_var("),
351 mm_strdup(var_text),
352 mm_strdup(")")),
353 ECPGmake_struct_type(ptr->variable->type->u.element->u.members,
354 ptr->variable->type->u.element->type,
355 ptr->variable->type->u.element->type_name,
356 ptr->variable->type->u.element->struct_sizeof),
357 0);
358 }
359 else
360 {
361 newvar = new_variable(cat_str(4, mm_strdup("("),
362 mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)),
363 mm_strdup(" *)(ECPGget_var("),
364 mm_strdup(var_text)),
365 ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
366 ptr->variable->type->u.element->size,
367 ptr->variable->type->u.element->counter),
368 ptr->variable->type->size),
369 0);
370 var_ptr = true;
371 }
372 }
373 else
374 {
375 newvar = new_variable(cat_str(4, mm_strdup("*("),
376 mm_strdup(ecpg_type_name(ptr->variable->type->type)),
377 mm_strdup(" *)(ECPGget_var("),
378 mm_strdup(var_text)),
379 ECPGmake_simple_type(ptr->variable->type->type,
380 ptr->variable->type->size,
381 ptr->variable->type->counter),
382 0);
383 var_ptr = true;
384 }
385
386 /* create call to "ECPGset_var(<counter>, <connection>, <pointer>. <line number>)" */
387 if (!skip_set_var)
388 {
389 sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
390 result = cat_str(5, result, mm_strdup("ECPGset_var("),
391 mm_strdup(var_text), mm_strdup(original_var),
392 mm_strdup("), __LINE__);\n"));
393 }
394
395 /* now the indicator if there is one and it's not a global variable */
396 if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
397 {
398 newind = ptr->indicator;
399 }
400 else
401 {
402 /* change variable name to "ECPGget_var(<counter>)" */
403 original_var = ptr->indicator->name;
404 sprintf(var_text, "%d))", ecpg_internal_var);
405 var_ptr = false;
406
407 if (ptr->indicator->type->type == ECPGt_struct
408 || ptr->indicator->type->type == ECPGt_union)
409 {
410 newind = new_variable(cat_str(5, mm_strdup("(*("),
411 mm_strdup(ptr->indicator->type->type_name),
412 mm_strdup(" *)(ECPGget_var("),
413 mm_strdup(var_text),
414 mm_strdup(")")),
415 ECPGmake_struct_type(ptr->indicator->type->u.members,
416 ptr->indicator->type->type,
417 ptr->indicator->type->type_name,
418 ptr->indicator->type->struct_sizeof),
419 0);
420 var_ptr = true;
421 }
422 else if (ptr->indicator->type->type == ECPGt_array)
423 {
424 if (ptr->indicator->type->u.element->type == ECPGt_struct
425 || ptr->indicator->type->u.element->type == ECPGt_union)
426 {
427 newind = new_variable(cat_str(5, mm_strdup("(*("),
428 mm_strdup(ptr->indicator->type->u.element->type_name),
429 mm_strdup(" *)(ECPGget_var("),
430 mm_strdup(var_text),
431 mm_strdup(")")),
432 ECPGmake_struct_type(ptr->indicator->type->u.element->u.members,
433 ptr->indicator->type->u.element->type,
434 ptr->indicator->type->u.element->type_name,
435 ptr->indicator->type->u.element->struct_sizeof),
436 0);
437 }
438 else
439 {
440 newind = new_variable(cat_str(4, mm_strdup("("),
441 mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)),
442 mm_strdup(" *)(ECPGget_var("), mm_strdup(var_text)),
443 ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type,
444 ptr->indicator->type->u.element->size,
445 ptr->indicator->type->u.element->counter),
446 ptr->indicator->type->size),
447 0);
448 var_ptr = true;
449 }
450 }
451 else if (atoi(ptr->indicator->type->size) > 1)
452 {
453 newind = new_variable(cat_str(4, mm_strdup("("),
454 mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
455 mm_strdup(" *)(ECPGget_var("),
456 mm_strdup(var_text)),
457 ECPGmake_simple_type(ptr->indicator->type->type,
458 ptr->indicator->type->size,
459 ptr->variable->type->counter),
460 0);
461 }
462 else
463 {
464 newind = new_variable(cat_str(4, mm_strdup("*("),
465 mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
466 mm_strdup(" *)(ECPGget_var("),
467 mm_strdup(var_text)),
468 ECPGmake_simple_type(ptr->indicator->type->type,
469 ptr->indicator->type->size,
470 ptr->variable->type->counter),
471 0);
472 var_ptr = true;
473 }
474
475 /* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
476 sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
477 result = cat_str(5, result, mm_strdup("ECPGset_var("),
478 mm_strdup(var_text), mm_strdup(original_var),
479 mm_strdup("), __LINE__);\n"));
480 }
481
482 add_variable_to_tail(&newlist, newvar, newind);
483 }
484
485 if (insert)
486 cur->argsinsert_oos = newlist;
487 else
488 cur->argsresult_oos = newlist;
489 }
490
491 return result;
492 }
493
494 /* This tests whether the cursor was declared and opened in the same function. */
495 #define SAMEFUNC(cur) \
496 ((cur->function == NULL) || \
497 (cur->function != NULL && strcmp(cur->function, current_function) == 0))
498
499 static struct cursor *
add_additional_variables(char * name,bool insert)500 add_additional_variables(char *name, bool insert)
501 {
502 struct cursor *ptr;
503 struct arguments *p;
504 int (* strcmp_fn)(const char *, const char *) = ((name[0] == ':' || name[0] == '"') ? strcmp : pg_strcasecmp);
505
506 for (ptr = cur; ptr != NULL; ptr=ptr->next)
507 {
508 if (strcmp_fn(ptr->name, name) == 0)
509 break;
510 }
511
512 if (ptr == NULL)
513 {
514 mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" does not exist", name);
515 return NULL;
516 }
517
518 if (insert)
519 {
520 /* add all those input variables that were given earlier
521 * note that we have to append here but have to keep the existing order */
522 for (p = (SAMEFUNC(ptr) ? ptr->argsinsert : ptr->argsinsert_oos); p; p = p->next)
523 add_variable_to_tail(&argsinsert, p->variable, p->indicator);
524 }
525
526 /* add all those output variables that were given earlier */
527 for (p = (SAMEFUNC(ptr) ? ptr->argsresult : ptr->argsresult_oos); p; p = p->next)
528 add_variable_to_tail(&argsresult, p->variable, p->indicator);
529
530 return ptr;
531 }
532
533 static void
add_typedef(char * name,char * dimension,char * length,enum ECPGttype type_enum,char * type_dimension,char * type_index,int initializer,int array)534 add_typedef(char *name, char *dimension, char *length, enum ECPGttype type_enum,
535 char *type_dimension, char *type_index, int initializer, int array)
536 {
537 /* add entry to list */
538 struct typedefs *ptr, *this;
539
540 if ((type_enum == ECPGt_struct ||
541 type_enum == ECPGt_union) &&
542 initializer == 1)
543 mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
544 else if (INFORMIX_MODE && strcmp(name, "string") == 0)
545 mmerror(PARSE_ERROR, ET_ERROR, "type name \"string\" is reserved in Informix mode");
546 else
547 {
548 for (ptr = types; ptr != NULL; ptr = ptr->next)
549 {
550 if (strcmp(name, ptr->name) == 0)
551 /* re-definition is a bug */
552 mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", name);
553 }
554 adjust_array(type_enum, &dimension, &length, type_dimension, type_index, array, true);
555
556 this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
557
558 /* initial definition */
559 this->next = types;
560 this->name = name;
561 this->brace_level = braces_open;
562 this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
563 this->type->type_enum = type_enum;
564 this->type->type_str = mm_strdup(name);
565 this->type->type_dimension = dimension; /* dimension of array */
566 this->type->type_index = length; /* length of string */
567 this->type->type_sizeof = ECPGstruct_sizeof;
568 this->struct_member_list = (type_enum == ECPGt_struct || type_enum == ECPGt_union) ?
569 ECPGstruct_member_dup(struct_member_list[struct_level]) : NULL;
570
571 if (type_enum != ECPGt_varchar &&
572 type_enum != ECPGt_bytea &&
573 type_enum != ECPGt_char &&
574 type_enum != ECPGt_unsigned_char &&
575 type_enum != ECPGt_string &&
576 atoi(this->type->type_index) >= 0)
577 mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
578
579 types = this;
580 }
581 }
582
583 /*
584 * check an SQL identifier is declared or not.
585 * If it is already declared, the global variable
586 * connection will be changed to the related connection.
587 */
588 static bool
check_declared_list(const char * name)589 check_declared_list(const char *name)
590 {
591 struct declared_list *ptr = NULL;
592 for (ptr = g_declared_list; ptr != NULL; ptr = ptr -> next)
593 {
594 if (!ptr->connection)
595 continue;
596 if (strcmp(name, ptr -> name) == 0)
597 {
598 if (connection && strcmp(ptr->connection, connection) != 0)
599 mmerror(PARSE_ERROR, ET_WARNING, "connection %s is overwritten with %s by DECLARE statement %s", connection, ptr->connection, name);
600 connection = mm_strdup(ptr -> connection);
601 return true;
602 }
603 }
604 return false;
605 }
606 %}
607
608 %expect 0
609 %name-prefix="base_yy"
610 %locations
611
612 %union {
613 double dval;
614 char *str;
615 int ival;
616 struct when action;
617 struct index index;
618 int tagname;
619 struct this_type type;
620 enum ECPGttype type_enum;
621 enum ECPGdtype dtype_enum;
622 struct fetch_desc descriptor;
623 struct su_symbol struct_union;
624 struct prep prep;
625 struct exec exec;
626 struct describe describe;
627 }
628 /* tokens */
629 /* src/interfaces/ecpg/preproc/ecpg.tokens */
630
631 /* special embedded SQL tokens */
632 %token SQL_ALLOCATE SQL_AUTOCOMMIT SQL_BOOL SQL_BREAK
633 SQL_CARDINALITY SQL_CONNECT
634 SQL_COUNT
635 SQL_DATETIME_INTERVAL_CODE
636 SQL_DATETIME_INTERVAL_PRECISION SQL_DESCRIBE
637 SQL_DESCRIPTOR SQL_DISCONNECT SQL_FOUND
638 SQL_FREE SQL_GET SQL_GO SQL_GOTO SQL_IDENTIFIED
639 SQL_INDICATOR SQL_KEY_MEMBER SQL_LENGTH
640 SQL_LONG SQL_NULLABLE SQL_OCTET_LENGTH
641 SQL_OPEN SQL_OUTPUT SQL_REFERENCE
642 SQL_RETURNED_LENGTH SQL_RETURNED_OCTET_LENGTH SQL_SCALE
643 SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQLERROR
644 SQL_SQLPRINT SQL_SQLWARNING SQL_START SQL_STOP
645 SQL_STRUCT SQL_UNSIGNED SQL_VAR SQL_WHENEVER
646
647 /* C tokens */
648 %token S_ADD S_AND S_ANYTHING S_AUTO S_CONST S_DEC S_DIV
649 S_DOTPOINT S_EQUAL S_EXTERN S_INC S_LSHIFT S_MEMPOINT
650 S_MEMBER S_MOD S_MUL S_NEQUAL S_OR S_REGISTER S_RSHIFT
651 S_STATIC S_SUB S_VOLATILE
652 S_TYPEDEF
653
654 %token CSTRING CVARIABLE CPP_LINE IP
655 /* types */
656 %type <str> toplevel_stmt
657 %type <str> stmt
658 %type <str> CallStmt
659 %type <str> CreateRoleStmt
660 %type <str> opt_with
661 %type <str> OptRoleList
662 %type <str> AlterOptRoleList
663 %type <str> AlterOptRoleElem
664 %type <str> CreateOptRoleElem
665 %type <str> CreateUserStmt
666 %type <str> AlterRoleStmt
667 %type <str> opt_in_database
668 %type <str> AlterRoleSetStmt
669 %type <str> DropRoleStmt
670 %type <str> CreateGroupStmt
671 %type <str> AlterGroupStmt
672 %type <str> add_drop
673 %type <str> CreateSchemaStmt
674 %type <str> OptSchemaName
675 %type <str> OptSchemaEltList
676 %type <str> schema_stmt
677 %type <str> VariableSetStmt
678 %type <str> set_rest
679 %type <str> generic_set
680 %type <str> set_rest_more
681 %type <str> var_name
682 %type <str> var_list
683 %type <str> var_value
684 %type <str> iso_level
685 %type <str> opt_boolean_or_string
686 %type <str> zone_value
687 %type <str> opt_encoding
688 %type <str> NonReservedWord_or_Sconst
689 %type <str> VariableResetStmt
690 %type <str> reset_rest
691 %type <str> generic_reset
692 %type <str> SetResetClause
693 %type <str> FunctionSetResetClause
694 %type <str> VariableShowStmt
695 %type <str> ConstraintsSetStmt
696 %type <str> constraints_set_list
697 %type <str> constraints_set_mode
698 %type <str> CheckPointStmt
699 %type <str> DiscardStmt
700 %type <str> AlterTableStmt
701 %type <str> alter_table_cmds
702 %type <str> partition_cmd
703 %type <str> index_partition_cmd
704 %type <str> alter_table_cmd
705 %type <str> alter_column_default
706 %type <str> opt_drop_behavior
707 %type <str> opt_collate_clause
708 %type <str> alter_using
709 %type <str> replica_identity
710 %type <str> reloptions
711 %type <str> opt_reloptions
712 %type <str> reloption_list
713 %type <str> reloption_elem
714 %type <str> alter_identity_column_option_list
715 %type <str> alter_identity_column_option
716 %type <str> PartitionBoundSpec
717 %type <str> hash_partbound_elem
718 %type <str> hash_partbound
719 %type <str> AlterCompositeTypeStmt
720 %type <str> alter_type_cmds
721 %type <str> alter_type_cmd
722 %type <str> ClosePortalStmt
723 %type <str> CopyStmt
724 %type <str> copy_from
725 %type <str> opt_program
726 %type <str> copy_file_name
727 %type <str> copy_options
728 %type <str> copy_opt_list
729 %type <str> copy_opt_item
730 %type <str> opt_binary
731 %type <str> copy_delimiter
732 %type <str> opt_using
733 %type <str> copy_generic_opt_list
734 %type <str> copy_generic_opt_elem
735 %type <str> copy_generic_opt_arg
736 %type <str> copy_generic_opt_arg_list
737 %type <str> copy_generic_opt_arg_list_item
738 %type <str> CreateStmt
739 %type <str> OptTemp
740 %type <str> OptTableElementList
741 %type <str> OptTypedTableElementList
742 %type <str> TableElementList
743 %type <str> TypedTableElementList
744 %type <str> TableElement
745 %type <str> TypedTableElement
746 %type <str> columnDef
747 %type <str> columnOptions
748 %type <str> column_compression
749 %type <str> opt_column_compression
750 %type <str> ColQualList
751 %type <str> ColConstraint
752 %type <str> ColConstraintElem
753 %type <str> generated_when
754 %type <str> ConstraintAttr
755 %type <str> TableLikeClause
756 %type <str> TableLikeOptionList
757 %type <str> TableLikeOption
758 %type <str> TableConstraint
759 %type <str> ConstraintElem
760 %type <str> opt_no_inherit
761 %type <str> opt_column_list
762 %type <str> columnList
763 %type <str> columnElem
764 %type <str> opt_c_include
765 %type <str> key_match
766 %type <str> ExclusionConstraintList
767 %type <str> ExclusionConstraintElem
768 %type <str> OptWhereClause
769 %type <str> key_actions
770 %type <str> key_update
771 %type <str> key_delete
772 %type <str> key_action
773 %type <str> OptInherit
774 %type <str> OptPartitionSpec
775 %type <str> PartitionSpec
776 %type <str> part_params
777 %type <str> part_elem
778 %type <str> table_access_method_clause
779 %type <str> OptWith
780 %type <str> OnCommitOption
781 %type <str> OptTableSpace
782 %type <str> OptConsTableSpace
783 %type <str> ExistingIndex
784 %type <str> CreateStatsStmt
785 %type <str> stats_params
786 %type <str> stats_param
787 %type <str> AlterStatsStmt
788 %type <str> create_as_target
789 %type <str> opt_with_data
790 %type <str> CreateMatViewStmt
791 %type <str> create_mv_target
792 %type <str> OptNoLog
793 %type <str> RefreshMatViewStmt
794 %type <str> CreateSeqStmt
795 %type <str> AlterSeqStmt
796 %type <str> OptSeqOptList
797 %type <str> OptParenthesizedSeqOptList
798 %type <str> SeqOptList
799 %type <str> SeqOptElem
800 %type <str> opt_by
801 %type <str> NumericOnly
802 %type <str> NumericOnly_list
803 %type <str> CreatePLangStmt
804 %type <str> opt_trusted
805 %type <str> handler_name
806 %type <str> opt_inline_handler
807 %type <str> validator_clause
808 %type <str> opt_validator
809 %type <str> opt_procedural
810 %type <str> CreateTableSpaceStmt
811 %type <str> OptTableSpaceOwner
812 %type <str> DropTableSpaceStmt
813 %type <str> CreateExtensionStmt
814 %type <str> create_extension_opt_list
815 %type <str> create_extension_opt_item
816 %type <str> AlterExtensionStmt
817 %type <str> alter_extension_opt_list
818 %type <str> alter_extension_opt_item
819 %type <str> AlterExtensionContentsStmt
820 %type <str> CreateFdwStmt
821 %type <str> fdw_option
822 %type <str> fdw_options
823 %type <str> opt_fdw_options
824 %type <str> AlterFdwStmt
825 %type <str> create_generic_options
826 %type <str> generic_option_list
827 %type <str> alter_generic_options
828 %type <str> alter_generic_option_list
829 %type <str> alter_generic_option_elem
830 %type <str> generic_option_elem
831 %type <str> generic_option_name
832 %type <str> generic_option_arg
833 %type <str> CreateForeignServerStmt
834 %type <str> opt_type
835 %type <str> foreign_server_version
836 %type <str> opt_foreign_server_version
837 %type <str> AlterForeignServerStmt
838 %type <str> CreateForeignTableStmt
839 %type <str> ImportForeignSchemaStmt
840 %type <str> import_qualification_type
841 %type <str> import_qualification
842 %type <str> CreateUserMappingStmt
843 %type <str> auth_ident
844 %type <str> DropUserMappingStmt
845 %type <str> AlterUserMappingStmt
846 %type <str> CreatePolicyStmt
847 %type <str> AlterPolicyStmt
848 %type <str> RowSecurityOptionalExpr
849 %type <str> RowSecurityOptionalWithCheck
850 %type <str> RowSecurityDefaultToRole
851 %type <str> RowSecurityOptionalToRole
852 %type <str> RowSecurityDefaultPermissive
853 %type <str> RowSecurityDefaultForCmd
854 %type <str> row_security_cmd
855 %type <str> CreateAmStmt
856 %type <str> am_type
857 %type <str> CreateTrigStmt
858 %type <str> TriggerActionTime
859 %type <str> TriggerEvents
860 %type <str> TriggerOneEvent
861 %type <str> TriggerReferencing
862 %type <str> TriggerTransitions
863 %type <str> TriggerTransition
864 %type <str> TransitionOldOrNew
865 %type <str> TransitionRowOrTable
866 %type <str> TransitionRelName
867 %type <str> TriggerForSpec
868 %type <str> TriggerForOptEach
869 %type <str> TriggerForType
870 %type <str> TriggerWhen
871 %type <str> FUNCTION_or_PROCEDURE
872 %type <str> TriggerFuncArgs
873 %type <str> TriggerFuncArg
874 %type <str> OptConstrFromTable
875 %type <str> ConstraintAttributeSpec
876 %type <str> ConstraintAttributeElem
877 %type <str> CreateEventTrigStmt
878 %type <str> event_trigger_when_list
879 %type <str> event_trigger_when_item
880 %type <str> event_trigger_value_list
881 %type <str> AlterEventTrigStmt
882 %type <str> enable_trigger
883 %type <str> CreateAssertionStmt
884 %type <str> DefineStmt
885 %type <str> definition
886 %type <str> def_list
887 %type <str> def_elem
888 %type <str> def_arg
889 %type <str> old_aggr_definition
890 %type <str> old_aggr_list
891 %type <str> old_aggr_elem
892 %type <str> opt_enum_val_list
893 %type <str> enum_val_list
894 %type <str> AlterEnumStmt
895 %type <str> opt_if_not_exists
896 %type <str> CreateOpClassStmt
897 %type <str> opclass_item_list
898 %type <str> opclass_item
899 %type <str> opt_default
900 %type <str> opt_opfamily
901 %type <str> opclass_purpose
902 %type <str> opt_recheck
903 %type <str> CreateOpFamilyStmt
904 %type <str> AlterOpFamilyStmt
905 %type <str> opclass_drop_list
906 %type <str> opclass_drop
907 %type <str> DropOpClassStmt
908 %type <str> DropOpFamilyStmt
909 %type <str> DropOwnedStmt
910 %type <str> ReassignOwnedStmt
911 %type <str> DropStmt
912 %type <str> object_type_any_name
913 %type <str> object_type_name
914 %type <str> drop_type_name
915 %type <str> object_type_name_on_any_name
916 %type <str> any_name_list
917 %type <str> any_name
918 %type <str> attrs
919 %type <str> type_name_list
920 %type <str> TruncateStmt
921 %type <str> opt_restart_seqs
922 %type <str> CommentStmt
923 %type <str> comment_text
924 %type <str> SecLabelStmt
925 %type <str> opt_provider
926 %type <str> security_label
927 %type <str> FetchStmt
928 %type <str> fetch_args
929 %type <str> from_in
930 %type <str> opt_from_in
931 %type <str> GrantStmt
932 %type <str> RevokeStmt
933 %type <str> privileges
934 %type <str> privilege_list
935 %type <str> privilege
936 %type <str> privilege_target
937 %type <str> grantee_list
938 %type <str> grantee
939 %type <str> opt_grant_grant_option
940 %type <str> GrantRoleStmt
941 %type <str> RevokeRoleStmt
942 %type <str> opt_grant_admin_option
943 %type <str> opt_granted_by
944 %type <str> AlterDefaultPrivilegesStmt
945 %type <str> DefACLOptionList
946 %type <str> DefACLOption
947 %type <str> DefACLAction
948 %type <str> defacl_privilege_target
949 %type <str> IndexStmt
950 %type <str> opt_unique
951 %type <str> opt_concurrently
952 %type <str> opt_index_name
953 %type <str> access_method_clause
954 %type <str> index_params
955 %type <str> index_elem_options
956 %type <str> index_elem
957 %type <str> opt_include
958 %type <str> index_including_params
959 %type <str> opt_collate
960 %type <str> opt_class
961 %type <str> opt_asc_desc
962 %type <str> opt_nulls_order
963 %type <str> CreateFunctionStmt
964 %type <str> opt_or_replace
965 %type <str> func_args
966 %type <str> func_args_list
967 %type <str> function_with_argtypes_list
968 %type <str> function_with_argtypes
969 %type <str> func_args_with_defaults
970 %type <str> func_args_with_defaults_list
971 %type <str> func_arg
972 %type <str> arg_class
973 %type <str> param_name
974 %type <str> func_return
975 %type <str> func_type
976 %type <str> func_arg_with_default
977 %type <str> aggr_arg
978 %type <str> aggr_args
979 %type <str> aggr_args_list
980 %type <str> aggregate_with_argtypes
981 %type <str> aggregate_with_argtypes_list
982 %type <str> opt_createfunc_opt_list
983 %type <str> createfunc_opt_list
984 %type <str> common_func_opt_item
985 %type <str> createfunc_opt_item
986 %type <str> func_as
987 %type <str> ReturnStmt
988 %type <str> opt_routine_body
989 %type <str> routine_body_stmt_list
990 %type <str> routine_body_stmt
991 %type <str> transform_type_list
992 %type <str> opt_definition
993 %type <str> table_func_column
994 %type <str> table_func_column_list
995 %type <str> AlterFunctionStmt
996 %type <str> alterfunc_opt_list
997 %type <str> opt_restrict
998 %type <str> RemoveFuncStmt
999 %type <str> RemoveAggrStmt
1000 %type <str> RemoveOperStmt
1001 %type <str> oper_argtypes
1002 %type <str> any_operator
1003 %type <str> operator_with_argtypes_list
1004 %type <str> operator_with_argtypes
1005 %type <str> DoStmt
1006 %type <str> dostmt_opt_list
1007 %type <str> dostmt_opt_item
1008 %type <str> CreateCastStmt
1009 %type <str> cast_context
1010 %type <str> DropCastStmt
1011 %type <str> opt_if_exists
1012 %type <str> CreateTransformStmt
1013 %type <str> transform_element_list
1014 %type <str> DropTransformStmt
1015 %type <str> ReindexStmt
1016 %type <str> reindex_target_type
1017 %type <str> reindex_target_multitable
1018 %type <str> AlterTblSpcStmt
1019 %type <str> RenameStmt
1020 %type <str> opt_column
1021 %type <str> opt_set_data
1022 %type <str> AlterObjectDependsStmt
1023 %type <str> opt_no
1024 %type <str> AlterObjectSchemaStmt
1025 %type <str> AlterOperatorStmt
1026 %type <str> operator_def_list
1027 %type <str> operator_def_elem
1028 %type <str> operator_def_arg
1029 %type <str> AlterTypeStmt
1030 %type <str> AlterOwnerStmt
1031 %type <str> CreatePublicationStmt
1032 %type <str> opt_publication_for_tables
1033 %type <str> publication_for_tables
1034 %type <str> AlterPublicationStmt
1035 %type <str> CreateSubscriptionStmt
1036 %type <str> AlterSubscriptionStmt
1037 %type <str> DropSubscriptionStmt
1038 %type <str> RuleStmt
1039 %type <str> RuleActionList
1040 %type <str> RuleActionMulti
1041 %type <str> RuleActionStmt
1042 %type <str> RuleActionStmtOrEmpty
1043 %type <str> event
1044 %type <str> opt_instead
1045 %type <str> NotifyStmt
1046 %type <str> notify_payload
1047 %type <str> ListenStmt
1048 %type <str> UnlistenStmt
1049 %type <str> TransactionStmt
1050 %type <str> TransactionStmtLegacy
1051 %type <str> opt_transaction
1052 %type <str> transaction_mode_item
1053 %type <str> transaction_mode_list
1054 %type <str> transaction_mode_list_or_empty
1055 %type <str> opt_transaction_chain
1056 %type <str> ViewStmt
1057 %type <str> opt_check_option
1058 %type <str> LoadStmt
1059 %type <str> CreatedbStmt
1060 %type <str> createdb_opt_list
1061 %type <str> createdb_opt_items
1062 %type <str> createdb_opt_item
1063 %type <str> createdb_opt_name
1064 %type <str> opt_equal
1065 %type <str> AlterDatabaseStmt
1066 %type <str> AlterDatabaseSetStmt
1067 %type <str> DropdbStmt
1068 %type <str> drop_option_list
1069 %type <str> drop_option
1070 %type <str> AlterCollationStmt
1071 %type <str> AlterSystemStmt
1072 %type <str> CreateDomainStmt
1073 %type <str> AlterDomainStmt
1074 %type <str> opt_as
1075 %type <str> AlterTSDictionaryStmt
1076 %type <str> AlterTSConfigurationStmt
1077 %type <str> any_with
1078 %type <str> CreateConversionStmt
1079 %type <str> ClusterStmt
1080 %type <str> cluster_index_specification
1081 %type <str> VacuumStmt
1082 %type <str> AnalyzeStmt
1083 %type <str> utility_option_list
1084 %type <str> analyze_keyword
1085 %type <str> utility_option_elem
1086 %type <str> utility_option_name
1087 %type <str> utility_option_arg
1088 %type <str> opt_analyze
1089 %type <str> opt_verbose
1090 %type <str> opt_full
1091 %type <str> opt_freeze
1092 %type <str> opt_name_list
1093 %type <str> vacuum_relation
1094 %type <str> vacuum_relation_list
1095 %type <str> opt_vacuum_relation_list
1096 %type <str> ExplainStmt
1097 %type <str> ExplainableStmt
1098 %type <prep> PrepareStmt
1099 %type <str> prep_type_clause
1100 %type <str> PreparableStmt
1101 %type <exec> ExecuteStmt
1102 %type <str> execute_param_clause
1103 %type <str> InsertStmt
1104 %type <str> insert_target
1105 %type <str> insert_rest
1106 %type <str> override_kind
1107 %type <str> insert_column_list
1108 %type <str> insert_column_item
1109 %type <str> opt_on_conflict
1110 %type <str> opt_conf_expr
1111 %type <str> returning_clause
1112 %type <str> DeleteStmt
1113 %type <str> using_clause
1114 %type <str> LockStmt
1115 %type <str> opt_lock
1116 %type <str> lock_type
1117 %type <str> opt_nowait
1118 %type <str> opt_nowait_or_skip
1119 %type <str> UpdateStmt
1120 %type <str> set_clause_list
1121 %type <str> set_clause
1122 %type <str> set_target
1123 %type <str> set_target_list
1124 %type <str> DeclareCursorStmt
1125 %type <str> cursor_name
1126 %type <str> cursor_options
1127 %type <str> opt_hold
1128 %type <str> SelectStmt
1129 %type <str> select_with_parens
1130 %type <str> select_no_parens
1131 %type <str> select_clause
1132 %type <str> simple_select
1133 %type <str> with_clause
1134 %type <str> cte_list
1135 %type <str> common_table_expr
1136 %type <str> opt_materialized
1137 %type <str> opt_search_clause
1138 %type <str> opt_cycle_clause
1139 %type <str> opt_with_clause
1140 %type <str> into_clause
1141 %type <str> OptTempTableName
1142 %type <str> opt_table
1143 %type <str> set_quantifier
1144 %type <str> distinct_clause
1145 %type <str> opt_all_clause
1146 %type <str> opt_sort_clause
1147 %type <str> sort_clause
1148 %type <str> sortby_list
1149 %type <str> sortby
1150 %type <str> select_limit
1151 %type <str> opt_select_limit
1152 %type <str> limit_clause
1153 %type <str> offset_clause
1154 %type <str> select_limit_value
1155 %type <str> select_offset_value
1156 %type <str> select_fetch_first_value
1157 %type <str> I_or_F_const
1158 %type <str> row_or_rows
1159 %type <str> first_or_next
1160 %type <str> group_clause
1161 %type <str> group_by_list
1162 %type <str> group_by_item
1163 %type <str> empty_grouping_set
1164 %type <str> rollup_clause
1165 %type <str> cube_clause
1166 %type <str> grouping_sets_clause
1167 %type <str> having_clause
1168 %type <str> for_locking_clause
1169 %type <str> opt_for_locking_clause
1170 %type <str> for_locking_items
1171 %type <str> for_locking_item
1172 %type <str> for_locking_strength
1173 %type <str> locked_rels_list
1174 %type <str> values_clause
1175 %type <str> from_clause
1176 %type <str> from_list
1177 %type <str> table_ref
1178 %type <str> joined_table
1179 %type <str> alias_clause
1180 %type <str> opt_alias_clause
1181 %type <str> opt_alias_clause_for_join_using
1182 %type <str> func_alias_clause
1183 %type <str> join_type
1184 %type <str> opt_outer
1185 %type <str> join_qual
1186 %type <str> relation_expr
1187 %type <str> relation_expr_list
1188 %type <str> relation_expr_opt_alias
1189 %type <str> tablesample_clause
1190 %type <str> opt_repeatable_clause
1191 %type <str> func_table
1192 %type <str> rowsfrom_item
1193 %type <str> rowsfrom_list
1194 %type <str> opt_col_def_list
1195 %type <str> opt_ordinality
1196 %type <str> where_clause
1197 %type <str> where_or_current_clause
1198 %type <str> OptTableFuncElementList
1199 %type <str> TableFuncElementList
1200 %type <str> TableFuncElement
1201 %type <str> xmltable
1202 %type <str> xmltable_column_list
1203 %type <str> xmltable_column_el
1204 %type <str> xmltable_column_option_list
1205 %type <str> xmltable_column_option_el
1206 %type <str> xml_namespace_list
1207 %type <str> xml_namespace_el
1208 %type <str> Typename
1209 %type <index> opt_array_bounds
1210 %type <str> SimpleTypename
1211 %type <str> ConstTypename
1212 %type <str> GenericType
1213 %type <str> opt_type_modifiers
1214 %type <str> Numeric
1215 %type <str> opt_float
1216 %type <str> Bit
1217 %type <str> ConstBit
1218 %type <str> BitWithLength
1219 %type <str> BitWithoutLength
1220 %type <str> Character
1221 %type <str> ConstCharacter
1222 %type <str> CharacterWithLength
1223 %type <str> CharacterWithoutLength
1224 %type <str> character
1225 %type <str> opt_varying
1226 %type <str> ConstDatetime
1227 %type <str> ConstInterval
1228 %type <str> opt_timezone
1229 %type <str> opt_interval
1230 %type <str> interval_second
1231 %type <str> a_expr
1232 %type <str> b_expr
1233 %type <str> c_expr
1234 %type <str> func_application
1235 %type <str> func_expr
1236 %type <str> func_expr_windowless
1237 %type <str> func_expr_common_subexpr
1238 %type <str> xml_root_version
1239 %type <str> opt_xml_root_standalone
1240 %type <str> xml_attributes
1241 %type <str> xml_attribute_list
1242 %type <str> xml_attribute_el
1243 %type <str> document_or_content
1244 %type <str> xml_whitespace_option
1245 %type <str> xmlexists_argument
1246 %type <str> xml_passing_mech
1247 %type <str> within_group_clause
1248 %type <str> filter_clause
1249 %type <str> window_clause
1250 %type <str> window_definition_list
1251 %type <str> window_definition
1252 %type <str> over_clause
1253 %type <str> window_specification
1254 %type <str> opt_existing_window_name
1255 %type <str> opt_partition_clause
1256 %type <str> opt_frame_clause
1257 %type <str> frame_extent
1258 %type <str> frame_bound
1259 %type <str> opt_window_exclusion_clause
1260 %type <str> row
1261 %type <str> explicit_row
1262 %type <str> implicit_row
1263 %type <str> sub_type
1264 %type <str> all_Op
1265 %type <str> MathOp
1266 %type <str> qual_Op
1267 %type <str> qual_all_Op
1268 %type <str> subquery_Op
1269 %type <str> expr_list
1270 %type <str> func_arg_list
1271 %type <str> func_arg_expr
1272 %type <str> func_arg_list_opt
1273 %type <str> type_list
1274 %type <str> array_expr
1275 %type <str> array_expr_list
1276 %type <str> extract_list
1277 %type <str> extract_arg
1278 %type <str> unicode_normal_form
1279 %type <str> overlay_list
1280 %type <str> position_list
1281 %type <str> substr_list
1282 %type <str> trim_list
1283 %type <str> in_expr
1284 %type <str> case_expr
1285 %type <str> when_clause_list
1286 %type <str> when_clause
1287 %type <str> case_default
1288 %type <str> case_arg
1289 %type <str> columnref
1290 %type <str> indirection_el
1291 %type <str> opt_slice_bound
1292 %type <str> indirection
1293 %type <str> opt_indirection
1294 %type <str> opt_asymmetric
1295 %type <str> opt_target_list
1296 %type <str> target_list
1297 %type <str> target_el
1298 %type <str> qualified_name_list
1299 %type <str> qualified_name
1300 %type <str> name_list
1301 %type <str> name
1302 %type <str> attr_name
1303 %type <str> file_name
1304 %type <str> func_name
1305 %type <str> AexprConst
1306 %type <str> Iconst
1307 %type <str> SignedIconst
1308 %type <str> RoleId
1309 %type <str> RoleSpec
1310 %type <str> role_list
1311 %type <str> NonReservedWord
1312 %type <str> BareColLabel
1313 %type <str> unreserved_keyword
1314 %type <str> col_name_keyword
1315 %type <str> type_func_name_keyword
1316 %type <str> reserved_keyword
1317 %type <str> bare_label_keyword
1318 /* ecpgtype */
1319 /* src/interfaces/ecpg/preproc/ecpg.type */
1320 %type <str> ECPGAllocateDescr
1321 %type <str> ECPGCKeywords
1322 %type <str> ECPGColId
1323 %type <str> ECPGColLabel
1324 %type <str> ECPGColLabelCommon
1325 %type <str> ECPGConnect
1326 %type <str> ECPGCursorStmt
1327 %type <str> ECPGDeallocateDescr
1328 %type <str> ECPGDeclaration
1329 %type <str> ECPGDeclare
1330 %type <str> ECPGDeclareStmt
1331 %type <str> ECPGDisconnect
1332 %type <str> ECPGExecuteImmediateStmt
1333 %type <str> ECPGFree
1334 %type <str> ECPGGetDescHeaderItem
1335 %type <str> ECPGGetDescItem
1336 %type <str> ECPGGetDescriptorHeader
1337 %type <str> ECPGKeywords
1338 %type <str> ECPGKeywords_rest
1339 %type <str> ECPGKeywords_vanames
1340 %type <str> ECPGOpen
1341 %type <str> ECPGSetAutocommit
1342 %type <str> ECPGSetConnection
1343 %type <str> ECPGSetDescHeaderItem
1344 %type <str> ECPGSetDescItem
1345 %type <str> ECPGSetDescriptorHeader
1346 %type <str> ECPGTypeName
1347 %type <str> ECPGTypedef
1348 %type <str> ECPGVar
1349 %type <str> ECPGVarDeclaration
1350 %type <str> ECPGWhenever
1351 %type <str> ECPGunreserved_interval
1352 %type <str> UsingConst
1353 %type <str> UsingValue
1354 %type <str> all_unreserved_keyword
1355 %type <str> c_anything
1356 %type <str> c_args
1357 %type <str> c_list
1358 %type <str> c_stuff
1359 %type <str> c_stuff_item
1360 %type <str> c_term
1361 %type <str> c_thing
1362 %type <str> char_variable
1363 %type <str> char_civar
1364 %type <str> civar
1365 %type <str> civarind
1366 %type <str> ColId
1367 %type <str> ColLabel
1368 %type <str> connect_options
1369 %type <str> connection_object
1370 %type <str> connection_target
1371 %type <str> coutputvariable
1372 %type <str> cvariable
1373 %type <str> db_prefix
1374 %type <str> CreateAsStmt
1375 %type <str> DeallocateStmt
1376 %type <str> dis_name
1377 %type <str> ecpg_bconst
1378 %type <str> ecpg_fconst
1379 %type <str> ecpg_ident
1380 %type <str> ecpg_interval
1381 %type <str> ecpg_into
1382 %type <str> ecpg_fetch_into
1383 %type <str> ecpg_param
1384 %type <str> ecpg_sconst
1385 %type <str> ecpg_using
1386 %type <str> ecpg_xconst
1387 %type <str> enum_definition
1388 %type <str> enum_type
1389 %type <str> execstring
1390 %type <str> execute_rest
1391 %type <str> indicator
1392 %type <str> into_descriptor
1393 %type <str> into_sqlda
1394 %type <str> Iresult
1395 %type <str> on_off
1396 %type <str> opt_bit_field
1397 %type <str> opt_connection_name
1398 %type <str> opt_database_name
1399 %type <str> opt_ecpg_into
1400 %type <str> opt_ecpg_fetch_into
1401 %type <str> opt_ecpg_using
1402 %type <str> opt_initializer
1403 %type <str> opt_options
1404 %type <str> opt_output
1405 %type <str> opt_pointer
1406 %type <str> opt_port
1407 %type <str> opt_reference
1408 %type <str> opt_scale
1409 %type <str> opt_server
1410 %type <str> opt_user
1411 %type <str> opt_opt_value
1412 %type <str> ora_user
1413 %type <str> precision
1414 %type <str> prepared_name
1415 %type <str> quoted_ident_stringvar
1416 %type <str> s_struct_union
1417 %type <str> server
1418 %type <str> server_name
1419 %type <str> single_vt_declaration
1420 %type <str> storage_clause
1421 %type <str> storage_declaration
1422 %type <str> storage_modifier
1423 %type <str> struct_union_type
1424 %type <str> struct_union_type_with_symbol
1425 %type <str> symbol
1426 %type <str> type_declaration
1427 %type <str> type_function_name
1428 %type <str> user_name
1429 %type <str> using_descriptor
1430 %type <str> var_declaration
1431 %type <str> var_type_declarations
1432 %type <str> variable
1433 %type <str> variable_declarations
1434 %type <str> variable_list
1435 %type <str> vt_declarations
1436
1437 %type <str> Op
1438 %type <str> IntConstVar
1439 %type <str> AllConstVar
1440 %type <str> CSTRING
1441 %type <str> CPP_LINE
1442 %type <str> CVARIABLE
1443 %type <str> BCONST
1444 %type <str> SCONST
1445 %type <str> XCONST
1446 %type <str> IDENT
1447
1448 %type <struct_union> s_struct_union_symbol
1449
1450 %type <descriptor> ECPGGetDescriptor
1451 %type <descriptor> ECPGSetDescriptor
1452
1453 %type <type_enum> simple_type
1454 %type <type_enum> signed_type
1455 %type <type_enum> unsigned_type
1456
1457 %type <dtype_enum> descriptor_item
1458 %type <dtype_enum> desc_header_item
1459
1460 %type <type> var_type
1461
1462 %type <action> action
1463
1464 %type <describe> ECPGDescribe
1465 /* orig_tokens */
1466 %token IDENT UIDENT FCONST SCONST USCONST BCONST XCONST Op
1467 %token ICONST PARAM
1468 %token TYPECAST DOT_DOT COLON_EQUALS EQUALS_GREATER
1469 %token LESS_EQUALS GREATER_EQUALS NOT_EQUALS
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479 %token ABORT_P ABSOLUTE_P ACCESS ACTION ADD_P ADMIN AFTER
1480 AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARRAY AS ASC
1481 ASENSITIVE ASSERTION ASSIGNMENT ASYMMETRIC ATOMIC AT ATTACH ATTRIBUTE AUTHORIZATION
1482
1483 BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
1484 BOOLEAN_P BOTH BREADTH BY
1485
1486 CACHE CALL CALLED CASCADE CASCADED CASE CAST CATALOG_P CHAIN CHAR_P
1487 CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE
1488 CLUSTER COALESCE COLLATE COLLATION COLUMN COLUMNS COMMENT COMMENTS COMMIT
1489 COMMITTED COMPRESSION CONCURRENTLY CONFIGURATION CONFLICT
1490 CONNECTION CONSTRAINT CONSTRAINTS CONTENT_P CONTINUE_P CONVERSION_P COPY
1491 COST CREATE CROSS CSV CUBE CURRENT_P
1492 CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA
1493 CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
1494
1495 DATA_P DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
1496 DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS DEPENDS DEPTH DESC
1497 DETACH DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P
1498 DOUBLE_P DROP
1499
1500 EACH ELSE ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ESCAPE EVENT EXCEPT
1501 EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN EXPRESSION
1502 EXTENSION EXTERNAL EXTRACT
1503
1504 FALSE_P FAMILY FETCH FILTER FINALIZE FIRST_P FLOAT_P FOLLOWING FOR
1505 FORCE FOREIGN FORWARD FREEZE FROM FULL FUNCTION FUNCTIONS
1506
1507 GENERATED GLOBAL GRANT GRANTED GREATEST GROUP_P GROUPING GROUPS
1508
1509 HANDLER HAVING HEADER_P HOLD HOUR_P
1510
1511 IDENTITY_P IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IMPORT_P IN_P INCLUDE
1512 INCLUDING INCREMENT INDEX INDEXES INHERIT INHERITS INITIALLY INLINE_P
1513 INNER_P INOUT INPUT_P INSENSITIVE INSERT INSTEAD INT_P INTEGER
1514 INTERSECT INTERVAL INTO INVOKER IS ISNULL ISOLATION
1515
1516 JOIN
1517
1518 KEY
1519
1520 LABEL LANGUAGE LARGE_P LAST_P LATERAL_P
1521 LEADING LEAKPROOF LEAST LEFT LEVEL LIKE LIMIT LISTEN LOAD LOCAL
1522 LOCALTIME LOCALTIMESTAMP LOCATION LOCK_P LOCKED LOGGED
1523
1524 MAPPING MATCH MATERIALIZED MAXVALUE METHOD MINUTE_P MINVALUE MODE MONTH_P MOVE
1525
1526 NAME_P NAMES NATIONAL NATURAL NCHAR NEW NEXT NFC NFD NFKC NFKD NO NONE
1527 NORMALIZE NORMALIZED
1528 NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
1529 NULLS_P NUMERIC
1530
1531 OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OPTIONS OR
1532 ORDER ORDINALITY OTHERS OUT_P OUTER_P
1533 OVER OVERLAPS OVERLAY OVERRIDING OWNED OWNER
1534
1535 PARALLEL PARSER PARTIAL PARTITION PASSING PASSWORD PLACING PLANS POLICY
1536 POSITION PRECEDING PRECISION PRESERVE PREPARE PREPARED PRIMARY
1537 PRIOR PRIVILEGES PROCEDURAL PROCEDURE PROCEDURES PROGRAM PUBLICATION
1538
1539 QUOTE
1540
1541 RANGE READ REAL REASSIGN RECHECK RECURSIVE REF REFERENCES REFERENCING
1542 REFRESH REINDEX RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA
1543 RESET RESTART RESTRICT RETURN RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
1544 ROUTINE ROUTINES ROW ROWS RULE
1545
1546 SAVEPOINT SCHEMA SCHEMAS SCROLL SEARCH SECOND_P SECURITY SELECT SEQUENCE SEQUENCES
1547 SERIALIZABLE SERVER SESSION SESSION_USER SET SETS SETOF SHARE SHOW
1548 SIMILAR SIMPLE SKIP SMALLINT SNAPSHOT SOME SQL_P STABLE STANDALONE_P
1549 START STATEMENT STATISTICS STDIN STDOUT STORAGE STORED STRICT_P STRIP_P
1550 SUBSCRIPTION SUBSTRING SUPPORT SYMMETRIC SYSID SYSTEM_P
1551
1552 TABLE TABLES TABLESAMPLE TABLESPACE TEMP TEMPLATE TEMPORARY TEXT_P THEN
1553 TIES TIME TIMESTAMP TO TRAILING TRANSACTION TRANSFORM
1554 TREAT TRIGGER TRIM TRUE_P
1555 TRUNCATE TRUSTED TYPE_P TYPES_P
1556
1557 UESCAPE UNBOUNDED UNCOMMITTED UNENCRYPTED UNION UNIQUE UNKNOWN
1558 UNLISTEN UNLOGGED UNTIL UPDATE USER USING
1559
1560 VACUUM VALID VALIDATE VALIDATOR VALUE_P VALUES VARCHAR VARIADIC VARYING
1561 VERBOSE VERSION_P VIEW VIEWS VOLATILE
1562
1563 WHEN WHERE WHITESPACE_P WINDOW WITH WITHIN WITHOUT WORK WRAPPER WRITE
1564
1565 XML_P XMLATTRIBUTES XMLCONCAT XMLELEMENT XMLEXISTS XMLFOREST XMLNAMESPACES
1566 XMLPARSE XMLPI XMLROOT XMLSERIALIZE XMLTABLE
1567
1568 YEAR_P YES_P
1569
1570 ZONE
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582 %token NOT_LA NULLS_LA WITH_LA
1583
1584
1585
1586
1587
1588
1589
1590
1591 %token MODE_TYPE_NAME
1592 %token MODE_PLPGSQL_EXPR
1593 %token MODE_PLPGSQL_ASSIGN1
1594 %token MODE_PLPGSQL_ASSIGN2
1595 %token MODE_PLPGSQL_ASSIGN3
1596
1597
1598
1599 %nonassoc SET
1600 %left UNION EXCEPT
1601 %left INTERSECT
1602 %left OR
1603 %left AND
1604 %right NOT
1605 %nonassoc IS ISNULL NOTNULL
1606 %nonassoc '<' '>' '=' LESS_EQUALS GREATER_EQUALS NOT_EQUALS
1607 %nonassoc BETWEEN IN_P LIKE ILIKE SIMILAR NOT_LA
1608 %nonassoc ESCAPE
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634 %nonassoc UNBOUNDED
1635 %nonassoc IDENT
1636 %nonassoc CSTRING PARTITION RANGE ROWS GROUPS PRECEDING FOLLOWING CUBE ROLLUP
1637 %left Op OPERATOR
1638 %left '+' '-'
1639 %left '*' '/' '%'
1640 %left '^'
1641
1642 %left AT
1643 %left COLLATE
1644 %right UMINUS
1645 %left '[' ']'
1646 %left '(' ')'
1647 %left TYPECAST
1648 %left '.'
1649
1650
1651
1652
1653
1654
1655
1656 %left JOIN CROSS LEFT FULL RIGHT INNER_P NATURAL
1657
1658 %%
1659 prog: statements;
1660 /* rules */
1661 toplevel_stmt:
1662 stmt
1663 {
1664 $$ = $1;
1665 }
1666 | TransactionStmtLegacy
1667 {
1668 fprintf(base_yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
1669 whenever_action(2);
1670 free($1);
1671 }
1672 ;
1673
1674
1675 stmt:
1676 AlterEventTrigStmt
1677 { output_statement($1, 0, ECPGst_normal); }
1678 | AlterCollationStmt
1679 { output_statement($1, 0, ECPGst_normal); }
1680 | AlterDatabaseStmt
1681 { output_statement($1, 0, ECPGst_normal); }
1682 | AlterDatabaseSetStmt
1683 { output_statement($1, 0, ECPGst_normal); }
1684 | AlterDefaultPrivilegesStmt
1685 { output_statement($1, 0, ECPGst_normal); }
1686 | AlterDomainStmt
1687 { output_statement($1, 0, ECPGst_normal); }
1688 | AlterEnumStmt
1689 { output_statement($1, 0, ECPGst_normal); }
1690 | AlterExtensionStmt
1691 { output_statement($1, 0, ECPGst_normal); }
1692 | AlterExtensionContentsStmt
1693 { output_statement($1, 0, ECPGst_normal); }
1694 | AlterFdwStmt
1695 { output_statement($1, 0, ECPGst_normal); }
1696 | AlterForeignServerStmt
1697 { output_statement($1, 0, ECPGst_normal); }
1698 | AlterFunctionStmt
1699 { output_statement($1, 0, ECPGst_normal); }
1700 | AlterGroupStmt
1701 { output_statement($1, 0, ECPGst_normal); }
1702 | AlterObjectDependsStmt
1703 { output_statement($1, 0, ECPGst_normal); }
1704 | AlterObjectSchemaStmt
1705 { output_statement($1, 0, ECPGst_normal); }
1706 | AlterOwnerStmt
1707 { output_statement($1, 0, ECPGst_normal); }
1708 | AlterOperatorStmt
1709 { output_statement($1, 0, ECPGst_normal); }
1710 | AlterTypeStmt
1711 { output_statement($1, 0, ECPGst_normal); }
1712 | AlterPolicyStmt
1713 { output_statement($1, 0, ECPGst_normal); }
1714 | AlterSeqStmt
1715 { output_statement($1, 0, ECPGst_normal); }
1716 | AlterSystemStmt
1717 { output_statement($1, 0, ECPGst_normal); }
1718 | AlterTableStmt
1719 { output_statement($1, 0, ECPGst_normal); }
1720 | AlterTblSpcStmt
1721 { output_statement($1, 0, ECPGst_normal); }
1722 | AlterCompositeTypeStmt
1723 { output_statement($1, 0, ECPGst_normal); }
1724 | AlterPublicationStmt
1725 { output_statement($1, 0, ECPGst_normal); }
1726 | AlterRoleSetStmt
1727 { output_statement($1, 0, ECPGst_normal); }
1728 | AlterRoleStmt
1729 { output_statement($1, 0, ECPGst_normal); }
1730 | AlterSubscriptionStmt
1731 { output_statement($1, 0, ECPGst_normal); }
1732 | AlterStatsStmt
1733 { output_statement($1, 0, ECPGst_normal); }
1734 | AlterTSConfigurationStmt
1735 { output_statement($1, 0, ECPGst_normal); }
1736 | AlterTSDictionaryStmt
1737 { output_statement($1, 0, ECPGst_normal); }
1738 | AlterUserMappingStmt
1739 { output_statement($1, 0, ECPGst_normal); }
1740 | AnalyzeStmt
1741 { output_statement($1, 0, ECPGst_normal); }
1742 | CallStmt
1743 { output_statement($1, 0, ECPGst_normal); }
1744 | CheckPointStmt
1745 { output_statement($1, 0, ECPGst_normal); }
1746 | ClosePortalStmt
1747 {
1748 if (INFORMIX_MODE)
1749 {
1750 if (pg_strcasecmp($1+strlen("close "), "database") == 0)
1751 {
1752 if (connection)
1753 mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CLOSE DATABASE statement");
1754
1755 fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, \"CURRENT\");");
1756 whenever_action(2);
1757 free($1);
1758 break;
1759 }
1760 }
1761
1762 output_statement($1, 0, ECPGst_normal);
1763 }
1764 | ClusterStmt
1765 { output_statement($1, 0, ECPGst_normal); }
1766 | CommentStmt
1767 { output_statement($1, 0, ECPGst_normal); }
1768 | ConstraintsSetStmt
1769 { output_statement($1, 0, ECPGst_normal); }
1770 | CopyStmt
1771 { output_statement($1, 0, ECPGst_normal); }
1772 | CreateAmStmt
1773 { output_statement($1, 0, ECPGst_normal); }
1774 | CreateAsStmt
1775 { output_statement($1, 0, ECPGst_normal); }
1776 | CreateAssertionStmt
1777 { output_statement($1, 0, ECPGst_normal); }
1778 | CreateCastStmt
1779 { output_statement($1, 0, ECPGst_normal); }
1780 | CreateConversionStmt
1781 { output_statement($1, 0, ECPGst_normal); }
1782 | CreateDomainStmt
1783 { output_statement($1, 0, ECPGst_normal); }
1784 | CreateExtensionStmt
1785 { output_statement($1, 0, ECPGst_normal); }
1786 | CreateFdwStmt
1787 { output_statement($1, 0, ECPGst_normal); }
1788 | CreateForeignServerStmt
1789 { output_statement($1, 0, ECPGst_normal); }
1790 | CreateForeignTableStmt
1791 { output_statement($1, 0, ECPGst_normal); }
1792 | CreateFunctionStmt
1793 { output_statement($1, 0, ECPGst_normal); }
1794 | CreateGroupStmt
1795 { output_statement($1, 0, ECPGst_normal); }
1796 | CreateMatViewStmt
1797 { output_statement($1, 0, ECPGst_normal); }
1798 | CreateOpClassStmt
1799 { output_statement($1, 0, ECPGst_normal); }
1800 | CreateOpFamilyStmt
1801 { output_statement($1, 0, ECPGst_normal); }
1802 | CreatePublicationStmt
1803 { output_statement($1, 0, ECPGst_normal); }
1804 | AlterOpFamilyStmt
1805 { output_statement($1, 0, ECPGst_normal); }
1806 | CreatePolicyStmt
1807 { output_statement($1, 0, ECPGst_normal); }
1808 | CreatePLangStmt
1809 { output_statement($1, 0, ECPGst_normal); }
1810 | CreateSchemaStmt
1811 { output_statement($1, 0, ECPGst_normal); }
1812 | CreateSeqStmt
1813 { output_statement($1, 0, ECPGst_normal); }
1814 | CreateStmt
1815 { output_statement($1, 0, ECPGst_normal); }
1816 | CreateSubscriptionStmt
1817 { output_statement($1, 0, ECPGst_normal); }
1818 | CreateStatsStmt
1819 { output_statement($1, 0, ECPGst_normal); }
1820 | CreateTableSpaceStmt
1821 { output_statement($1, 0, ECPGst_normal); }
1822 | CreateTransformStmt
1823 { output_statement($1, 0, ECPGst_normal); }
1824 | CreateTrigStmt
1825 { output_statement($1, 0, ECPGst_normal); }
1826 | CreateEventTrigStmt
1827 { output_statement($1, 0, ECPGst_normal); }
1828 | CreateRoleStmt
1829 { output_statement($1, 0, ECPGst_normal); }
1830 | CreateUserStmt
1831 { output_statement($1, 0, ECPGst_normal); }
1832 | CreateUserMappingStmt
1833 { output_statement($1, 0, ECPGst_normal); }
1834 | CreatedbStmt
1835 { output_statement($1, 0, ECPGst_normal); }
1836 | DeallocateStmt
1837 {
1838 output_deallocate_prepare_statement($1);
1839 }
1840 | DeclareCursorStmt
1841 { output_simple_statement($1, (strncmp($1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0); }
1842 | DefineStmt
1843 { output_statement($1, 0, ECPGst_normal); }
1844 | DeleteStmt
1845 { output_statement($1, 1, ECPGst_prepnormal); }
1846 | DiscardStmt
1847 { output_statement($1, 1, ECPGst_normal); }
1848 | DoStmt
1849 { output_statement($1, 0, ECPGst_normal); }
1850 | DropCastStmt
1851 { output_statement($1, 0, ECPGst_normal); }
1852 | DropOpClassStmt
1853 { output_statement($1, 0, ECPGst_normal); }
1854 | DropOpFamilyStmt
1855 { output_statement($1, 0, ECPGst_normal); }
1856 | DropOwnedStmt
1857 { output_statement($1, 0, ECPGst_normal); }
1858 | DropStmt
1859 { output_statement($1, 0, ECPGst_normal); }
1860 | DropSubscriptionStmt
1861 { output_statement($1, 0, ECPGst_normal); }
1862 | DropTableSpaceStmt
1863 { output_statement($1, 0, ECPGst_normal); }
1864 | DropTransformStmt
1865 { output_statement($1, 0, ECPGst_normal); }
1866 | DropRoleStmt
1867 { output_statement($1, 0, ECPGst_normal); }
1868 | DropUserMappingStmt
1869 { output_statement($1, 0, ECPGst_normal); }
1870 | DropdbStmt
1871 { output_statement($1, 0, ECPGst_normal); }
1872 | ExecuteStmt
1873 {
1874 check_declared_list($1.name);
1875 if ($1.type == NULL || strlen($1.type) == 0)
1876 output_statement($1.name, 1, ECPGst_execute);
1877 else
1878 {
1879 if ($1.name[0] != '"')
1880 /* case of char_variable */
1881 add_variable_to_tail(&argsinsert, find_variable($1.name), &no_indicator);
1882 else
1883 {
1884 /* case of ecpg_ident or CSTRING */
1885 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
1886 char *str = mm_strdup($1.name + 1);
1887
1888 /* It must be cut off double quotation because new_variable() double-quotes. */
1889 str[strlen(str) - 1] = '\0';
1890 sprintf(length, "%zu", strlen(str));
1891 add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
1892 }
1893 output_statement(cat_str(3, mm_strdup("execute"), mm_strdup("$0"), $1.type), 0, ECPGst_exec_with_exprlist);
1894 }
1895 }
1896 | ExplainStmt
1897 { output_statement($1, 0, ECPGst_normal); }
1898 | FetchStmt
1899 { output_statement($1, 1, ECPGst_normal); }
1900 | GrantStmt
1901 { output_statement($1, 0, ECPGst_normal); }
1902 | GrantRoleStmt
1903 { output_statement($1, 0, ECPGst_normal); }
1904 | ImportForeignSchemaStmt
1905 { output_statement($1, 0, ECPGst_normal); }
1906 | IndexStmt
1907 { output_statement($1, 0, ECPGst_normal); }
1908 | InsertStmt
1909 { output_statement($1, 1, ECPGst_prepnormal); }
1910 | ListenStmt
1911 { output_statement($1, 0, ECPGst_normal); }
1912 | RefreshMatViewStmt
1913 { output_statement($1, 0, ECPGst_normal); }
1914 | LoadStmt
1915 { output_statement($1, 0, ECPGst_normal); }
1916 | LockStmt
1917 { output_statement($1, 0, ECPGst_normal); }
1918 | NotifyStmt
1919 { output_statement($1, 0, ECPGst_normal); }
1920 | PrepareStmt
1921 {
1922 check_declared_list($1.name);
1923 if ($1.type == NULL)
1924 output_prepare_statement($1.name, $1.stmt);
1925 else if (strlen($1.type) == 0)
1926 {
1927 char *stmt = cat_str(3, mm_strdup("\""), $1.stmt, mm_strdup("\""));
1928 output_prepare_statement($1.name, stmt);
1929 }
1930 else
1931 {
1932 if ($1.name[0] != '"')
1933 /* case of char_variable */
1934 add_variable_to_tail(&argsinsert, find_variable($1.name), &no_indicator);
1935 else
1936 {
1937 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
1938 char *str = mm_strdup($1.name + 1);
1939
1940 /* It must be cut off double quotation because new_variable() double-quotes. */
1941 str[strlen(str) - 1] = '\0';
1942 sprintf(length, "%zu", strlen(str));
1943 add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
1944 }
1945 output_statement(cat_str(5, mm_strdup("prepare"), mm_strdup("$0"), $1.type, mm_strdup("as"), $1.stmt), 0, ECPGst_prepare);
1946 }
1947 }
1948 | ReassignOwnedStmt
1949 { output_statement($1, 0, ECPGst_normal); }
1950 | ReindexStmt
1951 { output_statement($1, 0, ECPGst_normal); }
1952 | RemoveAggrStmt
1953 { output_statement($1, 0, ECPGst_normal); }
1954 | RemoveFuncStmt
1955 { output_statement($1, 0, ECPGst_normal); }
1956 | RemoveOperStmt
1957 { output_statement($1, 0, ECPGst_normal); }
1958 | RenameStmt
1959 { output_statement($1, 0, ECPGst_normal); }
1960 | RevokeStmt
1961 { output_statement($1, 0, ECPGst_normal); }
1962 | RevokeRoleStmt
1963 { output_statement($1, 0, ECPGst_normal); }
1964 | RuleStmt
1965 { output_statement($1, 0, ECPGst_normal); }
1966 | SecLabelStmt
1967 { output_statement($1, 0, ECPGst_normal); }
1968 | SelectStmt
1969 { output_statement($1, 1, ECPGst_prepnormal); }
1970 | TransactionStmt
1971 {
1972 fprintf(base_yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
1973 whenever_action(2);
1974 free($1);
1975 }
1976 | TruncateStmt
1977 { output_statement($1, 0, ECPGst_normal); }
1978 | UnlistenStmt
1979 { output_statement($1, 0, ECPGst_normal); }
1980 | UpdateStmt
1981 { output_statement($1, 1, ECPGst_prepnormal); }
1982 | VacuumStmt
1983 { output_statement($1, 0, ECPGst_normal); }
1984 | VariableResetStmt
1985 { output_statement($1, 0, ECPGst_normal); }
1986 | VariableSetStmt
1987 { output_statement($1, 0, ECPGst_normal); }
1988 | VariableShowStmt
1989 { output_statement($1, 0, ECPGst_normal); }
1990 | ViewStmt
1991 { output_statement($1, 0, ECPGst_normal); }
1992 | ECPGAllocateDescr
1993 {
1994 fprintf(base_yyout,"ECPGallocate_desc(__LINE__, %s);",$1);
1995 whenever_action(0);
1996 free($1);
1997 }
1998 | ECPGConnect
1999 {
2000 if (connection)
2001 mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CONNECT statement");
2002
2003 fprintf(base_yyout, "{ ECPGconnect(__LINE__, %d, %s, %d); ", compat, $1, autocommit);
2004 reset_variables();
2005 whenever_action(2);
2006 free($1);
2007 }
2008 | ECPGDeclareStmt
2009 {
2010 output_simple_statement($1, 0);
2011 }
2012 | ECPGCursorStmt
2013 {
2014 output_simple_statement($1, (strncmp($1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0);
2015 }
2016 | ECPGDeallocateDescr
2017 {
2018 fprintf(base_yyout,"ECPGdeallocate_desc(__LINE__, %s);",$1);
2019 whenever_action(0);
2020 free($1);
2021 }
2022 | ECPGDeclare
2023 {
2024 output_simple_statement($1, 0);
2025 }
2026 | ECPGDescribe
2027 {
2028 check_declared_list($1.stmt_name);
2029
2030 fprintf(base_yyout, "{ ECPGdescribe(__LINE__, %d, %d, %s, %s,", compat, $1.input, connection ? connection : "NULL", $1.stmt_name);
2031 dump_variables(argsresult, 1);
2032 fputs("ECPGt_EORT);", base_yyout);
2033 fprintf(base_yyout, "}");
2034 output_line_number();
2035
2036 free($1.stmt_name);
2037 }
2038 | ECPGDisconnect
2039 {
2040 if (connection)
2041 mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DISCONNECT statement");
2042
2043 fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, %s);",
2044 $1 ? $1 : "\"CURRENT\"");
2045 whenever_action(2);
2046 free($1);
2047 }
2048 | ECPGExecuteImmediateStmt { output_statement($1, 0, ECPGst_exec_immediate); }
2049 | ECPGFree
2050 {
2051 const char *con = connection ? connection : "NULL";
2052
2053 if (strcmp($1, "all") == 0)
2054 fprintf(base_yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con);
2055 else if ($1[0] == ':')
2056 fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, %s);", compat, con, $1+1);
2057 else
2058 fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, \"%s\");", compat, con, $1);
2059
2060 whenever_action(2);
2061 free($1);
2062 }
2063 | ECPGGetDescriptor
2064 {
2065 lookup_descriptor($1.name, connection);
2066 output_get_descr($1.name, $1.str);
2067 free($1.name);
2068 free($1.str);
2069 }
2070 | ECPGGetDescriptorHeader
2071 {
2072 lookup_descriptor($1, connection);
2073 output_get_descr_header($1);
2074 free($1);
2075 }
2076 | ECPGOpen
2077 {
2078 struct cursor *ptr;
2079
2080 if ((ptr = add_additional_variables($1, true)) != NULL)
2081 {
2082 connection = ptr->connection ? mm_strdup(ptr->connection) : NULL;
2083 output_statement(mm_strdup(ptr->command), 0, ECPGst_normal);
2084 ptr->opened = true;
2085 }
2086 }
2087 | ECPGSetAutocommit
2088 {
2089 fprintf(base_yyout, "{ ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL");
2090 whenever_action(2);
2091 free($1);
2092 }
2093 | ECPGSetConnection
2094 {
2095 if (connection)
2096 mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in SET CONNECTION statement");
2097
2098 fprintf(base_yyout, "{ ECPGsetconn(__LINE__, %s);", $1);
2099 whenever_action(2);
2100 free($1);
2101 }
2102 | ECPGSetDescriptor
2103 {
2104 lookup_descriptor($1.name, connection);
2105 output_set_descr($1.name, $1.str);
2106 free($1.name);
2107 free($1.str);
2108 }
2109 | ECPGSetDescriptorHeader
2110 {
2111 lookup_descriptor($1, connection);
2112 output_set_descr_header($1);
2113 free($1);
2114 }
2115 | ECPGTypedef
2116 {
2117 if (connection)
2118 mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in TYPE statement");
2119
2120 fprintf(base_yyout, "%s", $1);
2121 free($1);
2122 output_line_number();
2123 }
2124 | ECPGVar
2125 {
2126 if (connection)
2127 mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in VAR statement");
2128
2129 output_simple_statement($1, 0);
2130 }
2131 | ECPGWhenever
2132 {
2133 if (connection)
2134 mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in WHENEVER statement");
2135
2136 output_simple_statement($1, 0);
2137 }
2138 |
2139 { $$ = NULL; }
2140 ;
2141
2142
2143 CallStmt:
2144 CALL func_application
2145 {
2146 $$ = cat_str(2,mm_strdup("call"),$2);
2147 }
2148 ;
2149
2150
2151 CreateRoleStmt:
2152 CREATE ROLE RoleId opt_with OptRoleList
2153 {
2154 $$ = cat_str(4,mm_strdup("create role"),$3,$4,$5);
2155 }
2156 ;
2157
2158
2159 opt_with:
2160 WITH
2161 {
2162 $$ = mm_strdup("with");
2163 }
2164 | WITH_LA
2165 {
2166 $$ = mm_strdup("with");
2167 }
2168 |
2169 {
2170 $$=EMPTY; }
2171 ;
2172
2173
2174 OptRoleList:
2175 OptRoleList CreateOptRoleElem
2176 {
2177 $$ = cat_str(2,$1,$2);
2178 }
2179 |
2180 {
2181 $$=EMPTY; }
2182 ;
2183
2184
2185 AlterOptRoleList:
2186 AlterOptRoleList AlterOptRoleElem
2187 {
2188 $$ = cat_str(2,$1,$2);
2189 }
2190 |
2191 {
2192 $$=EMPTY; }
2193 ;
2194
2195
2196 AlterOptRoleElem:
2197 PASSWORD ecpg_sconst
2198 {
2199 $$ = cat_str(2,mm_strdup("password"),$2);
2200 }
2201 | PASSWORD NULL_P
2202 {
2203 $$ = mm_strdup("password null");
2204 }
2205 | ENCRYPTED PASSWORD ecpg_sconst
2206 {
2207 $$ = cat_str(2,mm_strdup("encrypted password"),$3);
2208 }
2209 | UNENCRYPTED PASSWORD ecpg_sconst
2210 {
2211 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
2212 $$ = cat_str(2,mm_strdup("unencrypted password"),$3);
2213 }
2214 | INHERIT
2215 {
2216 $$ = mm_strdup("inherit");
2217 }
2218 | CONNECTION LIMIT SignedIconst
2219 {
2220 $$ = cat_str(2,mm_strdup("connection limit"),$3);
2221 }
2222 | VALID UNTIL ecpg_sconst
2223 {
2224 $$ = cat_str(2,mm_strdup("valid until"),$3);
2225 }
2226 | USER role_list
2227 {
2228 $$ = cat_str(2,mm_strdup("user"),$2);
2229 }
2230 | ecpg_ident
2231 {
2232 $$ = $1;
2233 }
2234 ;
2235
2236
2237 CreateOptRoleElem:
2238 AlterOptRoleElem
2239 {
2240 $$ = $1;
2241 }
2242 | SYSID Iconst
2243 {
2244 $$ = cat_str(2,mm_strdup("sysid"),$2);
2245 }
2246 | ADMIN role_list
2247 {
2248 $$ = cat_str(2,mm_strdup("admin"),$2);
2249 }
2250 | ROLE role_list
2251 {
2252 $$ = cat_str(2,mm_strdup("role"),$2);
2253 }
2254 | IN_P ROLE role_list
2255 {
2256 $$ = cat_str(2,mm_strdup("in role"),$3);
2257 }
2258 | IN_P GROUP_P role_list
2259 {
2260 $$ = cat_str(2,mm_strdup("in group"),$3);
2261 }
2262 ;
2263
2264
2265 CreateUserStmt:
2266 CREATE USER RoleId opt_with OptRoleList
2267 {
2268 $$ = cat_str(4,mm_strdup("create user"),$3,$4,$5);
2269 }
2270 ;
2271
2272
2273 AlterRoleStmt:
2274 ALTER ROLE RoleSpec opt_with AlterOptRoleList
2275 {
2276 $$ = cat_str(4,mm_strdup("alter role"),$3,$4,$5);
2277 }
2278 | ALTER USER RoleSpec opt_with AlterOptRoleList
2279 {
2280 $$ = cat_str(4,mm_strdup("alter user"),$3,$4,$5);
2281 }
2282 ;
2283
2284
2285 opt_in_database:
2286
2287 {
2288 $$=EMPTY; }
2289 | IN_P DATABASE name
2290 {
2291 $$ = cat_str(2,mm_strdup("in database"),$3);
2292 }
2293 ;
2294
2295
2296 AlterRoleSetStmt:
2297 ALTER ROLE RoleSpec opt_in_database SetResetClause
2298 {
2299 $$ = cat_str(4,mm_strdup("alter role"),$3,$4,$5);
2300 }
2301 | ALTER ROLE ALL opt_in_database SetResetClause
2302 {
2303 $$ = cat_str(3,mm_strdup("alter role all"),$4,$5);
2304 }
2305 | ALTER USER RoleSpec opt_in_database SetResetClause
2306 {
2307 $$ = cat_str(4,mm_strdup("alter user"),$3,$4,$5);
2308 }
2309 | ALTER USER ALL opt_in_database SetResetClause
2310 {
2311 $$ = cat_str(3,mm_strdup("alter user all"),$4,$5);
2312 }
2313 ;
2314
2315
2316 DropRoleStmt:
2317 DROP ROLE role_list
2318 {
2319 $$ = cat_str(2,mm_strdup("drop role"),$3);
2320 }
2321 | DROP ROLE IF_P EXISTS role_list
2322 {
2323 $$ = cat_str(2,mm_strdup("drop role if exists"),$5);
2324 }
2325 | DROP USER role_list
2326 {
2327 $$ = cat_str(2,mm_strdup("drop user"),$3);
2328 }
2329 | DROP USER IF_P EXISTS role_list
2330 {
2331 $$ = cat_str(2,mm_strdup("drop user if exists"),$5);
2332 }
2333 | DROP GROUP_P role_list
2334 {
2335 $$ = cat_str(2,mm_strdup("drop group"),$3);
2336 }
2337 | DROP GROUP_P IF_P EXISTS role_list
2338 {
2339 $$ = cat_str(2,mm_strdup("drop group if exists"),$5);
2340 }
2341 ;
2342
2343
2344 CreateGroupStmt:
2345 CREATE GROUP_P RoleId opt_with OptRoleList
2346 {
2347 $$ = cat_str(4,mm_strdup("create group"),$3,$4,$5);
2348 }
2349 ;
2350
2351
2352 AlterGroupStmt:
2353 ALTER GROUP_P RoleSpec add_drop USER role_list
2354 {
2355 $$ = cat_str(5,mm_strdup("alter group"),$3,$4,mm_strdup("user"),$6);
2356 }
2357 ;
2358
2359
2360 add_drop:
2361 ADD_P
2362 {
2363 $$ = mm_strdup("add");
2364 }
2365 | DROP
2366 {
2367 $$ = mm_strdup("drop");
2368 }
2369 ;
2370
2371
2372 CreateSchemaStmt:
2373 CREATE SCHEMA OptSchemaName AUTHORIZATION RoleSpec OptSchemaEltList
2374 {
2375 $$ = cat_str(5,mm_strdup("create schema"),$3,mm_strdup("authorization"),$5,$6);
2376 }
2377 | CREATE SCHEMA ColId OptSchemaEltList
2378 {
2379 $$ = cat_str(3,mm_strdup("create schema"),$3,$4);
2380 }
2381 | CREATE SCHEMA IF_P NOT EXISTS OptSchemaName AUTHORIZATION RoleSpec OptSchemaEltList
2382 {
2383 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
2384 $$ = cat_str(5,mm_strdup("create schema if not exists"),$6,mm_strdup("authorization"),$8,$9);
2385 }
2386 | CREATE SCHEMA IF_P NOT EXISTS ColId OptSchemaEltList
2387 {
2388 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
2389 $$ = cat_str(3,mm_strdup("create schema if not exists"),$6,$7);
2390 }
2391 ;
2392
2393
2394 OptSchemaName:
2395 ColId
2396 {
2397 $$ = $1;
2398 }
2399 |
2400 {
2401 $$=EMPTY; }
2402 ;
2403
2404
2405 OptSchemaEltList:
2406 OptSchemaEltList schema_stmt
2407 {
2408 $$ = cat_str(2,$1,$2);
2409 }
2410 |
2411 {
2412 $$=EMPTY; }
2413 ;
2414
2415
2416 schema_stmt:
2417 CreateStmt
2418 {
2419 $$ = $1;
2420 }
2421 | IndexStmt
2422 {
2423 $$ = $1;
2424 }
2425 | CreateSeqStmt
2426 {
2427 $$ = $1;
2428 }
2429 | CreateTrigStmt
2430 {
2431 $$ = $1;
2432 }
2433 | GrantStmt
2434 {
2435 $$ = $1;
2436 }
2437 | ViewStmt
2438 {
2439 $$ = $1;
2440 }
2441 ;
2442
2443
2444 VariableSetStmt:
2445 SET set_rest
2446 {
2447 $$ = cat_str(2,mm_strdup("set"),$2);
2448 }
2449 | SET LOCAL set_rest
2450 {
2451 $$ = cat_str(2,mm_strdup("set local"),$3);
2452 }
2453 | SET SESSION set_rest
2454 {
2455 $$ = cat_str(2,mm_strdup("set session"),$3);
2456 }
2457 ;
2458
2459
2460 set_rest:
2461 TRANSACTION transaction_mode_list
2462 {
2463 $$ = cat_str(2,mm_strdup("transaction"),$2);
2464 }
2465 | SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
2466 {
2467 $$ = cat_str(2,mm_strdup("session characteristics as transaction"),$5);
2468 }
2469 | set_rest_more
2470 {
2471 $$ = $1;
2472 }
2473 ;
2474
2475
2476 generic_set:
2477 var_name TO var_list
2478 {
2479 $$ = cat_str(3,$1,mm_strdup("to"),$3);
2480 }
2481 | var_name '=' var_list
2482 {
2483 $$ = cat_str(3,$1,mm_strdup("="),$3);
2484 }
2485 | var_name TO DEFAULT
2486 {
2487 $$ = cat_str(2,$1,mm_strdup("to default"));
2488 }
2489 | var_name '=' DEFAULT
2490 {
2491 $$ = cat_str(2,$1,mm_strdup("= default"));
2492 }
2493 ;
2494
2495
2496 set_rest_more:
2497 generic_set
2498 {
2499 $$ = $1;
2500 }
2501 | var_name FROM CURRENT_P
2502 {
2503 $$ = cat_str(2,$1,mm_strdup("from current"));
2504 }
2505 | TIME ZONE zone_value
2506 {
2507 $$ = cat_str(2,mm_strdup("time zone"),$3);
2508 }
2509 | CATALOG_P ecpg_sconst
2510 {
2511 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
2512 $$ = cat_str(2,mm_strdup("catalog"),$2);
2513 }
2514 | SCHEMA ecpg_sconst
2515 {
2516 $$ = cat_str(2,mm_strdup("schema"),$2);
2517 }
2518 | NAMES opt_encoding
2519 {
2520 $$ = cat_str(2,mm_strdup("names"),$2);
2521 }
2522 | ROLE NonReservedWord_or_Sconst
2523 {
2524 $$ = cat_str(2,mm_strdup("role"),$2);
2525 }
2526 | SESSION AUTHORIZATION NonReservedWord_or_Sconst
2527 {
2528 $$ = cat_str(2,mm_strdup("session authorization"),$3);
2529 }
2530 | SESSION AUTHORIZATION DEFAULT
2531 {
2532 $$ = mm_strdup("session authorization default");
2533 }
2534 | XML_P OPTION document_or_content
2535 {
2536 $$ = cat_str(2,mm_strdup("xml option"),$3);
2537 }
2538 | TRANSACTION SNAPSHOT ecpg_sconst
2539 {
2540 $$ = cat_str(2,mm_strdup("transaction snapshot"),$3);
2541 }
2542 ;
2543
2544
2545 var_name:
2546 ECPGColId
2547 {
2548 $$ = $1;
2549 }
2550 | var_name '.' ColId
2551 {
2552 $$ = cat_str(3,$1,mm_strdup("."),$3);
2553 }
2554 ;
2555
2556
2557 var_list:
2558 var_value
2559 {
2560 $$ = $1;
2561 }
2562 | var_list ',' var_value
2563 {
2564 $$ = cat_str(3,$1,mm_strdup(","),$3);
2565 }
2566 ;
2567
2568
2569 var_value:
2570 opt_boolean_or_string
2571 {
2572 $$ = $1;
2573 }
2574 | NumericOnly
2575 {
2576 if ($1[0] == '$')
2577 {
2578 free($1);
2579 $1 = mm_strdup("$0");
2580 }
2581
2582 $$ = $1;
2583 }
2584 ;
2585
2586
2587 iso_level:
2588 READ UNCOMMITTED
2589 {
2590 $$ = mm_strdup("read uncommitted");
2591 }
2592 | READ COMMITTED
2593 {
2594 $$ = mm_strdup("read committed");
2595 }
2596 | REPEATABLE READ
2597 {
2598 $$ = mm_strdup("repeatable read");
2599 }
2600 | SERIALIZABLE
2601 {
2602 $$ = mm_strdup("serializable");
2603 }
2604 ;
2605
2606
2607 opt_boolean_or_string:
2608 TRUE_P
2609 {
2610 $$ = mm_strdup("true");
2611 }
2612 | FALSE_P
2613 {
2614 $$ = mm_strdup("false");
2615 }
2616 | ON
2617 {
2618 $$ = mm_strdup("on");
2619 }
2620 | NonReservedWord_or_Sconst
2621 {
2622 $$ = $1;
2623 }
2624 ;
2625
2626
2627 zone_value:
2628 ecpg_sconst
2629 {
2630 $$ = $1;
2631 }
2632 | ecpg_ident
2633 {
2634 $$ = $1;
2635 }
2636 | ConstInterval ecpg_sconst opt_interval
2637 {
2638 $$ = cat_str(3,$1,$2,$3);
2639 }
2640 | ConstInterval '(' Iconst ')' ecpg_sconst
2641 {
2642 $$ = cat_str(5,$1,mm_strdup("("),$3,mm_strdup(")"),$5);
2643 }
2644 | NumericOnly
2645 {
2646 $$ = $1;
2647 }
2648 | DEFAULT
2649 {
2650 $$ = mm_strdup("default");
2651 }
2652 | LOCAL
2653 {
2654 $$ = mm_strdup("local");
2655 }
2656 ;
2657
2658
2659 opt_encoding:
2660 ecpg_sconst
2661 {
2662 $$ = $1;
2663 }
2664 | DEFAULT
2665 {
2666 $$ = mm_strdup("default");
2667 }
2668 |
2669 {
2670 $$=EMPTY; }
2671 ;
2672
2673
2674 NonReservedWord_or_Sconst:
2675 NonReservedWord
2676 {
2677 $$ = $1;
2678 }
2679 | ecpg_sconst
2680 {
2681 $$ = $1;
2682 }
2683 ;
2684
2685
2686 VariableResetStmt:
2687 RESET reset_rest
2688 {
2689 $$ = cat_str(2,mm_strdup("reset"),$2);
2690 }
2691 ;
2692
2693
2694 reset_rest:
2695 generic_reset
2696 {
2697 $$ = $1;
2698 }
2699 | TIME ZONE
2700 {
2701 $$ = mm_strdup("time zone");
2702 }
2703 | TRANSACTION ISOLATION LEVEL
2704 {
2705 $$ = mm_strdup("transaction isolation level");
2706 }
2707 | SESSION AUTHORIZATION
2708 {
2709 $$ = mm_strdup("session authorization");
2710 }
2711 ;
2712
2713
2714 generic_reset:
2715 var_name
2716 {
2717 $$ = $1;
2718 }
2719 | ALL
2720 {
2721 $$ = mm_strdup("all");
2722 }
2723 ;
2724
2725
2726 SetResetClause:
2727 SET set_rest
2728 {
2729 $$ = cat_str(2,mm_strdup("set"),$2);
2730 }
2731 | VariableResetStmt
2732 {
2733 $$ = $1;
2734 }
2735 ;
2736
2737
2738 FunctionSetResetClause:
2739 SET set_rest_more
2740 {
2741 $$ = cat_str(2,mm_strdup("set"),$2);
2742 }
2743 | VariableResetStmt
2744 {
2745 $$ = $1;
2746 }
2747 ;
2748
2749
2750 VariableShowStmt:
2751 SHOW var_name ecpg_into
2752 {
2753 $$ = cat_str(2,mm_strdup("show"),$2);
2754 }
2755 | SHOW TIME ZONE ecpg_into
2756 {
2757 $$ = mm_strdup("show time zone");
2758 }
2759 | SHOW TRANSACTION ISOLATION LEVEL ecpg_into
2760 {
2761 $$ = mm_strdup("show transaction isolation level");
2762 }
2763 | SHOW SESSION AUTHORIZATION ecpg_into
2764 {
2765 $$ = mm_strdup("show session authorization");
2766 }
2767 | SHOW ALL
2768 {
2769 mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL is not implemented");
2770 $$ = EMPTY;
2771 }
2772 ;
2773
2774
2775 ConstraintsSetStmt:
2776 SET CONSTRAINTS constraints_set_list constraints_set_mode
2777 {
2778 $$ = cat_str(3,mm_strdup("set constraints"),$3,$4);
2779 }
2780 ;
2781
2782
2783 constraints_set_list:
2784 ALL
2785 {
2786 $$ = mm_strdup("all");
2787 }
2788 | qualified_name_list
2789 {
2790 $$ = $1;
2791 }
2792 ;
2793
2794
2795 constraints_set_mode:
2796 DEFERRED
2797 {
2798 $$ = mm_strdup("deferred");
2799 }
2800 | IMMEDIATE
2801 {
2802 $$ = mm_strdup("immediate");
2803 }
2804 ;
2805
2806
2807 CheckPointStmt:
2808 CHECKPOINT
2809 {
2810 $$ = mm_strdup("checkpoint");
2811 }
2812 ;
2813
2814
2815 DiscardStmt:
2816 DISCARD ALL
2817 {
2818 $$ = mm_strdup("discard all");
2819 }
2820 | DISCARD TEMP
2821 {
2822 $$ = mm_strdup("discard temp");
2823 }
2824 | DISCARD TEMPORARY
2825 {
2826 $$ = mm_strdup("discard temporary");
2827 }
2828 | DISCARD PLANS
2829 {
2830 $$ = mm_strdup("discard plans");
2831 }
2832 | DISCARD SEQUENCES
2833 {
2834 $$ = mm_strdup("discard sequences");
2835 }
2836 ;
2837
2838
2839 AlterTableStmt:
2840 ALTER TABLE relation_expr alter_table_cmds
2841 {
2842 $$ = cat_str(3,mm_strdup("alter table"),$3,$4);
2843 }
2844 | ALTER TABLE IF_P EXISTS relation_expr alter_table_cmds
2845 {
2846 $$ = cat_str(3,mm_strdup("alter table if exists"),$5,$6);
2847 }
2848 | ALTER TABLE relation_expr partition_cmd
2849 {
2850 $$ = cat_str(3,mm_strdup("alter table"),$3,$4);
2851 }
2852 | ALTER TABLE IF_P EXISTS relation_expr partition_cmd
2853 {
2854 $$ = cat_str(3,mm_strdup("alter table if exists"),$5,$6);
2855 }
2856 | ALTER TABLE ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
2857 {
2858 $$ = cat_str(5,mm_strdup("alter table all in tablespace"),$6,mm_strdup("set tablespace"),$9,$10);
2859 }
2860 | ALTER TABLE ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
2861 {
2862 $$ = cat_str(7,mm_strdup("alter table all in tablespace"),$6,mm_strdup("owned by"),$9,mm_strdup("set tablespace"),$12,$13);
2863 }
2864 | ALTER INDEX qualified_name alter_table_cmds
2865 {
2866 $$ = cat_str(3,mm_strdup("alter index"),$3,$4);
2867 }
2868 | ALTER INDEX IF_P EXISTS qualified_name alter_table_cmds
2869 {
2870 $$ = cat_str(3,mm_strdup("alter index if exists"),$5,$6);
2871 }
2872 | ALTER INDEX qualified_name index_partition_cmd
2873 {
2874 $$ = cat_str(3,mm_strdup("alter index"),$3,$4);
2875 }
2876 | ALTER INDEX ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
2877 {
2878 $$ = cat_str(5,mm_strdup("alter index all in tablespace"),$6,mm_strdup("set tablespace"),$9,$10);
2879 }
2880 | ALTER INDEX ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
2881 {
2882 $$ = cat_str(7,mm_strdup("alter index all in tablespace"),$6,mm_strdup("owned by"),$9,mm_strdup("set tablespace"),$12,$13);
2883 }
2884 | ALTER SEQUENCE qualified_name alter_table_cmds
2885 {
2886 $$ = cat_str(3,mm_strdup("alter sequence"),$3,$4);
2887 }
2888 | ALTER SEQUENCE IF_P EXISTS qualified_name alter_table_cmds
2889 {
2890 $$ = cat_str(3,mm_strdup("alter sequence if exists"),$5,$6);
2891 }
2892 | ALTER VIEW qualified_name alter_table_cmds
2893 {
2894 $$ = cat_str(3,mm_strdup("alter view"),$3,$4);
2895 }
2896 | ALTER VIEW IF_P EXISTS qualified_name alter_table_cmds
2897 {
2898 $$ = cat_str(3,mm_strdup("alter view if exists"),$5,$6);
2899 }
2900 | ALTER MATERIALIZED VIEW qualified_name alter_table_cmds
2901 {
2902 $$ = cat_str(3,mm_strdup("alter materialized view"),$4,$5);
2903 }
2904 | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name alter_table_cmds
2905 {
2906 $$ = cat_str(3,mm_strdup("alter materialized view if exists"),$6,$7);
2907 }
2908 | ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
2909 {
2910 $$ = cat_str(5,mm_strdup("alter materialized view all in tablespace"),$7,mm_strdup("set tablespace"),$10,$11);
2911 }
2912 | ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
2913 {
2914 $$ = cat_str(7,mm_strdup("alter materialized view all in tablespace"),$7,mm_strdup("owned by"),$10,mm_strdup("set tablespace"),$13,$14);
2915 }
2916 | ALTER FOREIGN TABLE relation_expr alter_table_cmds
2917 {
2918 $$ = cat_str(3,mm_strdup("alter foreign table"),$4,$5);
2919 }
2920 | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
2921 {
2922 $$ = cat_str(3,mm_strdup("alter foreign table if exists"),$6,$7);
2923 }
2924 ;
2925
2926
2927 alter_table_cmds:
2928 alter_table_cmd
2929 {
2930 $$ = $1;
2931 }
2932 | alter_table_cmds ',' alter_table_cmd
2933 {
2934 $$ = cat_str(3,$1,mm_strdup(","),$3);
2935 }
2936 ;
2937
2938
2939 partition_cmd:
2940 ATTACH PARTITION qualified_name PartitionBoundSpec
2941 {
2942 $$ = cat_str(3,mm_strdup("attach partition"),$3,$4);
2943 }
2944 | DETACH PARTITION qualified_name opt_concurrently
2945 {
2946 $$ = cat_str(3,mm_strdup("detach partition"),$3,$4);
2947 }
2948 | DETACH PARTITION qualified_name FINALIZE
2949 {
2950 $$ = cat_str(3,mm_strdup("detach partition"),$3,mm_strdup("finalize"));
2951 }
2952 ;
2953
2954
2955 index_partition_cmd:
2956 ATTACH PARTITION qualified_name
2957 {
2958 $$ = cat_str(2,mm_strdup("attach partition"),$3);
2959 }
2960 ;
2961
2962
2963 alter_table_cmd:
2964 ADD_P columnDef
2965 {
2966 $$ = cat_str(2,mm_strdup("add"),$2);
2967 }
2968 | ADD_P IF_P NOT EXISTS columnDef
2969 {
2970 $$ = cat_str(2,mm_strdup("add if not exists"),$5);
2971 }
2972 | ADD_P COLUMN columnDef
2973 {
2974 $$ = cat_str(2,mm_strdup("add column"),$3);
2975 }
2976 | ADD_P COLUMN IF_P NOT EXISTS columnDef
2977 {
2978 $$ = cat_str(2,mm_strdup("add column if not exists"),$6);
2979 }
2980 | ALTER opt_column ColId alter_column_default
2981 {
2982 $$ = cat_str(4,mm_strdup("alter"),$2,$3,$4);
2983 }
2984 | ALTER opt_column ColId DROP NOT NULL_P
2985 {
2986 $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop not null"));
2987 }
2988 | ALTER opt_column ColId SET NOT NULL_P
2989 {
2990 $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("set not null"));
2991 }
2992 | ALTER opt_column ColId DROP EXPRESSION
2993 {
2994 $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop expression"));
2995 }
2996 | ALTER opt_column ColId DROP EXPRESSION IF_P EXISTS
2997 {
2998 $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop expression if exists"));
2999 }
3000 | ALTER opt_column ColId SET STATISTICS SignedIconst
3001 {
3002 $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set statistics"),$6);
3003 }
3004 | ALTER opt_column Iconst SET STATISTICS SignedIconst
3005 {
3006 $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set statistics"),$6);
3007 }
3008 | ALTER opt_column ColId SET reloptions
3009 {
3010 $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set"),$5);
3011 }
3012 | ALTER opt_column ColId RESET reloptions
3013 {
3014 $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("reset"),$5);
3015 }
3016 | ALTER opt_column ColId SET STORAGE ColId
3017 {
3018 $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set storage"),$6);
3019 }
3020 | ALTER opt_column ColId SET column_compression
3021 {
3022 $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set"),$5);
3023 }
3024 | ALTER opt_column ColId ADD_P GENERATED generated_when AS IDENTITY_P OptParenthesizedSeqOptList
3025 {
3026 $$ = cat_str(7,mm_strdup("alter"),$2,$3,mm_strdup("add generated"),$6,mm_strdup("as identity"),$9);
3027 }
3028 | ALTER opt_column ColId alter_identity_column_option_list
3029 {
3030 $$ = cat_str(4,mm_strdup("alter"),$2,$3,$4);
3031 }
3032 | ALTER opt_column ColId DROP IDENTITY_P
3033 {
3034 $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop identity"));
3035 }
3036 | ALTER opt_column ColId DROP IDENTITY_P IF_P EXISTS
3037 {
3038 $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop identity if exists"));
3039 }
3040 | DROP opt_column IF_P EXISTS ColId opt_drop_behavior
3041 {
3042 $$ = cat_str(5,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,$6);
3043 }
3044 | DROP opt_column ColId opt_drop_behavior
3045 {
3046 $$ = cat_str(4,mm_strdup("drop"),$2,$3,$4);
3047 }
3048 | ALTER opt_column ColId opt_set_data TYPE_P Typename opt_collate_clause alter_using
3049 {
3050 $$ = cat_str(8,mm_strdup("alter"),$2,$3,$4,mm_strdup("type"),$6,$7,$8);
3051 }
3052 | ALTER opt_column ColId alter_generic_options
3053 {
3054 $$ = cat_str(4,mm_strdup("alter"),$2,$3,$4);
3055 }
3056 | ADD_P TableConstraint
3057 {
3058 $$ = cat_str(2,mm_strdup("add"),$2);
3059 }
3060 | ALTER CONSTRAINT name ConstraintAttributeSpec
3061 {
3062 $$ = cat_str(3,mm_strdup("alter constraint"),$3,$4);
3063 }
3064 | VALIDATE CONSTRAINT name
3065 {
3066 $$ = cat_str(2,mm_strdup("validate constraint"),$3);
3067 }
3068 | DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
3069 {
3070 $$ = cat_str(3,mm_strdup("drop constraint if exists"),$5,$6);
3071 }
3072 | DROP CONSTRAINT name opt_drop_behavior
3073 {
3074 $$ = cat_str(3,mm_strdup("drop constraint"),$3,$4);
3075 }
3076 | SET WITHOUT OIDS
3077 {
3078 $$ = mm_strdup("set without oids");
3079 }
3080 | CLUSTER ON name
3081 {
3082 $$ = cat_str(2,mm_strdup("cluster on"),$3);
3083 }
3084 | SET WITHOUT CLUSTER
3085 {
3086 $$ = mm_strdup("set without cluster");
3087 }
3088 | SET LOGGED
3089 {
3090 $$ = mm_strdup("set logged");
3091 }
3092 | SET UNLOGGED
3093 {
3094 $$ = mm_strdup("set unlogged");
3095 }
3096 | ENABLE_P TRIGGER name
3097 {
3098 $$ = cat_str(2,mm_strdup("enable trigger"),$3);
3099 }
3100 | ENABLE_P ALWAYS TRIGGER name
3101 {
3102 $$ = cat_str(2,mm_strdup("enable always trigger"),$4);
3103 }
3104 | ENABLE_P REPLICA TRIGGER name
3105 {
3106 $$ = cat_str(2,mm_strdup("enable replica trigger"),$4);
3107 }
3108 | ENABLE_P TRIGGER ALL
3109 {
3110 $$ = mm_strdup("enable trigger all");
3111 }
3112 | ENABLE_P TRIGGER USER
3113 {
3114 $$ = mm_strdup("enable trigger user");
3115 }
3116 | DISABLE_P TRIGGER name
3117 {
3118 $$ = cat_str(2,mm_strdup("disable trigger"),$3);
3119 }
3120 | DISABLE_P TRIGGER ALL
3121 {
3122 $$ = mm_strdup("disable trigger all");
3123 }
3124 | DISABLE_P TRIGGER USER
3125 {
3126 $$ = mm_strdup("disable trigger user");
3127 }
3128 | ENABLE_P RULE name
3129 {
3130 $$ = cat_str(2,mm_strdup("enable rule"),$3);
3131 }
3132 | ENABLE_P ALWAYS RULE name
3133 {
3134 $$ = cat_str(2,mm_strdup("enable always rule"),$4);
3135 }
3136 | ENABLE_P REPLICA RULE name
3137 {
3138 $$ = cat_str(2,mm_strdup("enable replica rule"),$4);
3139 }
3140 | DISABLE_P RULE name
3141 {
3142 $$ = cat_str(2,mm_strdup("disable rule"),$3);
3143 }
3144 | INHERIT qualified_name
3145 {
3146 $$ = cat_str(2,mm_strdup("inherit"),$2);
3147 }
3148 | NO INHERIT qualified_name
3149 {
3150 $$ = cat_str(2,mm_strdup("no inherit"),$3);
3151 }
3152 | OF any_name
3153 {
3154 $$ = cat_str(2,mm_strdup("of"),$2);
3155 }
3156 | NOT OF
3157 {
3158 $$ = mm_strdup("not of");
3159 }
3160 | OWNER TO RoleSpec
3161 {
3162 $$ = cat_str(2,mm_strdup("owner to"),$3);
3163 }
3164 | SET TABLESPACE name
3165 {
3166 $$ = cat_str(2,mm_strdup("set tablespace"),$3);
3167 }
3168 | SET reloptions
3169 {
3170 $$ = cat_str(2,mm_strdup("set"),$2);
3171 }
3172 | RESET reloptions
3173 {
3174 $$ = cat_str(2,mm_strdup("reset"),$2);
3175 }
3176 | REPLICA IDENTITY_P replica_identity
3177 {
3178 $$ = cat_str(2,mm_strdup("replica identity"),$3);
3179 }
3180 | ENABLE_P ROW LEVEL SECURITY
3181 {
3182 $$ = mm_strdup("enable row level security");
3183 }
3184 | DISABLE_P ROW LEVEL SECURITY
3185 {
3186 $$ = mm_strdup("disable row level security");
3187 }
3188 | FORCE ROW LEVEL SECURITY
3189 {
3190 $$ = mm_strdup("force row level security");
3191 }
3192 | NO FORCE ROW LEVEL SECURITY
3193 {
3194 $$ = mm_strdup("no force row level security");
3195 }
3196 | alter_generic_options
3197 {
3198 $$ = $1;
3199 }
3200 ;
3201
3202
3203 alter_column_default:
3204 SET DEFAULT a_expr
3205 {
3206 $$ = cat_str(2,mm_strdup("set default"),$3);
3207 }
3208 | DROP DEFAULT
3209 {
3210 $$ = mm_strdup("drop default");
3211 }
3212 ;
3213
3214
3215 opt_drop_behavior:
3216 CASCADE
3217 {
3218 $$ = mm_strdup("cascade");
3219 }
3220 | RESTRICT
3221 {
3222 $$ = mm_strdup("restrict");
3223 }
3224 |
3225 {
3226 $$=EMPTY; }
3227 ;
3228
3229
3230 opt_collate_clause:
3231 COLLATE any_name
3232 {
3233 $$ = cat_str(2,mm_strdup("collate"),$2);
3234 }
3235 |
3236 {
3237 $$=EMPTY; }
3238 ;
3239
3240
3241 alter_using:
3242 USING a_expr
3243 {
3244 $$ = cat_str(2,mm_strdup("using"),$2);
3245 }
3246 |
3247 {
3248 $$=EMPTY; }
3249 ;
3250
3251
3252 replica_identity:
3253 NOTHING
3254 {
3255 $$ = mm_strdup("nothing");
3256 }
3257 | FULL
3258 {
3259 $$ = mm_strdup("full");
3260 }
3261 | DEFAULT
3262 {
3263 $$ = mm_strdup("default");
3264 }
3265 | USING INDEX name
3266 {
3267 $$ = cat_str(2,mm_strdup("using index"),$3);
3268 }
3269 ;
3270
3271
3272 reloptions:
3273 '(' reloption_list ')'
3274 {
3275 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
3276 }
3277 ;
3278
3279
3280 opt_reloptions:
3281 WITH reloptions
3282 {
3283 $$ = cat_str(2,mm_strdup("with"),$2);
3284 }
3285 |
3286 {
3287 $$=EMPTY; }
3288 ;
3289
3290
3291 reloption_list:
3292 reloption_elem
3293 {
3294 $$ = $1;
3295 }
3296 | reloption_list ',' reloption_elem
3297 {
3298 $$ = cat_str(3,$1,mm_strdup(","),$3);
3299 }
3300 ;
3301
3302
3303 reloption_elem:
3304 ColLabel '=' def_arg
3305 {
3306 $$ = cat_str(3,$1,mm_strdup("="),$3);
3307 }
3308 | ColLabel
3309 {
3310 $$ = $1;
3311 }
3312 | ColLabel '.' ColLabel '=' def_arg
3313 {
3314 $$ = cat_str(5,$1,mm_strdup("."),$3,mm_strdup("="),$5);
3315 }
3316 | ColLabel '.' ColLabel
3317 {
3318 $$ = cat_str(3,$1,mm_strdup("."),$3);
3319 }
3320 ;
3321
3322
3323 alter_identity_column_option_list:
3324 alter_identity_column_option
3325 {
3326 $$ = $1;
3327 }
3328 | alter_identity_column_option_list alter_identity_column_option
3329 {
3330 $$ = cat_str(2,$1,$2);
3331 }
3332 ;
3333
3334
3335 alter_identity_column_option:
3336 RESTART
3337 {
3338 $$ = mm_strdup("restart");
3339 }
3340 | RESTART opt_with NumericOnly
3341 {
3342 $$ = cat_str(3,mm_strdup("restart"),$2,$3);
3343 }
3344 | SET SeqOptElem
3345 {
3346 $$ = cat_str(2,mm_strdup("set"),$2);
3347 }
3348 | SET GENERATED generated_when
3349 {
3350 $$ = cat_str(2,mm_strdup("set generated"),$3);
3351 }
3352 ;
3353
3354
3355 PartitionBoundSpec:
3356 FOR VALUES WITH '(' hash_partbound ')'
3357 {
3358 $$ = cat_str(3,mm_strdup("for values with ("),$5,mm_strdup(")"));
3359 }
3360 | FOR VALUES IN_P '(' expr_list ')'
3361 {
3362 $$ = cat_str(3,mm_strdup("for values in ("),$5,mm_strdup(")"));
3363 }
3364 | FOR VALUES FROM '(' expr_list ')' TO '(' expr_list ')'
3365 {
3366 $$ = cat_str(5,mm_strdup("for values from ("),$5,mm_strdup(") to ("),$9,mm_strdup(")"));
3367 }
3368 | DEFAULT
3369 {
3370 $$ = mm_strdup("default");
3371 }
3372 ;
3373
3374
3375 hash_partbound_elem:
3376 NonReservedWord Iconst
3377 {
3378 $$ = cat_str(2,$1,$2);
3379 }
3380 ;
3381
3382
3383 hash_partbound:
3384 hash_partbound_elem
3385 {
3386 $$ = $1;
3387 }
3388 | hash_partbound ',' hash_partbound_elem
3389 {
3390 $$ = cat_str(3,$1,mm_strdup(","),$3);
3391 }
3392 ;
3393
3394
3395 AlterCompositeTypeStmt:
3396 ALTER TYPE_P any_name alter_type_cmds
3397 {
3398 $$ = cat_str(3,mm_strdup("alter type"),$3,$4);
3399 }
3400 ;
3401
3402
3403 alter_type_cmds:
3404 alter_type_cmd
3405 {
3406 $$ = $1;
3407 }
3408 | alter_type_cmds ',' alter_type_cmd
3409 {
3410 $$ = cat_str(3,$1,mm_strdup(","),$3);
3411 }
3412 ;
3413
3414
3415 alter_type_cmd:
3416 ADD_P ATTRIBUTE TableFuncElement opt_drop_behavior
3417 {
3418 $$ = cat_str(3,mm_strdup("add attribute"),$3,$4);
3419 }
3420 | DROP ATTRIBUTE IF_P EXISTS ColId opt_drop_behavior
3421 {
3422 $$ = cat_str(3,mm_strdup("drop attribute if exists"),$5,$6);
3423 }
3424 | DROP ATTRIBUTE ColId opt_drop_behavior
3425 {
3426 $$ = cat_str(3,mm_strdup("drop attribute"),$3,$4);
3427 }
3428 | ALTER ATTRIBUTE ColId opt_set_data TYPE_P Typename opt_collate_clause opt_drop_behavior
3429 {
3430 $$ = cat_str(7,mm_strdup("alter attribute"),$3,$4,mm_strdup("type"),$6,$7,$8);
3431 }
3432 ;
3433
3434
3435 ClosePortalStmt:
3436 CLOSE cursor_name
3437 {
3438 char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : $2;
3439 struct cursor *ptr = NULL;
3440 for (ptr = cur; ptr != NULL; ptr = ptr -> next)
3441 {
3442 if (strcmp($2, ptr -> name) == 0)
3443 {
3444 if (ptr -> connection)
3445 connection = mm_strdup(ptr -> connection);
3446
3447 break;
3448 }
3449 }
3450 $$ = cat2_str(mm_strdup("close"), cursor_marker);
3451 }
3452 | CLOSE ALL
3453 {
3454 $$ = mm_strdup("close all");
3455 }
3456 ;
3457
3458
3459 CopyStmt:
3460 COPY opt_binary qualified_name opt_column_list copy_from opt_program copy_file_name copy_delimiter opt_with copy_options where_clause
3461 {
3462 if (strcmp($6, "from") == 0 &&
3463 (strcmp($7, "stdin") == 0 || strcmp($7, "stdout") == 0))
3464 mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not implemented");
3465
3466 $$ = cat_str(11,mm_strdup("copy"),$2,$3,$4,$5,$6,$7,$8,$9,$10,$11);
3467 }
3468 | COPY '(' PreparableStmt ')' TO opt_program copy_file_name opt_with copy_options
3469 {
3470 $$ = cat_str(7,mm_strdup("copy ("),$3,mm_strdup(") to"),$6,$7,$8,$9);
3471 }
3472 ;
3473
3474
3475 copy_from:
3476 FROM
3477 {
3478 $$ = mm_strdup("from");
3479 }
3480 | TO
3481 {
3482 $$ = mm_strdup("to");
3483 }
3484 ;
3485
3486
3487 opt_program:
3488 PROGRAM
3489 {
3490 $$ = mm_strdup("program");
3491 }
3492 |
3493 {
3494 $$=EMPTY; }
3495 ;
3496
3497
3498 copy_file_name:
3499 ecpg_sconst
3500 {
3501 $$ = $1;
3502 }
3503 | STDIN
3504 {
3505 $$ = mm_strdup("stdin");
3506 }
3507 | STDOUT
3508 {
3509 $$ = mm_strdup("stdout");
3510 }
3511 ;
3512
3513
3514 copy_options:
3515 copy_opt_list
3516 {
3517 $$ = $1;
3518 }
3519 | '(' copy_generic_opt_list ')'
3520 {
3521 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
3522 }
3523 ;
3524
3525
3526 copy_opt_list:
3527 copy_opt_list copy_opt_item
3528 {
3529 $$ = cat_str(2,$1,$2);
3530 }
3531 |
3532 {
3533 $$=EMPTY; }
3534 ;
3535
3536
3537 copy_opt_item:
3538 BINARY
3539 {
3540 $$ = mm_strdup("binary");
3541 }
3542 | FREEZE
3543 {
3544 $$ = mm_strdup("freeze");
3545 }
3546 | DELIMITER opt_as ecpg_sconst
3547 {
3548 $$ = cat_str(3,mm_strdup("delimiter"),$2,$3);
3549 }
3550 | NULL_P opt_as ecpg_sconst
3551 {
3552 $$ = cat_str(3,mm_strdup("null"),$2,$3);
3553 }
3554 | CSV
3555 {
3556 $$ = mm_strdup("csv");
3557 }
3558 | HEADER_P
3559 {
3560 $$ = mm_strdup("header");
3561 }
3562 | QUOTE opt_as ecpg_sconst
3563 {
3564 $$ = cat_str(3,mm_strdup("quote"),$2,$3);
3565 }
3566 | ESCAPE opt_as ecpg_sconst
3567 {
3568 $$ = cat_str(3,mm_strdup("escape"),$2,$3);
3569 }
3570 | FORCE QUOTE columnList
3571 {
3572 $$ = cat_str(2,mm_strdup("force quote"),$3);
3573 }
3574 | FORCE QUOTE '*'
3575 {
3576 $$ = mm_strdup("force quote *");
3577 }
3578 | FORCE NOT NULL_P columnList
3579 {
3580 $$ = cat_str(2,mm_strdup("force not null"),$4);
3581 }
3582 | FORCE NULL_P columnList
3583 {
3584 $$ = cat_str(2,mm_strdup("force null"),$3);
3585 }
3586 | ENCODING ecpg_sconst
3587 {
3588 $$ = cat_str(2,mm_strdup("encoding"),$2);
3589 }
3590 ;
3591
3592
3593 opt_binary:
3594 BINARY
3595 {
3596 $$ = mm_strdup("binary");
3597 }
3598 |
3599 {
3600 $$=EMPTY; }
3601 ;
3602
3603
3604 copy_delimiter:
3605 opt_using DELIMITERS ecpg_sconst
3606 {
3607 $$ = cat_str(3,$1,mm_strdup("delimiters"),$3);
3608 }
3609 |
3610 {
3611 $$=EMPTY; }
3612 ;
3613
3614
3615 opt_using:
3616 USING
3617 {
3618 $$ = mm_strdup("using");
3619 }
3620 |
3621 {
3622 $$=EMPTY; }
3623 ;
3624
3625
3626 copy_generic_opt_list:
3627 copy_generic_opt_elem
3628 {
3629 $$ = $1;
3630 }
3631 | copy_generic_opt_list ',' copy_generic_opt_elem
3632 {
3633 $$ = cat_str(3,$1,mm_strdup(","),$3);
3634 }
3635 ;
3636
3637
3638 copy_generic_opt_elem:
3639 ColLabel copy_generic_opt_arg
3640 {
3641 $$ = cat_str(2,$1,$2);
3642 }
3643 ;
3644
3645
3646 copy_generic_opt_arg:
3647 opt_boolean_or_string
3648 {
3649 $$ = $1;
3650 }
3651 | NumericOnly
3652 {
3653 $$ = $1;
3654 }
3655 | '*'
3656 {
3657 $$ = mm_strdup("*");
3658 }
3659 | '(' copy_generic_opt_arg_list ')'
3660 {
3661 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
3662 }
3663 |
3664 {
3665 $$=EMPTY; }
3666 ;
3667
3668
3669 copy_generic_opt_arg_list:
3670 copy_generic_opt_arg_list_item
3671 {
3672 $$ = $1;
3673 }
3674 | copy_generic_opt_arg_list ',' copy_generic_opt_arg_list_item
3675 {
3676 $$ = cat_str(3,$1,mm_strdup(","),$3);
3677 }
3678 ;
3679
3680
3681 copy_generic_opt_arg_list_item:
3682 opt_boolean_or_string
3683 {
3684 $$ = $1;
3685 }
3686 ;
3687
3688
3689 CreateStmt:
3690 CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' OptInherit OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
3691 {
3692 $$ = cat_str(13,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("("),$6,mm_strdup(")"),$8,$9,$10,$11,$12,$13);
3693 }
3694 | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name '(' OptTableElementList ')' OptInherit OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
3695 {
3696 $$ = cat_str(13,mm_strdup("create"),$2,mm_strdup("table if not exists"),$7,mm_strdup("("),$9,mm_strdup(")"),$11,$12,$13,$14,$15,$16);
3697 }
3698 | CREATE OptTemp TABLE qualified_name OF any_name OptTypedTableElementList OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
3699 {
3700 $$ = cat_str(12,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("of"),$6,$7,$8,$9,$10,$11,$12);
3701 }
3702 | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name OF any_name OptTypedTableElementList OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
3703 {
3704 $$ = cat_str(12,mm_strdup("create"),$2,mm_strdup("table if not exists"),$7,mm_strdup("of"),$9,$10,$11,$12,$13,$14,$15);
3705 }
3706 | CREATE OptTemp TABLE qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
3707 {
3708 $$ = cat_str(13,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("partition of"),$7,$8,$9,$10,$11,$12,$13,$14);
3709 }
3710 | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
3711 {
3712 $$ = cat_str(13,mm_strdup("create"),$2,mm_strdup("table if not exists"),$7,mm_strdup("partition of"),$10,$11,$12,$13,$14,$15,$16,$17);
3713 }
3714 ;
3715
3716
3717 OptTemp:
3718 TEMPORARY
3719 {
3720 $$ = mm_strdup("temporary");
3721 }
3722 | TEMP
3723 {
3724 $$ = mm_strdup("temp");
3725 }
3726 | LOCAL TEMPORARY
3727 {
3728 $$ = mm_strdup("local temporary");
3729 }
3730 | LOCAL TEMP
3731 {
3732 $$ = mm_strdup("local temp");
3733 }
3734 | GLOBAL TEMPORARY
3735 {
3736 $$ = mm_strdup("global temporary");
3737 }
3738 | GLOBAL TEMP
3739 {
3740 $$ = mm_strdup("global temp");
3741 }
3742 | UNLOGGED
3743 {
3744 $$ = mm_strdup("unlogged");
3745 }
3746 |
3747 {
3748 $$=EMPTY; }
3749 ;
3750
3751
3752 OptTableElementList:
3753 TableElementList
3754 {
3755 $$ = $1;
3756 }
3757 |
3758 {
3759 $$=EMPTY; }
3760 ;
3761
3762
3763 OptTypedTableElementList:
3764 '(' TypedTableElementList ')'
3765 {
3766 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
3767 }
3768 |
3769 {
3770 $$=EMPTY; }
3771 ;
3772
3773
3774 TableElementList:
3775 TableElement
3776 {
3777 $$ = $1;
3778 }
3779 | TableElementList ',' TableElement
3780 {
3781 $$ = cat_str(3,$1,mm_strdup(","),$3);
3782 }
3783 ;
3784
3785
3786 TypedTableElementList:
3787 TypedTableElement
3788 {
3789 $$ = $1;
3790 }
3791 | TypedTableElementList ',' TypedTableElement
3792 {
3793 $$ = cat_str(3,$1,mm_strdup(","),$3);
3794 }
3795 ;
3796
3797
3798 TableElement:
3799 columnDef
3800 {
3801 $$ = $1;
3802 }
3803 | TableLikeClause
3804 {
3805 $$ = $1;
3806 }
3807 | TableConstraint
3808 {
3809 $$ = $1;
3810 }
3811 ;
3812
3813
3814 TypedTableElement:
3815 columnOptions
3816 {
3817 $$ = $1;
3818 }
3819 | TableConstraint
3820 {
3821 $$ = $1;
3822 }
3823 ;
3824
3825
3826 columnDef:
3827 ColId Typename opt_column_compression create_generic_options ColQualList
3828 {
3829 $$ = cat_str(5,$1,$2,$3,$4,$5);
3830 }
3831 ;
3832
3833
3834 columnOptions:
3835 ColId ColQualList
3836 {
3837 $$ = cat_str(2,$1,$2);
3838 }
3839 | ColId WITH OPTIONS ColQualList
3840 {
3841 $$ = cat_str(3,$1,mm_strdup("with options"),$4);
3842 }
3843 ;
3844
3845
3846 column_compression:
3847 COMPRESSION ColId
3848 {
3849 $$ = cat_str(2,mm_strdup("compression"),$2);
3850 }
3851 | COMPRESSION DEFAULT
3852 {
3853 $$ = mm_strdup("compression default");
3854 }
3855 ;
3856
3857
3858 opt_column_compression:
3859 column_compression
3860 {
3861 $$ = $1;
3862 }
3863 |
3864 {
3865 $$=EMPTY; }
3866 ;
3867
3868
3869 ColQualList:
3870 ColQualList ColConstraint
3871 {
3872 $$ = cat_str(2,$1,$2);
3873 }
3874 |
3875 {
3876 $$=EMPTY; }
3877 ;
3878
3879
3880 ColConstraint:
3881 CONSTRAINT name ColConstraintElem
3882 {
3883 $$ = cat_str(3,mm_strdup("constraint"),$2,$3);
3884 }
3885 | ColConstraintElem
3886 {
3887 $$ = $1;
3888 }
3889 | ConstraintAttr
3890 {
3891 $$ = $1;
3892 }
3893 | COLLATE any_name
3894 {
3895 $$ = cat_str(2,mm_strdup("collate"),$2);
3896 }
3897 ;
3898
3899
3900 ColConstraintElem:
3901 NOT NULL_P
3902 {
3903 $$ = mm_strdup("not null");
3904 }
3905 | NULL_P
3906 {
3907 $$ = mm_strdup("null");
3908 }
3909 | UNIQUE opt_definition OptConsTableSpace
3910 {
3911 $$ = cat_str(3,mm_strdup("unique"),$2,$3);
3912 }
3913 | PRIMARY KEY opt_definition OptConsTableSpace
3914 {
3915 $$ = cat_str(3,mm_strdup("primary key"),$3,$4);
3916 }
3917 | CHECK '(' a_expr ')' opt_no_inherit
3918 {
3919 $$ = cat_str(4,mm_strdup("check ("),$3,mm_strdup(")"),$5);
3920 }
3921 | DEFAULT b_expr
3922 {
3923 $$ = cat_str(2,mm_strdup("default"),$2);
3924 }
3925 | GENERATED generated_when AS IDENTITY_P OptParenthesizedSeqOptList
3926 {
3927 $$ = cat_str(4,mm_strdup("generated"),$2,mm_strdup("as identity"),$5);
3928 }
3929 | GENERATED generated_when AS '(' a_expr ')' STORED
3930 {
3931 $$ = cat_str(5,mm_strdup("generated"),$2,mm_strdup("as ("),$5,mm_strdup(") stored"));
3932 }
3933 | REFERENCES qualified_name opt_column_list key_match key_actions
3934 {
3935 $$ = cat_str(5,mm_strdup("references"),$2,$3,$4,$5);
3936 }
3937 ;
3938
3939
3940 generated_when:
3941 ALWAYS
3942 {
3943 $$ = mm_strdup("always");
3944 }
3945 | BY DEFAULT
3946 {
3947 $$ = mm_strdup("by default");
3948 }
3949 ;
3950
3951
3952 ConstraintAttr:
3953 DEFERRABLE
3954 {
3955 $$ = mm_strdup("deferrable");
3956 }
3957 | NOT DEFERRABLE
3958 {
3959 $$ = mm_strdup("not deferrable");
3960 }
3961 | INITIALLY DEFERRED
3962 {
3963 $$ = mm_strdup("initially deferred");
3964 }
3965 | INITIALLY IMMEDIATE
3966 {
3967 $$ = mm_strdup("initially immediate");
3968 }
3969 ;
3970
3971
3972 TableLikeClause:
3973 LIKE qualified_name TableLikeOptionList
3974 {
3975 $$ = cat_str(3,mm_strdup("like"),$2,$3);
3976 }
3977 ;
3978
3979
3980 TableLikeOptionList:
3981 TableLikeOptionList INCLUDING TableLikeOption
3982 {
3983 $$ = cat_str(3,$1,mm_strdup("including"),$3);
3984 }
3985 | TableLikeOptionList EXCLUDING TableLikeOption
3986 {
3987 $$ = cat_str(3,$1,mm_strdup("excluding"),$3);
3988 }
3989 |
3990 {
3991 $$=EMPTY; }
3992 ;
3993
3994
3995 TableLikeOption:
3996 COMMENTS
3997 {
3998 $$ = mm_strdup("comments");
3999 }
4000 | COMPRESSION
4001 {
4002 $$ = mm_strdup("compression");
4003 }
4004 | CONSTRAINTS
4005 {
4006 $$ = mm_strdup("constraints");
4007 }
4008 | DEFAULTS
4009 {
4010 $$ = mm_strdup("defaults");
4011 }
4012 | IDENTITY_P
4013 {
4014 $$ = mm_strdup("identity");
4015 }
4016 | GENERATED
4017 {
4018 $$ = mm_strdup("generated");
4019 }
4020 | INDEXES
4021 {
4022 $$ = mm_strdup("indexes");
4023 }
4024 | STATISTICS
4025 {
4026 $$ = mm_strdup("statistics");
4027 }
4028 | STORAGE
4029 {
4030 $$ = mm_strdup("storage");
4031 }
4032 | ALL
4033 {
4034 $$ = mm_strdup("all");
4035 }
4036 ;
4037
4038
4039 TableConstraint:
4040 CONSTRAINT name ConstraintElem
4041 {
4042 $$ = cat_str(3,mm_strdup("constraint"),$2,$3);
4043 }
4044 | ConstraintElem
4045 {
4046 $$ = $1;
4047 }
4048 ;
4049
4050
4051 ConstraintElem:
4052 CHECK '(' a_expr ')' ConstraintAttributeSpec
4053 {
4054 $$ = cat_str(4,mm_strdup("check ("),$3,mm_strdup(")"),$5);
4055 }
4056 | UNIQUE '(' columnList ')' opt_c_include opt_definition OptConsTableSpace ConstraintAttributeSpec
4057 {
4058 $$ = cat_str(7,mm_strdup("unique ("),$3,mm_strdup(")"),$5,$6,$7,$8);
4059 }
4060 | UNIQUE ExistingIndex ConstraintAttributeSpec
4061 {
4062 $$ = cat_str(3,mm_strdup("unique"),$2,$3);
4063 }
4064 | PRIMARY KEY '(' columnList ')' opt_c_include opt_definition OptConsTableSpace ConstraintAttributeSpec
4065 {
4066 $$ = cat_str(7,mm_strdup("primary key ("),$4,mm_strdup(")"),$6,$7,$8,$9);
4067 }
4068 | PRIMARY KEY ExistingIndex ConstraintAttributeSpec
4069 {
4070 $$ = cat_str(3,mm_strdup("primary key"),$3,$4);
4071 }
4072 | EXCLUDE access_method_clause '(' ExclusionConstraintList ')' opt_c_include opt_definition OptConsTableSpace OptWhereClause ConstraintAttributeSpec
4073 {
4074 $$ = cat_str(10,mm_strdup("exclude"),$2,mm_strdup("("),$4,mm_strdup(")"),$6,$7,$8,$9,$10);
4075 }
4076 | FOREIGN KEY '(' columnList ')' REFERENCES qualified_name opt_column_list key_match key_actions ConstraintAttributeSpec
4077 {
4078 $$ = cat_str(8,mm_strdup("foreign key ("),$4,mm_strdup(") references"),$7,$8,$9,$10,$11);
4079 }
4080 ;
4081
4082
4083 opt_no_inherit:
4084 NO INHERIT
4085 {
4086 $$ = mm_strdup("no inherit");
4087 }
4088 |
4089 {
4090 $$=EMPTY; }
4091 ;
4092
4093
4094 opt_column_list:
4095 '(' columnList ')'
4096 {
4097 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
4098 }
4099 |
4100 {
4101 $$=EMPTY; }
4102 ;
4103
4104
4105 columnList:
4106 columnElem
4107 {
4108 $$ = $1;
4109 }
4110 | columnList ',' columnElem
4111 {
4112 $$ = cat_str(3,$1,mm_strdup(","),$3);
4113 }
4114 ;
4115
4116
4117 columnElem:
4118 ColId
4119 {
4120 $$ = $1;
4121 }
4122 ;
4123
4124
4125 opt_c_include:
4126 INCLUDE '(' columnList ')'
4127 {
4128 $$ = cat_str(3,mm_strdup("include ("),$3,mm_strdup(")"));
4129 }
4130 |
4131 {
4132 $$=EMPTY; }
4133 ;
4134
4135
4136 key_match:
4137 MATCH FULL
4138 {
4139 $$ = mm_strdup("match full");
4140 }
4141 | MATCH PARTIAL
4142 {
4143 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
4144 $$ = mm_strdup("match partial");
4145 }
4146 | MATCH SIMPLE
4147 {
4148 $$ = mm_strdup("match simple");
4149 }
4150 |
4151 {
4152 $$=EMPTY; }
4153 ;
4154
4155
4156 ExclusionConstraintList:
4157 ExclusionConstraintElem
4158 {
4159 $$ = $1;
4160 }
4161 | ExclusionConstraintList ',' ExclusionConstraintElem
4162 {
4163 $$ = cat_str(3,$1,mm_strdup(","),$3);
4164 }
4165 ;
4166
4167
4168 ExclusionConstraintElem:
4169 index_elem WITH any_operator
4170 {
4171 $$ = cat_str(3,$1,mm_strdup("with"),$3);
4172 }
4173 | index_elem WITH OPERATOR '(' any_operator ')'
4174 {
4175 $$ = cat_str(4,$1,mm_strdup("with operator ("),$5,mm_strdup(")"));
4176 }
4177 ;
4178
4179
4180 OptWhereClause:
4181 WHERE '(' a_expr ')'
4182 {
4183 $$ = cat_str(3,mm_strdup("where ("),$3,mm_strdup(")"));
4184 }
4185 |
4186 {
4187 $$=EMPTY; }
4188 ;
4189
4190
4191 key_actions:
4192 key_update
4193 {
4194 $$ = $1;
4195 }
4196 | key_delete
4197 {
4198 $$ = $1;
4199 }
4200 | key_update key_delete
4201 {
4202 $$ = cat_str(2,$1,$2);
4203 }
4204 | key_delete key_update
4205 {
4206 $$ = cat_str(2,$1,$2);
4207 }
4208 |
4209 {
4210 $$=EMPTY; }
4211 ;
4212
4213
4214 key_update:
4215 ON UPDATE key_action
4216 {
4217 $$ = cat_str(2,mm_strdup("on update"),$3);
4218 }
4219 ;
4220
4221
4222 key_delete:
4223 ON DELETE_P key_action
4224 {
4225 $$ = cat_str(2,mm_strdup("on delete"),$3);
4226 }
4227 ;
4228
4229
4230 key_action:
4231 NO ACTION
4232 {
4233 $$ = mm_strdup("no action");
4234 }
4235 | RESTRICT
4236 {
4237 $$ = mm_strdup("restrict");
4238 }
4239 | CASCADE
4240 {
4241 $$ = mm_strdup("cascade");
4242 }
4243 | SET NULL_P
4244 {
4245 $$ = mm_strdup("set null");
4246 }
4247 | SET DEFAULT
4248 {
4249 $$ = mm_strdup("set default");
4250 }
4251 ;
4252
4253
4254 OptInherit:
4255 INHERITS '(' qualified_name_list ')'
4256 {
4257 $$ = cat_str(3,mm_strdup("inherits ("),$3,mm_strdup(")"));
4258 }
4259 |
4260 {
4261 $$=EMPTY; }
4262 ;
4263
4264
4265 OptPartitionSpec:
4266 PartitionSpec
4267 {
4268 $$ = $1;
4269 }
4270 |
4271 {
4272 $$=EMPTY; }
4273 ;
4274
4275
4276 PartitionSpec:
4277 PARTITION BY ColId '(' part_params ')'
4278 {
4279 $$ = cat_str(5,mm_strdup("partition by"),$3,mm_strdup("("),$5,mm_strdup(")"));
4280 }
4281 ;
4282
4283
4284 part_params:
4285 part_elem
4286 {
4287 $$ = $1;
4288 }
4289 | part_params ',' part_elem
4290 {
4291 $$ = cat_str(3,$1,mm_strdup(","),$3);
4292 }
4293 ;
4294
4295
4296 part_elem:
4297 ColId opt_collate opt_class
4298 {
4299 $$ = cat_str(3,$1,$2,$3);
4300 }
4301 | func_expr_windowless opt_collate opt_class
4302 {
4303 $$ = cat_str(3,$1,$2,$3);
4304 }
4305 | '(' a_expr ')' opt_collate opt_class
4306 {
4307 $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(")"),$4,$5);
4308 }
4309 ;
4310
4311
4312 table_access_method_clause:
4313 USING name
4314 {
4315 $$ = cat_str(2,mm_strdup("using"),$2);
4316 }
4317 |
4318 {
4319 $$=EMPTY; }
4320 ;
4321
4322
4323 OptWith:
4324 WITH reloptions
4325 {
4326 $$ = cat_str(2,mm_strdup("with"),$2);
4327 }
4328 | WITHOUT OIDS
4329 {
4330 $$ = mm_strdup("without oids");
4331 }
4332 |
4333 {
4334 $$=EMPTY; }
4335 ;
4336
4337
4338 OnCommitOption:
4339 ON COMMIT DROP
4340 {
4341 $$ = mm_strdup("on commit drop");
4342 }
4343 | ON COMMIT DELETE_P ROWS
4344 {
4345 $$ = mm_strdup("on commit delete rows");
4346 }
4347 | ON COMMIT PRESERVE ROWS
4348 {
4349 $$ = mm_strdup("on commit preserve rows");
4350 }
4351 |
4352 {
4353 $$=EMPTY; }
4354 ;
4355
4356
4357 OptTableSpace:
4358 TABLESPACE name
4359 {
4360 $$ = cat_str(2,mm_strdup("tablespace"),$2);
4361 }
4362 |
4363 {
4364 $$=EMPTY; }
4365 ;
4366
4367
4368 OptConsTableSpace:
4369 USING INDEX TABLESPACE name
4370 {
4371 $$ = cat_str(2,mm_strdup("using index tablespace"),$4);
4372 }
4373 |
4374 {
4375 $$=EMPTY; }
4376 ;
4377
4378
4379 ExistingIndex:
4380 USING INDEX name
4381 {
4382 $$ = cat_str(2,mm_strdup("using index"),$3);
4383 }
4384 ;
4385
4386
4387 CreateStatsStmt:
4388 CREATE STATISTICS any_name opt_name_list ON stats_params FROM from_list
4389 {
4390 $$ = cat_str(7,mm_strdup("create statistics"),$3,$4,mm_strdup("on"),$6,mm_strdup("from"),$8);
4391 }
4392 | CREATE STATISTICS IF_P NOT EXISTS any_name opt_name_list ON stats_params FROM from_list
4393 {
4394 $$ = cat_str(7,mm_strdup("create statistics if not exists"),$6,$7,mm_strdup("on"),$9,mm_strdup("from"),$11);
4395 }
4396 ;
4397
4398
4399 stats_params:
4400 stats_param
4401 {
4402 $$ = $1;
4403 }
4404 | stats_params ',' stats_param
4405 {
4406 $$ = cat_str(3,$1,mm_strdup(","),$3);
4407 }
4408 ;
4409
4410
4411 stats_param:
4412 ColId
4413 {
4414 $$ = $1;
4415 }
4416 | func_expr_windowless
4417 {
4418 $$ = $1;
4419 }
4420 | '(' a_expr ')'
4421 {
4422 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
4423 }
4424 ;
4425
4426
4427 AlterStatsStmt:
4428 ALTER STATISTICS any_name SET STATISTICS SignedIconst
4429 {
4430 $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("set statistics"),$6);
4431 }
4432 | ALTER STATISTICS IF_P EXISTS any_name SET STATISTICS SignedIconst
4433 {
4434 $$ = cat_str(4,mm_strdup("alter statistics if exists"),$5,mm_strdup("set statistics"),$8);
4435 }
4436 ;
4437
4438
4439 create_as_target:
4440 qualified_name opt_column_list table_access_method_clause OptWith OnCommitOption OptTableSpace
4441 {
4442 $$ = cat_str(6,$1,$2,$3,$4,$5,$6);
4443 }
4444 ;
4445
4446
4447 opt_with_data:
4448 WITH DATA_P
4449 {
4450 $$ = mm_strdup("with data");
4451 }
4452 | WITH NO DATA_P
4453 {
4454 $$ = mm_strdup("with no data");
4455 }
4456 |
4457 {
4458 $$=EMPTY; }
4459 ;
4460
4461
4462 CreateMatViewStmt:
4463 CREATE OptNoLog MATERIALIZED VIEW create_mv_target AS SelectStmt opt_with_data
4464 {
4465 $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("materialized view"),$5,mm_strdup("as"),$7,$8);
4466 }
4467 | CREATE OptNoLog MATERIALIZED VIEW IF_P NOT EXISTS create_mv_target AS SelectStmt opt_with_data
4468 {
4469 $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("materialized view if not exists"),$8,mm_strdup("as"),$10,$11);
4470 }
4471 ;
4472
4473
4474 create_mv_target:
4475 qualified_name opt_column_list table_access_method_clause opt_reloptions OptTableSpace
4476 {
4477 $$ = cat_str(5,$1,$2,$3,$4,$5);
4478 }
4479 ;
4480
4481
4482 OptNoLog:
4483 UNLOGGED
4484 {
4485 $$ = mm_strdup("unlogged");
4486 }
4487 |
4488 {
4489 $$=EMPTY; }
4490 ;
4491
4492
4493 RefreshMatViewStmt:
4494 REFRESH MATERIALIZED VIEW opt_concurrently qualified_name opt_with_data
4495 {
4496 $$ = cat_str(4,mm_strdup("refresh materialized view"),$4,$5,$6);
4497 }
4498 ;
4499
4500
4501 CreateSeqStmt:
4502 CREATE OptTemp SEQUENCE qualified_name OptSeqOptList
4503 {
4504 $$ = cat_str(5,mm_strdup("create"),$2,mm_strdup("sequence"),$4,$5);
4505 }
4506 | CREATE OptTemp SEQUENCE IF_P NOT EXISTS qualified_name OptSeqOptList
4507 {
4508 $$ = cat_str(5,mm_strdup("create"),$2,mm_strdup("sequence if not exists"),$7,$8);
4509 }
4510 ;
4511
4512
4513 AlterSeqStmt:
4514 ALTER SEQUENCE qualified_name SeqOptList
4515 {
4516 $$ = cat_str(3,mm_strdup("alter sequence"),$3,$4);
4517 }
4518 | ALTER SEQUENCE IF_P EXISTS qualified_name SeqOptList
4519 {
4520 $$ = cat_str(3,mm_strdup("alter sequence if exists"),$5,$6);
4521 }
4522 ;
4523
4524
4525 OptSeqOptList:
4526 SeqOptList
4527 {
4528 $$ = $1;
4529 }
4530 |
4531 {
4532 $$=EMPTY; }
4533 ;
4534
4535
4536 OptParenthesizedSeqOptList:
4537 '(' SeqOptList ')'
4538 {
4539 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
4540 }
4541 |
4542 {
4543 $$=EMPTY; }
4544 ;
4545
4546
4547 SeqOptList:
4548 SeqOptElem
4549 {
4550 $$ = $1;
4551 }
4552 | SeqOptList SeqOptElem
4553 {
4554 $$ = cat_str(2,$1,$2);
4555 }
4556 ;
4557
4558
4559 SeqOptElem:
4560 AS SimpleTypename
4561 {
4562 $$ = cat_str(2,mm_strdup("as"),$2);
4563 }
4564 | CACHE NumericOnly
4565 {
4566 $$ = cat_str(2,mm_strdup("cache"),$2);
4567 }
4568 | CYCLE
4569 {
4570 $$ = mm_strdup("cycle");
4571 }
4572 | NO CYCLE
4573 {
4574 $$ = mm_strdup("no cycle");
4575 }
4576 | INCREMENT opt_by NumericOnly
4577 {
4578 $$ = cat_str(3,mm_strdup("increment"),$2,$3);
4579 }
4580 | MAXVALUE NumericOnly
4581 {
4582 $$ = cat_str(2,mm_strdup("maxvalue"),$2);
4583 }
4584 | MINVALUE NumericOnly
4585 {
4586 $$ = cat_str(2,mm_strdup("minvalue"),$2);
4587 }
4588 | NO MAXVALUE
4589 {
4590 $$ = mm_strdup("no maxvalue");
4591 }
4592 | NO MINVALUE
4593 {
4594 $$ = mm_strdup("no minvalue");
4595 }
4596 | OWNED BY any_name
4597 {
4598 $$ = cat_str(2,mm_strdup("owned by"),$3);
4599 }
4600 | SEQUENCE NAME_P any_name
4601 {
4602 $$ = cat_str(2,mm_strdup("sequence name"),$3);
4603 }
4604 | START opt_with NumericOnly
4605 {
4606 $$ = cat_str(3,mm_strdup("start"),$2,$3);
4607 }
4608 | RESTART
4609 {
4610 $$ = mm_strdup("restart");
4611 }
4612 | RESTART opt_with NumericOnly
4613 {
4614 $$ = cat_str(3,mm_strdup("restart"),$2,$3);
4615 }
4616 ;
4617
4618
4619 opt_by:
4620 BY
4621 {
4622 $$ = mm_strdup("by");
4623 }
4624 |
4625 {
4626 $$=EMPTY; }
4627 ;
4628
4629
4630 NumericOnly:
4631 ecpg_fconst
4632 {
4633 $$ = $1;
4634 }
4635 | '+' ecpg_fconst
4636 {
4637 $$ = cat_str(2,mm_strdup("+"),$2);
4638 }
4639 | '-' ecpg_fconst
4640 {
4641 $$ = cat_str(2,mm_strdup("-"),$2);
4642 }
4643 | SignedIconst
4644 {
4645 $$ = $1;
4646 }
4647 ;
4648
4649
4650 NumericOnly_list:
4651 NumericOnly
4652 {
4653 $$ = $1;
4654 }
4655 | NumericOnly_list ',' NumericOnly
4656 {
4657 $$ = cat_str(3,$1,mm_strdup(","),$3);
4658 }
4659 ;
4660
4661
4662 CreatePLangStmt:
4663 CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE name
4664 {
4665 $$ = cat_str(6,mm_strdup("create"),$2,$3,$4,mm_strdup("language"),$6);
4666 }
4667 | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE name HANDLER handler_name opt_inline_handler opt_validator
4668 {
4669 $$ = cat_str(10,mm_strdup("create"),$2,$3,$4,mm_strdup("language"),$6,mm_strdup("handler"),$8,$9,$10);
4670 }
4671 ;
4672
4673
4674 opt_trusted:
4675 TRUSTED
4676 {
4677 $$ = mm_strdup("trusted");
4678 }
4679 |
4680 {
4681 $$=EMPTY; }
4682 ;
4683
4684
4685 handler_name:
4686 name
4687 {
4688 $$ = $1;
4689 }
4690 | name attrs
4691 {
4692 $$ = cat_str(2,$1,$2);
4693 }
4694 ;
4695
4696
4697 opt_inline_handler:
4698 INLINE_P handler_name
4699 {
4700 $$ = cat_str(2,mm_strdup("inline"),$2);
4701 }
4702 |
4703 {
4704 $$=EMPTY; }
4705 ;
4706
4707
4708 validator_clause:
4709 VALIDATOR handler_name
4710 {
4711 $$ = cat_str(2,mm_strdup("validator"),$2);
4712 }
4713 | NO VALIDATOR
4714 {
4715 $$ = mm_strdup("no validator");
4716 }
4717 ;
4718
4719
4720 opt_validator:
4721 validator_clause
4722 {
4723 $$ = $1;
4724 }
4725 |
4726 {
4727 $$=EMPTY; }
4728 ;
4729
4730
4731 opt_procedural:
4732 PROCEDURAL
4733 {
4734 $$ = mm_strdup("procedural");
4735 }
4736 |
4737 {
4738 $$=EMPTY; }
4739 ;
4740
4741
4742 CreateTableSpaceStmt:
4743 CREATE TABLESPACE name OptTableSpaceOwner LOCATION ecpg_sconst opt_reloptions
4744 {
4745 $$ = cat_str(6,mm_strdup("create tablespace"),$3,$4,mm_strdup("location"),$6,$7);
4746 }
4747 ;
4748
4749
4750 OptTableSpaceOwner:
4751 OWNER RoleSpec
4752 {
4753 $$ = cat_str(2,mm_strdup("owner"),$2);
4754 }
4755 |
4756 {
4757 $$=EMPTY; }
4758 ;
4759
4760
4761 DropTableSpaceStmt:
4762 DROP TABLESPACE name
4763 {
4764 $$ = cat_str(2,mm_strdup("drop tablespace"),$3);
4765 }
4766 | DROP TABLESPACE IF_P EXISTS name
4767 {
4768 $$ = cat_str(2,mm_strdup("drop tablespace if exists"),$5);
4769 }
4770 ;
4771
4772
4773 CreateExtensionStmt:
4774 CREATE EXTENSION name opt_with create_extension_opt_list
4775 {
4776 $$ = cat_str(4,mm_strdup("create extension"),$3,$4,$5);
4777 }
4778 | CREATE EXTENSION IF_P NOT EXISTS name opt_with create_extension_opt_list
4779 {
4780 $$ = cat_str(4,mm_strdup("create extension if not exists"),$6,$7,$8);
4781 }
4782 ;
4783
4784
4785 create_extension_opt_list:
4786 create_extension_opt_list create_extension_opt_item
4787 {
4788 $$ = cat_str(2,$1,$2);
4789 }
4790 |
4791 {
4792 $$=EMPTY; }
4793 ;
4794
4795
4796 create_extension_opt_item:
4797 SCHEMA name
4798 {
4799 $$ = cat_str(2,mm_strdup("schema"),$2);
4800 }
4801 | VERSION_P NonReservedWord_or_Sconst
4802 {
4803 $$ = cat_str(2,mm_strdup("version"),$2);
4804 }
4805 | FROM NonReservedWord_or_Sconst
4806 {
4807 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
4808 $$ = cat_str(2,mm_strdup("from"),$2);
4809 }
4810 | CASCADE
4811 {
4812 $$ = mm_strdup("cascade");
4813 }
4814 ;
4815
4816
4817 AlterExtensionStmt:
4818 ALTER EXTENSION name UPDATE alter_extension_opt_list
4819 {
4820 $$ = cat_str(4,mm_strdup("alter extension"),$3,mm_strdup("update"),$5);
4821 }
4822 ;
4823
4824
4825 alter_extension_opt_list:
4826 alter_extension_opt_list alter_extension_opt_item
4827 {
4828 $$ = cat_str(2,$1,$2);
4829 }
4830 |
4831 {
4832 $$=EMPTY; }
4833 ;
4834
4835
4836 alter_extension_opt_item:
4837 TO NonReservedWord_or_Sconst
4838 {
4839 $$ = cat_str(2,mm_strdup("to"),$2);
4840 }
4841 ;
4842
4843
4844 AlterExtensionContentsStmt:
4845 ALTER EXTENSION name add_drop object_type_name name
4846 {
4847 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,$5,$6);
4848 }
4849 | ALTER EXTENSION name add_drop object_type_any_name any_name
4850 {
4851 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,$5,$6);
4852 }
4853 | ALTER EXTENSION name add_drop AGGREGATE aggregate_with_argtypes
4854 {
4855 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("aggregate"),$6);
4856 }
4857 | ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')'
4858 {
4859 $$ = cat_str(8,mm_strdup("alter extension"),$3,$4,mm_strdup("cast ("),$7,mm_strdup("as"),$9,mm_strdup(")"));
4860 }
4861 | ALTER EXTENSION name add_drop DOMAIN_P Typename
4862 {
4863 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("domain"),$6);
4864 }
4865 | ALTER EXTENSION name add_drop FUNCTION function_with_argtypes
4866 {
4867 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("function"),$6);
4868 }
4869 | ALTER EXTENSION name add_drop OPERATOR operator_with_argtypes
4870 {
4871 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("operator"),$6);
4872 }
4873 | ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING name
4874 {
4875 $$ = cat_str(7,mm_strdup("alter extension"),$3,$4,mm_strdup("operator class"),$7,mm_strdup("using"),$9);
4876 }
4877 | ALTER EXTENSION name add_drop OPERATOR FAMILY any_name USING name
4878 {
4879 $$ = cat_str(7,mm_strdup("alter extension"),$3,$4,mm_strdup("operator family"),$7,mm_strdup("using"),$9);
4880 }
4881 | ALTER EXTENSION name add_drop PROCEDURE function_with_argtypes
4882 {
4883 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("procedure"),$6);
4884 }
4885 | ALTER EXTENSION name add_drop ROUTINE function_with_argtypes
4886 {
4887 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("routine"),$6);
4888 }
4889 | ALTER EXTENSION name add_drop TRANSFORM FOR Typename LANGUAGE name
4890 {
4891 $$ = cat_str(7,mm_strdup("alter extension"),$3,$4,mm_strdup("transform for"),$7,mm_strdup("language"),$9);
4892 }
4893 | ALTER EXTENSION name add_drop TYPE_P Typename
4894 {
4895 $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("type"),$6);
4896 }
4897 ;
4898
4899
4900 CreateFdwStmt:
4901 CREATE FOREIGN DATA_P WRAPPER name opt_fdw_options create_generic_options
4902 {
4903 $$ = cat_str(4,mm_strdup("create foreign data wrapper"),$5,$6,$7);
4904 }
4905 ;
4906
4907
4908 fdw_option:
4909 HANDLER handler_name
4910 {
4911 $$ = cat_str(2,mm_strdup("handler"),$2);
4912 }
4913 | NO HANDLER
4914 {
4915 $$ = mm_strdup("no handler");
4916 }
4917 | VALIDATOR handler_name
4918 {
4919 $$ = cat_str(2,mm_strdup("validator"),$2);
4920 }
4921 | NO VALIDATOR
4922 {
4923 $$ = mm_strdup("no validator");
4924 }
4925 ;
4926
4927
4928 fdw_options:
4929 fdw_option
4930 {
4931 $$ = $1;
4932 }
4933 | fdw_options fdw_option
4934 {
4935 $$ = cat_str(2,$1,$2);
4936 }
4937 ;
4938
4939
4940 opt_fdw_options:
4941 fdw_options
4942 {
4943 $$ = $1;
4944 }
4945 |
4946 {
4947 $$=EMPTY; }
4948 ;
4949
4950
4951 AlterFdwStmt:
4952 ALTER FOREIGN DATA_P WRAPPER name opt_fdw_options alter_generic_options
4953 {
4954 $$ = cat_str(4,mm_strdup("alter foreign data wrapper"),$5,$6,$7);
4955 }
4956 | ALTER FOREIGN DATA_P WRAPPER name fdw_options
4957 {
4958 $$ = cat_str(3,mm_strdup("alter foreign data wrapper"),$5,$6);
4959 }
4960 ;
4961
4962
4963 create_generic_options:
4964 OPTIONS '(' generic_option_list ')'
4965 {
4966 $$ = cat_str(3,mm_strdup("options ("),$3,mm_strdup(")"));
4967 }
4968 |
4969 {
4970 $$=EMPTY; }
4971 ;
4972
4973
4974 generic_option_list:
4975 generic_option_elem
4976 {
4977 $$ = $1;
4978 }
4979 | generic_option_list ',' generic_option_elem
4980 {
4981 $$ = cat_str(3,$1,mm_strdup(","),$3);
4982 }
4983 ;
4984
4985
4986 alter_generic_options:
4987 OPTIONS '(' alter_generic_option_list ')'
4988 {
4989 $$ = cat_str(3,mm_strdup("options ("),$3,mm_strdup(")"));
4990 }
4991 ;
4992
4993
4994 alter_generic_option_list:
4995 alter_generic_option_elem
4996 {
4997 $$ = $1;
4998 }
4999 | alter_generic_option_list ',' alter_generic_option_elem
5000 {
5001 $$ = cat_str(3,$1,mm_strdup(","),$3);
5002 }
5003 ;
5004
5005
5006 alter_generic_option_elem:
5007 generic_option_elem
5008 {
5009 $$ = $1;
5010 }
5011 | SET generic_option_elem
5012 {
5013 $$ = cat_str(2,mm_strdup("set"),$2);
5014 }
5015 | ADD_P generic_option_elem
5016 {
5017 $$ = cat_str(2,mm_strdup("add"),$2);
5018 }
5019 | DROP generic_option_name
5020 {
5021 $$ = cat_str(2,mm_strdup("drop"),$2);
5022 }
5023 ;
5024
5025
5026 generic_option_elem:
5027 generic_option_name generic_option_arg
5028 {
5029 $$ = cat_str(2,$1,$2);
5030 }
5031 ;
5032
5033
5034 generic_option_name:
5035 ColLabel
5036 {
5037 $$ = $1;
5038 }
5039 ;
5040
5041
5042 generic_option_arg:
5043 ecpg_sconst
5044 {
5045 $$ = $1;
5046 }
5047 ;
5048
5049
5050 CreateForeignServerStmt:
5051 CREATE SERVER name opt_type opt_foreign_server_version FOREIGN DATA_P WRAPPER name create_generic_options
5052 {
5053 $$ = cat_str(7,mm_strdup("create server"),$3,$4,$5,mm_strdup("foreign data wrapper"),$9,$10);
5054 }
5055 | CREATE SERVER IF_P NOT EXISTS name opt_type opt_foreign_server_version FOREIGN DATA_P WRAPPER name create_generic_options
5056 {
5057 $$ = cat_str(7,mm_strdup("create server if not exists"),$6,$7,$8,mm_strdup("foreign data wrapper"),$12,$13);
5058 }
5059 ;
5060
5061
5062 opt_type:
5063 TYPE_P ecpg_sconst
5064 {
5065 $$ = cat_str(2,mm_strdup("type"),$2);
5066 }
5067 |
5068 {
5069 $$=EMPTY; }
5070 ;
5071
5072
5073 foreign_server_version:
5074 VERSION_P ecpg_sconst
5075 {
5076 $$ = cat_str(2,mm_strdup("version"),$2);
5077 }
5078 | VERSION_P NULL_P
5079 {
5080 $$ = mm_strdup("version null");
5081 }
5082 ;
5083
5084
5085 opt_foreign_server_version:
5086 foreign_server_version
5087 {
5088 $$ = $1;
5089 }
5090 |
5091 {
5092 $$=EMPTY; }
5093 ;
5094
5095
5096 AlterForeignServerStmt:
5097 ALTER SERVER name foreign_server_version alter_generic_options
5098 {
5099 $$ = cat_str(4,mm_strdup("alter server"),$3,$4,$5);
5100 }
5101 | ALTER SERVER name foreign_server_version
5102 {
5103 $$ = cat_str(3,mm_strdup("alter server"),$3,$4);
5104 }
5105 | ALTER SERVER name alter_generic_options
5106 {
5107 $$ = cat_str(3,mm_strdup("alter server"),$3,$4);
5108 }
5109 ;
5110
5111
5112 CreateForeignTableStmt:
5113 CREATE FOREIGN TABLE qualified_name '(' OptTableElementList ')' OptInherit SERVER name create_generic_options
5114 {
5115 $$ = cat_str(9,mm_strdup("create foreign table"),$4,mm_strdup("("),$6,mm_strdup(")"),$8,mm_strdup("server"),$10,$11);
5116 }
5117 | CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name '(' OptTableElementList ')' OptInherit SERVER name create_generic_options
5118 {
5119 $$ = cat_str(9,mm_strdup("create foreign table if not exists"),$7,mm_strdup("("),$9,mm_strdup(")"),$11,mm_strdup("server"),$13,$14);
5120 }
5121 | CREATE FOREIGN TABLE qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec SERVER name create_generic_options
5122 {
5123 $$ = cat_str(9,mm_strdup("create foreign table"),$4,mm_strdup("partition of"),$7,$8,$9,mm_strdup("server"),$11,$12);
5124 }
5125 | CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec SERVER name create_generic_options
5126 {
5127 $$ = cat_str(9,mm_strdup("create foreign table if not exists"),$7,mm_strdup("partition of"),$10,$11,$12,mm_strdup("server"),$14,$15);
5128 }
5129 ;
5130
5131
5132 ImportForeignSchemaStmt:
5133 IMPORT_P FOREIGN SCHEMA name import_qualification FROM SERVER name INTO name create_generic_options
5134 {
5135 $$ = cat_str(8,mm_strdup("import foreign schema"),$4,$5,mm_strdup("from server"),$8,mm_strdup("into"),$10,$11);
5136 }
5137 ;
5138
5139
5140 import_qualification_type:
5141 LIMIT TO
5142 {
5143 $$ = mm_strdup("limit to");
5144 }
5145 | EXCEPT
5146 {
5147 $$ = mm_strdup("except");
5148 }
5149 ;
5150
5151
5152 import_qualification:
5153 import_qualification_type '(' relation_expr_list ')'
5154 {
5155 $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
5156 }
5157 |
5158 {
5159 $$=EMPTY; }
5160 ;
5161
5162
5163 CreateUserMappingStmt:
5164 CREATE USER MAPPING FOR auth_ident SERVER name create_generic_options
5165 {
5166 $$ = cat_str(5,mm_strdup("create user mapping for"),$5,mm_strdup("server"),$7,$8);
5167 }
5168 | CREATE USER MAPPING IF_P NOT EXISTS FOR auth_ident SERVER name create_generic_options
5169 {
5170 $$ = cat_str(5,mm_strdup("create user mapping if not exists for"),$8,mm_strdup("server"),$10,$11);
5171 }
5172 ;
5173
5174
5175 auth_ident:
5176 RoleSpec
5177 {
5178 $$ = $1;
5179 }
5180 | USER
5181 {
5182 $$ = mm_strdup("user");
5183 }
5184 ;
5185
5186
5187 DropUserMappingStmt:
5188 DROP USER MAPPING FOR auth_ident SERVER name
5189 {
5190 $$ = cat_str(4,mm_strdup("drop user mapping for"),$5,mm_strdup("server"),$7);
5191 }
5192 | DROP USER MAPPING IF_P EXISTS FOR auth_ident SERVER name
5193 {
5194 $$ = cat_str(4,mm_strdup("drop user mapping if exists for"),$7,mm_strdup("server"),$9);
5195 }
5196 ;
5197
5198
5199 AlterUserMappingStmt:
5200 ALTER USER MAPPING FOR auth_ident SERVER name alter_generic_options
5201 {
5202 $$ = cat_str(5,mm_strdup("alter user mapping for"),$5,mm_strdup("server"),$7,$8);
5203 }
5204 ;
5205
5206
5207 CreatePolicyStmt:
5208 CREATE POLICY name ON qualified_name RowSecurityDefaultPermissive RowSecurityDefaultForCmd RowSecurityDefaultToRole RowSecurityOptionalExpr RowSecurityOptionalWithCheck
5209 {
5210 $$ = cat_str(9,mm_strdup("create policy"),$3,mm_strdup("on"),$5,$6,$7,$8,$9,$10);
5211 }
5212 ;
5213
5214
5215 AlterPolicyStmt:
5216 ALTER POLICY name ON qualified_name RowSecurityOptionalToRole RowSecurityOptionalExpr RowSecurityOptionalWithCheck
5217 {
5218 $$ = cat_str(7,mm_strdup("alter policy"),$3,mm_strdup("on"),$5,$6,$7,$8);
5219 }
5220 ;
5221
5222
5223 RowSecurityOptionalExpr:
5224 USING '(' a_expr ')'
5225 {
5226 $$ = cat_str(3,mm_strdup("using ("),$3,mm_strdup(")"));
5227 }
5228 |
5229 {
5230 $$=EMPTY; }
5231 ;
5232
5233
5234 RowSecurityOptionalWithCheck:
5235 WITH CHECK '(' a_expr ')'
5236 {
5237 $$ = cat_str(3,mm_strdup("with check ("),$4,mm_strdup(")"));
5238 }
5239 |
5240 {
5241 $$=EMPTY; }
5242 ;
5243
5244
5245 RowSecurityDefaultToRole:
5246 TO role_list
5247 {
5248 $$ = cat_str(2,mm_strdup("to"),$2);
5249 }
5250 |
5251 {
5252 $$=EMPTY; }
5253 ;
5254
5255
5256 RowSecurityOptionalToRole:
5257 TO role_list
5258 {
5259 $$ = cat_str(2,mm_strdup("to"),$2);
5260 }
5261 |
5262 {
5263 $$=EMPTY; }
5264 ;
5265
5266
5267 RowSecurityDefaultPermissive:
5268 AS ecpg_ident
5269 {
5270 $$ = cat_str(2,mm_strdup("as"),$2);
5271 }
5272 |
5273 {
5274 $$=EMPTY; }
5275 ;
5276
5277
5278 RowSecurityDefaultForCmd:
5279 FOR row_security_cmd
5280 {
5281 $$ = cat_str(2,mm_strdup("for"),$2);
5282 }
5283 |
5284 {
5285 $$=EMPTY; }
5286 ;
5287
5288
5289 row_security_cmd:
5290 ALL
5291 {
5292 $$ = mm_strdup("all");
5293 }
5294 | SELECT
5295 {
5296 $$ = mm_strdup("select");
5297 }
5298 | INSERT
5299 {
5300 $$ = mm_strdup("insert");
5301 }
5302 | UPDATE
5303 {
5304 $$ = mm_strdup("update");
5305 }
5306 | DELETE_P
5307 {
5308 $$ = mm_strdup("delete");
5309 }
5310 ;
5311
5312
5313 CreateAmStmt:
5314 CREATE ACCESS METHOD name TYPE_P am_type HANDLER handler_name
5315 {
5316 $$ = cat_str(6,mm_strdup("create access method"),$4,mm_strdup("type"),$6,mm_strdup("handler"),$8);
5317 }
5318 ;
5319
5320
5321 am_type:
5322 INDEX
5323 {
5324 $$ = mm_strdup("index");
5325 }
5326 | TABLE
5327 {
5328 $$ = mm_strdup("table");
5329 }
5330 ;
5331
5332
5333 CreateTrigStmt:
5334 CREATE opt_or_replace TRIGGER name TriggerActionTime TriggerEvents ON qualified_name TriggerReferencing TriggerForSpec TriggerWhen EXECUTE FUNCTION_or_PROCEDURE func_name '(' TriggerFuncArgs ')'
5335 {
5336 $$ = cat_str(17,mm_strdup("create"),$2,mm_strdup("trigger"),$4,$5,$6,mm_strdup("on"),$8,$9,$10,$11,mm_strdup("execute"),$13,$14,mm_strdup("("),$16,mm_strdup(")"));
5337 }
5338 | CREATE opt_or_replace CONSTRAINT TRIGGER name AFTER TriggerEvents ON qualified_name OptConstrFromTable ConstraintAttributeSpec FOR EACH ROW TriggerWhen EXECUTE FUNCTION_or_PROCEDURE func_name '(' TriggerFuncArgs ')'
5339 {
5340 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
5341 $$ = cat_str(18,mm_strdup("create"),$2,mm_strdup("constraint trigger"),$5,mm_strdup("after"),$7,mm_strdup("on"),$9,$10,$11,mm_strdup("for each row"),$15,mm_strdup("execute"),$17,$18,mm_strdup("("),$20,mm_strdup(")"));
5342 }
5343 ;
5344
5345
5346 TriggerActionTime:
5347 BEFORE
5348 {
5349 $$ = mm_strdup("before");
5350 }
5351 | AFTER
5352 {
5353 $$ = mm_strdup("after");
5354 }
5355 | INSTEAD OF
5356 {
5357 $$ = mm_strdup("instead of");
5358 }
5359 ;
5360
5361
5362 TriggerEvents:
5363 TriggerOneEvent
5364 {
5365 $$ = $1;
5366 }
5367 | TriggerEvents OR TriggerOneEvent
5368 {
5369 $$ = cat_str(3,$1,mm_strdup("or"),$3);
5370 }
5371 ;
5372
5373
5374 TriggerOneEvent:
5375 INSERT
5376 {
5377 $$ = mm_strdup("insert");
5378 }
5379 | DELETE_P
5380 {
5381 $$ = mm_strdup("delete");
5382 }
5383 | UPDATE
5384 {
5385 $$ = mm_strdup("update");
5386 }
5387 | UPDATE OF columnList
5388 {
5389 $$ = cat_str(2,mm_strdup("update of"),$3);
5390 }
5391 | TRUNCATE
5392 {
5393 $$ = mm_strdup("truncate");
5394 }
5395 ;
5396
5397
5398 TriggerReferencing:
5399 REFERENCING TriggerTransitions
5400 {
5401 $$ = cat_str(2,mm_strdup("referencing"),$2);
5402 }
5403 |
5404 {
5405 $$=EMPTY; }
5406 ;
5407
5408
5409 TriggerTransitions:
5410 TriggerTransition
5411 {
5412 $$ = $1;
5413 }
5414 | TriggerTransitions TriggerTransition
5415 {
5416 $$ = cat_str(2,$1,$2);
5417 }
5418 ;
5419
5420
5421 TriggerTransition:
5422 TransitionOldOrNew TransitionRowOrTable opt_as TransitionRelName
5423 {
5424 $$ = cat_str(4,$1,$2,$3,$4);
5425 }
5426 ;
5427
5428
5429 TransitionOldOrNew:
5430 NEW
5431 {
5432 $$ = mm_strdup("new");
5433 }
5434 | OLD
5435 {
5436 $$ = mm_strdup("old");
5437 }
5438 ;
5439
5440
5441 TransitionRowOrTable:
5442 TABLE
5443 {
5444 $$ = mm_strdup("table");
5445 }
5446 | ROW
5447 {
5448 $$ = mm_strdup("row");
5449 }
5450 ;
5451
5452
5453 TransitionRelName:
5454 ColId
5455 {
5456 $$ = $1;
5457 }
5458 ;
5459
5460
5461 TriggerForSpec:
5462 FOR TriggerForOptEach TriggerForType
5463 {
5464 $$ = cat_str(3,mm_strdup("for"),$2,$3);
5465 }
5466 |
5467 {
5468 $$=EMPTY; }
5469 ;
5470
5471
5472 TriggerForOptEach:
5473 EACH
5474 {
5475 $$ = mm_strdup("each");
5476 }
5477 |
5478 {
5479 $$=EMPTY; }
5480 ;
5481
5482
5483 TriggerForType:
5484 ROW
5485 {
5486 $$ = mm_strdup("row");
5487 }
5488 | STATEMENT
5489 {
5490 $$ = mm_strdup("statement");
5491 }
5492 ;
5493
5494
5495 TriggerWhen:
5496 WHEN '(' a_expr ')'
5497 {
5498 $$ = cat_str(3,mm_strdup("when ("),$3,mm_strdup(")"));
5499 }
5500 |
5501 {
5502 $$=EMPTY; }
5503 ;
5504
5505
5506 FUNCTION_or_PROCEDURE:
5507 FUNCTION
5508 {
5509 $$ = mm_strdup("function");
5510 }
5511 | PROCEDURE
5512 {
5513 $$ = mm_strdup("procedure");
5514 }
5515 ;
5516
5517
5518 TriggerFuncArgs:
5519 TriggerFuncArg
5520 {
5521 $$ = $1;
5522 }
5523 | TriggerFuncArgs ',' TriggerFuncArg
5524 {
5525 $$ = cat_str(3,$1,mm_strdup(","),$3);
5526 }
5527 |
5528 {
5529 $$=EMPTY; }
5530 ;
5531
5532
5533 TriggerFuncArg:
5534 Iconst
5535 {
5536 $$ = $1;
5537 }
5538 | ecpg_fconst
5539 {
5540 $$ = $1;
5541 }
5542 | ecpg_sconst
5543 {
5544 $$ = $1;
5545 }
5546 | ColLabel
5547 {
5548 $$ = $1;
5549 }
5550 ;
5551
5552
5553 OptConstrFromTable:
5554 FROM qualified_name
5555 {
5556 $$ = cat_str(2,mm_strdup("from"),$2);
5557 }
5558 |
5559 {
5560 $$=EMPTY; }
5561 ;
5562
5563
5564 ConstraintAttributeSpec:
5565
5566 {
5567 $$=EMPTY; }
5568 | ConstraintAttributeSpec ConstraintAttributeElem
5569 {
5570 $$ = cat_str(2,$1,$2);
5571 }
5572 ;
5573
5574
5575 ConstraintAttributeElem:
5576 NOT DEFERRABLE
5577 {
5578 $$ = mm_strdup("not deferrable");
5579 }
5580 | DEFERRABLE
5581 {
5582 $$ = mm_strdup("deferrable");
5583 }
5584 | INITIALLY IMMEDIATE
5585 {
5586 $$ = mm_strdup("initially immediate");
5587 }
5588 | INITIALLY DEFERRED
5589 {
5590 $$ = mm_strdup("initially deferred");
5591 }
5592 | NOT VALID
5593 {
5594 $$ = mm_strdup("not valid");
5595 }
5596 | NO INHERIT
5597 {
5598 $$ = mm_strdup("no inherit");
5599 }
5600 ;
5601
5602
5603 CreateEventTrigStmt:
5604 CREATE EVENT TRIGGER name ON ColLabel EXECUTE FUNCTION_or_PROCEDURE func_name '(' ')'
5605 {
5606 $$ = cat_str(8,mm_strdup("create event trigger"),$4,mm_strdup("on"),$6,mm_strdup("execute"),$8,$9,mm_strdup("( )"));
5607 }
5608 | CREATE EVENT TRIGGER name ON ColLabel WHEN event_trigger_when_list EXECUTE FUNCTION_or_PROCEDURE func_name '(' ')'
5609 {
5610 $$ = cat_str(10,mm_strdup("create event trigger"),$4,mm_strdup("on"),$6,mm_strdup("when"),$8,mm_strdup("execute"),$10,$11,mm_strdup("( )"));
5611 }
5612 ;
5613
5614
5615 event_trigger_when_list:
5616 event_trigger_when_item
5617 {
5618 $$ = $1;
5619 }
5620 | event_trigger_when_list AND event_trigger_when_item
5621 {
5622 $$ = cat_str(3,$1,mm_strdup("and"),$3);
5623 }
5624 ;
5625
5626
5627 event_trigger_when_item:
5628 ColId IN_P '(' event_trigger_value_list ')'
5629 {
5630 $$ = cat_str(4,$1,mm_strdup("in ("),$4,mm_strdup(")"));
5631 }
5632 ;
5633
5634
5635 event_trigger_value_list:
5636 SCONST
5637 {
5638 $$ = mm_strdup("sconst");
5639 }
5640 | event_trigger_value_list ',' SCONST
5641 {
5642 $$ = cat_str(2,$1,mm_strdup(", sconst"));
5643 }
5644 ;
5645
5646
5647 AlterEventTrigStmt:
5648 ALTER EVENT TRIGGER name enable_trigger
5649 {
5650 $$ = cat_str(3,mm_strdup("alter event trigger"),$4,$5);
5651 }
5652 ;
5653
5654
5655 enable_trigger:
5656 ENABLE_P
5657 {
5658 $$ = mm_strdup("enable");
5659 }
5660 | ENABLE_P REPLICA
5661 {
5662 $$ = mm_strdup("enable replica");
5663 }
5664 | ENABLE_P ALWAYS
5665 {
5666 $$ = mm_strdup("enable always");
5667 }
5668 | DISABLE_P
5669 {
5670 $$ = mm_strdup("disable");
5671 }
5672 ;
5673
5674
5675 CreateAssertionStmt:
5676 CREATE ASSERTION any_name CHECK '(' a_expr ')' ConstraintAttributeSpec
5677 {
5678 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
5679 $$ = cat_str(6,mm_strdup("create assertion"),$3,mm_strdup("check ("),$6,mm_strdup(")"),$8);
5680 }
5681 ;
5682
5683
5684 DefineStmt:
5685 CREATE opt_or_replace AGGREGATE func_name aggr_args definition
5686 {
5687 $$ = cat_str(6,mm_strdup("create"),$2,mm_strdup("aggregate"),$4,$5,$6);
5688 }
5689 | CREATE opt_or_replace AGGREGATE func_name old_aggr_definition
5690 {
5691 $$ = cat_str(5,mm_strdup("create"),$2,mm_strdup("aggregate"),$4,$5);
5692 }
5693 | CREATE OPERATOR any_operator definition
5694 {
5695 $$ = cat_str(3,mm_strdup("create operator"),$3,$4);
5696 }
5697 | CREATE TYPE_P any_name definition
5698 {
5699 $$ = cat_str(3,mm_strdup("create type"),$3,$4);
5700 }
5701 | CREATE TYPE_P any_name
5702 {
5703 $$ = cat_str(2,mm_strdup("create type"),$3);
5704 }
5705 | CREATE TYPE_P any_name AS '(' OptTableFuncElementList ')'
5706 {
5707 $$ = cat_str(5,mm_strdup("create type"),$3,mm_strdup("as ("),$6,mm_strdup(")"));
5708 }
5709 | CREATE TYPE_P any_name AS ENUM_P '(' opt_enum_val_list ')'
5710 {
5711 $$ = cat_str(5,mm_strdup("create type"),$3,mm_strdup("as enum ("),$7,mm_strdup(")"));
5712 }
5713 | CREATE TYPE_P any_name AS RANGE definition
5714 {
5715 $$ = cat_str(4,mm_strdup("create type"),$3,mm_strdup("as range"),$6);
5716 }
5717 | CREATE TEXT_P SEARCH PARSER any_name definition
5718 {
5719 $$ = cat_str(3,mm_strdup("create text search parser"),$5,$6);
5720 }
5721 | CREATE TEXT_P SEARCH DICTIONARY any_name definition
5722 {
5723 $$ = cat_str(3,mm_strdup("create text search dictionary"),$5,$6);
5724 }
5725 | CREATE TEXT_P SEARCH TEMPLATE any_name definition
5726 {
5727 $$ = cat_str(3,mm_strdup("create text search template"),$5,$6);
5728 }
5729 | CREATE TEXT_P SEARCH CONFIGURATION any_name definition
5730 {
5731 $$ = cat_str(3,mm_strdup("create text search configuration"),$5,$6);
5732 }
5733 | CREATE COLLATION any_name definition
5734 {
5735 $$ = cat_str(3,mm_strdup("create collation"),$3,$4);
5736 }
5737 | CREATE COLLATION IF_P NOT EXISTS any_name definition
5738 {
5739 $$ = cat_str(3,mm_strdup("create collation if not exists"),$6,$7);
5740 }
5741 | CREATE COLLATION any_name FROM any_name
5742 {
5743 $$ = cat_str(4,mm_strdup("create collation"),$3,mm_strdup("from"),$5);
5744 }
5745 | CREATE COLLATION IF_P NOT EXISTS any_name FROM any_name
5746 {
5747 $$ = cat_str(4,mm_strdup("create collation if not exists"),$6,mm_strdup("from"),$8);
5748 }
5749 ;
5750
5751
5752 definition:
5753 '(' def_list ')'
5754 {
5755 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
5756 }
5757 ;
5758
5759
5760 def_list:
5761 def_elem
5762 {
5763 $$ = $1;
5764 }
5765 | def_list ',' def_elem
5766 {
5767 $$ = cat_str(3,$1,mm_strdup(","),$3);
5768 }
5769 ;
5770
5771
5772 def_elem:
5773 ColLabel '=' def_arg
5774 {
5775 $$ = cat_str(3,$1,mm_strdup("="),$3);
5776 }
5777 | ColLabel
5778 {
5779 $$ = $1;
5780 }
5781 ;
5782
5783
5784 def_arg:
5785 func_type
5786 {
5787 $$ = $1;
5788 }
5789 | reserved_keyword
5790 {
5791 $$ = $1;
5792 }
5793 | qual_all_Op
5794 {
5795 $$ = $1;
5796 }
5797 | NumericOnly
5798 {
5799 $$ = $1;
5800 }
5801 | ecpg_sconst
5802 {
5803 $$ = $1;
5804 }
5805 | NONE
5806 {
5807 $$ = mm_strdup("none");
5808 }
5809 ;
5810
5811
5812 old_aggr_definition:
5813 '(' old_aggr_list ')'
5814 {
5815 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
5816 }
5817 ;
5818
5819
5820 old_aggr_list:
5821 old_aggr_elem
5822 {
5823 $$ = $1;
5824 }
5825 | old_aggr_list ',' old_aggr_elem
5826 {
5827 $$ = cat_str(3,$1,mm_strdup(","),$3);
5828 }
5829 ;
5830
5831
5832 old_aggr_elem:
5833 ecpg_ident '=' def_arg
5834 {
5835 $$ = cat_str(3,$1,mm_strdup("="),$3);
5836 }
5837 ;
5838
5839
5840 opt_enum_val_list:
5841 enum_val_list
5842 {
5843 $$ = $1;
5844 }
5845 |
5846 {
5847 $$=EMPTY; }
5848 ;
5849
5850
5851 enum_val_list:
5852 ecpg_sconst
5853 {
5854 $$ = $1;
5855 }
5856 | enum_val_list ',' ecpg_sconst
5857 {
5858 $$ = cat_str(3,$1,mm_strdup(","),$3);
5859 }
5860 ;
5861
5862
5863 AlterEnumStmt:
5864 ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst
5865 {
5866 $$ = cat_str(5,mm_strdup("alter type"),$3,mm_strdup("add value"),$6,$7);
5867 }
5868 | ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst BEFORE ecpg_sconst
5869 {
5870 $$ = cat_str(7,mm_strdup("alter type"),$3,mm_strdup("add value"),$6,$7,mm_strdup("before"),$9);
5871 }
5872 | ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst AFTER ecpg_sconst
5873 {
5874 $$ = cat_str(7,mm_strdup("alter type"),$3,mm_strdup("add value"),$6,$7,mm_strdup("after"),$9);
5875 }
5876 | ALTER TYPE_P any_name RENAME VALUE_P ecpg_sconst TO ecpg_sconst
5877 {
5878 $$ = cat_str(6,mm_strdup("alter type"),$3,mm_strdup("rename value"),$6,mm_strdup("to"),$8);
5879 }
5880 ;
5881
5882
5883 opt_if_not_exists:
5884 IF_P NOT EXISTS
5885 {
5886 $$ = mm_strdup("if not exists");
5887 }
5888 |
5889 {
5890 $$=EMPTY; }
5891 ;
5892
5893
5894 CreateOpClassStmt:
5895 CREATE OPERATOR CLASS any_name opt_default FOR TYPE_P Typename USING name opt_opfamily AS opclass_item_list
5896 {
5897 $$ = cat_str(10,mm_strdup("create operator class"),$4,$5,mm_strdup("for type"),$8,mm_strdup("using"),$10,$11,mm_strdup("as"),$13);
5898 }
5899 ;
5900
5901
5902 opclass_item_list:
5903 opclass_item
5904 {
5905 $$ = $1;
5906 }
5907 | opclass_item_list ',' opclass_item
5908 {
5909 $$ = cat_str(3,$1,mm_strdup(","),$3);
5910 }
5911 ;
5912
5913
5914 opclass_item:
5915 OPERATOR Iconst any_operator opclass_purpose opt_recheck
5916 {
5917 $$ = cat_str(5,mm_strdup("operator"),$2,$3,$4,$5);
5918 }
5919 | OPERATOR Iconst operator_with_argtypes opclass_purpose opt_recheck
5920 {
5921 $$ = cat_str(5,mm_strdup("operator"),$2,$3,$4,$5);
5922 }
5923 | FUNCTION Iconst function_with_argtypes
5924 {
5925 $$ = cat_str(3,mm_strdup("function"),$2,$3);
5926 }
5927 | FUNCTION Iconst '(' type_list ')' function_with_argtypes
5928 {
5929 $$ = cat_str(6,mm_strdup("function"),$2,mm_strdup("("),$4,mm_strdup(")"),$6);
5930 }
5931 | STORAGE Typename
5932 {
5933 $$ = cat_str(2,mm_strdup("storage"),$2);
5934 }
5935 ;
5936
5937
5938 opt_default:
5939 DEFAULT
5940 {
5941 $$ = mm_strdup("default");
5942 }
5943 |
5944 {
5945 $$=EMPTY; }
5946 ;
5947
5948
5949 opt_opfamily:
5950 FAMILY any_name
5951 {
5952 $$ = cat_str(2,mm_strdup("family"),$2);
5953 }
5954 |
5955 {
5956 $$=EMPTY; }
5957 ;
5958
5959
5960 opclass_purpose:
5961 FOR SEARCH
5962 {
5963 $$ = mm_strdup("for search");
5964 }
5965 | FOR ORDER BY any_name
5966 {
5967 $$ = cat_str(2,mm_strdup("for order by"),$4);
5968 }
5969 |
5970 {
5971 $$=EMPTY; }
5972 ;
5973
5974
5975 opt_recheck:
5976 RECHECK
5977 {
5978 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
5979 $$ = mm_strdup("recheck");
5980 }
5981 |
5982 {
5983 $$=EMPTY; }
5984 ;
5985
5986
5987 CreateOpFamilyStmt:
5988 CREATE OPERATOR FAMILY any_name USING name
5989 {
5990 $$ = cat_str(4,mm_strdup("create operator family"),$4,mm_strdup("using"),$6);
5991 }
5992 ;
5993
5994
5995 AlterOpFamilyStmt:
5996 ALTER OPERATOR FAMILY any_name USING name ADD_P opclass_item_list
5997 {
5998 $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("add"),$8);
5999 }
6000 | ALTER OPERATOR FAMILY any_name USING name DROP opclass_drop_list
6001 {
6002 $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("drop"),$8);
6003 }
6004 ;
6005
6006
6007 opclass_drop_list:
6008 opclass_drop
6009 {
6010 $$ = $1;
6011 }
6012 | opclass_drop_list ',' opclass_drop
6013 {
6014 $$ = cat_str(3,$1,mm_strdup(","),$3);
6015 }
6016 ;
6017
6018
6019 opclass_drop:
6020 OPERATOR Iconst '(' type_list ')'
6021 {
6022 $$ = cat_str(5,mm_strdup("operator"),$2,mm_strdup("("),$4,mm_strdup(")"));
6023 }
6024 | FUNCTION Iconst '(' type_list ')'
6025 {
6026 $$ = cat_str(5,mm_strdup("function"),$2,mm_strdup("("),$4,mm_strdup(")"));
6027 }
6028 ;
6029
6030
6031 DropOpClassStmt:
6032 DROP OPERATOR CLASS any_name USING name opt_drop_behavior
6033 {
6034 $$ = cat_str(5,mm_strdup("drop operator class"),$4,mm_strdup("using"),$6,$7);
6035 }
6036 | DROP OPERATOR CLASS IF_P EXISTS any_name USING name opt_drop_behavior
6037 {
6038 $$ = cat_str(5,mm_strdup("drop operator class if exists"),$6,mm_strdup("using"),$8,$9);
6039 }
6040 ;
6041
6042
6043 DropOpFamilyStmt:
6044 DROP OPERATOR FAMILY any_name USING name opt_drop_behavior
6045 {
6046 $$ = cat_str(5,mm_strdup("drop operator family"),$4,mm_strdup("using"),$6,$7);
6047 }
6048 | DROP OPERATOR FAMILY IF_P EXISTS any_name USING name opt_drop_behavior
6049 {
6050 $$ = cat_str(5,mm_strdup("drop operator family if exists"),$6,mm_strdup("using"),$8,$9);
6051 }
6052 ;
6053
6054
6055 DropOwnedStmt:
6056 DROP OWNED BY role_list opt_drop_behavior
6057 {
6058 $$ = cat_str(3,mm_strdup("drop owned by"),$4,$5);
6059 }
6060 ;
6061
6062
6063 ReassignOwnedStmt:
6064 REASSIGN OWNED BY role_list TO RoleSpec
6065 {
6066 $$ = cat_str(4,mm_strdup("reassign owned by"),$4,mm_strdup("to"),$6);
6067 }
6068 ;
6069
6070
6071 DropStmt:
6072 DROP object_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
6073 {
6074 $$ = cat_str(5,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,$6);
6075 }
6076 | DROP object_type_any_name any_name_list opt_drop_behavior
6077 {
6078 $$ = cat_str(4,mm_strdup("drop"),$2,$3,$4);
6079 }
6080 | DROP drop_type_name IF_P EXISTS name_list opt_drop_behavior
6081 {
6082 $$ = cat_str(5,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,$6);
6083 }
6084 | DROP drop_type_name name_list opt_drop_behavior
6085 {
6086 $$ = cat_str(4,mm_strdup("drop"),$2,$3,$4);
6087 }
6088 | DROP object_type_name_on_any_name name ON any_name opt_drop_behavior
6089 {
6090 $$ = cat_str(6,mm_strdup("drop"),$2,$3,mm_strdup("on"),$5,$6);
6091 }
6092 | DROP object_type_name_on_any_name IF_P EXISTS name ON any_name opt_drop_behavior
6093 {
6094 $$ = cat_str(7,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,mm_strdup("on"),$7,$8);
6095 }
6096 | DROP TYPE_P type_name_list opt_drop_behavior
6097 {
6098 $$ = cat_str(3,mm_strdup("drop type"),$3,$4);
6099 }
6100 | DROP TYPE_P IF_P EXISTS type_name_list opt_drop_behavior
6101 {
6102 $$ = cat_str(3,mm_strdup("drop type if exists"),$5,$6);
6103 }
6104 | DROP DOMAIN_P type_name_list opt_drop_behavior
6105 {
6106 $$ = cat_str(3,mm_strdup("drop domain"),$3,$4);
6107 }
6108 | DROP DOMAIN_P IF_P EXISTS type_name_list opt_drop_behavior
6109 {
6110 $$ = cat_str(3,mm_strdup("drop domain if exists"),$5,$6);
6111 }
6112 | DROP INDEX CONCURRENTLY any_name_list opt_drop_behavior
6113 {
6114 $$ = cat_str(3,mm_strdup("drop index concurrently"),$4,$5);
6115 }
6116 | DROP INDEX CONCURRENTLY IF_P EXISTS any_name_list opt_drop_behavior
6117 {
6118 $$ = cat_str(3,mm_strdup("drop index concurrently if exists"),$6,$7);
6119 }
6120 ;
6121
6122
6123 object_type_any_name:
6124 TABLE
6125 {
6126 $$ = mm_strdup("table");
6127 }
6128 | SEQUENCE
6129 {
6130 $$ = mm_strdup("sequence");
6131 }
6132 | VIEW
6133 {
6134 $$ = mm_strdup("view");
6135 }
6136 | MATERIALIZED VIEW
6137 {
6138 $$ = mm_strdup("materialized view");
6139 }
6140 | INDEX
6141 {
6142 $$ = mm_strdup("index");
6143 }
6144 | FOREIGN TABLE
6145 {
6146 $$ = mm_strdup("foreign table");
6147 }
6148 | COLLATION
6149 {
6150 $$ = mm_strdup("collation");
6151 }
6152 | CONVERSION_P
6153 {
6154 $$ = mm_strdup("conversion");
6155 }
6156 | STATISTICS
6157 {
6158 $$ = mm_strdup("statistics");
6159 }
6160 | TEXT_P SEARCH PARSER
6161 {
6162 $$ = mm_strdup("text search parser");
6163 }
6164 | TEXT_P SEARCH DICTIONARY
6165 {
6166 $$ = mm_strdup("text search dictionary");
6167 }
6168 | TEXT_P SEARCH TEMPLATE
6169 {
6170 $$ = mm_strdup("text search template");
6171 }
6172 | TEXT_P SEARCH CONFIGURATION
6173 {
6174 $$ = mm_strdup("text search configuration");
6175 }
6176 ;
6177
6178
6179 object_type_name:
6180 drop_type_name
6181 {
6182 $$ = $1;
6183 }
6184 | DATABASE
6185 {
6186 $$ = mm_strdup("database");
6187 }
6188 | ROLE
6189 {
6190 $$ = mm_strdup("role");
6191 }
6192 | SUBSCRIPTION
6193 {
6194 $$ = mm_strdup("subscription");
6195 }
6196 | TABLESPACE
6197 {
6198 $$ = mm_strdup("tablespace");
6199 }
6200 ;
6201
6202
6203 drop_type_name:
6204 ACCESS METHOD
6205 {
6206 $$ = mm_strdup("access method");
6207 }
6208 | EVENT TRIGGER
6209 {
6210 $$ = mm_strdup("event trigger");
6211 }
6212 | EXTENSION
6213 {
6214 $$ = mm_strdup("extension");
6215 }
6216 | FOREIGN DATA_P WRAPPER
6217 {
6218 $$ = mm_strdup("foreign data wrapper");
6219 }
6220 | opt_procedural LANGUAGE
6221 {
6222 $$ = cat_str(2,$1,mm_strdup("language"));
6223 }
6224 | PUBLICATION
6225 {
6226 $$ = mm_strdup("publication");
6227 }
6228 | SCHEMA
6229 {
6230 $$ = mm_strdup("schema");
6231 }
6232 | SERVER
6233 {
6234 $$ = mm_strdup("server");
6235 }
6236 ;
6237
6238
6239 object_type_name_on_any_name:
6240 POLICY
6241 {
6242 $$ = mm_strdup("policy");
6243 }
6244 | RULE
6245 {
6246 $$ = mm_strdup("rule");
6247 }
6248 | TRIGGER
6249 {
6250 $$ = mm_strdup("trigger");
6251 }
6252 ;
6253
6254
6255 any_name_list:
6256 any_name
6257 {
6258 $$ = $1;
6259 }
6260 | any_name_list ',' any_name
6261 {
6262 $$ = cat_str(3,$1,mm_strdup(","),$3);
6263 }
6264 ;
6265
6266
6267 any_name:
6268 ColId
6269 {
6270 $$ = $1;
6271 }
6272 | ColId attrs
6273 {
6274 $$ = cat_str(2,$1,$2);
6275 }
6276 ;
6277
6278
6279 attrs:
6280 '.' attr_name
6281 {
6282 $$ = cat_str(2,mm_strdup("."),$2);
6283 }
6284 | attrs '.' attr_name
6285 {
6286 $$ = cat_str(3,$1,mm_strdup("."),$3);
6287 }
6288 ;
6289
6290
6291 type_name_list:
6292 Typename
6293 {
6294 $$ = $1;
6295 }
6296 | type_name_list ',' Typename
6297 {
6298 $$ = cat_str(3,$1,mm_strdup(","),$3);
6299 }
6300 ;
6301
6302
6303 TruncateStmt:
6304 TRUNCATE opt_table relation_expr_list opt_restart_seqs opt_drop_behavior
6305 {
6306 $$ = cat_str(5,mm_strdup("truncate"),$2,$3,$4,$5);
6307 }
6308 ;
6309
6310
6311 opt_restart_seqs:
6312 CONTINUE_P IDENTITY_P
6313 {
6314 $$ = mm_strdup("continue identity");
6315 }
6316 | RESTART IDENTITY_P
6317 {
6318 $$ = mm_strdup("restart identity");
6319 }
6320 |
6321 {
6322 $$=EMPTY; }
6323 ;
6324
6325
6326 CommentStmt:
6327 COMMENT ON object_type_any_name any_name IS comment_text
6328 {
6329 $$ = cat_str(5,mm_strdup("comment on"),$3,$4,mm_strdup("is"),$6);
6330 }
6331 | COMMENT ON COLUMN any_name IS comment_text
6332 {
6333 $$ = cat_str(4,mm_strdup("comment on column"),$4,mm_strdup("is"),$6);
6334 }
6335 | COMMENT ON object_type_name name IS comment_text
6336 {
6337 $$ = cat_str(5,mm_strdup("comment on"),$3,$4,mm_strdup("is"),$6);
6338 }
6339 | COMMENT ON TYPE_P Typename IS comment_text
6340 {
6341 $$ = cat_str(4,mm_strdup("comment on type"),$4,mm_strdup("is"),$6);
6342 }
6343 | COMMENT ON DOMAIN_P Typename IS comment_text
6344 {
6345 $$ = cat_str(4,mm_strdup("comment on domain"),$4,mm_strdup("is"),$6);
6346 }
6347 | COMMENT ON AGGREGATE aggregate_with_argtypes IS comment_text
6348 {
6349 $$ = cat_str(4,mm_strdup("comment on aggregate"),$4,mm_strdup("is"),$6);
6350 }
6351 | COMMENT ON FUNCTION function_with_argtypes IS comment_text
6352 {
6353 $$ = cat_str(4,mm_strdup("comment on function"),$4,mm_strdup("is"),$6);
6354 }
6355 | COMMENT ON OPERATOR operator_with_argtypes IS comment_text
6356 {
6357 $$ = cat_str(4,mm_strdup("comment on operator"),$4,mm_strdup("is"),$6);
6358 }
6359 | COMMENT ON CONSTRAINT name ON any_name IS comment_text
6360 {
6361 $$ = cat_str(6,mm_strdup("comment on constraint"),$4,mm_strdup("on"),$6,mm_strdup("is"),$8);
6362 }
6363 | COMMENT ON CONSTRAINT name ON DOMAIN_P any_name IS comment_text
6364 {
6365 $$ = cat_str(6,mm_strdup("comment on constraint"),$4,mm_strdup("on domain"),$7,mm_strdup("is"),$9);
6366 }
6367 | COMMENT ON object_type_name_on_any_name name ON any_name IS comment_text
6368 {
6369 $$ = cat_str(7,mm_strdup("comment on"),$3,$4,mm_strdup("on"),$6,mm_strdup("is"),$8);
6370 }
6371 | COMMENT ON PROCEDURE function_with_argtypes IS comment_text
6372 {
6373 $$ = cat_str(4,mm_strdup("comment on procedure"),$4,mm_strdup("is"),$6);
6374 }
6375 | COMMENT ON ROUTINE function_with_argtypes IS comment_text
6376 {
6377 $$ = cat_str(4,mm_strdup("comment on routine"),$4,mm_strdup("is"),$6);
6378 }
6379 | COMMENT ON TRANSFORM FOR Typename LANGUAGE name IS comment_text
6380 {
6381 $$ = cat_str(6,mm_strdup("comment on transform for"),$5,mm_strdup("language"),$7,mm_strdup("is"),$9);
6382 }
6383 | COMMENT ON OPERATOR CLASS any_name USING name IS comment_text
6384 {
6385 $$ = cat_str(6,mm_strdup("comment on operator class"),$5,mm_strdup("using"),$7,mm_strdup("is"),$9);
6386 }
6387 | COMMENT ON OPERATOR FAMILY any_name USING name IS comment_text
6388 {
6389 $$ = cat_str(6,mm_strdup("comment on operator family"),$5,mm_strdup("using"),$7,mm_strdup("is"),$9);
6390 }
6391 | COMMENT ON LARGE_P OBJECT_P NumericOnly IS comment_text
6392 {
6393 $$ = cat_str(4,mm_strdup("comment on large object"),$5,mm_strdup("is"),$7);
6394 }
6395 | COMMENT ON CAST '(' Typename AS Typename ')' IS comment_text
6396 {
6397 $$ = cat_str(6,mm_strdup("comment on cast ("),$5,mm_strdup("as"),$7,mm_strdup(") is"),$10);
6398 }
6399 ;
6400
6401
6402 comment_text:
6403 ecpg_sconst
6404 {
6405 $$ = $1;
6406 }
6407 | NULL_P
6408 {
6409 $$ = mm_strdup("null");
6410 }
6411 ;
6412
6413
6414 SecLabelStmt:
6415 SECURITY LABEL opt_provider ON object_type_any_name any_name IS security_label
6416 {
6417 $$ = cat_str(7,mm_strdup("security label"),$3,mm_strdup("on"),$5,$6,mm_strdup("is"),$8);
6418 }
6419 | SECURITY LABEL opt_provider ON COLUMN any_name IS security_label
6420 {
6421 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on column"),$6,mm_strdup("is"),$8);
6422 }
6423 | SECURITY LABEL opt_provider ON object_type_name name IS security_label
6424 {
6425 $$ = cat_str(7,mm_strdup("security label"),$3,mm_strdup("on"),$5,$6,mm_strdup("is"),$8);
6426 }
6427 | SECURITY LABEL opt_provider ON TYPE_P Typename IS security_label
6428 {
6429 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on type"),$6,mm_strdup("is"),$8);
6430 }
6431 | SECURITY LABEL opt_provider ON DOMAIN_P Typename IS security_label
6432 {
6433 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on domain"),$6,mm_strdup("is"),$8);
6434 }
6435 | SECURITY LABEL opt_provider ON AGGREGATE aggregate_with_argtypes IS security_label
6436 {
6437 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on aggregate"),$6,mm_strdup("is"),$8);
6438 }
6439 | SECURITY LABEL opt_provider ON FUNCTION function_with_argtypes IS security_label
6440 {
6441 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on function"),$6,mm_strdup("is"),$8);
6442 }
6443 | SECURITY LABEL opt_provider ON LARGE_P OBJECT_P NumericOnly IS security_label
6444 {
6445 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on large object"),$7,mm_strdup("is"),$9);
6446 }
6447 | SECURITY LABEL opt_provider ON PROCEDURE function_with_argtypes IS security_label
6448 {
6449 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on procedure"),$6,mm_strdup("is"),$8);
6450 }
6451 | SECURITY LABEL opt_provider ON ROUTINE function_with_argtypes IS security_label
6452 {
6453 $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on routine"),$6,mm_strdup("is"),$8);
6454 }
6455 ;
6456
6457
6458 opt_provider:
6459 FOR NonReservedWord_or_Sconst
6460 {
6461 $$ = cat_str(2,mm_strdup("for"),$2);
6462 }
6463 |
6464 {
6465 $$=EMPTY; }
6466 ;
6467
6468
6469 security_label:
6470 ecpg_sconst
6471 {
6472 $$ = $1;
6473 }
6474 | NULL_P
6475 {
6476 $$ = mm_strdup("null");
6477 }
6478 ;
6479
6480
6481 FetchStmt:
6482 FETCH fetch_args
6483 {
6484 $$ = cat_str(2,mm_strdup("fetch"),$2);
6485 }
6486 | MOVE fetch_args
6487 {
6488 $$ = cat_str(2,mm_strdup("move"),$2);
6489 }
6490 | FETCH fetch_args ecpg_fetch_into
6491 {
6492 $$ = cat2_str(mm_strdup("fetch"), $2);
6493 }
6494 | FETCH FORWARD cursor_name opt_ecpg_fetch_into
6495 {
6496 char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
6497 struct cursor *ptr = add_additional_variables($3, false);
6498 if (ptr -> connection)
6499 connection = mm_strdup(ptr -> connection);
6500
6501 $$ = cat_str(2, mm_strdup("fetch forward"), cursor_marker);
6502 }
6503 | FETCH FORWARD from_in cursor_name opt_ecpg_fetch_into
6504 {
6505 char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
6506 struct cursor *ptr = add_additional_variables($4, false);
6507 if (ptr -> connection)
6508 connection = mm_strdup(ptr -> connection);
6509
6510 $$ = cat_str(2, mm_strdup("fetch forward from"), cursor_marker);
6511 }
6512 | FETCH BACKWARD cursor_name opt_ecpg_fetch_into
6513 {
6514 char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
6515 struct cursor *ptr = add_additional_variables($3, false);
6516 if (ptr -> connection)
6517 connection = mm_strdup(ptr -> connection);
6518
6519 $$ = cat_str(2, mm_strdup("fetch backward"), cursor_marker);
6520 }
6521 | FETCH BACKWARD from_in cursor_name opt_ecpg_fetch_into
6522 {
6523 char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
6524 struct cursor *ptr = add_additional_variables($4, false);
6525 if (ptr -> connection)
6526 connection = mm_strdup(ptr -> connection);
6527
6528 $$ = cat_str(2, mm_strdup("fetch backward from"), cursor_marker);
6529 }
6530 | MOVE FORWARD cursor_name
6531 {
6532 char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
6533 struct cursor *ptr = add_additional_variables($3, false);
6534 if (ptr -> connection)
6535 connection = mm_strdup(ptr -> connection);
6536
6537 $$ = cat_str(2, mm_strdup("move forward"), cursor_marker);
6538 }
6539 | MOVE FORWARD from_in cursor_name
6540 {
6541 char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
6542 struct cursor *ptr = add_additional_variables($4, false);
6543 if (ptr -> connection)
6544 connection = mm_strdup(ptr -> connection);
6545
6546 $$ = cat_str(2, mm_strdup("move forward from"), cursor_marker);
6547 }
6548 | MOVE BACKWARD cursor_name
6549 {
6550 char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
6551 struct cursor *ptr = add_additional_variables($3, false);
6552 if (ptr -> connection)
6553 connection = mm_strdup(ptr -> connection);
6554
6555 $$ = cat_str(2, mm_strdup("move backward"), cursor_marker);
6556 }
6557 | MOVE BACKWARD from_in cursor_name
6558 {
6559 char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
6560 struct cursor *ptr = add_additional_variables($4, false);
6561 if (ptr -> connection)
6562 connection = mm_strdup(ptr -> connection);
6563
6564 $$ = cat_str(2, mm_strdup("move backward from"), cursor_marker);
6565 }
6566 ;
6567
6568
6569 fetch_args:
6570 cursor_name
6571 {
6572 struct cursor *ptr = add_additional_variables($1, false);
6573 if (ptr -> connection)
6574 connection = mm_strdup(ptr -> connection);
6575
6576 if ($1[0] == ':')
6577 {
6578 free($1);
6579 $1 = mm_strdup("$0");
6580 }
6581
6582 $$ = $1;
6583 }
6584 | from_in cursor_name
6585 {
6586 struct cursor *ptr = add_additional_variables($2, false);
6587 if (ptr -> connection)
6588 connection = mm_strdup(ptr -> connection);
6589
6590 if ($2[0] == ':')
6591 {
6592 free($2);
6593 $2 = mm_strdup("$0");
6594 }
6595
6596 $$ = cat_str(2,$1,$2);
6597 }
6598 | NEXT opt_from_in cursor_name
6599 {
6600 struct cursor *ptr = add_additional_variables($3, false);
6601 if (ptr -> connection)
6602 connection = mm_strdup(ptr -> connection);
6603
6604 if ($3[0] == ':')
6605 {
6606 free($3);
6607 $3 = mm_strdup("$0");
6608 }
6609
6610 $$ = cat_str(3,mm_strdup("next"),$2,$3);
6611 }
6612 | PRIOR opt_from_in cursor_name
6613 {
6614 struct cursor *ptr = add_additional_variables($3, false);
6615 if (ptr -> connection)
6616 connection = mm_strdup(ptr -> connection);
6617
6618 if ($3[0] == ':')
6619 {
6620 free($3);
6621 $3 = mm_strdup("$0");
6622 }
6623
6624 $$ = cat_str(3,mm_strdup("prior"),$2,$3);
6625 }
6626 | FIRST_P opt_from_in cursor_name
6627 {
6628 struct cursor *ptr = add_additional_variables($3, false);
6629 if (ptr -> connection)
6630 connection = mm_strdup(ptr -> connection);
6631
6632 if ($3[0] == ':')
6633 {
6634 free($3);
6635 $3 = mm_strdup("$0");
6636 }
6637
6638 $$ = cat_str(3,mm_strdup("first"),$2,$3);
6639 }
6640 | LAST_P opt_from_in cursor_name
6641 {
6642 struct cursor *ptr = add_additional_variables($3, false);
6643 if (ptr -> connection)
6644 connection = mm_strdup(ptr -> connection);
6645
6646 if ($3[0] == ':')
6647 {
6648 free($3);
6649 $3 = mm_strdup("$0");
6650 }
6651
6652 $$ = cat_str(3,mm_strdup("last"),$2,$3);
6653 }
6654 | ABSOLUTE_P SignedIconst opt_from_in cursor_name
6655 {
6656 struct cursor *ptr = add_additional_variables($4, false);
6657 if (ptr -> connection)
6658 connection = mm_strdup(ptr -> connection);
6659
6660 if ($4[0] == ':')
6661 {
6662 free($4);
6663 $4 = mm_strdup("$0");
6664 }
6665 if ($2[0] == '$')
6666 {
6667 free($2);
6668 $2 = mm_strdup("$0");
6669 }
6670
6671 $$ = cat_str(4,mm_strdup("absolute"),$2,$3,$4);
6672 }
6673 | RELATIVE_P SignedIconst opt_from_in cursor_name
6674 {
6675 struct cursor *ptr = add_additional_variables($4, false);
6676 if (ptr -> connection)
6677 connection = mm_strdup(ptr -> connection);
6678
6679 if ($4[0] == ':')
6680 {
6681 free($4);
6682 $4 = mm_strdup("$0");
6683 }
6684 if ($2[0] == '$')
6685 {
6686 free($2);
6687 $2 = mm_strdup("$0");
6688 }
6689
6690 $$ = cat_str(4,mm_strdup("relative"),$2,$3,$4);
6691 }
6692 | SignedIconst opt_from_in cursor_name
6693 {
6694 struct cursor *ptr = add_additional_variables($3, false);
6695 if (ptr -> connection)
6696 connection = mm_strdup(ptr -> connection);
6697
6698 if ($3[0] == ':')
6699 {
6700 free($3);
6701 $3 = mm_strdup("$0");
6702 }
6703 if ($1[0] == '$')
6704 {
6705 free($1);
6706 $1 = mm_strdup("$0");
6707 }
6708
6709 $$ = cat_str(3,$1,$2,$3);
6710 }
6711 | ALL opt_from_in cursor_name
6712 {
6713 struct cursor *ptr = add_additional_variables($3, false);
6714 if (ptr -> connection)
6715 connection = mm_strdup(ptr -> connection);
6716
6717 if ($3[0] == ':')
6718 {
6719 free($3);
6720 $3 = mm_strdup("$0");
6721 }
6722
6723 $$ = cat_str(3,mm_strdup("all"),$2,$3);
6724 }
6725 | FORWARD SignedIconst opt_from_in cursor_name
6726 {
6727 struct cursor *ptr = add_additional_variables($4, false);
6728 if (ptr -> connection)
6729 connection = mm_strdup(ptr -> connection);
6730
6731 if ($4[0] == ':')
6732 {
6733 free($4);
6734 $4 = mm_strdup("$0");
6735 }
6736 if ($2[0] == '$')
6737 {
6738 free($2);
6739 $2 = mm_strdup("$0");
6740 }
6741
6742 $$ = cat_str(4,mm_strdup("forward"),$2,$3,$4);
6743 }
6744 | FORWARD ALL opt_from_in cursor_name
6745 {
6746 struct cursor *ptr = add_additional_variables($4, false);
6747 if (ptr -> connection)
6748 connection = mm_strdup(ptr -> connection);
6749
6750 if ($4[0] == ':')
6751 {
6752 free($4);
6753 $4 = mm_strdup("$0");
6754 }
6755
6756 $$ = cat_str(3,mm_strdup("forward all"),$3,$4);
6757 }
6758 | BACKWARD SignedIconst opt_from_in cursor_name
6759 {
6760 struct cursor *ptr = add_additional_variables($4, false);
6761 if (ptr -> connection)
6762 connection = mm_strdup(ptr -> connection);
6763
6764 if ($4[0] == ':')
6765 {
6766 free($4);
6767 $4 = mm_strdup("$0");
6768 }
6769 if ($2[0] == '$')
6770 {
6771 free($2);
6772 $2 = mm_strdup("$0");
6773 }
6774
6775 $$ = cat_str(4,mm_strdup("backward"),$2,$3,$4);
6776 }
6777 | BACKWARD ALL opt_from_in cursor_name
6778 {
6779 struct cursor *ptr = add_additional_variables($4, false);
6780 if (ptr -> connection)
6781 connection = mm_strdup(ptr -> connection);
6782
6783 if ($4[0] == ':')
6784 {
6785 free($4);
6786 $4 = mm_strdup("$0");
6787 }
6788
6789 $$ = cat_str(3,mm_strdup("backward all"),$3,$4);
6790 }
6791 ;
6792
6793
6794 from_in:
6795 FROM
6796 {
6797 $$ = mm_strdup("from");
6798 }
6799 | IN_P
6800 {
6801 $$ = mm_strdup("in");
6802 }
6803 ;
6804
6805
6806 opt_from_in:
6807 from_in
6808 {
6809 $$ = $1;
6810 }
6811 |
6812 {
6813 $$=EMPTY; }
6814 ;
6815
6816
6817 GrantStmt:
6818 GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_option opt_granted_by
6819 {
6820 $$ = cat_str(8,mm_strdup("grant"),$2,mm_strdup("on"),$4,mm_strdup("to"),$6,$7,$8);
6821 }
6822 ;
6823
6824
6825 RevokeStmt:
6826 REVOKE privileges ON privilege_target FROM grantee_list opt_granted_by opt_drop_behavior
6827 {
6828 $$ = cat_str(8,mm_strdup("revoke"),$2,mm_strdup("on"),$4,mm_strdup("from"),$6,$7,$8);
6829 }
6830 | REVOKE GRANT OPTION FOR privileges ON privilege_target FROM grantee_list opt_granted_by opt_drop_behavior
6831 {
6832 $$ = cat_str(8,mm_strdup("revoke grant option for"),$5,mm_strdup("on"),$7,mm_strdup("from"),$9,$10,$11);
6833 }
6834 ;
6835
6836
6837 privileges:
6838 privilege_list
6839 {
6840 $$ = $1;
6841 }
6842 | ALL
6843 {
6844 $$ = mm_strdup("all");
6845 }
6846 | ALL PRIVILEGES
6847 {
6848 $$ = mm_strdup("all privileges");
6849 }
6850 | ALL '(' columnList ')'
6851 {
6852 $$ = cat_str(3,mm_strdup("all ("),$3,mm_strdup(")"));
6853 }
6854 | ALL PRIVILEGES '(' columnList ')'
6855 {
6856 $$ = cat_str(3,mm_strdup("all privileges ("),$4,mm_strdup(")"));
6857 }
6858 ;
6859
6860
6861 privilege_list:
6862 privilege
6863 {
6864 $$ = $1;
6865 }
6866 | privilege_list ',' privilege
6867 {
6868 $$ = cat_str(3,$1,mm_strdup(","),$3);
6869 }
6870 ;
6871
6872
6873 privilege:
6874 SELECT opt_column_list
6875 {
6876 $$ = cat_str(2,mm_strdup("select"),$2);
6877 }
6878 | REFERENCES opt_column_list
6879 {
6880 $$ = cat_str(2,mm_strdup("references"),$2);
6881 }
6882 | CREATE opt_column_list
6883 {
6884 $$ = cat_str(2,mm_strdup("create"),$2);
6885 }
6886 | ColId opt_column_list
6887 {
6888 $$ = cat_str(2,$1,$2);
6889 }
6890 ;
6891
6892
6893 privilege_target:
6894 qualified_name_list
6895 {
6896 $$ = $1;
6897 }
6898 | TABLE qualified_name_list
6899 {
6900 $$ = cat_str(2,mm_strdup("table"),$2);
6901 }
6902 | SEQUENCE qualified_name_list
6903 {
6904 $$ = cat_str(2,mm_strdup("sequence"),$2);
6905 }
6906 | FOREIGN DATA_P WRAPPER name_list
6907 {
6908 $$ = cat_str(2,mm_strdup("foreign data wrapper"),$4);
6909 }
6910 | FOREIGN SERVER name_list
6911 {
6912 $$ = cat_str(2,mm_strdup("foreign server"),$3);
6913 }
6914 | FUNCTION function_with_argtypes_list
6915 {
6916 $$ = cat_str(2,mm_strdup("function"),$2);
6917 }
6918 | PROCEDURE function_with_argtypes_list
6919 {
6920 $$ = cat_str(2,mm_strdup("procedure"),$2);
6921 }
6922 | ROUTINE function_with_argtypes_list
6923 {
6924 $$ = cat_str(2,mm_strdup("routine"),$2);
6925 }
6926 | DATABASE name_list
6927 {
6928 $$ = cat_str(2,mm_strdup("database"),$2);
6929 }
6930 | DOMAIN_P any_name_list
6931 {
6932 $$ = cat_str(2,mm_strdup("domain"),$2);
6933 }
6934 | LANGUAGE name_list
6935 {
6936 $$ = cat_str(2,mm_strdup("language"),$2);
6937 }
6938 | LARGE_P OBJECT_P NumericOnly_list
6939 {
6940 $$ = cat_str(2,mm_strdup("large object"),$3);
6941 }
6942 | SCHEMA name_list
6943 {
6944 $$ = cat_str(2,mm_strdup("schema"),$2);
6945 }
6946 | TABLESPACE name_list
6947 {
6948 $$ = cat_str(2,mm_strdup("tablespace"),$2);
6949 }
6950 | TYPE_P any_name_list
6951 {
6952 $$ = cat_str(2,mm_strdup("type"),$2);
6953 }
6954 | ALL TABLES IN_P SCHEMA name_list
6955 {
6956 $$ = cat_str(2,mm_strdup("all tables in schema"),$5);
6957 }
6958 | ALL SEQUENCES IN_P SCHEMA name_list
6959 {
6960 $$ = cat_str(2,mm_strdup("all sequences in schema"),$5);
6961 }
6962 | ALL FUNCTIONS IN_P SCHEMA name_list
6963 {
6964 $$ = cat_str(2,mm_strdup("all functions in schema"),$5);
6965 }
6966 | ALL PROCEDURES IN_P SCHEMA name_list
6967 {
6968 $$ = cat_str(2,mm_strdup("all procedures in schema"),$5);
6969 }
6970 | ALL ROUTINES IN_P SCHEMA name_list
6971 {
6972 $$ = cat_str(2,mm_strdup("all routines in schema"),$5);
6973 }
6974 ;
6975
6976
6977 grantee_list:
6978 grantee
6979 {
6980 $$ = $1;
6981 }
6982 | grantee_list ',' grantee
6983 {
6984 $$ = cat_str(3,$1,mm_strdup(","),$3);
6985 }
6986 ;
6987
6988
6989 grantee:
6990 RoleSpec
6991 {
6992 $$ = $1;
6993 }
6994 | GROUP_P RoleSpec
6995 {
6996 $$ = cat_str(2,mm_strdup("group"),$2);
6997 }
6998 ;
6999
7000
7001 opt_grant_grant_option:
7002 WITH GRANT OPTION
7003 {
7004 $$ = mm_strdup("with grant option");
7005 }
7006 |
7007 {
7008 $$=EMPTY; }
7009 ;
7010
7011
7012 GrantRoleStmt:
7013 GRANT privilege_list TO role_list opt_grant_admin_option opt_granted_by
7014 {
7015 $$ = cat_str(6,mm_strdup("grant"),$2,mm_strdup("to"),$4,$5,$6);
7016 }
7017 ;
7018
7019
7020 RevokeRoleStmt:
7021 REVOKE privilege_list FROM role_list opt_granted_by opt_drop_behavior
7022 {
7023 $$ = cat_str(6,mm_strdup("revoke"),$2,mm_strdup("from"),$4,$5,$6);
7024 }
7025 | REVOKE ADMIN OPTION FOR privilege_list FROM role_list opt_granted_by opt_drop_behavior
7026 {
7027 $$ = cat_str(6,mm_strdup("revoke admin option for"),$5,mm_strdup("from"),$7,$8,$9);
7028 }
7029 ;
7030
7031
7032 opt_grant_admin_option:
7033 WITH ADMIN OPTION
7034 {
7035 $$ = mm_strdup("with admin option");
7036 }
7037 |
7038 {
7039 $$=EMPTY; }
7040 ;
7041
7042
7043 opt_granted_by:
7044 GRANTED BY RoleSpec
7045 {
7046 $$ = cat_str(2,mm_strdup("granted by"),$3);
7047 }
7048 |
7049 {
7050 $$=EMPTY; }
7051 ;
7052
7053
7054 AlterDefaultPrivilegesStmt:
7055 ALTER DEFAULT PRIVILEGES DefACLOptionList DefACLAction
7056 {
7057 $$ = cat_str(3,mm_strdup("alter default privileges"),$4,$5);
7058 }
7059 ;
7060
7061
7062 DefACLOptionList:
7063 DefACLOptionList DefACLOption
7064 {
7065 $$ = cat_str(2,$1,$2);
7066 }
7067 |
7068 {
7069 $$=EMPTY; }
7070 ;
7071
7072
7073 DefACLOption:
7074 IN_P SCHEMA name_list
7075 {
7076 $$ = cat_str(2,mm_strdup("in schema"),$3);
7077 }
7078 | FOR ROLE role_list
7079 {
7080 $$ = cat_str(2,mm_strdup("for role"),$3);
7081 }
7082 | FOR USER role_list
7083 {
7084 $$ = cat_str(2,mm_strdup("for user"),$3);
7085 }
7086 ;
7087
7088
7089 DefACLAction:
7090 GRANT privileges ON defacl_privilege_target TO grantee_list opt_grant_grant_option
7091 {
7092 $$ = cat_str(7,mm_strdup("grant"),$2,mm_strdup("on"),$4,mm_strdup("to"),$6,$7);
7093 }
7094 | REVOKE privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior
7095 {
7096 $$ = cat_str(7,mm_strdup("revoke"),$2,mm_strdup("on"),$4,mm_strdup("from"),$6,$7);
7097 }
7098 | REVOKE GRANT OPTION FOR privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior
7099 {
7100 $$ = cat_str(7,mm_strdup("revoke grant option for"),$5,mm_strdup("on"),$7,mm_strdup("from"),$9,$10);
7101 }
7102 ;
7103
7104
7105 defacl_privilege_target:
7106 TABLES
7107 {
7108 $$ = mm_strdup("tables");
7109 }
7110 | FUNCTIONS
7111 {
7112 $$ = mm_strdup("functions");
7113 }
7114 | ROUTINES
7115 {
7116 $$ = mm_strdup("routines");
7117 }
7118 | SEQUENCES
7119 {
7120 $$ = mm_strdup("sequences");
7121 }
7122 | TYPES_P
7123 {
7124 $$ = mm_strdup("types");
7125 }
7126 | SCHEMAS
7127 {
7128 $$ = mm_strdup("schemas");
7129 }
7130 ;
7131
7132
7133 IndexStmt:
7134 CREATE opt_unique INDEX opt_concurrently opt_index_name ON relation_expr access_method_clause '(' index_params ')' opt_include opt_reloptions OptTableSpace where_clause
7135 {
7136 $$ = cat_str(15,mm_strdup("create"),$2,mm_strdup("index"),$4,$5,mm_strdup("on"),$7,$8,mm_strdup("("),$10,mm_strdup(")"),$12,$13,$14,$15);
7137 }
7138 | CREATE opt_unique INDEX opt_concurrently IF_P NOT EXISTS name ON relation_expr access_method_clause '(' index_params ')' opt_include opt_reloptions OptTableSpace where_clause
7139 {
7140 $$ = cat_str(16,mm_strdup("create"),$2,mm_strdup("index"),$4,mm_strdup("if not exists"),$8,mm_strdup("on"),$10,$11,mm_strdup("("),$13,mm_strdup(")"),$15,$16,$17,$18);
7141 }
7142 ;
7143
7144
7145 opt_unique:
7146 UNIQUE
7147 {
7148 $$ = mm_strdup("unique");
7149 }
7150 |
7151 {
7152 $$=EMPTY; }
7153 ;
7154
7155
7156 opt_concurrently:
7157 CONCURRENTLY
7158 {
7159 $$ = mm_strdup("concurrently");
7160 }
7161 |
7162 {
7163 $$=EMPTY; }
7164 ;
7165
7166
7167 opt_index_name:
7168 name
7169 {
7170 $$ = $1;
7171 }
7172 |
7173 {
7174 $$=EMPTY; }
7175 ;
7176
7177
7178 access_method_clause:
7179 USING name
7180 {
7181 $$ = cat_str(2,mm_strdup("using"),$2);
7182 }
7183 |
7184 {
7185 $$=EMPTY; }
7186 ;
7187
7188
7189 index_params:
7190 index_elem
7191 {
7192 $$ = $1;
7193 }
7194 | index_params ',' index_elem
7195 {
7196 $$ = cat_str(3,$1,mm_strdup(","),$3);
7197 }
7198 ;
7199
7200
7201 index_elem_options:
7202 opt_collate opt_class opt_asc_desc opt_nulls_order
7203 {
7204 $$ = cat_str(4,$1,$2,$3,$4);
7205 }
7206 | opt_collate any_name reloptions opt_asc_desc opt_nulls_order
7207 {
7208 $$ = cat_str(5,$1,$2,$3,$4,$5);
7209 }
7210 ;
7211
7212
7213 index_elem:
7214 ColId index_elem_options
7215 {
7216 $$ = cat_str(2,$1,$2);
7217 }
7218 | func_expr_windowless index_elem_options
7219 {
7220 $$ = cat_str(2,$1,$2);
7221 }
7222 | '(' a_expr ')' index_elem_options
7223 {
7224 $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
7225 }
7226 ;
7227
7228
7229 opt_include:
7230 INCLUDE '(' index_including_params ')'
7231 {
7232 $$ = cat_str(3,mm_strdup("include ("),$3,mm_strdup(")"));
7233 }
7234 |
7235 {
7236 $$=EMPTY; }
7237 ;
7238
7239
7240 index_including_params:
7241 index_elem
7242 {
7243 $$ = $1;
7244 }
7245 | index_including_params ',' index_elem
7246 {
7247 $$ = cat_str(3,$1,mm_strdup(","),$3);
7248 }
7249 ;
7250
7251
7252 opt_collate:
7253 COLLATE any_name
7254 {
7255 $$ = cat_str(2,mm_strdup("collate"),$2);
7256 }
7257 |
7258 {
7259 $$=EMPTY; }
7260 ;
7261
7262
7263 opt_class:
7264 any_name
7265 {
7266 $$ = $1;
7267 }
7268 |
7269 {
7270 $$=EMPTY; }
7271 ;
7272
7273
7274 opt_asc_desc:
7275 ASC
7276 {
7277 $$ = mm_strdup("asc");
7278 }
7279 | DESC
7280 {
7281 $$ = mm_strdup("desc");
7282 }
7283 |
7284 {
7285 $$=EMPTY; }
7286 ;
7287
7288
7289 opt_nulls_order:
7290 NULLS_LA FIRST_P
7291 {
7292 $$ = mm_strdup("nulls first");
7293 }
7294 | NULLS_LA LAST_P
7295 {
7296 $$ = mm_strdup("nulls last");
7297 }
7298 |
7299 {
7300 $$=EMPTY; }
7301 ;
7302
7303
7304 CreateFunctionStmt:
7305 CREATE opt_or_replace FUNCTION func_name func_args_with_defaults RETURNS func_return opt_createfunc_opt_list opt_routine_body
7306 {
7307 $$ = cat_str(9,mm_strdup("create"),$2,mm_strdup("function"),$4,$5,mm_strdup("returns"),$7,$8,$9);
7308 }
7309 | CREATE opt_or_replace FUNCTION func_name func_args_with_defaults RETURNS TABLE '(' table_func_column_list ')' opt_createfunc_opt_list opt_routine_body
7310 {
7311 $$ = cat_str(10,mm_strdup("create"),$2,mm_strdup("function"),$4,$5,mm_strdup("returns table ("),$9,mm_strdup(")"),$11,$12);
7312 }
7313 | CREATE opt_or_replace FUNCTION func_name func_args_with_defaults opt_createfunc_opt_list opt_routine_body
7314 {
7315 $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("function"),$4,$5,$6,$7);
7316 }
7317 | CREATE opt_or_replace PROCEDURE func_name func_args_with_defaults opt_createfunc_opt_list opt_routine_body
7318 {
7319 $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("procedure"),$4,$5,$6,$7);
7320 }
7321 ;
7322
7323
7324 opt_or_replace:
7325 OR REPLACE
7326 {
7327 $$ = mm_strdup("or replace");
7328 }
7329 |
7330 {
7331 $$=EMPTY; }
7332 ;
7333
7334
7335 func_args:
7336 '(' func_args_list ')'
7337 {
7338 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
7339 }
7340 | '(' ')'
7341 {
7342 $$ = mm_strdup("( )");
7343 }
7344 ;
7345
7346
7347 func_args_list:
7348 func_arg
7349 {
7350 $$ = $1;
7351 }
7352 | func_args_list ',' func_arg
7353 {
7354 $$ = cat_str(3,$1,mm_strdup(","),$3);
7355 }
7356 ;
7357
7358
7359 function_with_argtypes_list:
7360 function_with_argtypes
7361 {
7362 $$ = $1;
7363 }
7364 | function_with_argtypes_list ',' function_with_argtypes
7365 {
7366 $$ = cat_str(3,$1,mm_strdup(","),$3);
7367 }
7368 ;
7369
7370
7371 function_with_argtypes:
7372 func_name func_args
7373 {
7374 $$ = cat_str(2,$1,$2);
7375 }
7376 | type_func_name_keyword
7377 {
7378 $$ = $1;
7379 }
7380 | ColId
7381 {
7382 $$ = $1;
7383 }
7384 | ColId indirection
7385 {
7386 $$ = cat_str(2,$1,$2);
7387 }
7388 ;
7389
7390
7391 func_args_with_defaults:
7392 '(' func_args_with_defaults_list ')'
7393 {
7394 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
7395 }
7396 | '(' ')'
7397 {
7398 $$ = mm_strdup("( )");
7399 }
7400 ;
7401
7402
7403 func_args_with_defaults_list:
7404 func_arg_with_default
7405 {
7406 $$ = $1;
7407 }
7408 | func_args_with_defaults_list ',' func_arg_with_default
7409 {
7410 $$ = cat_str(3,$1,mm_strdup(","),$3);
7411 }
7412 ;
7413
7414
7415 func_arg:
7416 arg_class param_name func_type
7417 {
7418 $$ = cat_str(3,$1,$2,$3);
7419 }
7420 | param_name arg_class func_type
7421 {
7422 $$ = cat_str(3,$1,$2,$3);
7423 }
7424 | param_name func_type
7425 {
7426 $$ = cat_str(2,$1,$2);
7427 }
7428 | arg_class func_type
7429 {
7430 $$ = cat_str(2,$1,$2);
7431 }
7432 | func_type
7433 {
7434 $$ = $1;
7435 }
7436 ;
7437
7438
7439 arg_class:
7440 IN_P
7441 {
7442 $$ = mm_strdup("in");
7443 }
7444 | OUT_P
7445 {
7446 $$ = mm_strdup("out");
7447 }
7448 | INOUT
7449 {
7450 $$ = mm_strdup("inout");
7451 }
7452 | IN_P OUT_P
7453 {
7454 $$ = mm_strdup("in out");
7455 }
7456 | VARIADIC
7457 {
7458 $$ = mm_strdup("variadic");
7459 }
7460 ;
7461
7462
7463 param_name:
7464 type_function_name
7465 {
7466 $$ = $1;
7467 }
7468 ;
7469
7470
7471 func_return:
7472 func_type
7473 {
7474 $$ = $1;
7475 }
7476 ;
7477
7478
7479 func_type:
7480 Typename
7481 {
7482 $$ = $1;
7483 }
7484 | type_function_name attrs '%' TYPE_P
7485 {
7486 $$ = cat_str(3,$1,$2,mm_strdup("% type"));
7487 }
7488 | SETOF type_function_name attrs '%' TYPE_P
7489 {
7490 $$ = cat_str(4,mm_strdup("setof"),$2,$3,mm_strdup("% type"));
7491 }
7492 ;
7493
7494
7495 func_arg_with_default:
7496 func_arg
7497 {
7498 $$ = $1;
7499 }
7500 | func_arg DEFAULT a_expr
7501 {
7502 $$ = cat_str(3,$1,mm_strdup("default"),$3);
7503 }
7504 | func_arg '=' a_expr
7505 {
7506 $$ = cat_str(3,$1,mm_strdup("="),$3);
7507 }
7508 ;
7509
7510
7511 aggr_arg:
7512 func_arg
7513 {
7514 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
7515 $$ = $1;
7516 }
7517 ;
7518
7519
7520 aggr_args:
7521 '(' '*' ')'
7522 {
7523 $$ = mm_strdup("( * )");
7524 }
7525 | '(' aggr_args_list ')'
7526 {
7527 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
7528 }
7529 | '(' ORDER BY aggr_args_list ')'
7530 {
7531 $$ = cat_str(3,mm_strdup("( order by"),$4,mm_strdup(")"));
7532 }
7533 | '(' aggr_args_list ORDER BY aggr_args_list ')'
7534 {
7535 $$ = cat_str(5,mm_strdup("("),$2,mm_strdup("order by"),$5,mm_strdup(")"));
7536 }
7537 ;
7538
7539
7540 aggr_args_list:
7541 aggr_arg
7542 {
7543 $$ = $1;
7544 }
7545 | aggr_args_list ',' aggr_arg
7546 {
7547 $$ = cat_str(3,$1,mm_strdup(","),$3);
7548 }
7549 ;
7550
7551
7552 aggregate_with_argtypes:
7553 func_name aggr_args
7554 {
7555 $$ = cat_str(2,$1,$2);
7556 }
7557 ;
7558
7559
7560 aggregate_with_argtypes_list:
7561 aggregate_with_argtypes
7562 {
7563 $$ = $1;
7564 }
7565 | aggregate_with_argtypes_list ',' aggregate_with_argtypes
7566 {
7567 $$ = cat_str(3,$1,mm_strdup(","),$3);
7568 }
7569 ;
7570
7571
7572 opt_createfunc_opt_list:
7573 createfunc_opt_list
7574 {
7575 $$ = $1;
7576 }
7577 |
7578 {
7579 $$=EMPTY; }
7580 ;
7581
7582
7583 createfunc_opt_list:
7584 createfunc_opt_item
7585 {
7586 $$ = $1;
7587 }
7588 | createfunc_opt_list createfunc_opt_item
7589 {
7590 $$ = cat_str(2,$1,$2);
7591 }
7592 ;
7593
7594
7595 common_func_opt_item:
7596 CALLED ON NULL_P INPUT_P
7597 {
7598 $$ = mm_strdup("called on null input");
7599 }
7600 | RETURNS NULL_P ON NULL_P INPUT_P
7601 {
7602 $$ = mm_strdup("returns null on null input");
7603 }
7604 | STRICT_P
7605 {
7606 $$ = mm_strdup("strict");
7607 }
7608 | IMMUTABLE
7609 {
7610 $$ = mm_strdup("immutable");
7611 }
7612 | STABLE
7613 {
7614 $$ = mm_strdup("stable");
7615 }
7616 | VOLATILE
7617 {
7618 $$ = mm_strdup("volatile");
7619 }
7620 | EXTERNAL SECURITY DEFINER
7621 {
7622 $$ = mm_strdup("external security definer");
7623 }
7624 | EXTERNAL SECURITY INVOKER
7625 {
7626 $$ = mm_strdup("external security invoker");
7627 }
7628 | SECURITY DEFINER
7629 {
7630 $$ = mm_strdup("security definer");
7631 }
7632 | SECURITY INVOKER
7633 {
7634 $$ = mm_strdup("security invoker");
7635 }
7636 | LEAKPROOF
7637 {
7638 $$ = mm_strdup("leakproof");
7639 }
7640 | NOT LEAKPROOF
7641 {
7642 $$ = mm_strdup("not leakproof");
7643 }
7644 | COST NumericOnly
7645 {
7646 $$ = cat_str(2,mm_strdup("cost"),$2);
7647 }
7648 | ROWS NumericOnly
7649 {
7650 $$ = cat_str(2,mm_strdup("rows"),$2);
7651 }
7652 | SUPPORT any_name
7653 {
7654 $$ = cat_str(2,mm_strdup("support"),$2);
7655 }
7656 | FunctionSetResetClause
7657 {
7658 $$ = $1;
7659 }
7660 | PARALLEL ColId
7661 {
7662 $$ = cat_str(2,mm_strdup("parallel"),$2);
7663 }
7664 ;
7665
7666
7667 createfunc_opt_item:
7668 AS func_as
7669 {
7670 $$ = cat_str(2,mm_strdup("as"),$2);
7671 }
7672 | LANGUAGE NonReservedWord_or_Sconst
7673 {
7674 $$ = cat_str(2,mm_strdup("language"),$2);
7675 }
7676 | TRANSFORM transform_type_list
7677 {
7678 $$ = cat_str(2,mm_strdup("transform"),$2);
7679 }
7680 | WINDOW
7681 {
7682 $$ = mm_strdup("window");
7683 }
7684 | common_func_opt_item
7685 {
7686 $$ = $1;
7687 }
7688 ;
7689
7690
7691 func_as:
7692 ecpg_sconst
7693 {
7694 $$ = $1;
7695 }
7696 | ecpg_sconst ',' ecpg_sconst
7697 {
7698 $$ = cat_str(3,$1,mm_strdup(","),$3);
7699 }
7700 ;
7701
7702
7703 ReturnStmt:
7704 RETURN a_expr
7705 {
7706 $$ = cat_str(2,mm_strdup("return"),$2);
7707 }
7708 ;
7709
7710
7711 opt_routine_body:
7712 ReturnStmt
7713 {
7714 $$ = $1;
7715 }
7716 | BEGIN_P ATOMIC routine_body_stmt_list END_P
7717 {
7718 $$ = cat_str(3,mm_strdup("begin atomic"),$3,mm_strdup("end"));
7719 }
7720 |
7721 {
7722 $$=EMPTY; }
7723 ;
7724
7725
7726 routine_body_stmt_list:
7727 routine_body_stmt_list routine_body_stmt ';'
7728 {
7729 $$ = cat_str(3,$1,$2,mm_strdup(";"));
7730 }
7731 |
7732 {
7733 $$=EMPTY; }
7734 ;
7735
7736
7737 routine_body_stmt:
7738 stmt
7739 {
7740 $$ = $1;
7741 }
7742 | ReturnStmt
7743 {
7744 $$ = $1;
7745 }
7746 ;
7747
7748
7749 transform_type_list:
7750 FOR TYPE_P Typename
7751 {
7752 $$ = cat_str(2,mm_strdup("for type"),$3);
7753 }
7754 | transform_type_list ',' FOR TYPE_P Typename
7755 {
7756 $$ = cat_str(3,$1,mm_strdup(", for type"),$5);
7757 }
7758 ;
7759
7760
7761 opt_definition:
7762 WITH definition
7763 {
7764 $$ = cat_str(2,mm_strdup("with"),$2);
7765 }
7766 |
7767 {
7768 $$=EMPTY; }
7769 ;
7770
7771
7772 table_func_column:
7773 param_name func_type
7774 {
7775 $$ = cat_str(2,$1,$2);
7776 }
7777 ;
7778
7779
7780 table_func_column_list:
7781 table_func_column
7782 {
7783 $$ = $1;
7784 }
7785 | table_func_column_list ',' table_func_column
7786 {
7787 $$ = cat_str(3,$1,mm_strdup(","),$3);
7788 }
7789 ;
7790
7791
7792 AlterFunctionStmt:
7793 ALTER FUNCTION function_with_argtypes alterfunc_opt_list opt_restrict
7794 {
7795 $$ = cat_str(4,mm_strdup("alter function"),$3,$4,$5);
7796 }
7797 | ALTER PROCEDURE function_with_argtypes alterfunc_opt_list opt_restrict
7798 {
7799 $$ = cat_str(4,mm_strdup("alter procedure"),$3,$4,$5);
7800 }
7801 | ALTER ROUTINE function_with_argtypes alterfunc_opt_list opt_restrict
7802 {
7803 $$ = cat_str(4,mm_strdup("alter routine"),$3,$4,$5);
7804 }
7805 ;
7806
7807
7808 alterfunc_opt_list:
7809 common_func_opt_item
7810 {
7811 $$ = $1;
7812 }
7813 | alterfunc_opt_list common_func_opt_item
7814 {
7815 $$ = cat_str(2,$1,$2);
7816 }
7817 ;
7818
7819
7820 opt_restrict:
7821 RESTRICT
7822 {
7823 $$ = mm_strdup("restrict");
7824 }
7825 |
7826 {
7827 $$=EMPTY; }
7828 ;
7829
7830
7831 RemoveFuncStmt:
7832 DROP FUNCTION function_with_argtypes_list opt_drop_behavior
7833 {
7834 $$ = cat_str(3,mm_strdup("drop function"),$3,$4);
7835 }
7836 | DROP FUNCTION IF_P EXISTS function_with_argtypes_list opt_drop_behavior
7837 {
7838 $$ = cat_str(3,mm_strdup("drop function if exists"),$5,$6);
7839 }
7840 | DROP PROCEDURE function_with_argtypes_list opt_drop_behavior
7841 {
7842 $$ = cat_str(3,mm_strdup("drop procedure"),$3,$4);
7843 }
7844 | DROP PROCEDURE IF_P EXISTS function_with_argtypes_list opt_drop_behavior
7845 {
7846 $$ = cat_str(3,mm_strdup("drop procedure if exists"),$5,$6);
7847 }
7848 | DROP ROUTINE function_with_argtypes_list opt_drop_behavior
7849 {
7850 $$ = cat_str(3,mm_strdup("drop routine"),$3,$4);
7851 }
7852 | DROP ROUTINE IF_P EXISTS function_with_argtypes_list opt_drop_behavior
7853 {
7854 $$ = cat_str(3,mm_strdup("drop routine if exists"),$5,$6);
7855 }
7856 ;
7857
7858
7859 RemoveAggrStmt:
7860 DROP AGGREGATE aggregate_with_argtypes_list opt_drop_behavior
7861 {
7862 $$ = cat_str(3,mm_strdup("drop aggregate"),$3,$4);
7863 }
7864 | DROP AGGREGATE IF_P EXISTS aggregate_with_argtypes_list opt_drop_behavior
7865 {
7866 $$ = cat_str(3,mm_strdup("drop aggregate if exists"),$5,$6);
7867 }
7868 ;
7869
7870
7871 RemoveOperStmt:
7872 DROP OPERATOR operator_with_argtypes_list opt_drop_behavior
7873 {
7874 $$ = cat_str(3,mm_strdup("drop operator"),$3,$4);
7875 }
7876 | DROP OPERATOR IF_P EXISTS operator_with_argtypes_list opt_drop_behavior
7877 {
7878 $$ = cat_str(3,mm_strdup("drop operator if exists"),$5,$6);
7879 }
7880 ;
7881
7882
7883 oper_argtypes:
7884 '(' Typename ')'
7885 {
7886 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
7887 }
7888 | '(' Typename ',' Typename ')'
7889 {
7890 $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(","),$4,mm_strdup(")"));
7891 }
7892 | '(' NONE ',' Typename ')'
7893 {
7894 $$ = cat_str(3,mm_strdup("( none ,"),$4,mm_strdup(")"));
7895 }
7896 | '(' Typename ',' NONE ')'
7897 {
7898 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(", none )"));
7899 }
7900 ;
7901
7902
7903 any_operator:
7904 all_Op
7905 {
7906 $$ = $1;
7907 }
7908 | ColId '.' any_operator
7909 {
7910 $$ = cat_str(3,$1,mm_strdup("."),$3);
7911 }
7912 ;
7913
7914
7915 operator_with_argtypes_list:
7916 operator_with_argtypes
7917 {
7918 $$ = $1;
7919 }
7920 | operator_with_argtypes_list ',' operator_with_argtypes
7921 {
7922 $$ = cat_str(3,$1,mm_strdup(","),$3);
7923 }
7924 ;
7925
7926
7927 operator_with_argtypes:
7928 any_operator oper_argtypes
7929 {
7930 $$ = cat_str(2,$1,$2);
7931 }
7932 ;
7933
7934
7935 DoStmt:
7936 DO dostmt_opt_list
7937 {
7938 $$ = cat_str(2,mm_strdup("do"),$2);
7939 }
7940 ;
7941
7942
7943 dostmt_opt_list:
7944 dostmt_opt_item
7945 {
7946 $$ = $1;
7947 }
7948 | dostmt_opt_list dostmt_opt_item
7949 {
7950 $$ = cat_str(2,$1,$2);
7951 }
7952 ;
7953
7954
7955 dostmt_opt_item:
7956 ecpg_sconst
7957 {
7958 $$ = $1;
7959 }
7960 | LANGUAGE NonReservedWord_or_Sconst
7961 {
7962 $$ = cat_str(2,mm_strdup("language"),$2);
7963 }
7964 ;
7965
7966
7967 CreateCastStmt:
7968 CREATE CAST '(' Typename AS Typename ')' WITH FUNCTION function_with_argtypes cast_context
7969 {
7970 $$ = cat_str(7,mm_strdup("create cast ("),$4,mm_strdup("as"),$6,mm_strdup(") with function"),$10,$11);
7971 }
7972 | CREATE CAST '(' Typename AS Typename ')' WITHOUT FUNCTION cast_context
7973 {
7974 $$ = cat_str(6,mm_strdup("create cast ("),$4,mm_strdup("as"),$6,mm_strdup(") without function"),$10);
7975 }
7976 | CREATE CAST '(' Typename AS Typename ')' WITH INOUT cast_context
7977 {
7978 $$ = cat_str(6,mm_strdup("create cast ("),$4,mm_strdup("as"),$6,mm_strdup(") with inout"),$10);
7979 }
7980 ;
7981
7982
7983 cast_context:
7984 AS IMPLICIT_P
7985 {
7986 $$ = mm_strdup("as implicit");
7987 }
7988 | AS ASSIGNMENT
7989 {
7990 $$ = mm_strdup("as assignment");
7991 }
7992 |
7993 {
7994 $$=EMPTY; }
7995 ;
7996
7997
7998 DropCastStmt:
7999 DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_behavior
8000 {
8001 $$ = cat_str(8,mm_strdup("drop cast"),$3,mm_strdup("("),$5,mm_strdup("as"),$7,mm_strdup(")"),$9);
8002 }
8003 ;
8004
8005
8006 opt_if_exists:
8007 IF_P EXISTS
8008 {
8009 $$ = mm_strdup("if exists");
8010 }
8011 |
8012 {
8013 $$=EMPTY; }
8014 ;
8015
8016
8017 CreateTransformStmt:
8018 CREATE opt_or_replace TRANSFORM FOR Typename LANGUAGE name '(' transform_element_list ')'
8019 {
8020 $$ = cat_str(9,mm_strdup("create"),$2,mm_strdup("transform for"),$5,mm_strdup("language"),$7,mm_strdup("("),$9,mm_strdup(")"));
8021 }
8022 ;
8023
8024
8025 transform_element_list:
8026 FROM SQL_P WITH FUNCTION function_with_argtypes ',' TO SQL_P WITH FUNCTION function_with_argtypes
8027 {
8028 $$ = cat_str(4,mm_strdup("from sql with function"),$5,mm_strdup(", to sql with function"),$11);
8029 }
8030 | TO SQL_P WITH FUNCTION function_with_argtypes ',' FROM SQL_P WITH FUNCTION function_with_argtypes
8031 {
8032 $$ = cat_str(4,mm_strdup("to sql with function"),$5,mm_strdup(", from sql with function"),$11);
8033 }
8034 | FROM SQL_P WITH FUNCTION function_with_argtypes
8035 {
8036 $$ = cat_str(2,mm_strdup("from sql with function"),$5);
8037 }
8038 | TO SQL_P WITH FUNCTION function_with_argtypes
8039 {
8040 $$ = cat_str(2,mm_strdup("to sql with function"),$5);
8041 }
8042 ;
8043
8044
8045 DropTransformStmt:
8046 DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_drop_behavior
8047 {
8048 $$ = cat_str(7,mm_strdup("drop transform"),$3,mm_strdup("for"),$5,mm_strdup("language"),$7,$8);
8049 }
8050 ;
8051
8052
8053 ReindexStmt:
8054 REINDEX reindex_target_type opt_concurrently qualified_name
8055 {
8056 $$ = cat_str(4,mm_strdup("reindex"),$2,$3,$4);
8057 }
8058 | REINDEX reindex_target_multitable opt_concurrently name
8059 {
8060 $$ = cat_str(4,mm_strdup("reindex"),$2,$3,$4);
8061 }
8062 | REINDEX '(' utility_option_list ')' reindex_target_type opt_concurrently qualified_name
8063 {
8064 $$ = cat_str(6,mm_strdup("reindex ("),$3,mm_strdup(")"),$5,$6,$7);
8065 }
8066 | REINDEX '(' utility_option_list ')' reindex_target_multitable opt_concurrently name
8067 {
8068 $$ = cat_str(6,mm_strdup("reindex ("),$3,mm_strdup(")"),$5,$6,$7);
8069 }
8070 ;
8071
8072
8073 reindex_target_type:
8074 INDEX
8075 {
8076 $$ = mm_strdup("index");
8077 }
8078 | TABLE
8079 {
8080 $$ = mm_strdup("table");
8081 }
8082 ;
8083
8084
8085 reindex_target_multitable:
8086 SCHEMA
8087 {
8088 $$ = mm_strdup("schema");
8089 }
8090 | SYSTEM_P
8091 {
8092 $$ = mm_strdup("system");
8093 }
8094 | DATABASE
8095 {
8096 $$ = mm_strdup("database");
8097 }
8098 ;
8099
8100
8101 AlterTblSpcStmt:
8102 ALTER TABLESPACE name SET reloptions
8103 {
8104 $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("set"),$5);
8105 }
8106 | ALTER TABLESPACE name RESET reloptions
8107 {
8108 $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("reset"),$5);
8109 }
8110 ;
8111
8112
8113 RenameStmt:
8114 ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
8115 {
8116 $$ = cat_str(4,mm_strdup("alter aggregate"),$3,mm_strdup("rename to"),$6);
8117 }
8118 | ALTER COLLATION any_name RENAME TO name
8119 {
8120 $$ = cat_str(4,mm_strdup("alter collation"),$3,mm_strdup("rename to"),$6);
8121 }
8122 | ALTER CONVERSION_P any_name RENAME TO name
8123 {
8124 $$ = cat_str(4,mm_strdup("alter conversion"),$3,mm_strdup("rename to"),$6);
8125 }
8126 | ALTER DATABASE name RENAME TO name
8127 {
8128 $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("rename to"),$6);
8129 }
8130 | ALTER DOMAIN_P any_name RENAME TO name
8131 {
8132 $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("rename to"),$6);
8133 }
8134 | ALTER DOMAIN_P any_name RENAME CONSTRAINT name TO name
8135 {
8136 $$ = cat_str(6,mm_strdup("alter domain"),$3,mm_strdup("rename constraint"),$6,mm_strdup("to"),$8);
8137 }
8138 | ALTER FOREIGN DATA_P WRAPPER name RENAME TO name
8139 {
8140 $$ = cat_str(4,mm_strdup("alter foreign data wrapper"),$5,mm_strdup("rename to"),$8);
8141 }
8142 | ALTER FUNCTION function_with_argtypes RENAME TO name
8143 {
8144 $$ = cat_str(4,mm_strdup("alter function"),$3,mm_strdup("rename to"),$6);
8145 }
8146 | ALTER GROUP_P RoleId RENAME TO RoleId
8147 {
8148 $$ = cat_str(4,mm_strdup("alter group"),$3,mm_strdup("rename to"),$6);
8149 }
8150 | ALTER opt_procedural LANGUAGE name RENAME TO name
8151 {
8152 $$ = cat_str(6,mm_strdup("alter"),$2,mm_strdup("language"),$4,mm_strdup("rename to"),$7);
8153 }
8154 | ALTER OPERATOR CLASS any_name USING name RENAME TO name
8155 {
8156 $$ = cat_str(6,mm_strdup("alter operator class"),$4,mm_strdup("using"),$6,mm_strdup("rename to"),$9);
8157 }
8158 | ALTER OPERATOR FAMILY any_name USING name RENAME TO name
8159 {
8160 $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("rename to"),$9);
8161 }
8162 | ALTER POLICY name ON qualified_name RENAME TO name
8163 {
8164 $$ = cat_str(6,mm_strdup("alter policy"),$3,mm_strdup("on"),$5,mm_strdup("rename to"),$8);
8165 }
8166 | ALTER POLICY IF_P EXISTS name ON qualified_name RENAME TO name
8167 {
8168 $$ = cat_str(6,mm_strdup("alter policy if exists"),$5,mm_strdup("on"),$7,mm_strdup("rename to"),$10);
8169 }
8170 | ALTER PROCEDURE function_with_argtypes RENAME TO name
8171 {
8172 $$ = cat_str(4,mm_strdup("alter procedure"),$3,mm_strdup("rename to"),$6);
8173 }
8174 | ALTER PUBLICATION name RENAME TO name
8175 {
8176 $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("rename to"),$6);
8177 }
8178 | ALTER ROUTINE function_with_argtypes RENAME TO name
8179 {
8180 $$ = cat_str(4,mm_strdup("alter routine"),$3,mm_strdup("rename to"),$6);
8181 }
8182 | ALTER SCHEMA name RENAME TO name
8183 {
8184 $$ = cat_str(4,mm_strdup("alter schema"),$3,mm_strdup("rename to"),$6);
8185 }
8186 | ALTER SERVER name RENAME TO name
8187 {
8188 $$ = cat_str(4,mm_strdup("alter server"),$3,mm_strdup("rename to"),$6);
8189 }
8190 | ALTER SUBSCRIPTION name RENAME TO name
8191 {
8192 $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("rename to"),$6);
8193 }
8194 | ALTER TABLE relation_expr RENAME TO name
8195 {
8196 $$ = cat_str(4,mm_strdup("alter table"),$3,mm_strdup("rename to"),$6);
8197 }
8198 | ALTER TABLE IF_P EXISTS relation_expr RENAME TO name
8199 {
8200 $$ = cat_str(4,mm_strdup("alter table if exists"),$5,mm_strdup("rename to"),$8);
8201 }
8202 | ALTER SEQUENCE qualified_name RENAME TO name
8203 {
8204 $$ = cat_str(4,mm_strdup("alter sequence"),$3,mm_strdup("rename to"),$6);
8205 }
8206 | ALTER SEQUENCE IF_P EXISTS qualified_name RENAME TO name
8207 {
8208 $$ = cat_str(4,mm_strdup("alter sequence if exists"),$5,mm_strdup("rename to"),$8);
8209 }
8210 | ALTER VIEW qualified_name RENAME TO name
8211 {
8212 $$ = cat_str(4,mm_strdup("alter view"),$3,mm_strdup("rename to"),$6);
8213 }
8214 | ALTER VIEW IF_P EXISTS qualified_name RENAME TO name
8215 {
8216 $$ = cat_str(4,mm_strdup("alter view if exists"),$5,mm_strdup("rename to"),$8);
8217 }
8218 | ALTER MATERIALIZED VIEW qualified_name RENAME TO name
8219 {
8220 $$ = cat_str(4,mm_strdup("alter materialized view"),$4,mm_strdup("rename to"),$7);
8221 }
8222 | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME TO name
8223 {
8224 $$ = cat_str(4,mm_strdup("alter materialized view if exists"),$6,mm_strdup("rename to"),$9);
8225 }
8226 | ALTER INDEX qualified_name RENAME TO name
8227 {
8228 $$ = cat_str(4,mm_strdup("alter index"),$3,mm_strdup("rename to"),$6);
8229 }
8230 | ALTER INDEX IF_P EXISTS qualified_name RENAME TO name
8231 {
8232 $$ = cat_str(4,mm_strdup("alter index if exists"),$5,mm_strdup("rename to"),$8);
8233 }
8234 | ALTER FOREIGN TABLE relation_expr RENAME TO name
8235 {
8236 $$ = cat_str(4,mm_strdup("alter foreign table"),$4,mm_strdup("rename to"),$7);
8237 }
8238 | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME TO name
8239 {
8240 $$ = cat_str(4,mm_strdup("alter foreign table if exists"),$6,mm_strdup("rename to"),$9);
8241 }
8242 | ALTER TABLE relation_expr RENAME opt_column name TO name
8243 {
8244 $$ = cat_str(7,mm_strdup("alter table"),$3,mm_strdup("rename"),$5,$6,mm_strdup("to"),$8);
8245 }
8246 | ALTER TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name
8247 {
8248 $$ = cat_str(7,mm_strdup("alter table if exists"),$5,mm_strdup("rename"),$7,$8,mm_strdup("to"),$10);
8249 }
8250 | ALTER VIEW qualified_name RENAME opt_column name TO name
8251 {
8252 $$ = cat_str(7,mm_strdup("alter view"),$3,mm_strdup("rename"),$5,$6,mm_strdup("to"),$8);
8253 }
8254 | ALTER VIEW IF_P EXISTS qualified_name RENAME opt_column name TO name
8255 {
8256 $$ = cat_str(7,mm_strdup("alter view if exists"),$5,mm_strdup("rename"),$7,$8,mm_strdup("to"),$10);
8257 }
8258 | ALTER MATERIALIZED VIEW qualified_name RENAME opt_column name TO name
8259 {
8260 $$ = cat_str(7,mm_strdup("alter materialized view"),$4,mm_strdup("rename"),$6,$7,mm_strdup("to"),$9);
8261 }
8262 | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME opt_column name TO name
8263 {
8264 $$ = cat_str(7,mm_strdup("alter materialized view if exists"),$6,mm_strdup("rename"),$8,$9,mm_strdup("to"),$11);
8265 }
8266 | ALTER TABLE relation_expr RENAME CONSTRAINT name TO name
8267 {
8268 $$ = cat_str(6,mm_strdup("alter table"),$3,mm_strdup("rename constraint"),$6,mm_strdup("to"),$8);
8269 }
8270 | ALTER TABLE IF_P EXISTS relation_expr RENAME CONSTRAINT name TO name
8271 {
8272 $$ = cat_str(6,mm_strdup("alter table if exists"),$5,mm_strdup("rename constraint"),$8,mm_strdup("to"),$10);
8273 }
8274 | ALTER FOREIGN TABLE relation_expr RENAME opt_column name TO name
8275 {
8276 $$ = cat_str(7,mm_strdup("alter foreign table"),$4,mm_strdup("rename"),$6,$7,mm_strdup("to"),$9);
8277 }
8278 | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name
8279 {
8280 $$ = cat_str(7,mm_strdup("alter foreign table if exists"),$6,mm_strdup("rename"),$8,$9,mm_strdup("to"),$11);
8281 }
8282 | ALTER RULE name ON qualified_name RENAME TO name
8283 {
8284 $$ = cat_str(6,mm_strdup("alter rule"),$3,mm_strdup("on"),$5,mm_strdup("rename to"),$8);
8285 }
8286 | ALTER TRIGGER name ON qualified_name RENAME TO name
8287 {
8288 $$ = cat_str(6,mm_strdup("alter trigger"),$3,mm_strdup("on"),$5,mm_strdup("rename to"),$8);
8289 }
8290 | ALTER EVENT TRIGGER name RENAME TO name
8291 {
8292 $$ = cat_str(4,mm_strdup("alter event trigger"),$4,mm_strdup("rename to"),$7);
8293 }
8294 | ALTER ROLE RoleId RENAME TO RoleId
8295 {
8296 $$ = cat_str(4,mm_strdup("alter role"),$3,mm_strdup("rename to"),$6);
8297 }
8298 | ALTER USER RoleId RENAME TO RoleId
8299 {
8300 $$ = cat_str(4,mm_strdup("alter user"),$3,mm_strdup("rename to"),$6);
8301 }
8302 | ALTER TABLESPACE name RENAME TO name
8303 {
8304 $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("rename to"),$6);
8305 }
8306 | ALTER STATISTICS any_name RENAME TO name
8307 {
8308 $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("rename to"),$6);
8309 }
8310 | ALTER TEXT_P SEARCH PARSER any_name RENAME TO name
8311 {
8312 $$ = cat_str(4,mm_strdup("alter text search parser"),$5,mm_strdup("rename to"),$8);
8313 }
8314 | ALTER TEXT_P SEARCH DICTIONARY any_name RENAME TO name
8315 {
8316 $$ = cat_str(4,mm_strdup("alter text search dictionary"),$5,mm_strdup("rename to"),$8);
8317 }
8318 | ALTER TEXT_P SEARCH TEMPLATE any_name RENAME TO name
8319 {
8320 $$ = cat_str(4,mm_strdup("alter text search template"),$5,mm_strdup("rename to"),$8);
8321 }
8322 | ALTER TEXT_P SEARCH CONFIGURATION any_name RENAME TO name
8323 {
8324 $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("rename to"),$8);
8325 }
8326 | ALTER TYPE_P any_name RENAME TO name
8327 {
8328 $$ = cat_str(4,mm_strdup("alter type"),$3,mm_strdup("rename to"),$6);
8329 }
8330 | ALTER TYPE_P any_name RENAME ATTRIBUTE name TO name opt_drop_behavior
8331 {
8332 $$ = cat_str(7,mm_strdup("alter type"),$3,mm_strdup("rename attribute"),$6,mm_strdup("to"),$8,$9);
8333 }
8334 ;
8335
8336
8337 opt_column:
8338 COLUMN
8339 {
8340 $$ = mm_strdup("column");
8341 }
8342 |
8343 {
8344 $$=EMPTY; }
8345 ;
8346
8347
8348 opt_set_data:
8349 SET DATA_P
8350 {
8351 $$ = mm_strdup("set data");
8352 }
8353 |
8354 {
8355 $$=EMPTY; }
8356 ;
8357
8358
8359 AlterObjectDependsStmt:
8360 ALTER FUNCTION function_with_argtypes opt_no DEPENDS ON EXTENSION name
8361 {
8362 $$ = cat_str(5,mm_strdup("alter function"),$3,$4,mm_strdup("depends on extension"),$8);
8363 }
8364 | ALTER PROCEDURE function_with_argtypes opt_no DEPENDS ON EXTENSION name
8365 {
8366 $$ = cat_str(5,mm_strdup("alter procedure"),$3,$4,mm_strdup("depends on extension"),$8);
8367 }
8368 | ALTER ROUTINE function_with_argtypes opt_no DEPENDS ON EXTENSION name
8369 {
8370 $$ = cat_str(5,mm_strdup("alter routine"),$3,$4,mm_strdup("depends on extension"),$8);
8371 }
8372 | ALTER TRIGGER name ON qualified_name opt_no DEPENDS ON EXTENSION name
8373 {
8374 $$ = cat_str(7,mm_strdup("alter trigger"),$3,mm_strdup("on"),$5,$6,mm_strdup("depends on extension"),$10);
8375 }
8376 | ALTER MATERIALIZED VIEW qualified_name opt_no DEPENDS ON EXTENSION name
8377 {
8378 $$ = cat_str(5,mm_strdup("alter materialized view"),$4,$5,mm_strdup("depends on extension"),$9);
8379 }
8380 | ALTER INDEX qualified_name opt_no DEPENDS ON EXTENSION name
8381 {
8382 $$ = cat_str(5,mm_strdup("alter index"),$3,$4,mm_strdup("depends on extension"),$8);
8383 }
8384 ;
8385
8386
8387 opt_no:
8388 NO
8389 {
8390 $$ = mm_strdup("no");
8391 }
8392 |
8393 {
8394 $$=EMPTY; }
8395 ;
8396
8397
8398 AlterObjectSchemaStmt:
8399 ALTER AGGREGATE aggregate_with_argtypes SET SCHEMA name
8400 {
8401 $$ = cat_str(4,mm_strdup("alter aggregate"),$3,mm_strdup("set schema"),$6);
8402 }
8403 | ALTER COLLATION any_name SET SCHEMA name
8404 {
8405 $$ = cat_str(4,mm_strdup("alter collation"),$3,mm_strdup("set schema"),$6);
8406 }
8407 | ALTER CONVERSION_P any_name SET SCHEMA name
8408 {
8409 $$ = cat_str(4,mm_strdup("alter conversion"),$3,mm_strdup("set schema"),$6);
8410 }
8411 | ALTER DOMAIN_P any_name SET SCHEMA name
8412 {
8413 $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("set schema"),$6);
8414 }
8415 | ALTER EXTENSION name SET SCHEMA name
8416 {
8417 $$ = cat_str(4,mm_strdup("alter extension"),$3,mm_strdup("set schema"),$6);
8418 }
8419 | ALTER FUNCTION function_with_argtypes SET SCHEMA name
8420 {
8421 $$ = cat_str(4,mm_strdup("alter function"),$3,mm_strdup("set schema"),$6);
8422 }
8423 | ALTER OPERATOR operator_with_argtypes SET SCHEMA name
8424 {
8425 $$ = cat_str(4,mm_strdup("alter operator"),$3,mm_strdup("set schema"),$6);
8426 }
8427 | ALTER OPERATOR CLASS any_name USING name SET SCHEMA name
8428 {
8429 $$ = cat_str(6,mm_strdup("alter operator class"),$4,mm_strdup("using"),$6,mm_strdup("set schema"),$9);
8430 }
8431 | ALTER OPERATOR FAMILY any_name USING name SET SCHEMA name
8432 {
8433 $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("set schema"),$9);
8434 }
8435 | ALTER PROCEDURE function_with_argtypes SET SCHEMA name
8436 {
8437 $$ = cat_str(4,mm_strdup("alter procedure"),$3,mm_strdup("set schema"),$6);
8438 }
8439 | ALTER ROUTINE function_with_argtypes SET SCHEMA name
8440 {
8441 $$ = cat_str(4,mm_strdup("alter routine"),$3,mm_strdup("set schema"),$6);
8442 }
8443 | ALTER TABLE relation_expr SET SCHEMA name
8444 {
8445 $$ = cat_str(4,mm_strdup("alter table"),$3,mm_strdup("set schema"),$6);
8446 }
8447 | ALTER TABLE IF_P EXISTS relation_expr SET SCHEMA name
8448 {
8449 $$ = cat_str(4,mm_strdup("alter table if exists"),$5,mm_strdup("set schema"),$8);
8450 }
8451 | ALTER STATISTICS any_name SET SCHEMA name
8452 {
8453 $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("set schema"),$6);
8454 }
8455 | ALTER TEXT_P SEARCH PARSER any_name SET SCHEMA name
8456 {
8457 $$ = cat_str(4,mm_strdup("alter text search parser"),$5,mm_strdup("set schema"),$8);
8458 }
8459 | ALTER TEXT_P SEARCH DICTIONARY any_name SET SCHEMA name
8460 {
8461 $$ = cat_str(4,mm_strdup("alter text search dictionary"),$5,mm_strdup("set schema"),$8);
8462 }
8463 | ALTER TEXT_P SEARCH TEMPLATE any_name SET SCHEMA name
8464 {
8465 $$ = cat_str(4,mm_strdup("alter text search template"),$5,mm_strdup("set schema"),$8);
8466 }
8467 | ALTER TEXT_P SEARCH CONFIGURATION any_name SET SCHEMA name
8468 {
8469 $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("set schema"),$8);
8470 }
8471 | ALTER SEQUENCE qualified_name SET SCHEMA name
8472 {
8473 $$ = cat_str(4,mm_strdup("alter sequence"),$3,mm_strdup("set schema"),$6);
8474 }
8475 | ALTER SEQUENCE IF_P EXISTS qualified_name SET SCHEMA name
8476 {
8477 $$ = cat_str(4,mm_strdup("alter sequence if exists"),$5,mm_strdup("set schema"),$8);
8478 }
8479 | ALTER VIEW qualified_name SET SCHEMA name
8480 {
8481 $$ = cat_str(4,mm_strdup("alter view"),$3,mm_strdup("set schema"),$6);
8482 }
8483 | ALTER VIEW IF_P EXISTS qualified_name SET SCHEMA name
8484 {
8485 $$ = cat_str(4,mm_strdup("alter view if exists"),$5,mm_strdup("set schema"),$8);
8486 }
8487 | ALTER MATERIALIZED VIEW qualified_name SET SCHEMA name
8488 {
8489 $$ = cat_str(4,mm_strdup("alter materialized view"),$4,mm_strdup("set schema"),$7);
8490 }
8491 | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name SET SCHEMA name
8492 {
8493 $$ = cat_str(4,mm_strdup("alter materialized view if exists"),$6,mm_strdup("set schema"),$9);
8494 }
8495 | ALTER FOREIGN TABLE relation_expr SET SCHEMA name
8496 {
8497 $$ = cat_str(4,mm_strdup("alter foreign table"),$4,mm_strdup("set schema"),$7);
8498 }
8499 | ALTER FOREIGN TABLE IF_P EXISTS relation_expr SET SCHEMA name
8500 {
8501 $$ = cat_str(4,mm_strdup("alter foreign table if exists"),$6,mm_strdup("set schema"),$9);
8502 }
8503 | ALTER TYPE_P any_name SET SCHEMA name
8504 {
8505 $$ = cat_str(4,mm_strdup("alter type"),$3,mm_strdup("set schema"),$6);
8506 }
8507 ;
8508
8509
8510 AlterOperatorStmt:
8511 ALTER OPERATOR operator_with_argtypes SET '(' operator_def_list ')'
8512 {
8513 $$ = cat_str(5,mm_strdup("alter operator"),$3,mm_strdup("set ("),$6,mm_strdup(")"));
8514 }
8515 ;
8516
8517
8518 operator_def_list:
8519 operator_def_elem
8520 {
8521 $$ = $1;
8522 }
8523 | operator_def_list ',' operator_def_elem
8524 {
8525 $$ = cat_str(3,$1,mm_strdup(","),$3);
8526 }
8527 ;
8528
8529
8530 operator_def_elem:
8531 ColLabel '=' NONE
8532 {
8533 $$ = cat_str(2,$1,mm_strdup("= none"));
8534 }
8535 | ColLabel '=' operator_def_arg
8536 {
8537 $$ = cat_str(3,$1,mm_strdup("="),$3);
8538 }
8539 ;
8540
8541
8542 operator_def_arg:
8543 func_type
8544 {
8545 $$ = $1;
8546 }
8547 | reserved_keyword
8548 {
8549 $$ = $1;
8550 }
8551 | qual_all_Op
8552 {
8553 $$ = $1;
8554 }
8555 | NumericOnly
8556 {
8557 $$ = $1;
8558 }
8559 | ecpg_sconst
8560 {
8561 $$ = $1;
8562 }
8563 ;
8564
8565
8566 AlterTypeStmt:
8567 ALTER TYPE_P any_name SET '(' operator_def_list ')'
8568 {
8569 $$ = cat_str(5,mm_strdup("alter type"),$3,mm_strdup("set ("),$6,mm_strdup(")"));
8570 }
8571 ;
8572
8573
8574 AlterOwnerStmt:
8575 ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
8576 {
8577 $$ = cat_str(4,mm_strdup("alter aggregate"),$3,mm_strdup("owner to"),$6);
8578 }
8579 | ALTER COLLATION any_name OWNER TO RoleSpec
8580 {
8581 $$ = cat_str(4,mm_strdup("alter collation"),$3,mm_strdup("owner to"),$6);
8582 }
8583 | ALTER CONVERSION_P any_name OWNER TO RoleSpec
8584 {
8585 $$ = cat_str(4,mm_strdup("alter conversion"),$3,mm_strdup("owner to"),$6);
8586 }
8587 | ALTER DATABASE name OWNER TO RoleSpec
8588 {
8589 $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("owner to"),$6);
8590 }
8591 | ALTER DOMAIN_P any_name OWNER TO RoleSpec
8592 {
8593 $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("owner to"),$6);
8594 }
8595 | ALTER FUNCTION function_with_argtypes OWNER TO RoleSpec
8596 {
8597 $$ = cat_str(4,mm_strdup("alter function"),$3,mm_strdup("owner to"),$6);
8598 }
8599 | ALTER opt_procedural LANGUAGE name OWNER TO RoleSpec
8600 {
8601 $$ = cat_str(6,mm_strdup("alter"),$2,mm_strdup("language"),$4,mm_strdup("owner to"),$7);
8602 }
8603 | ALTER LARGE_P OBJECT_P NumericOnly OWNER TO RoleSpec
8604 {
8605 $$ = cat_str(4,mm_strdup("alter large object"),$4,mm_strdup("owner to"),$7);
8606 }
8607 | ALTER OPERATOR operator_with_argtypes OWNER TO RoleSpec
8608 {
8609 $$ = cat_str(4,mm_strdup("alter operator"),$3,mm_strdup("owner to"),$6);
8610 }
8611 | ALTER OPERATOR CLASS any_name USING name OWNER TO RoleSpec
8612 {
8613 $$ = cat_str(6,mm_strdup("alter operator class"),$4,mm_strdup("using"),$6,mm_strdup("owner to"),$9);
8614 }
8615 | ALTER OPERATOR FAMILY any_name USING name OWNER TO RoleSpec
8616 {
8617 $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("owner to"),$9);
8618 }
8619 | ALTER PROCEDURE function_with_argtypes OWNER TO RoleSpec
8620 {
8621 $$ = cat_str(4,mm_strdup("alter procedure"),$3,mm_strdup("owner to"),$6);
8622 }
8623 | ALTER ROUTINE function_with_argtypes OWNER TO RoleSpec
8624 {
8625 $$ = cat_str(4,mm_strdup("alter routine"),$3,mm_strdup("owner to"),$6);
8626 }
8627 | ALTER SCHEMA name OWNER TO RoleSpec
8628 {
8629 $$ = cat_str(4,mm_strdup("alter schema"),$3,mm_strdup("owner to"),$6);
8630 }
8631 | ALTER TYPE_P any_name OWNER TO RoleSpec
8632 {
8633 $$ = cat_str(4,mm_strdup("alter type"),$3,mm_strdup("owner to"),$6);
8634 }
8635 | ALTER TABLESPACE name OWNER TO RoleSpec
8636 {
8637 $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("owner to"),$6);
8638 }
8639 | ALTER STATISTICS any_name OWNER TO RoleSpec
8640 {
8641 $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("owner to"),$6);
8642 }
8643 | ALTER TEXT_P SEARCH DICTIONARY any_name OWNER TO RoleSpec
8644 {
8645 $$ = cat_str(4,mm_strdup("alter text search dictionary"),$5,mm_strdup("owner to"),$8);
8646 }
8647 | ALTER TEXT_P SEARCH CONFIGURATION any_name OWNER TO RoleSpec
8648 {
8649 $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("owner to"),$8);
8650 }
8651 | ALTER FOREIGN DATA_P WRAPPER name OWNER TO RoleSpec
8652 {
8653 $$ = cat_str(4,mm_strdup("alter foreign data wrapper"),$5,mm_strdup("owner to"),$8);
8654 }
8655 | ALTER SERVER name OWNER TO RoleSpec
8656 {
8657 $$ = cat_str(4,mm_strdup("alter server"),$3,mm_strdup("owner to"),$6);
8658 }
8659 | ALTER EVENT TRIGGER name OWNER TO RoleSpec
8660 {
8661 $$ = cat_str(4,mm_strdup("alter event trigger"),$4,mm_strdup("owner to"),$7);
8662 }
8663 | ALTER PUBLICATION name OWNER TO RoleSpec
8664 {
8665 $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("owner to"),$6);
8666 }
8667 | ALTER SUBSCRIPTION name OWNER TO RoleSpec
8668 {
8669 $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("owner to"),$6);
8670 }
8671 ;
8672
8673
8674 CreatePublicationStmt:
8675 CREATE PUBLICATION name opt_publication_for_tables opt_definition
8676 {
8677 $$ = cat_str(4,mm_strdup("create publication"),$3,$4,$5);
8678 }
8679 ;
8680
8681
8682 opt_publication_for_tables:
8683 publication_for_tables
8684 {
8685 $$ = $1;
8686 }
8687 |
8688 {
8689 $$=EMPTY; }
8690 ;
8691
8692
8693 publication_for_tables:
8694 FOR TABLE relation_expr_list
8695 {
8696 $$ = cat_str(2,mm_strdup("for table"),$3);
8697 }
8698 | FOR ALL TABLES
8699 {
8700 $$ = mm_strdup("for all tables");
8701 }
8702 ;
8703
8704
8705 AlterPublicationStmt:
8706 ALTER PUBLICATION name SET definition
8707 {
8708 $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("set"),$5);
8709 }
8710 | ALTER PUBLICATION name ADD_P TABLE relation_expr_list
8711 {
8712 $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("add table"),$6);
8713 }
8714 | ALTER PUBLICATION name SET TABLE relation_expr_list
8715 {
8716 $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("set table"),$6);
8717 }
8718 | ALTER PUBLICATION name DROP TABLE relation_expr_list
8719 {
8720 $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("drop table"),$6);
8721 }
8722 ;
8723
8724
8725 CreateSubscriptionStmt:
8726 CREATE SUBSCRIPTION name CONNECTION ecpg_sconst PUBLICATION name_list opt_definition
8727 {
8728 $$ = cat_str(7,mm_strdup("create subscription"),$3,mm_strdup("connection"),$5,mm_strdup("publication"),$7,$8);
8729 }
8730 ;
8731
8732
8733 AlterSubscriptionStmt:
8734 ALTER SUBSCRIPTION name SET definition
8735 {
8736 $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("set"),$5);
8737 }
8738 | ALTER SUBSCRIPTION name CONNECTION ecpg_sconst
8739 {
8740 $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("connection"),$5);
8741 }
8742 | ALTER SUBSCRIPTION name REFRESH PUBLICATION opt_definition
8743 {
8744 $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("refresh publication"),$6);
8745 }
8746 | ALTER SUBSCRIPTION name ADD_P PUBLICATION name_list opt_definition
8747 {
8748 $$ = cat_str(5,mm_strdup("alter subscription"),$3,mm_strdup("add publication"),$6,$7);
8749 }
8750 | ALTER SUBSCRIPTION name DROP PUBLICATION name_list opt_definition
8751 {
8752 $$ = cat_str(5,mm_strdup("alter subscription"),$3,mm_strdup("drop publication"),$6,$7);
8753 }
8754 | ALTER SUBSCRIPTION name SET PUBLICATION name_list opt_definition
8755 {
8756 $$ = cat_str(5,mm_strdup("alter subscription"),$3,mm_strdup("set publication"),$6,$7);
8757 }
8758 | ALTER SUBSCRIPTION name ENABLE_P
8759 {
8760 $$ = cat_str(3,mm_strdup("alter subscription"),$3,mm_strdup("enable"));
8761 }
8762 | ALTER SUBSCRIPTION name DISABLE_P
8763 {
8764 $$ = cat_str(3,mm_strdup("alter subscription"),$3,mm_strdup("disable"));
8765 }
8766 ;
8767
8768
8769 DropSubscriptionStmt:
8770 DROP SUBSCRIPTION name opt_drop_behavior
8771 {
8772 $$ = cat_str(3,mm_strdup("drop subscription"),$3,$4);
8773 }
8774 | DROP SUBSCRIPTION IF_P EXISTS name opt_drop_behavior
8775 {
8776 $$ = cat_str(3,mm_strdup("drop subscription if exists"),$5,$6);
8777 }
8778 ;
8779
8780
8781 RuleStmt:
8782 CREATE opt_or_replace RULE name AS ON event TO qualified_name where_clause DO opt_instead RuleActionList
8783 {
8784 $$ = cat_str(12,mm_strdup("create"),$2,mm_strdup("rule"),$4,mm_strdup("as on"),$7,mm_strdup("to"),$9,$10,mm_strdup("do"),$12,$13);
8785 }
8786 ;
8787
8788
8789 RuleActionList:
8790 NOTHING
8791 {
8792 $$ = mm_strdup("nothing");
8793 }
8794 | RuleActionStmt
8795 {
8796 $$ = $1;
8797 }
8798 | '(' RuleActionMulti ')'
8799 {
8800 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
8801 }
8802 ;
8803
8804
8805 RuleActionMulti:
8806 RuleActionMulti ';' RuleActionStmtOrEmpty
8807 {
8808 $$ = cat_str(3,$1,mm_strdup(";"),$3);
8809 }
8810 | RuleActionStmtOrEmpty
8811 {
8812 $$ = $1;
8813 }
8814 ;
8815
8816
8817 RuleActionStmt:
8818 SelectStmt
8819 {
8820 $$ = $1;
8821 }
8822 | InsertStmt
8823 {
8824 $$ = $1;
8825 }
8826 | UpdateStmt
8827 {
8828 $$ = $1;
8829 }
8830 | DeleteStmt
8831 {
8832 $$ = $1;
8833 }
8834 | NotifyStmt
8835 {
8836 $$ = $1;
8837 }
8838 ;
8839
8840
8841 RuleActionStmtOrEmpty:
8842 RuleActionStmt
8843 {
8844 $$ = $1;
8845 }
8846 |
8847 {
8848 $$=EMPTY; }
8849 ;
8850
8851
8852 event:
8853 SELECT
8854 {
8855 $$ = mm_strdup("select");
8856 }
8857 | UPDATE
8858 {
8859 $$ = mm_strdup("update");
8860 }
8861 | DELETE_P
8862 {
8863 $$ = mm_strdup("delete");
8864 }
8865 | INSERT
8866 {
8867 $$ = mm_strdup("insert");
8868 }
8869 ;
8870
8871
8872 opt_instead:
8873 INSTEAD
8874 {
8875 $$ = mm_strdup("instead");
8876 }
8877 | ALSO
8878 {
8879 $$ = mm_strdup("also");
8880 }
8881 |
8882 {
8883 $$=EMPTY; }
8884 ;
8885
8886
8887 NotifyStmt:
8888 NOTIFY ColId notify_payload
8889 {
8890 $$ = cat_str(3,mm_strdup("notify"),$2,$3);
8891 }
8892 ;
8893
8894
8895 notify_payload:
8896 ',' ecpg_sconst
8897 {
8898 $$ = cat_str(2,mm_strdup(","),$2);
8899 }
8900 |
8901 {
8902 $$=EMPTY; }
8903 ;
8904
8905
8906 ListenStmt:
8907 LISTEN ColId
8908 {
8909 $$ = cat_str(2,mm_strdup("listen"),$2);
8910 }
8911 ;
8912
8913
8914 UnlistenStmt:
8915 UNLISTEN ColId
8916 {
8917 $$ = cat_str(2,mm_strdup("unlisten"),$2);
8918 }
8919 | UNLISTEN '*'
8920 {
8921 $$ = mm_strdup("unlisten *");
8922 }
8923 ;
8924
8925
8926 TransactionStmt:
8927 ABORT_P opt_transaction opt_transaction_chain
8928 {
8929 $$ = cat_str(3,mm_strdup("abort"),$2,$3);
8930 }
8931 | START TRANSACTION transaction_mode_list_or_empty
8932 {
8933 $$ = cat_str(2,mm_strdup("start transaction"),$3);
8934 }
8935 | COMMIT opt_transaction opt_transaction_chain
8936 {
8937 $$ = cat_str(3,mm_strdup("commit"),$2,$3);
8938 }
8939 | ROLLBACK opt_transaction opt_transaction_chain
8940 {
8941 $$ = cat_str(3,mm_strdup("rollback"),$2,$3);
8942 }
8943 | SAVEPOINT ColId
8944 {
8945 $$ = cat_str(2,mm_strdup("savepoint"),$2);
8946 }
8947 | RELEASE SAVEPOINT ColId
8948 {
8949 $$ = cat_str(2,mm_strdup("release savepoint"),$3);
8950 }
8951 | RELEASE ColId
8952 {
8953 $$ = cat_str(2,mm_strdup("release"),$2);
8954 }
8955 | ROLLBACK opt_transaction TO SAVEPOINT ColId
8956 {
8957 $$ = cat_str(4,mm_strdup("rollback"),$2,mm_strdup("to savepoint"),$5);
8958 }
8959 | ROLLBACK opt_transaction TO ColId
8960 {
8961 $$ = cat_str(4,mm_strdup("rollback"),$2,mm_strdup("to"),$4);
8962 }
8963 | PREPARE TRANSACTION ecpg_sconst
8964 {
8965 $$ = cat_str(2,mm_strdup("prepare transaction"),$3);
8966 }
8967 | COMMIT PREPARED ecpg_sconst
8968 {
8969 $$ = cat_str(2,mm_strdup("commit prepared"),$3);
8970 }
8971 | ROLLBACK PREPARED ecpg_sconst
8972 {
8973 $$ = cat_str(2,mm_strdup("rollback prepared"),$3);
8974 }
8975 ;
8976
8977
8978 TransactionStmtLegacy:
8979 BEGIN_P opt_transaction transaction_mode_list_or_empty
8980 {
8981 $$ = cat_str(3,mm_strdup("begin"),$2,$3);
8982 }
8983 | END_P opt_transaction opt_transaction_chain
8984 {
8985 $$ = cat_str(3,mm_strdup("end"),$2,$3);
8986 }
8987 ;
8988
8989
8990 opt_transaction:
8991 WORK
8992 {
8993 $$ = mm_strdup("work");
8994 }
8995 | TRANSACTION
8996 {
8997 $$ = mm_strdup("transaction");
8998 }
8999 |
9000 {
9001 $$=EMPTY; }
9002 ;
9003
9004
9005 transaction_mode_item:
9006 ISOLATION LEVEL iso_level
9007 {
9008 $$ = cat_str(2,mm_strdup("isolation level"),$3);
9009 }
9010 | READ ONLY
9011 {
9012 $$ = mm_strdup("read only");
9013 }
9014 | READ WRITE
9015 {
9016 $$ = mm_strdup("read write");
9017 }
9018 | DEFERRABLE
9019 {
9020 $$ = mm_strdup("deferrable");
9021 }
9022 | NOT DEFERRABLE
9023 {
9024 $$ = mm_strdup("not deferrable");
9025 }
9026 ;
9027
9028
9029 transaction_mode_list:
9030 transaction_mode_item
9031 {
9032 $$ = $1;
9033 }
9034 | transaction_mode_list ',' transaction_mode_item
9035 {
9036 $$ = cat_str(3,$1,mm_strdup(","),$3);
9037 }
9038 | transaction_mode_list transaction_mode_item
9039 {
9040 $$ = cat_str(2,$1,$2);
9041 }
9042 ;
9043
9044
9045 transaction_mode_list_or_empty:
9046 transaction_mode_list
9047 {
9048 $$ = $1;
9049 }
9050 |
9051 {
9052 $$=EMPTY; }
9053 ;
9054
9055
9056 opt_transaction_chain:
9057 AND CHAIN
9058 {
9059 $$ = mm_strdup("and chain");
9060 }
9061 | AND NO CHAIN
9062 {
9063 $$ = mm_strdup("and no chain");
9064 }
9065 |
9066 {
9067 $$=EMPTY; }
9068 ;
9069
9070
9071 ViewStmt:
9072 CREATE OptTemp VIEW qualified_name opt_column_list opt_reloptions AS SelectStmt opt_check_option
9073 {
9074 $$ = cat_str(9,mm_strdup("create"),$2,mm_strdup("view"),$4,$5,$6,mm_strdup("as"),$8,$9);
9075 }
9076 | CREATE OR REPLACE OptTemp VIEW qualified_name opt_column_list opt_reloptions AS SelectStmt opt_check_option
9077 {
9078 $$ = cat_str(9,mm_strdup("create or replace"),$4,mm_strdup("view"),$6,$7,$8,mm_strdup("as"),$10,$11);
9079 }
9080 | CREATE OptTemp RECURSIVE VIEW qualified_name '(' columnList ')' opt_reloptions AS SelectStmt opt_check_option
9081 {
9082 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
9083 $$ = cat_str(11,mm_strdup("create"),$2,mm_strdup("recursive view"),$5,mm_strdup("("),$7,mm_strdup(")"),$9,mm_strdup("as"),$11,$12);
9084 }
9085 | CREATE OR REPLACE OptTemp RECURSIVE VIEW qualified_name '(' columnList ')' opt_reloptions AS SelectStmt opt_check_option
9086 {
9087 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
9088 $$ = cat_str(11,mm_strdup("create or replace"),$4,mm_strdup("recursive view"),$7,mm_strdup("("),$9,mm_strdup(")"),$11,mm_strdup("as"),$13,$14);
9089 }
9090 ;
9091
9092
9093 opt_check_option:
9094 WITH CHECK OPTION
9095 {
9096 $$ = mm_strdup("with check option");
9097 }
9098 | WITH CASCADED CHECK OPTION
9099 {
9100 $$ = mm_strdup("with cascaded check option");
9101 }
9102 | WITH LOCAL CHECK OPTION
9103 {
9104 $$ = mm_strdup("with local check option");
9105 }
9106 |
9107 {
9108 $$=EMPTY; }
9109 ;
9110
9111
9112 LoadStmt:
9113 LOAD file_name
9114 {
9115 $$ = cat_str(2,mm_strdup("load"),$2);
9116 }
9117 ;
9118
9119
9120 CreatedbStmt:
9121 CREATE DATABASE name opt_with createdb_opt_list
9122 {
9123 $$ = cat_str(4,mm_strdup("create database"),$3,$4,$5);
9124 }
9125 ;
9126
9127
9128 createdb_opt_list:
9129 createdb_opt_items
9130 {
9131 $$ = $1;
9132 }
9133 |
9134 {
9135 $$=EMPTY; }
9136 ;
9137
9138
9139 createdb_opt_items:
9140 createdb_opt_item
9141 {
9142 $$ = $1;
9143 }
9144 | createdb_opt_items createdb_opt_item
9145 {
9146 $$ = cat_str(2,$1,$2);
9147 }
9148 ;
9149
9150
9151 createdb_opt_item:
9152 createdb_opt_name opt_equal SignedIconst
9153 {
9154 $$ = cat_str(3,$1,$2,$3);
9155 }
9156 | createdb_opt_name opt_equal opt_boolean_or_string
9157 {
9158 $$ = cat_str(3,$1,$2,$3);
9159 }
9160 | createdb_opt_name opt_equal DEFAULT
9161 {
9162 $$ = cat_str(3,$1,$2,mm_strdup("default"));
9163 }
9164 ;
9165
9166
9167 createdb_opt_name:
9168 ecpg_ident
9169 {
9170 $$ = $1;
9171 }
9172 | CONNECTION LIMIT
9173 {
9174 $$ = mm_strdup("connection limit");
9175 }
9176 | ENCODING
9177 {
9178 $$ = mm_strdup("encoding");
9179 }
9180 | LOCATION
9181 {
9182 $$ = mm_strdup("location");
9183 }
9184 | OWNER
9185 {
9186 $$ = mm_strdup("owner");
9187 }
9188 | TABLESPACE
9189 {
9190 $$ = mm_strdup("tablespace");
9191 }
9192 | TEMPLATE
9193 {
9194 $$ = mm_strdup("template");
9195 }
9196 ;
9197
9198
9199 opt_equal:
9200 '='
9201 {
9202 $$ = mm_strdup("=");
9203 }
9204 |
9205 {
9206 $$=EMPTY; }
9207 ;
9208
9209
9210 AlterDatabaseStmt:
9211 ALTER DATABASE name WITH createdb_opt_list
9212 {
9213 $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("with"),$5);
9214 }
9215 | ALTER DATABASE name createdb_opt_list
9216 {
9217 $$ = cat_str(3,mm_strdup("alter database"),$3,$4);
9218 }
9219 | ALTER DATABASE name SET TABLESPACE name
9220 {
9221 $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("set tablespace"),$6);
9222 }
9223 ;
9224
9225
9226 AlterDatabaseSetStmt:
9227 ALTER DATABASE name SetResetClause
9228 {
9229 $$ = cat_str(3,mm_strdup("alter database"),$3,$4);
9230 }
9231 ;
9232
9233
9234 DropdbStmt:
9235 DROP DATABASE name
9236 {
9237 $$ = cat_str(2,mm_strdup("drop database"),$3);
9238 }
9239 | DROP DATABASE IF_P EXISTS name
9240 {
9241 $$ = cat_str(2,mm_strdup("drop database if exists"),$5);
9242 }
9243 | DROP DATABASE name opt_with '(' drop_option_list ')'
9244 {
9245 $$ = cat_str(6,mm_strdup("drop database"),$3,$4,mm_strdup("("),$6,mm_strdup(")"));
9246 }
9247 | DROP DATABASE IF_P EXISTS name opt_with '(' drop_option_list ')'
9248 {
9249 $$ = cat_str(6,mm_strdup("drop database if exists"),$5,$6,mm_strdup("("),$8,mm_strdup(")"));
9250 }
9251 ;
9252
9253
9254 drop_option_list:
9255 drop_option
9256 {
9257 $$ = $1;
9258 }
9259 | drop_option_list ',' drop_option
9260 {
9261 $$ = cat_str(3,$1,mm_strdup(","),$3);
9262 }
9263 ;
9264
9265
9266 drop_option:
9267 FORCE
9268 {
9269 $$ = mm_strdup("force");
9270 }
9271 ;
9272
9273
9274 AlterCollationStmt:
9275 ALTER COLLATION any_name REFRESH VERSION_P
9276 {
9277 $$ = cat_str(3,mm_strdup("alter collation"),$3,mm_strdup("refresh version"));
9278 }
9279 ;
9280
9281
9282 AlterSystemStmt:
9283 ALTER SYSTEM_P SET generic_set
9284 {
9285 $$ = cat_str(2,mm_strdup("alter system set"),$4);
9286 }
9287 | ALTER SYSTEM_P RESET generic_reset
9288 {
9289 $$ = cat_str(2,mm_strdup("alter system reset"),$4);
9290 }
9291 ;
9292
9293
9294 CreateDomainStmt:
9295 CREATE DOMAIN_P any_name opt_as Typename ColQualList
9296 {
9297 $$ = cat_str(5,mm_strdup("create domain"),$3,$4,$5,$6);
9298 }
9299 ;
9300
9301
9302 AlterDomainStmt:
9303 ALTER DOMAIN_P any_name alter_column_default
9304 {
9305 $$ = cat_str(3,mm_strdup("alter domain"),$3,$4);
9306 }
9307 | ALTER DOMAIN_P any_name DROP NOT NULL_P
9308 {
9309 $$ = cat_str(3,mm_strdup("alter domain"),$3,mm_strdup("drop not null"));
9310 }
9311 | ALTER DOMAIN_P any_name SET NOT NULL_P
9312 {
9313 $$ = cat_str(3,mm_strdup("alter domain"),$3,mm_strdup("set not null"));
9314 }
9315 | ALTER DOMAIN_P any_name ADD_P TableConstraint
9316 {
9317 $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("add"),$5);
9318 }
9319 | ALTER DOMAIN_P any_name DROP CONSTRAINT name opt_drop_behavior
9320 {
9321 $$ = cat_str(5,mm_strdup("alter domain"),$3,mm_strdup("drop constraint"),$6,$7);
9322 }
9323 | ALTER DOMAIN_P any_name DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
9324 {
9325 $$ = cat_str(5,mm_strdup("alter domain"),$3,mm_strdup("drop constraint if exists"),$8,$9);
9326 }
9327 | ALTER DOMAIN_P any_name VALIDATE CONSTRAINT name
9328 {
9329 $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("validate constraint"),$6);
9330 }
9331 ;
9332
9333
9334 opt_as:
9335 AS
9336 {
9337 $$ = mm_strdup("as");
9338 }
9339 |
9340 {
9341 $$=EMPTY; }
9342 ;
9343
9344
9345 AlterTSDictionaryStmt:
9346 ALTER TEXT_P SEARCH DICTIONARY any_name definition
9347 {
9348 $$ = cat_str(3,mm_strdup("alter text search dictionary"),$5,$6);
9349 }
9350 ;
9351
9352
9353 AlterTSConfigurationStmt:
9354 ALTER TEXT_P SEARCH CONFIGURATION any_name ADD_P MAPPING FOR name_list any_with any_name_list
9355 {
9356 $$ = cat_str(6,mm_strdup("alter text search configuration"),$5,mm_strdup("add mapping for"),$9,$10,$11);
9357 }
9358 | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list any_with any_name_list
9359 {
9360 $$ = cat_str(6,mm_strdup("alter text search configuration"),$5,mm_strdup("alter mapping for"),$9,$10,$11);
9361 }
9362 | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING REPLACE any_name any_with any_name
9363 {
9364 $$ = cat_str(6,mm_strdup("alter text search configuration"),$5,mm_strdup("alter mapping replace"),$9,$10,$11);
9365 }
9366 | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list REPLACE any_name any_with any_name
9367 {
9368 $$ = cat_str(8,mm_strdup("alter text search configuration"),$5,mm_strdup("alter mapping for"),$9,mm_strdup("replace"),$11,$12,$13);
9369 }
9370 | ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING FOR name_list
9371 {
9372 $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("drop mapping for"),$9);
9373 }
9374 | ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING IF_P EXISTS FOR name_list
9375 {
9376 $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("drop mapping if exists for"),$11);
9377 }
9378 ;
9379
9380
9381 any_with:
9382 WITH
9383 {
9384 $$ = mm_strdup("with");
9385 }
9386 | WITH_LA
9387 {
9388 $$ = mm_strdup("with");
9389 }
9390 ;
9391
9392
9393 CreateConversionStmt:
9394 CREATE opt_default CONVERSION_P any_name FOR ecpg_sconst TO ecpg_sconst FROM any_name
9395 {
9396 $$ = cat_str(10,mm_strdup("create"),$2,mm_strdup("conversion"),$4,mm_strdup("for"),$6,mm_strdup("to"),$8,mm_strdup("from"),$10);
9397 }
9398 ;
9399
9400
9401 ClusterStmt:
9402 CLUSTER opt_verbose qualified_name cluster_index_specification
9403 {
9404 $$ = cat_str(4,mm_strdup("cluster"),$2,$3,$4);
9405 }
9406 | CLUSTER '(' utility_option_list ')' qualified_name cluster_index_specification
9407 {
9408 $$ = cat_str(5,mm_strdup("cluster ("),$3,mm_strdup(")"),$5,$6);
9409 }
9410 | CLUSTER opt_verbose
9411 {
9412 $$ = cat_str(2,mm_strdup("cluster"),$2);
9413 }
9414 | CLUSTER opt_verbose name ON qualified_name
9415 {
9416 $$ = cat_str(5,mm_strdup("cluster"),$2,$3,mm_strdup("on"),$5);
9417 }
9418 ;
9419
9420
9421 cluster_index_specification:
9422 USING name
9423 {
9424 $$ = cat_str(2,mm_strdup("using"),$2);
9425 }
9426 |
9427 {
9428 $$=EMPTY; }
9429 ;
9430
9431
9432 VacuumStmt:
9433 VACUUM opt_full opt_freeze opt_verbose opt_analyze opt_vacuum_relation_list
9434 {
9435 $$ = cat_str(6,mm_strdup("vacuum"),$2,$3,$4,$5,$6);
9436 }
9437 | VACUUM '(' utility_option_list ')' opt_vacuum_relation_list
9438 {
9439 $$ = cat_str(4,mm_strdup("vacuum ("),$3,mm_strdup(")"),$5);
9440 }
9441 ;
9442
9443
9444 AnalyzeStmt:
9445 analyze_keyword opt_verbose opt_vacuum_relation_list
9446 {
9447 $$ = cat_str(3,$1,$2,$3);
9448 }
9449 | analyze_keyword '(' utility_option_list ')' opt_vacuum_relation_list
9450 {
9451 $$ = cat_str(5,$1,mm_strdup("("),$3,mm_strdup(")"),$5);
9452 }
9453 ;
9454
9455
9456 utility_option_list:
9457 utility_option_elem
9458 {
9459 $$ = $1;
9460 }
9461 | utility_option_list ',' utility_option_elem
9462 {
9463 $$ = cat_str(3,$1,mm_strdup(","),$3);
9464 }
9465 ;
9466
9467
9468 analyze_keyword:
9469 ANALYZE
9470 {
9471 $$ = mm_strdup("analyze");
9472 }
9473 | ANALYSE
9474 {
9475 $$ = mm_strdup("analyse");
9476 }
9477 ;
9478
9479
9480 utility_option_elem:
9481 utility_option_name utility_option_arg
9482 {
9483 $$ = cat_str(2,$1,$2);
9484 }
9485 ;
9486
9487
9488 utility_option_name:
9489 NonReservedWord
9490 {
9491 $$ = $1;
9492 }
9493 | analyze_keyword
9494 {
9495 $$ = $1;
9496 }
9497 ;
9498
9499
9500 utility_option_arg:
9501 opt_boolean_or_string
9502 {
9503 $$ = $1;
9504 }
9505 | NumericOnly
9506 {
9507 $$ = $1;
9508 }
9509 |
9510 {
9511 $$=EMPTY; }
9512 ;
9513
9514
9515 opt_analyze:
9516 analyze_keyword
9517 {
9518 $$ = $1;
9519 }
9520 |
9521 {
9522 $$=EMPTY; }
9523 ;
9524
9525
9526 opt_verbose:
9527 VERBOSE
9528 {
9529 $$ = mm_strdup("verbose");
9530 }
9531 |
9532 {
9533 $$=EMPTY; }
9534 ;
9535
9536
9537 opt_full:
9538 FULL
9539 {
9540 $$ = mm_strdup("full");
9541 }
9542 |
9543 {
9544 $$=EMPTY; }
9545 ;
9546
9547
9548 opt_freeze:
9549 FREEZE
9550 {
9551 $$ = mm_strdup("freeze");
9552 }
9553 |
9554 {
9555 $$=EMPTY; }
9556 ;
9557
9558
9559 opt_name_list:
9560 '(' name_list ')'
9561 {
9562 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
9563 }
9564 |
9565 {
9566 $$=EMPTY; }
9567 ;
9568
9569
9570 vacuum_relation:
9571 qualified_name opt_name_list
9572 {
9573 $$ = cat_str(2,$1,$2);
9574 }
9575 ;
9576
9577
9578 vacuum_relation_list:
9579 vacuum_relation
9580 {
9581 $$ = $1;
9582 }
9583 | vacuum_relation_list ',' vacuum_relation
9584 {
9585 $$ = cat_str(3,$1,mm_strdup(","),$3);
9586 }
9587 ;
9588
9589
9590 opt_vacuum_relation_list:
9591 vacuum_relation_list
9592 {
9593 $$ = $1;
9594 }
9595 |
9596 {
9597 $$=EMPTY; }
9598 ;
9599
9600
9601 ExplainStmt:
9602 EXPLAIN ExplainableStmt
9603 {
9604 $$ = cat_str(2,mm_strdup("explain"),$2);
9605 }
9606 | EXPLAIN analyze_keyword opt_verbose ExplainableStmt
9607 {
9608 $$ = cat_str(4,mm_strdup("explain"),$2,$3,$4);
9609 }
9610 | EXPLAIN VERBOSE ExplainableStmt
9611 {
9612 $$ = cat_str(2,mm_strdup("explain verbose"),$3);
9613 }
9614 | EXPLAIN '(' utility_option_list ')' ExplainableStmt
9615 {
9616 $$ = cat_str(4,mm_strdup("explain ("),$3,mm_strdup(")"),$5);
9617 }
9618 ;
9619
9620
9621 ExplainableStmt:
9622 SelectStmt
9623 {
9624 $$ = $1;
9625 }
9626 | InsertStmt
9627 {
9628 $$ = $1;
9629 }
9630 | UpdateStmt
9631 {
9632 $$ = $1;
9633 }
9634 | DeleteStmt
9635 {
9636 $$ = $1;
9637 }
9638 | DeclareCursorStmt
9639 {
9640 $$ = $1;
9641 }
9642 | CreateAsStmt
9643 {
9644 $$ = $1;
9645 }
9646 | CreateMatViewStmt
9647 {
9648 $$ = $1;
9649 }
9650 | RefreshMatViewStmt
9651 {
9652 $$ = $1;
9653 }
9654 | ExecuteStmt
9655 {
9656 $$ = $1.name;
9657 }
9658 ;
9659
9660
9661 PrepareStmt:
9662 PREPARE prepared_name prep_type_clause AS PreparableStmt
9663 {
9664 $$.name = $2;
9665 $$.type = $3;
9666 $$.stmt = $5;
9667 }
9668 | PREPARE prepared_name FROM execstring
9669 {
9670 $$.name = $2;
9671 $$.type = NULL;
9672 $$.stmt = $4;
9673 }
9674 ;
9675
9676
9677 prep_type_clause:
9678 '(' type_list ')'
9679 {
9680 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
9681 }
9682 |
9683 {
9684 $$=EMPTY; }
9685 ;
9686
9687
9688 PreparableStmt:
9689 SelectStmt
9690 {
9691 $$ = $1;
9692 }
9693 | InsertStmt
9694 {
9695 $$ = $1;
9696 }
9697 | UpdateStmt
9698 {
9699 $$ = $1;
9700 }
9701 | DeleteStmt
9702 {
9703 $$ = $1;
9704 }
9705 ;
9706
9707
9708 ExecuteStmt:
9709 EXECUTE prepared_name execute_param_clause execute_rest
9710 {
9711 $$.name = $2;
9712 $$.type = $3;
9713 }
9714 | CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause opt_with_data execute_rest
9715 {
9716 $$.name = cat_str(8,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("as execute"),$7,$8,$9);
9717 }
9718 | CREATE OptTemp TABLE IF_P NOT EXISTS create_as_target AS EXECUTE prepared_name execute_param_clause opt_with_data execute_rest
9719 {
9720 $$.name = cat_str(8,mm_strdup("create"),$2,mm_strdup("table if not exists"),$7,mm_strdup("as execute"),$10,$11,$12);
9721 }
9722 ;
9723
9724
9725 execute_param_clause:
9726 '(' expr_list ')'
9727 {
9728 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
9729 }
9730 |
9731 {
9732 $$=EMPTY; }
9733 ;
9734
9735
9736 InsertStmt:
9737 opt_with_clause INSERT INTO insert_target insert_rest opt_on_conflict returning_clause
9738 {
9739 $$ = cat_str(6,$1,mm_strdup("insert into"),$4,$5,$6,$7);
9740 }
9741 ;
9742
9743
9744 insert_target:
9745 qualified_name
9746 {
9747 $$ = $1;
9748 }
9749 | qualified_name AS ColId
9750 {
9751 $$ = cat_str(3,$1,mm_strdup("as"),$3);
9752 }
9753 ;
9754
9755
9756 insert_rest:
9757 SelectStmt
9758 {
9759 $$ = $1;
9760 }
9761 | OVERRIDING override_kind VALUE_P SelectStmt
9762 {
9763 $$ = cat_str(4,mm_strdup("overriding"),$2,mm_strdup("value"),$4);
9764 }
9765 | '(' insert_column_list ')' SelectStmt
9766 {
9767 $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
9768 }
9769 | '(' insert_column_list ')' OVERRIDING override_kind VALUE_P SelectStmt
9770 {
9771 $$ = cat_str(6,mm_strdup("("),$2,mm_strdup(") overriding"),$5,mm_strdup("value"),$7);
9772 }
9773 | DEFAULT VALUES
9774 {
9775 $$ = mm_strdup("default values");
9776 }
9777 ;
9778
9779
9780 override_kind:
9781 USER
9782 {
9783 $$ = mm_strdup("user");
9784 }
9785 | SYSTEM_P
9786 {
9787 $$ = mm_strdup("system");
9788 }
9789 ;
9790
9791
9792 insert_column_list:
9793 insert_column_item
9794 {
9795 $$ = $1;
9796 }
9797 | insert_column_list ',' insert_column_item
9798 {
9799 $$ = cat_str(3,$1,mm_strdup(","),$3);
9800 }
9801 ;
9802
9803
9804 insert_column_item:
9805 ColId opt_indirection
9806 {
9807 $$ = cat_str(2,$1,$2);
9808 }
9809 ;
9810
9811
9812 opt_on_conflict:
9813 ON CONFLICT opt_conf_expr DO UPDATE SET set_clause_list where_clause
9814 {
9815 $$ = cat_str(5,mm_strdup("on conflict"),$3,mm_strdup("do update set"),$7,$8);
9816 }
9817 | ON CONFLICT opt_conf_expr DO NOTHING
9818 {
9819 $$ = cat_str(3,mm_strdup("on conflict"),$3,mm_strdup("do nothing"));
9820 }
9821 |
9822 {
9823 $$=EMPTY; }
9824 ;
9825
9826
9827 opt_conf_expr:
9828 '(' index_params ')' where_clause
9829 {
9830 $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
9831 }
9832 | ON CONSTRAINT name
9833 {
9834 $$ = cat_str(2,mm_strdup("on constraint"),$3);
9835 }
9836 |
9837 {
9838 $$=EMPTY; }
9839 ;
9840
9841
9842 returning_clause:
9843 RETURNING target_list opt_ecpg_into
9844 {
9845 $$ = cat_str(2,mm_strdup("returning"),$2);
9846 }
9847 |
9848 {
9849 $$=EMPTY; }
9850 ;
9851
9852
9853 DeleteStmt:
9854 opt_with_clause DELETE_P FROM relation_expr_opt_alias using_clause where_or_current_clause returning_clause
9855 {
9856 $$ = cat_str(6,$1,mm_strdup("delete from"),$4,$5,$6,$7);
9857 }
9858 ;
9859
9860
9861 using_clause:
9862 USING from_list
9863 {
9864 $$ = cat_str(2,mm_strdup("using"),$2);
9865 }
9866 |
9867 {
9868 $$=EMPTY; }
9869 ;
9870
9871
9872 LockStmt:
9873 LOCK_P opt_table relation_expr_list opt_lock opt_nowait
9874 {
9875 $$ = cat_str(5,mm_strdup("lock"),$2,$3,$4,$5);
9876 }
9877 ;
9878
9879
9880 opt_lock:
9881 IN_P lock_type MODE
9882 {
9883 $$ = cat_str(3,mm_strdup("in"),$2,mm_strdup("mode"));
9884 }
9885 |
9886 {
9887 $$=EMPTY; }
9888 ;
9889
9890
9891 lock_type:
9892 ACCESS SHARE
9893 {
9894 $$ = mm_strdup("access share");
9895 }
9896 | ROW SHARE
9897 {
9898 $$ = mm_strdup("row share");
9899 }
9900 | ROW EXCLUSIVE
9901 {
9902 $$ = mm_strdup("row exclusive");
9903 }
9904 | SHARE UPDATE EXCLUSIVE
9905 {
9906 $$ = mm_strdup("share update exclusive");
9907 }
9908 | SHARE
9909 {
9910 $$ = mm_strdup("share");
9911 }
9912 | SHARE ROW EXCLUSIVE
9913 {
9914 $$ = mm_strdup("share row exclusive");
9915 }
9916 | EXCLUSIVE
9917 {
9918 $$ = mm_strdup("exclusive");
9919 }
9920 | ACCESS EXCLUSIVE
9921 {
9922 $$ = mm_strdup("access exclusive");
9923 }
9924 ;
9925
9926
9927 opt_nowait:
9928 NOWAIT
9929 {
9930 $$ = mm_strdup("nowait");
9931 }
9932 |
9933 {
9934 $$=EMPTY; }
9935 ;
9936
9937
9938 opt_nowait_or_skip:
9939 NOWAIT
9940 {
9941 $$ = mm_strdup("nowait");
9942 }
9943 | SKIP LOCKED
9944 {
9945 $$ = mm_strdup("skip locked");
9946 }
9947 |
9948 {
9949 $$=EMPTY; }
9950 ;
9951
9952
9953 UpdateStmt:
9954 opt_with_clause UPDATE relation_expr_opt_alias SET set_clause_list from_clause where_or_current_clause returning_clause
9955 {
9956 $$ = cat_str(8,$1,mm_strdup("update"),$3,mm_strdup("set"),$5,$6,$7,$8);
9957 }
9958 ;
9959
9960
9961 set_clause_list:
9962 set_clause
9963 {
9964 $$ = $1;
9965 }
9966 | set_clause_list ',' set_clause
9967 {
9968 $$ = cat_str(3,$1,mm_strdup(","),$3);
9969 }
9970 ;
9971
9972
9973 set_clause:
9974 set_target '=' a_expr
9975 {
9976 $$ = cat_str(3,$1,mm_strdup("="),$3);
9977 }
9978 | '(' set_target_list ')' '=' a_expr
9979 {
9980 $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(") ="),$5);
9981 }
9982 ;
9983
9984
9985 set_target:
9986 ColId opt_indirection
9987 {
9988 $$ = cat_str(2,$1,$2);
9989 }
9990 ;
9991
9992
9993 set_target_list:
9994 set_target
9995 {
9996 $$ = $1;
9997 }
9998 | set_target_list ',' set_target
9999 {
10000 $$ = cat_str(3,$1,mm_strdup(","),$3);
10001 }
10002 ;
10003
10004
10005 DeclareCursorStmt:
10006 DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt
10007 {
10008 struct cursor *ptr, *this;
10009 char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : mm_strdup($2);
10010 char *comment, *c1, *c2;
10011 int (* strcmp_fn)(const char *, const char *) = (($2[0] == ':' || $2[0] == '"') ? strcmp : pg_strcasecmp);
10012
10013 if (INFORMIX_MODE && pg_strcasecmp($2, "database") == 0)
10014 mmfatal(PARSE_ERROR, "\"database\" cannot be used as cursor name in INFORMIX mode");
10015
10016 for (ptr = cur; ptr != NULL; ptr = ptr->next)
10017 {
10018 if (strcmp_fn($2, ptr->name) == 0)
10019 {
10020 if ($2[0] == ':')
10021 mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
10022 else
10023 mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
10024 }
10025 }
10026
10027 this = (struct cursor *) mm_alloc(sizeof(struct cursor));
10028
10029 this->next = cur;
10030 this->name = $2;
10031 this->function = (current_function ? mm_strdup(current_function) : NULL);
10032 this->connection = connection ? mm_strdup(connection) : NULL;
10033 this->opened = false;
10034 this->command = cat_str(7, mm_strdup("declare"), cursor_marker, $3, mm_strdup("cursor"), $5, mm_strdup("for"), $7);
10035 this->argsinsert = argsinsert;
10036 this->argsinsert_oos = NULL;
10037 this->argsresult = argsresult;
10038 this->argsresult_oos = NULL;
10039 argsinsert = argsresult = NULL;
10040 cur = this;
10041
10042 c1 = mm_strdup(this->command);
10043 if ((c2 = strstr(c1, "*/")) != NULL)
10044 {
10045 /* We put this text into a comment, so we better remove [*][/]. */
10046 c2[0] = '.';
10047 c2[1] = '.';
10048 }
10049 comment = cat_str(3, mm_strdup("/*"), c1, mm_strdup("*/"));
10050
10051 $$ = cat2_str(adjust_outofscope_cursor_vars(this), comment);
10052 }
10053 ;
10054
10055
10056 cursor_name:
10057 name
10058 {
10059 $$ = $1;
10060 }
10061 | char_civar
10062 {
10063 char *curname = mm_alloc(strlen($1) + 2);
10064 sprintf(curname, ":%s", $1);
10065 free($1);
10066 $1 = curname;
10067 $$ = $1;
10068 }
10069 ;
10070
10071
10072 cursor_options:
10073
10074 {
10075 $$=EMPTY; }
10076 | cursor_options NO SCROLL
10077 {
10078 $$ = cat_str(2,$1,mm_strdup("no scroll"));
10079 }
10080 | cursor_options SCROLL
10081 {
10082 $$ = cat_str(2,$1,mm_strdup("scroll"));
10083 }
10084 | cursor_options BINARY
10085 {
10086 $$ = cat_str(2,$1,mm_strdup("binary"));
10087 }
10088 | cursor_options ASENSITIVE
10089 {
10090 $$ = cat_str(2,$1,mm_strdup("asensitive"));
10091 }
10092 | cursor_options INSENSITIVE
10093 {
10094 $$ = cat_str(2,$1,mm_strdup("insensitive"));
10095 }
10096 ;
10097
10098
10099 opt_hold:
10100
10101 {
10102 if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit)
10103 $$ = mm_strdup("with hold");
10104 else
10105 $$ = EMPTY;
10106 }
10107 | WITH HOLD
10108 {
10109 $$ = mm_strdup("with hold");
10110 }
10111 | WITHOUT HOLD
10112 {
10113 $$ = mm_strdup("without hold");
10114 }
10115 ;
10116
10117
10118 SelectStmt:
10119 select_no_parens %prec UMINUS
10120 {
10121 $$ = $1;
10122 }
10123 | select_with_parens %prec UMINUS
10124 {
10125 $$ = $1;
10126 }
10127 ;
10128
10129
10130 select_with_parens:
10131 '(' select_no_parens ')'
10132 {
10133 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
10134 }
10135 | '(' select_with_parens ')'
10136 {
10137 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
10138 }
10139 ;
10140
10141
10142 select_no_parens:
10143 simple_select
10144 {
10145 $$ = $1;
10146 }
10147 | select_clause sort_clause
10148 {
10149 $$ = cat_str(2,$1,$2);
10150 }
10151 | select_clause opt_sort_clause for_locking_clause opt_select_limit
10152 {
10153 $$ = cat_str(4,$1,$2,$3,$4);
10154 }
10155 | select_clause opt_sort_clause select_limit opt_for_locking_clause
10156 {
10157 $$ = cat_str(4,$1,$2,$3,$4);
10158 }
10159 | with_clause select_clause
10160 {
10161 $$ = cat_str(2,$1,$2);
10162 }
10163 | with_clause select_clause sort_clause
10164 {
10165 $$ = cat_str(3,$1,$2,$3);
10166 }
10167 | with_clause select_clause opt_sort_clause for_locking_clause opt_select_limit
10168 {
10169 $$ = cat_str(5,$1,$2,$3,$4,$5);
10170 }
10171 | with_clause select_clause opt_sort_clause select_limit opt_for_locking_clause
10172 {
10173 $$ = cat_str(5,$1,$2,$3,$4,$5);
10174 }
10175 ;
10176
10177
10178 select_clause:
10179 simple_select
10180 {
10181 $$ = $1;
10182 }
10183 | select_with_parens
10184 {
10185 $$ = $1;
10186 }
10187 ;
10188
10189
10190 simple_select:
10191 SELECT opt_all_clause opt_target_list into_clause from_clause where_clause group_clause having_clause window_clause
10192 {
10193 $$ = cat_str(9,mm_strdup("select"),$2,$3,$4,$5,$6,$7,$8,$9);
10194 }
10195 | SELECT distinct_clause target_list into_clause from_clause where_clause group_clause having_clause window_clause
10196 {
10197 $$ = cat_str(9,mm_strdup("select"),$2,$3,$4,$5,$6,$7,$8,$9);
10198 }
10199 | values_clause
10200 {
10201 $$ = $1;
10202 }
10203 | TABLE relation_expr
10204 {
10205 $$ = cat_str(2,mm_strdup("table"),$2);
10206 }
10207 | select_clause UNION set_quantifier select_clause
10208 {
10209 $$ = cat_str(4,$1,mm_strdup("union"),$3,$4);
10210 }
10211 | select_clause INTERSECT set_quantifier select_clause
10212 {
10213 $$ = cat_str(4,$1,mm_strdup("intersect"),$3,$4);
10214 }
10215 | select_clause EXCEPT set_quantifier select_clause
10216 {
10217 $$ = cat_str(4,$1,mm_strdup("except"),$3,$4);
10218 }
10219 ;
10220
10221
10222 with_clause:
10223 WITH cte_list
10224 {
10225 $$ = cat_str(2,mm_strdup("with"),$2);
10226 }
10227 | WITH_LA cte_list
10228 {
10229 $$ = cat_str(2,mm_strdup("with"),$2);
10230 }
10231 | WITH RECURSIVE cte_list
10232 {
10233 $$ = cat_str(2,mm_strdup("with recursive"),$3);
10234 }
10235 ;
10236
10237
10238 cte_list:
10239 common_table_expr
10240 {
10241 $$ = $1;
10242 }
10243 | cte_list ',' common_table_expr
10244 {
10245 $$ = cat_str(3,$1,mm_strdup(","),$3);
10246 }
10247 ;
10248
10249
10250 common_table_expr:
10251 name opt_name_list AS opt_materialized '(' PreparableStmt ')' opt_search_clause opt_cycle_clause
10252 {
10253 $$ = cat_str(9,$1,$2,mm_strdup("as"),$4,mm_strdup("("),$6,mm_strdup(")"),$8,$9);
10254 }
10255 ;
10256
10257
10258 opt_materialized:
10259 MATERIALIZED
10260 {
10261 $$ = mm_strdup("materialized");
10262 }
10263 | NOT MATERIALIZED
10264 {
10265 $$ = mm_strdup("not materialized");
10266 }
10267 |
10268 {
10269 $$=EMPTY; }
10270 ;
10271
10272
10273 opt_search_clause:
10274 SEARCH DEPTH FIRST_P BY columnList SET ColId
10275 {
10276 $$ = cat_str(4,mm_strdup("search depth first by"),$5,mm_strdup("set"),$7);
10277 }
10278 | SEARCH BREADTH FIRST_P BY columnList SET ColId
10279 {
10280 $$ = cat_str(4,mm_strdup("search breadth first by"),$5,mm_strdup("set"),$7);
10281 }
10282 |
10283 {
10284 $$=EMPTY; }
10285 ;
10286
10287
10288 opt_cycle_clause:
10289 CYCLE columnList SET ColId TO AexprConst DEFAULT AexprConst USING ColId
10290 {
10291 $$ = cat_str(10,mm_strdup("cycle"),$2,mm_strdup("set"),$4,mm_strdup("to"),$6,mm_strdup("default"),$8,mm_strdup("using"),$10);
10292 }
10293 | CYCLE columnList SET ColId USING ColId
10294 {
10295 $$ = cat_str(6,mm_strdup("cycle"),$2,mm_strdup("set"),$4,mm_strdup("using"),$6);
10296 }
10297 |
10298 {
10299 $$=EMPTY; }
10300 ;
10301
10302
10303 opt_with_clause:
10304 with_clause
10305 {
10306 $$ = $1;
10307 }
10308 |
10309 {
10310 $$=EMPTY; }
10311 ;
10312
10313
10314 into_clause:
10315 INTO OptTempTableName
10316 {
10317 FoundInto = 1;
10318 $$= cat2_str(mm_strdup("into"), $2);
10319 }
10320 | ecpg_into { $$ = EMPTY; }
10321 |
10322 {
10323 $$=EMPTY; }
10324 ;
10325
10326
10327 OptTempTableName:
10328 TEMPORARY opt_table qualified_name
10329 {
10330 $$ = cat_str(3,mm_strdup("temporary"),$2,$3);
10331 }
10332 | TEMP opt_table qualified_name
10333 {
10334 $$ = cat_str(3,mm_strdup("temp"),$2,$3);
10335 }
10336 | LOCAL TEMPORARY opt_table qualified_name
10337 {
10338 $$ = cat_str(3,mm_strdup("local temporary"),$3,$4);
10339 }
10340 | LOCAL TEMP opt_table qualified_name
10341 {
10342 $$ = cat_str(3,mm_strdup("local temp"),$3,$4);
10343 }
10344 | GLOBAL TEMPORARY opt_table qualified_name
10345 {
10346 $$ = cat_str(3,mm_strdup("global temporary"),$3,$4);
10347 }
10348 | GLOBAL TEMP opt_table qualified_name
10349 {
10350 $$ = cat_str(3,mm_strdup("global temp"),$3,$4);
10351 }
10352 | UNLOGGED opt_table qualified_name
10353 {
10354 $$ = cat_str(3,mm_strdup("unlogged"),$2,$3);
10355 }
10356 | TABLE qualified_name
10357 {
10358 $$ = cat_str(2,mm_strdup("table"),$2);
10359 }
10360 | qualified_name
10361 {
10362 $$ = $1;
10363 }
10364 ;
10365
10366
10367 opt_table:
10368 TABLE
10369 {
10370 $$ = mm_strdup("table");
10371 }
10372 |
10373 {
10374 $$=EMPTY; }
10375 ;
10376
10377
10378 set_quantifier:
10379 ALL
10380 {
10381 $$ = mm_strdup("all");
10382 }
10383 | DISTINCT
10384 {
10385 $$ = mm_strdup("distinct");
10386 }
10387 |
10388 {
10389 $$=EMPTY; }
10390 ;
10391
10392
10393 distinct_clause:
10394 DISTINCT
10395 {
10396 $$ = mm_strdup("distinct");
10397 }
10398 | DISTINCT ON '(' expr_list ')'
10399 {
10400 $$ = cat_str(3,mm_strdup("distinct on ("),$4,mm_strdup(")"));
10401 }
10402 ;
10403
10404
10405 opt_all_clause:
10406 ALL
10407 {
10408 $$ = mm_strdup("all");
10409 }
10410 |
10411 {
10412 $$=EMPTY; }
10413 ;
10414
10415
10416 opt_sort_clause:
10417 sort_clause
10418 {
10419 $$ = $1;
10420 }
10421 |
10422 {
10423 $$=EMPTY; }
10424 ;
10425
10426
10427 sort_clause:
10428 ORDER BY sortby_list
10429 {
10430 $$ = cat_str(2,mm_strdup("order by"),$3);
10431 }
10432 ;
10433
10434
10435 sortby_list:
10436 sortby
10437 {
10438 $$ = $1;
10439 }
10440 | sortby_list ',' sortby
10441 {
10442 $$ = cat_str(3,$1,mm_strdup(","),$3);
10443 }
10444 ;
10445
10446
10447 sortby:
10448 a_expr USING qual_all_Op opt_nulls_order
10449 {
10450 $$ = cat_str(4,$1,mm_strdup("using"),$3,$4);
10451 }
10452 | a_expr opt_asc_desc opt_nulls_order
10453 {
10454 $$ = cat_str(3,$1,$2,$3);
10455 }
10456 ;
10457
10458
10459 select_limit:
10460 limit_clause offset_clause
10461 {
10462 $$ = cat_str(2,$1,$2);
10463 }
10464 | offset_clause limit_clause
10465 {
10466 $$ = cat_str(2,$1,$2);
10467 }
10468 | limit_clause
10469 {
10470 $$ = $1;
10471 }
10472 | offset_clause
10473 {
10474 $$ = $1;
10475 }
10476 ;
10477
10478
10479 opt_select_limit:
10480 select_limit
10481 {
10482 $$ = $1;
10483 }
10484 |
10485 {
10486 $$=EMPTY; }
10487 ;
10488
10489
10490 limit_clause:
10491 LIMIT select_limit_value
10492 {
10493 $$ = cat_str(2,mm_strdup("limit"),$2);
10494 }
10495 | LIMIT select_limit_value ',' select_offset_value
10496 {
10497 mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
10498 $$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4);
10499 }
10500 | FETCH first_or_next select_fetch_first_value row_or_rows ONLY
10501 {
10502 $$ = cat_str(5,mm_strdup("fetch"),$2,$3,$4,mm_strdup("only"));
10503 }
10504 | FETCH first_or_next select_fetch_first_value row_or_rows WITH TIES
10505 {
10506 $$ = cat_str(5,mm_strdup("fetch"),$2,$3,$4,mm_strdup("with ties"));
10507 }
10508 | FETCH first_or_next row_or_rows ONLY
10509 {
10510 $$ = cat_str(4,mm_strdup("fetch"),$2,$3,mm_strdup("only"));
10511 }
10512 | FETCH first_or_next row_or_rows WITH TIES
10513 {
10514 $$ = cat_str(4,mm_strdup("fetch"),$2,$3,mm_strdup("with ties"));
10515 }
10516 ;
10517
10518
10519 offset_clause:
10520 OFFSET select_offset_value
10521 {
10522 $$ = cat_str(2,mm_strdup("offset"),$2);
10523 }
10524 | OFFSET select_fetch_first_value row_or_rows
10525 {
10526 $$ = cat_str(3,mm_strdup("offset"),$2,$3);
10527 }
10528 ;
10529
10530
10531 select_limit_value:
10532 a_expr
10533 {
10534 $$ = $1;
10535 }
10536 | ALL
10537 {
10538 $$ = mm_strdup("all");
10539 }
10540 ;
10541
10542
10543 select_offset_value:
10544 a_expr
10545 {
10546 $$ = $1;
10547 }
10548 ;
10549
10550
10551 select_fetch_first_value:
10552 c_expr
10553 {
10554 $$ = $1;
10555 }
10556 | '+' I_or_F_const
10557 {
10558 $$ = cat_str(2,mm_strdup("+"),$2);
10559 }
10560 | '-' I_or_F_const
10561 {
10562 $$ = cat_str(2,mm_strdup("-"),$2);
10563 }
10564 ;
10565
10566
10567 I_or_F_const:
10568 Iconst
10569 {
10570 $$ = $1;
10571 }
10572 | ecpg_fconst
10573 {
10574 $$ = $1;
10575 }
10576 ;
10577
10578
10579 row_or_rows:
10580 ROW
10581 {
10582 $$ = mm_strdup("row");
10583 }
10584 | ROWS
10585 {
10586 $$ = mm_strdup("rows");
10587 }
10588 ;
10589
10590
10591 first_or_next:
10592 FIRST_P
10593 {
10594 $$ = mm_strdup("first");
10595 }
10596 | NEXT
10597 {
10598 $$ = mm_strdup("next");
10599 }
10600 ;
10601
10602
10603 group_clause:
10604 GROUP_P BY set_quantifier group_by_list
10605 {
10606 $$ = cat_str(3,mm_strdup("group by"),$3,$4);
10607 }
10608 |
10609 {
10610 $$=EMPTY; }
10611 ;
10612
10613
10614 group_by_list:
10615 group_by_item
10616 {
10617 $$ = $1;
10618 }
10619 | group_by_list ',' group_by_item
10620 {
10621 $$ = cat_str(3,$1,mm_strdup(","),$3);
10622 }
10623 ;
10624
10625
10626 group_by_item:
10627 a_expr
10628 {
10629 $$ = $1;
10630 }
10631 | empty_grouping_set
10632 {
10633 $$ = $1;
10634 }
10635 | cube_clause
10636 {
10637 $$ = $1;
10638 }
10639 | rollup_clause
10640 {
10641 $$ = $1;
10642 }
10643 | grouping_sets_clause
10644 {
10645 $$ = $1;
10646 }
10647 ;
10648
10649
10650 empty_grouping_set:
10651 '(' ')'
10652 {
10653 $$ = mm_strdup("( )");
10654 }
10655 ;
10656
10657
10658 rollup_clause:
10659 ROLLUP '(' expr_list ')'
10660 {
10661 $$ = cat_str(3,mm_strdup("rollup ("),$3,mm_strdup(")"));
10662 }
10663 ;
10664
10665
10666 cube_clause:
10667 CUBE '(' expr_list ')'
10668 {
10669 $$ = cat_str(3,mm_strdup("cube ("),$3,mm_strdup(")"));
10670 }
10671 ;
10672
10673
10674 grouping_sets_clause:
10675 GROUPING SETS '(' group_by_list ')'
10676 {
10677 $$ = cat_str(3,mm_strdup("grouping sets ("),$4,mm_strdup(")"));
10678 }
10679 ;
10680
10681
10682 having_clause:
10683 HAVING a_expr
10684 {
10685 $$ = cat_str(2,mm_strdup("having"),$2);
10686 }
10687 |
10688 {
10689 $$=EMPTY; }
10690 ;
10691
10692
10693 for_locking_clause:
10694 for_locking_items
10695 {
10696 $$ = $1;
10697 }
10698 | FOR READ ONLY
10699 {
10700 $$ = mm_strdup("for read only");
10701 }
10702 ;
10703
10704
10705 opt_for_locking_clause:
10706 for_locking_clause
10707 {
10708 $$ = $1;
10709 }
10710 |
10711 {
10712 $$=EMPTY; }
10713 ;
10714
10715
10716 for_locking_items:
10717 for_locking_item
10718 {
10719 $$ = $1;
10720 }
10721 | for_locking_items for_locking_item
10722 {
10723 $$ = cat_str(2,$1,$2);
10724 }
10725 ;
10726
10727
10728 for_locking_item:
10729 for_locking_strength locked_rels_list opt_nowait_or_skip
10730 {
10731 $$ = cat_str(3,$1,$2,$3);
10732 }
10733 ;
10734
10735
10736 for_locking_strength:
10737 FOR UPDATE
10738 {
10739 $$ = mm_strdup("for update");
10740 }
10741 | FOR NO KEY UPDATE
10742 {
10743 $$ = mm_strdup("for no key update");
10744 }
10745 | FOR SHARE
10746 {
10747 $$ = mm_strdup("for share");
10748 }
10749 | FOR KEY SHARE
10750 {
10751 $$ = mm_strdup("for key share");
10752 }
10753 ;
10754
10755
10756 locked_rels_list:
10757 OF qualified_name_list
10758 {
10759 $$ = cat_str(2,mm_strdup("of"),$2);
10760 }
10761 |
10762 {
10763 $$=EMPTY; }
10764 ;
10765
10766
10767 values_clause:
10768 VALUES '(' expr_list ')'
10769 {
10770 $$ = cat_str(3,mm_strdup("values ("),$3,mm_strdup(")"));
10771 }
10772 | values_clause ',' '(' expr_list ')'
10773 {
10774 $$ = cat_str(4,$1,mm_strdup(", ("),$4,mm_strdup(")"));
10775 }
10776 ;
10777
10778
10779 from_clause:
10780 FROM from_list
10781 {
10782 $$ = cat_str(2,mm_strdup("from"),$2);
10783 }
10784 |
10785 {
10786 $$=EMPTY; }
10787 ;
10788
10789
10790 from_list:
10791 table_ref
10792 {
10793 $$ = $1;
10794 }
10795 | from_list ',' table_ref
10796 {
10797 $$ = cat_str(3,$1,mm_strdup(","),$3);
10798 }
10799 ;
10800
10801
10802 table_ref:
10803 relation_expr opt_alias_clause
10804 {
10805 $$ = cat_str(2,$1,$2);
10806 }
10807 | relation_expr opt_alias_clause tablesample_clause
10808 {
10809 $$ = cat_str(3,$1,$2,$3);
10810 }
10811 | func_table func_alias_clause
10812 {
10813 $$ = cat_str(2,$1,$2);
10814 }
10815 | LATERAL_P func_table func_alias_clause
10816 {
10817 $$ = cat_str(3,mm_strdup("lateral"),$2,$3);
10818 }
10819 | xmltable opt_alias_clause
10820 {
10821 $$ = cat_str(2,$1,$2);
10822 }
10823 | LATERAL_P xmltable opt_alias_clause
10824 {
10825 $$ = cat_str(3,mm_strdup("lateral"),$2,$3);
10826 }
10827 | select_with_parens opt_alias_clause
10828 {
10829 if ($2 == NULL)
10830 mmerror(PARSE_ERROR, ET_ERROR, "subquery in FROM must have an alias");
10831
10832 $$ = cat_str(2,$1,$2);
10833 }
10834 | LATERAL_P select_with_parens opt_alias_clause
10835 {
10836 if ($3 == NULL)
10837 mmerror(PARSE_ERROR, ET_ERROR, "subquery in FROM must have an alias");
10838
10839 $$ = cat_str(3,mm_strdup("lateral"),$2,$3);
10840 }
10841 | joined_table
10842 {
10843 $$ = $1;
10844 }
10845 | '(' joined_table ')' alias_clause
10846 {
10847 $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
10848 }
10849 ;
10850
10851
10852 joined_table:
10853 '(' joined_table ')'
10854 {
10855 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
10856 }
10857 | table_ref CROSS JOIN table_ref
10858 {
10859 $$ = cat_str(3,$1,mm_strdup("cross join"),$4);
10860 }
10861 | table_ref join_type JOIN table_ref join_qual
10862 {
10863 $$ = cat_str(5,$1,$2,mm_strdup("join"),$4,$5);
10864 }
10865 | table_ref JOIN table_ref join_qual
10866 {
10867 $$ = cat_str(4,$1,mm_strdup("join"),$3,$4);
10868 }
10869 | table_ref NATURAL join_type JOIN table_ref
10870 {
10871 $$ = cat_str(5,$1,mm_strdup("natural"),$3,mm_strdup("join"),$5);
10872 }
10873 | table_ref NATURAL JOIN table_ref
10874 {
10875 $$ = cat_str(3,$1,mm_strdup("natural join"),$4);
10876 }
10877 ;
10878
10879
10880 alias_clause:
10881 AS ColId '(' name_list ')'
10882 {
10883 $$ = cat_str(5,mm_strdup("as"),$2,mm_strdup("("),$4,mm_strdup(")"));
10884 }
10885 | AS ColId
10886 {
10887 $$ = cat_str(2,mm_strdup("as"),$2);
10888 }
10889 | ColId '(' name_list ')'
10890 {
10891 $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
10892 }
10893 | ColId
10894 {
10895 $$ = $1;
10896 }
10897 ;
10898
10899
10900 opt_alias_clause:
10901 alias_clause
10902 {
10903 $$ = $1;
10904 }
10905 |
10906 {
10907 $$=EMPTY; }
10908 ;
10909
10910
10911 opt_alias_clause_for_join_using:
10912 AS ColId
10913 {
10914 $$ = cat_str(2,mm_strdup("as"),$2);
10915 }
10916 |
10917 {
10918 $$=EMPTY; }
10919 ;
10920
10921
10922 func_alias_clause:
10923 alias_clause
10924 {
10925 $$ = $1;
10926 }
10927 | AS '(' TableFuncElementList ')'
10928 {
10929 $$ = cat_str(3,mm_strdup("as ("),$3,mm_strdup(")"));
10930 }
10931 | AS ColId '(' TableFuncElementList ')'
10932 {
10933 $$ = cat_str(5,mm_strdup("as"),$2,mm_strdup("("),$4,mm_strdup(")"));
10934 }
10935 | ColId '(' TableFuncElementList ')'
10936 {
10937 $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
10938 }
10939 |
10940 {
10941 $$=EMPTY; }
10942 ;
10943
10944
10945 join_type:
10946 FULL opt_outer
10947 {
10948 $$ = cat_str(2,mm_strdup("full"),$2);
10949 }
10950 | LEFT opt_outer
10951 {
10952 $$ = cat_str(2,mm_strdup("left"),$2);
10953 }
10954 | RIGHT opt_outer
10955 {
10956 $$ = cat_str(2,mm_strdup("right"),$2);
10957 }
10958 | INNER_P
10959 {
10960 $$ = mm_strdup("inner");
10961 }
10962 ;
10963
10964
10965 opt_outer:
10966 OUTER_P
10967 {
10968 $$ = mm_strdup("outer");
10969 }
10970 |
10971 {
10972 $$=EMPTY; }
10973 ;
10974
10975
10976 join_qual:
10977 USING '(' name_list ')' opt_alias_clause_for_join_using
10978 {
10979 $$ = cat_str(4,mm_strdup("using ("),$3,mm_strdup(")"),$5);
10980 }
10981 | ON a_expr
10982 {
10983 $$ = cat_str(2,mm_strdup("on"),$2);
10984 }
10985 ;
10986
10987
10988 relation_expr:
10989 qualified_name
10990 {
10991 $$ = $1;
10992 }
10993 | qualified_name '*'
10994 {
10995 $$ = cat_str(2,$1,mm_strdup("*"));
10996 }
10997 | ONLY qualified_name
10998 {
10999 $$ = cat_str(2,mm_strdup("only"),$2);
11000 }
11001 | ONLY '(' qualified_name ')'
11002 {
11003 $$ = cat_str(3,mm_strdup("only ("),$3,mm_strdup(")"));
11004 }
11005 ;
11006
11007
11008 relation_expr_list:
11009 relation_expr
11010 {
11011 $$ = $1;
11012 }
11013 | relation_expr_list ',' relation_expr
11014 {
11015 $$ = cat_str(3,$1,mm_strdup(","),$3);
11016 }
11017 ;
11018
11019
11020 relation_expr_opt_alias:
11021 relation_expr %prec UMINUS
11022 {
11023 $$ = $1;
11024 }
11025 | relation_expr ColId
11026 {
11027 $$ = cat_str(2,$1,$2);
11028 }
11029 | relation_expr AS ColId
11030 {
11031 $$ = cat_str(3,$1,mm_strdup("as"),$3);
11032 }
11033 ;
11034
11035
11036 tablesample_clause:
11037 TABLESAMPLE func_name '(' expr_list ')' opt_repeatable_clause
11038 {
11039 $$ = cat_str(6,mm_strdup("tablesample"),$2,mm_strdup("("),$4,mm_strdup(")"),$6);
11040 }
11041 ;
11042
11043
11044 opt_repeatable_clause:
11045 REPEATABLE '(' a_expr ')'
11046 {
11047 $$ = cat_str(3,mm_strdup("repeatable ("),$3,mm_strdup(")"));
11048 }
11049 |
11050 {
11051 $$=EMPTY; }
11052 ;
11053
11054
11055 func_table:
11056 func_expr_windowless opt_ordinality
11057 {
11058 $$ = cat_str(2,$1,$2);
11059 }
11060 | ROWS FROM '(' rowsfrom_list ')' opt_ordinality
11061 {
11062 $$ = cat_str(4,mm_strdup("rows from ("),$4,mm_strdup(")"),$6);
11063 }
11064 ;
11065
11066
11067 rowsfrom_item:
11068 func_expr_windowless opt_col_def_list
11069 {
11070 $$ = cat_str(2,$1,$2);
11071 }
11072 ;
11073
11074
11075 rowsfrom_list:
11076 rowsfrom_item
11077 {
11078 $$ = $1;
11079 }
11080 | rowsfrom_list ',' rowsfrom_item
11081 {
11082 $$ = cat_str(3,$1,mm_strdup(","),$3);
11083 }
11084 ;
11085
11086
11087 opt_col_def_list:
11088 AS '(' TableFuncElementList ')'
11089 {
11090 $$ = cat_str(3,mm_strdup("as ("),$3,mm_strdup(")"));
11091 }
11092 |
11093 {
11094 $$=EMPTY; }
11095 ;
11096
11097
11098 opt_ordinality:
11099 WITH_LA ORDINALITY
11100 {
11101 $$ = mm_strdup("with ordinality");
11102 }
11103 |
11104 {
11105 $$=EMPTY; }
11106 ;
11107
11108
11109 where_clause:
11110 WHERE a_expr
11111 {
11112 $$ = cat_str(2,mm_strdup("where"),$2);
11113 }
11114 |
11115 {
11116 $$=EMPTY; }
11117 ;
11118
11119
11120 where_or_current_clause:
11121 WHERE a_expr
11122 {
11123 $$ = cat_str(2,mm_strdup("where"),$2);
11124 }
11125 | WHERE CURRENT_P OF cursor_name
11126 {
11127 char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
11128 $$ = cat_str(2,mm_strdup("where current of"), cursor_marker);
11129 }
11130 |
11131 {
11132 $$=EMPTY; }
11133 ;
11134
11135
11136 OptTableFuncElementList:
11137 TableFuncElementList
11138 {
11139 $$ = $1;
11140 }
11141 |
11142 {
11143 $$=EMPTY; }
11144 ;
11145
11146
11147 TableFuncElementList:
11148 TableFuncElement
11149 {
11150 $$ = $1;
11151 }
11152 | TableFuncElementList ',' TableFuncElement
11153 {
11154 $$ = cat_str(3,$1,mm_strdup(","),$3);
11155 }
11156 ;
11157
11158
11159 TableFuncElement:
11160 ColId Typename opt_collate_clause
11161 {
11162 $$ = cat_str(3,$1,$2,$3);
11163 }
11164 ;
11165
11166
11167 xmltable:
11168 XMLTABLE '(' c_expr xmlexists_argument COLUMNS xmltable_column_list ')'
11169 {
11170 $$ = cat_str(6,mm_strdup("xmltable ("),$3,$4,mm_strdup("columns"),$6,mm_strdup(")"));
11171 }
11172 | XMLTABLE '(' XMLNAMESPACES '(' xml_namespace_list ')' ',' c_expr xmlexists_argument COLUMNS xmltable_column_list ')'
11173 {
11174 $$ = cat_str(8,mm_strdup("xmltable ( xmlnamespaces ("),$5,mm_strdup(") ,"),$8,$9,mm_strdup("columns"),$11,mm_strdup(")"));
11175 }
11176 ;
11177
11178
11179 xmltable_column_list:
11180 xmltable_column_el
11181 {
11182 $$ = $1;
11183 }
11184 | xmltable_column_list ',' xmltable_column_el
11185 {
11186 $$ = cat_str(3,$1,mm_strdup(","),$3);
11187 }
11188 ;
11189
11190
11191 xmltable_column_el:
11192 ColId Typename
11193 {
11194 $$ = cat_str(2,$1,$2);
11195 }
11196 | ColId Typename xmltable_column_option_list
11197 {
11198 $$ = cat_str(3,$1,$2,$3);
11199 }
11200 | ColId FOR ORDINALITY
11201 {
11202 $$ = cat_str(2,$1,mm_strdup("for ordinality"));
11203 }
11204 ;
11205
11206
11207 xmltable_column_option_list:
11208 xmltable_column_option_el
11209 {
11210 $$ = $1;
11211 }
11212 | xmltable_column_option_list xmltable_column_option_el
11213 {
11214 $$ = cat_str(2,$1,$2);
11215 }
11216 ;
11217
11218
11219 xmltable_column_option_el:
11220 ecpg_ident b_expr
11221 {
11222 $$ = cat_str(2,$1,$2);
11223 }
11224 | DEFAULT b_expr
11225 {
11226 $$ = cat_str(2,mm_strdup("default"),$2);
11227 }
11228 | NOT NULL_P
11229 {
11230 $$ = mm_strdup("not null");
11231 }
11232 | NULL_P
11233 {
11234 $$ = mm_strdup("null");
11235 }
11236 ;
11237
11238
11239 xml_namespace_list:
11240 xml_namespace_el
11241 {
11242 $$ = $1;
11243 }
11244 | xml_namespace_list ',' xml_namespace_el
11245 {
11246 $$ = cat_str(3,$1,mm_strdup(","),$3);
11247 }
11248 ;
11249
11250
11251 xml_namespace_el:
11252 b_expr AS ColLabel
11253 {
11254 $$ = cat_str(3,$1,mm_strdup("as"),$3);
11255 }
11256 | DEFAULT b_expr
11257 {
11258 $$ = cat_str(2,mm_strdup("default"),$2);
11259 }
11260 ;
11261
11262
11263 Typename:
11264 SimpleTypename opt_array_bounds
11265 { $$ = cat2_str($1, $2.str); }
11266 | SETOF SimpleTypename opt_array_bounds
11267 { $$ = cat_str(3, mm_strdup("setof"), $2, $3.str); }
11268 | SimpleTypename ARRAY '[' Iconst ']'
11269 {
11270 $$ = cat_str(4,$1,mm_strdup("array ["),$4,mm_strdup("]"));
11271 }
11272 | SETOF SimpleTypename ARRAY '[' Iconst ']'
11273 {
11274 $$ = cat_str(5,mm_strdup("setof"),$2,mm_strdup("array ["),$5,mm_strdup("]"));
11275 }
11276 | SimpleTypename ARRAY
11277 {
11278 $$ = cat_str(2,$1,mm_strdup("array"));
11279 }
11280 | SETOF SimpleTypename ARRAY
11281 {
11282 $$ = cat_str(3,mm_strdup("setof"),$2,mm_strdup("array"));
11283 }
11284 ;
11285
11286
11287 opt_array_bounds:
11288 opt_array_bounds '[' ']'
11289 {
11290 $$.index1 = $1.index1;
11291 $$.index2 = $1.index2;
11292 if (strcmp($$.index1, "-1") == 0)
11293 $$.index1 = mm_strdup("0");
11294 else if (strcmp($1.index2, "-1") == 0)
11295 $$.index2 = mm_strdup("0");
11296 $$.str = cat_str(2, $1.str, mm_strdup("[]"));
11297 }
11298 | opt_array_bounds '[' Iresult ']'
11299 {
11300 $$.index1 = $1.index1;
11301 $$.index2 = $1.index2;
11302 if (strcmp($1.index1, "-1") == 0)
11303 $$.index1 = mm_strdup($3);
11304 else if (strcmp($1.index2, "-1") == 0)
11305 $$.index2 = mm_strdup($3);
11306 $$.str = cat_str(4, $1.str, mm_strdup("["), $3, mm_strdup("]"));
11307 }
11308 |
11309 {
11310 $$.index1 = mm_strdup("-1");
11311 $$.index2 = mm_strdup("-1");
11312 $$.str= EMPTY;
11313 }
11314 ;
11315
11316
11317 SimpleTypename:
11318 GenericType
11319 {
11320 $$ = $1;
11321 }
11322 | Numeric
11323 {
11324 $$ = $1;
11325 }
11326 | Bit
11327 {
11328 $$ = $1;
11329 }
11330 | Character
11331 {
11332 $$ = $1;
11333 }
11334 | ConstDatetime
11335 {
11336 $$ = $1;
11337 }
11338 | ConstInterval opt_interval
11339 {
11340 $$ = cat_str(2,$1,$2);
11341 }
11342 | ConstInterval '(' Iconst ')'
11343 {
11344 $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
11345 }
11346 ;
11347
11348
11349 ConstTypename:
11350 Numeric
11351 {
11352 $$ = $1;
11353 }
11354 | ConstBit
11355 {
11356 $$ = $1;
11357 }
11358 | ConstCharacter
11359 {
11360 $$ = $1;
11361 }
11362 | ConstDatetime
11363 {
11364 $$ = $1;
11365 }
11366 ;
11367
11368
11369 GenericType:
11370 type_function_name opt_type_modifiers
11371 {
11372 $$ = cat_str(2,$1,$2);
11373 }
11374 | type_function_name attrs opt_type_modifiers
11375 {
11376 $$ = cat_str(3,$1,$2,$3);
11377 }
11378 ;
11379
11380
11381 opt_type_modifiers:
11382 '(' expr_list ')'
11383 {
11384 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
11385 }
11386 |
11387 {
11388 $$=EMPTY; }
11389 ;
11390
11391
11392 Numeric:
11393 INT_P
11394 {
11395 $$ = mm_strdup("int");
11396 }
11397 | INTEGER
11398 {
11399 $$ = mm_strdup("integer");
11400 }
11401 | SMALLINT
11402 {
11403 $$ = mm_strdup("smallint");
11404 }
11405 | BIGINT
11406 {
11407 $$ = mm_strdup("bigint");
11408 }
11409 | REAL
11410 {
11411 $$ = mm_strdup("real");
11412 }
11413 | FLOAT_P opt_float
11414 {
11415 $$ = cat_str(2,mm_strdup("float"),$2);
11416 }
11417 | DOUBLE_P PRECISION
11418 {
11419 $$ = mm_strdup("double precision");
11420 }
11421 | DECIMAL_P opt_type_modifiers
11422 {
11423 $$ = cat_str(2,mm_strdup("decimal"),$2);
11424 }
11425 | DEC opt_type_modifiers
11426 {
11427 $$ = cat_str(2,mm_strdup("dec"),$2);
11428 }
11429 | NUMERIC opt_type_modifiers
11430 {
11431 $$ = cat_str(2,mm_strdup("numeric"),$2);
11432 }
11433 | BOOLEAN_P
11434 {
11435 $$ = mm_strdup("boolean");
11436 }
11437 ;
11438
11439
11440 opt_float:
11441 '(' Iconst ')'
11442 {
11443 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
11444 }
11445 |
11446 {
11447 $$=EMPTY; }
11448 ;
11449
11450
11451 Bit:
11452 BitWithLength
11453 {
11454 $$ = $1;
11455 }
11456 | BitWithoutLength
11457 {
11458 $$ = $1;
11459 }
11460 ;
11461
11462
11463 ConstBit:
11464 BitWithLength
11465 {
11466 $$ = $1;
11467 }
11468 | BitWithoutLength
11469 {
11470 $$ = $1;
11471 }
11472 ;
11473
11474
11475 BitWithLength:
11476 BIT opt_varying '(' expr_list ')'
11477 {
11478 $$ = cat_str(5,mm_strdup("bit"),$2,mm_strdup("("),$4,mm_strdup(")"));
11479 }
11480 ;
11481
11482
11483 BitWithoutLength:
11484 BIT opt_varying
11485 {
11486 $$ = cat_str(2,mm_strdup("bit"),$2);
11487 }
11488 ;
11489
11490
11491 Character:
11492 CharacterWithLength
11493 {
11494 $$ = $1;
11495 }
11496 | CharacterWithoutLength
11497 {
11498 $$ = $1;
11499 }
11500 ;
11501
11502
11503 ConstCharacter:
11504 CharacterWithLength
11505 {
11506 $$ = $1;
11507 }
11508 | CharacterWithoutLength
11509 {
11510 $$ = $1;
11511 }
11512 ;
11513
11514
11515 CharacterWithLength:
11516 character '(' Iconst ')'
11517 {
11518 $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
11519 }
11520 ;
11521
11522
11523 CharacterWithoutLength:
11524 character
11525 {
11526 $$ = $1;
11527 }
11528 ;
11529
11530
11531 character:
11532 CHARACTER opt_varying
11533 {
11534 $$ = cat_str(2,mm_strdup("character"),$2);
11535 }
11536 | CHAR_P opt_varying
11537 {
11538 $$ = cat_str(2,mm_strdup("char"),$2);
11539 }
11540 | VARCHAR
11541 {
11542 $$ = mm_strdup("varchar");
11543 }
11544 | NATIONAL CHARACTER opt_varying
11545 {
11546 $$ = cat_str(2,mm_strdup("national character"),$3);
11547 }
11548 | NATIONAL CHAR_P opt_varying
11549 {
11550 $$ = cat_str(2,mm_strdup("national char"),$3);
11551 }
11552 | NCHAR opt_varying
11553 {
11554 $$ = cat_str(2,mm_strdup("nchar"),$2);
11555 }
11556 ;
11557
11558
11559 opt_varying:
11560 VARYING
11561 {
11562 $$ = mm_strdup("varying");
11563 }
11564 |
11565 {
11566 $$=EMPTY; }
11567 ;
11568
11569
11570 ConstDatetime:
11571 TIMESTAMP '(' Iconst ')' opt_timezone
11572 {
11573 $$ = cat_str(4,mm_strdup("timestamp ("),$3,mm_strdup(")"),$5);
11574 }
11575 | TIMESTAMP opt_timezone
11576 {
11577 $$ = cat_str(2,mm_strdup("timestamp"),$2);
11578 }
11579 | TIME '(' Iconst ')' opt_timezone
11580 {
11581 $$ = cat_str(4,mm_strdup("time ("),$3,mm_strdup(")"),$5);
11582 }
11583 | TIME opt_timezone
11584 {
11585 $$ = cat_str(2,mm_strdup("time"),$2);
11586 }
11587 ;
11588
11589
11590 ConstInterval:
11591 INTERVAL
11592 {
11593 $$ = mm_strdup("interval");
11594 }
11595 ;
11596
11597
11598 opt_timezone:
11599 WITH_LA TIME ZONE
11600 {
11601 $$ = mm_strdup("with time zone");
11602 }
11603 | WITHOUT TIME ZONE
11604 {
11605 $$ = mm_strdup("without time zone");
11606 }
11607 |
11608 {
11609 $$=EMPTY; }
11610 ;
11611
11612
11613 opt_interval:
11614 YEAR_P
11615 {
11616 $$ = mm_strdup("year");
11617 }
11618 | MONTH_P
11619 {
11620 $$ = mm_strdup("month");
11621 }
11622 | DAY_P
11623 {
11624 $$ = mm_strdup("day");
11625 }
11626 | HOUR_P
11627 {
11628 $$ = mm_strdup("hour");
11629 }
11630 | MINUTE_P
11631 {
11632 $$ = mm_strdup("minute");
11633 }
11634 | interval_second
11635 {
11636 $$ = $1;
11637 }
11638 | YEAR_P TO MONTH_P
11639 {
11640 $$ = mm_strdup("year to month");
11641 }
11642 | DAY_P TO HOUR_P
11643 {
11644 $$ = mm_strdup("day to hour");
11645 }
11646 | DAY_P TO MINUTE_P
11647 {
11648 $$ = mm_strdup("day to minute");
11649 }
11650 | DAY_P TO interval_second
11651 {
11652 $$ = cat_str(2,mm_strdup("day to"),$3);
11653 }
11654 | HOUR_P TO MINUTE_P
11655 {
11656 $$ = mm_strdup("hour to minute");
11657 }
11658 | HOUR_P TO interval_second
11659 {
11660 $$ = cat_str(2,mm_strdup("hour to"),$3);
11661 }
11662 | MINUTE_P TO interval_second
11663 {
11664 $$ = cat_str(2,mm_strdup("minute to"),$3);
11665 }
11666 |
11667 {
11668 $$=EMPTY; }
11669 ;
11670
11671
11672 interval_second:
11673 SECOND_P
11674 {
11675 $$ = mm_strdup("second");
11676 }
11677 | SECOND_P '(' Iconst ')'
11678 {
11679 $$ = cat_str(3,mm_strdup("second ("),$3,mm_strdup(")"));
11680 }
11681 ;
11682
11683
11684 a_expr:
11685 c_expr
11686 {
11687 $$ = $1;
11688 }
11689 | a_expr TYPECAST Typename
11690 {
11691 $$ = cat_str(3,$1,mm_strdup("::"),$3);
11692 }
11693 | a_expr COLLATE any_name
11694 {
11695 $$ = cat_str(3,$1,mm_strdup("collate"),$3);
11696 }
11697 | a_expr AT TIME ZONE a_expr %prec AT
11698 {
11699 $$ = cat_str(3,$1,mm_strdup("at time zone"),$5);
11700 }
11701 | '+' a_expr %prec UMINUS
11702 {
11703 $$ = cat_str(2,mm_strdup("+"),$2);
11704 }
11705 | '-' a_expr %prec UMINUS
11706 {
11707 $$ = cat_str(2,mm_strdup("-"),$2);
11708 }
11709 | a_expr '+' a_expr
11710 {
11711 $$ = cat_str(3,$1,mm_strdup("+"),$3);
11712 }
11713 | a_expr '-' a_expr
11714 {
11715 $$ = cat_str(3,$1,mm_strdup("-"),$3);
11716 }
11717 | a_expr '*' a_expr
11718 {
11719 $$ = cat_str(3,$1,mm_strdup("*"),$3);
11720 }
11721 | a_expr '/' a_expr
11722 {
11723 $$ = cat_str(3,$1,mm_strdup("/"),$3);
11724 }
11725 | a_expr '%' a_expr
11726 {
11727 $$ = cat_str(3,$1,mm_strdup("%"),$3);
11728 }
11729 | a_expr '^' a_expr
11730 {
11731 $$ = cat_str(3,$1,mm_strdup("^"),$3);
11732 }
11733 | a_expr '<' a_expr
11734 {
11735 $$ = cat_str(3,$1,mm_strdup("<"),$3);
11736 }
11737 | a_expr '>' a_expr
11738 {
11739 $$ = cat_str(3,$1,mm_strdup(">"),$3);
11740 }
11741 | a_expr '=' a_expr
11742 {
11743 $$ = cat_str(3,$1,mm_strdup("="),$3);
11744 }
11745 | a_expr LESS_EQUALS a_expr
11746 {
11747 $$ = cat_str(3,$1,mm_strdup("<="),$3);
11748 }
11749 | a_expr GREATER_EQUALS a_expr
11750 {
11751 $$ = cat_str(3,$1,mm_strdup(">="),$3);
11752 }
11753 | a_expr NOT_EQUALS a_expr
11754 {
11755 $$ = cat_str(3,$1,mm_strdup("<>"),$3);
11756 }
11757 | a_expr qual_Op a_expr %prec Op
11758 {
11759 $$ = cat_str(3,$1,$2,$3);
11760 }
11761 | qual_Op a_expr %prec Op
11762 {
11763 $$ = cat_str(2,$1,$2);
11764 }
11765 | a_expr AND a_expr
11766 {
11767 $$ = cat_str(3,$1,mm_strdup("and"),$3);
11768 }
11769 | a_expr OR a_expr
11770 {
11771 $$ = cat_str(3,$1,mm_strdup("or"),$3);
11772 }
11773 | NOT a_expr
11774 {
11775 $$ = cat_str(2,mm_strdup("not"),$2);
11776 }
11777 | NOT_LA a_expr %prec NOT
11778 {
11779 $$ = cat_str(2,mm_strdup("not"),$2);
11780 }
11781 | a_expr LIKE a_expr
11782 {
11783 $$ = cat_str(3,$1,mm_strdup("like"),$3);
11784 }
11785 | a_expr LIKE a_expr ESCAPE a_expr %prec LIKE
11786 {
11787 $$ = cat_str(5,$1,mm_strdup("like"),$3,mm_strdup("escape"),$5);
11788 }
11789 | a_expr NOT_LA LIKE a_expr %prec NOT_LA
11790 {
11791 $$ = cat_str(3,$1,mm_strdup("not like"),$4);
11792 }
11793 | a_expr NOT_LA LIKE a_expr ESCAPE a_expr %prec NOT_LA
11794 {
11795 $$ = cat_str(5,$1,mm_strdup("not like"),$4,mm_strdup("escape"),$6);
11796 }
11797 | a_expr ILIKE a_expr
11798 {
11799 $$ = cat_str(3,$1,mm_strdup("ilike"),$3);
11800 }
11801 | a_expr ILIKE a_expr ESCAPE a_expr %prec ILIKE
11802 {
11803 $$ = cat_str(5,$1,mm_strdup("ilike"),$3,mm_strdup("escape"),$5);
11804 }
11805 | a_expr NOT_LA ILIKE a_expr %prec NOT_LA
11806 {
11807 $$ = cat_str(3,$1,mm_strdup("not ilike"),$4);
11808 }
11809 | a_expr NOT_LA ILIKE a_expr ESCAPE a_expr %prec NOT_LA
11810 {
11811 $$ = cat_str(5,$1,mm_strdup("not ilike"),$4,mm_strdup("escape"),$6);
11812 }
11813 | a_expr SIMILAR TO a_expr %prec SIMILAR
11814 {
11815 $$ = cat_str(3,$1,mm_strdup("similar to"),$4);
11816 }
11817 | a_expr SIMILAR TO a_expr ESCAPE a_expr %prec SIMILAR
11818 {
11819 $$ = cat_str(5,$1,mm_strdup("similar to"),$4,mm_strdup("escape"),$6);
11820 }
11821 | a_expr NOT_LA SIMILAR TO a_expr %prec NOT_LA
11822 {
11823 $$ = cat_str(3,$1,mm_strdup("not similar to"),$5);
11824 }
11825 | a_expr NOT_LA SIMILAR TO a_expr ESCAPE a_expr %prec NOT_LA
11826 {
11827 $$ = cat_str(5,$1,mm_strdup("not similar to"),$5,mm_strdup("escape"),$7);
11828 }
11829 | a_expr IS NULL_P %prec IS
11830 {
11831 $$ = cat_str(2,$1,mm_strdup("is null"));
11832 }
11833 | a_expr ISNULL
11834 {
11835 $$ = cat_str(2,$1,mm_strdup("isnull"));
11836 }
11837 | a_expr IS NOT NULL_P %prec IS
11838 {
11839 $$ = cat_str(2,$1,mm_strdup("is not null"));
11840 }
11841 | a_expr NOTNULL
11842 {
11843 $$ = cat_str(2,$1,mm_strdup("notnull"));
11844 }
11845 | row OVERLAPS row
11846 {
11847 $$ = cat_str(3,$1,mm_strdup("overlaps"),$3);
11848 }
11849 | a_expr IS TRUE_P %prec IS
11850 {
11851 $$ = cat_str(2,$1,mm_strdup("is true"));
11852 }
11853 | a_expr IS NOT TRUE_P %prec IS
11854 {
11855 $$ = cat_str(2,$1,mm_strdup("is not true"));
11856 }
11857 | a_expr IS FALSE_P %prec IS
11858 {
11859 $$ = cat_str(2,$1,mm_strdup("is false"));
11860 }
11861 | a_expr IS NOT FALSE_P %prec IS
11862 {
11863 $$ = cat_str(2,$1,mm_strdup("is not false"));
11864 }
11865 | a_expr IS UNKNOWN %prec IS
11866 {
11867 $$ = cat_str(2,$1,mm_strdup("is unknown"));
11868 }
11869 | a_expr IS NOT UNKNOWN %prec IS
11870 {
11871 $$ = cat_str(2,$1,mm_strdup("is not unknown"));
11872 }
11873 | a_expr IS DISTINCT FROM a_expr %prec IS
11874 {
11875 $$ = cat_str(3,$1,mm_strdup("is distinct from"),$5);
11876 }
11877 | a_expr IS NOT DISTINCT FROM a_expr %prec IS
11878 {
11879 $$ = cat_str(3,$1,mm_strdup("is not distinct from"),$6);
11880 }
11881 | a_expr BETWEEN opt_asymmetric b_expr AND a_expr %prec BETWEEN
11882 {
11883 $$ = cat_str(6,$1,mm_strdup("between"),$3,$4,mm_strdup("and"),$6);
11884 }
11885 | a_expr NOT_LA BETWEEN opt_asymmetric b_expr AND a_expr %prec NOT_LA
11886 {
11887 $$ = cat_str(6,$1,mm_strdup("not between"),$4,$5,mm_strdup("and"),$7);
11888 }
11889 | a_expr BETWEEN SYMMETRIC b_expr AND a_expr %prec BETWEEN
11890 {
11891 $$ = cat_str(5,$1,mm_strdup("between symmetric"),$4,mm_strdup("and"),$6);
11892 }
11893 | a_expr NOT_LA BETWEEN SYMMETRIC b_expr AND a_expr %prec NOT_LA
11894 {
11895 $$ = cat_str(5,$1,mm_strdup("not between symmetric"),$5,mm_strdup("and"),$7);
11896 }
11897 | a_expr IN_P in_expr
11898 {
11899 $$ = cat_str(3,$1,mm_strdup("in"),$3);
11900 }
11901 | a_expr NOT_LA IN_P in_expr %prec NOT_LA
11902 {
11903 $$ = cat_str(3,$1,mm_strdup("not in"),$4);
11904 }
11905 | a_expr subquery_Op sub_type select_with_parens %prec Op
11906 {
11907 $$ = cat_str(4,$1,$2,$3,$4);
11908 }
11909 | a_expr subquery_Op sub_type '(' a_expr ')' %prec Op
11910 {
11911 $$ = cat_str(6,$1,$2,$3,mm_strdup("("),$5,mm_strdup(")"));
11912 }
11913 | UNIQUE select_with_parens
11914 {
11915 mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
11916 $$ = cat_str(2,mm_strdup("unique"),$2);
11917 }
11918 | a_expr IS DOCUMENT_P %prec IS
11919 {
11920 $$ = cat_str(2,$1,mm_strdup("is document"));
11921 }
11922 | a_expr IS NOT DOCUMENT_P %prec IS
11923 {
11924 $$ = cat_str(2,$1,mm_strdup("is not document"));
11925 }
11926 | a_expr IS NORMALIZED %prec IS
11927 {
11928 $$ = cat_str(2,$1,mm_strdup("is normalized"));
11929 }
11930 | a_expr IS unicode_normal_form NORMALIZED %prec IS
11931 {
11932 $$ = cat_str(4,$1,mm_strdup("is"),$3,mm_strdup("normalized"));
11933 }
11934 | a_expr IS NOT NORMALIZED %prec IS
11935 {
11936 $$ = cat_str(2,$1,mm_strdup("is not normalized"));
11937 }
11938 | a_expr IS NOT unicode_normal_form NORMALIZED %prec IS
11939 {
11940 $$ = cat_str(4,$1,mm_strdup("is not"),$4,mm_strdup("normalized"));
11941 }
11942 | DEFAULT
11943 {
11944 $$ = mm_strdup("default");
11945 }
11946 ;
11947
11948
11949 b_expr:
11950 c_expr
11951 {
11952 $$ = $1;
11953 }
11954 | b_expr TYPECAST Typename
11955 {
11956 $$ = cat_str(3,$1,mm_strdup("::"),$3);
11957 }
11958 | '+' b_expr %prec UMINUS
11959 {
11960 $$ = cat_str(2,mm_strdup("+"),$2);
11961 }
11962 | '-' b_expr %prec UMINUS
11963 {
11964 $$ = cat_str(2,mm_strdup("-"),$2);
11965 }
11966 | b_expr '+' b_expr
11967 {
11968 $$ = cat_str(3,$1,mm_strdup("+"),$3);
11969 }
11970 | b_expr '-' b_expr
11971 {
11972 $$ = cat_str(3,$1,mm_strdup("-"),$3);
11973 }
11974 | b_expr '*' b_expr
11975 {
11976 $$ = cat_str(3,$1,mm_strdup("*"),$3);
11977 }
11978 | b_expr '/' b_expr
11979 {
11980 $$ = cat_str(3,$1,mm_strdup("/"),$3);
11981 }
11982 | b_expr '%' b_expr
11983 {
11984 $$ = cat_str(3,$1,mm_strdup("%"),$3);
11985 }
11986 | b_expr '^' b_expr
11987 {
11988 $$ = cat_str(3,$1,mm_strdup("^"),$3);
11989 }
11990 | b_expr '<' b_expr
11991 {
11992 $$ = cat_str(3,$1,mm_strdup("<"),$3);
11993 }
11994 | b_expr '>' b_expr
11995 {
11996 $$ = cat_str(3,$1,mm_strdup(">"),$3);
11997 }
11998 | b_expr '=' b_expr
11999 {
12000 $$ = cat_str(3,$1,mm_strdup("="),$3);
12001 }
12002 | b_expr LESS_EQUALS b_expr
12003 {
12004 $$ = cat_str(3,$1,mm_strdup("<="),$3);
12005 }
12006 | b_expr GREATER_EQUALS b_expr
12007 {
12008 $$ = cat_str(3,$1,mm_strdup(">="),$3);
12009 }
12010 | b_expr NOT_EQUALS b_expr
12011 {
12012 $$ = cat_str(3,$1,mm_strdup("<>"),$3);
12013 }
12014 | b_expr qual_Op b_expr %prec Op
12015 {
12016 $$ = cat_str(3,$1,$2,$3);
12017 }
12018 | qual_Op b_expr %prec Op
12019 {
12020 $$ = cat_str(2,$1,$2);
12021 }
12022 | b_expr IS DISTINCT FROM b_expr %prec IS
12023 {
12024 $$ = cat_str(3,$1,mm_strdup("is distinct from"),$5);
12025 }
12026 | b_expr IS NOT DISTINCT FROM b_expr %prec IS
12027 {
12028 $$ = cat_str(3,$1,mm_strdup("is not distinct from"),$6);
12029 }
12030 | b_expr IS DOCUMENT_P %prec IS
12031 {
12032 $$ = cat_str(2,$1,mm_strdup("is document"));
12033 }
12034 | b_expr IS NOT DOCUMENT_P %prec IS
12035 {
12036 $$ = cat_str(2,$1,mm_strdup("is not document"));
12037 }
12038 ;
12039
12040
12041 c_expr:
12042 columnref
12043 {
12044 $$ = $1;
12045 }
12046 | AexprConst
12047 {
12048 $$ = $1;
12049 }
12050 | ecpg_param opt_indirection
12051 {
12052 $$ = cat_str(2,$1,$2);
12053 }
12054 | '(' a_expr ')' opt_indirection
12055 {
12056 $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
12057 }
12058 | case_expr
12059 {
12060 $$ = $1;
12061 }
12062 | func_expr
12063 {
12064 $$ = $1;
12065 }
12066 | select_with_parens %prec UMINUS
12067 {
12068 $$ = $1;
12069 }
12070 | select_with_parens indirection
12071 {
12072 $$ = cat_str(2,$1,$2);
12073 }
12074 | EXISTS select_with_parens
12075 {
12076 $$ = cat_str(2,mm_strdup("exists"),$2);
12077 }
12078 | ARRAY select_with_parens
12079 {
12080 $$ = cat_str(2,mm_strdup("array"),$2);
12081 }
12082 | ARRAY array_expr
12083 {
12084 $$ = cat_str(2,mm_strdup("array"),$2);
12085 }
12086 | explicit_row
12087 {
12088 $$ = $1;
12089 }
12090 | implicit_row
12091 {
12092 $$ = $1;
12093 }
12094 | GROUPING '(' expr_list ')'
12095 {
12096 $$ = cat_str(3,mm_strdup("grouping ("),$3,mm_strdup(")"));
12097 }
12098 ;
12099
12100
12101 func_application:
12102 func_name '(' ')'
12103 {
12104 $$ = cat_str(2,$1,mm_strdup("( )"));
12105 }
12106 | func_name '(' func_arg_list opt_sort_clause ')'
12107 {
12108 $$ = cat_str(5,$1,mm_strdup("("),$3,$4,mm_strdup(")"));
12109 }
12110 | func_name '(' VARIADIC func_arg_expr opt_sort_clause ')'
12111 {
12112 $$ = cat_str(5,$1,mm_strdup("( variadic"),$4,$5,mm_strdup(")"));
12113 }
12114 | func_name '(' func_arg_list ',' VARIADIC func_arg_expr opt_sort_clause ')'
12115 {
12116 $$ = cat_str(7,$1,mm_strdup("("),$3,mm_strdup(", variadic"),$6,$7,mm_strdup(")"));
12117 }
12118 | func_name '(' ALL func_arg_list opt_sort_clause ')'
12119 {
12120 $$ = cat_str(5,$1,mm_strdup("( all"),$4,$5,mm_strdup(")"));
12121 }
12122 | func_name '(' DISTINCT func_arg_list opt_sort_clause ')'
12123 {
12124 $$ = cat_str(5,$1,mm_strdup("( distinct"),$4,$5,mm_strdup(")"));
12125 }
12126 | func_name '(' '*' ')'
12127 {
12128 $$ = cat_str(2,$1,mm_strdup("( * )"));
12129 }
12130 ;
12131
12132
12133 func_expr:
12134 func_application within_group_clause filter_clause over_clause
12135 {
12136 $$ = cat_str(4,$1,$2,$3,$4);
12137 }
12138 | func_expr_common_subexpr
12139 {
12140 $$ = $1;
12141 }
12142 ;
12143
12144
12145 func_expr_windowless:
12146 func_application
12147 {
12148 $$ = $1;
12149 }
12150 | func_expr_common_subexpr
12151 {
12152 $$ = $1;
12153 }
12154 ;
12155
12156
12157 func_expr_common_subexpr:
12158 COLLATION FOR '(' a_expr ')'
12159 {
12160 $$ = cat_str(3,mm_strdup("collation for ("),$4,mm_strdup(")"));
12161 }
12162 | CURRENT_DATE
12163 {
12164 $$ = mm_strdup("current_date");
12165 }
12166 | CURRENT_TIME
12167 {
12168 $$ = mm_strdup("current_time");
12169 }
12170 | CURRENT_TIME '(' Iconst ')'
12171 {
12172 $$ = cat_str(3,mm_strdup("current_time ("),$3,mm_strdup(")"));
12173 }
12174 | CURRENT_TIMESTAMP
12175 {
12176 $$ = mm_strdup("current_timestamp");
12177 }
12178 | CURRENT_TIMESTAMP '(' Iconst ')'
12179 {
12180 $$ = cat_str(3,mm_strdup("current_timestamp ("),$3,mm_strdup(")"));
12181 }
12182 | LOCALTIME
12183 {
12184 $$ = mm_strdup("localtime");
12185 }
12186 | LOCALTIME '(' Iconst ')'
12187 {
12188 $$ = cat_str(3,mm_strdup("localtime ("),$3,mm_strdup(")"));
12189 }
12190 | LOCALTIMESTAMP
12191 {
12192 $$ = mm_strdup("localtimestamp");
12193 }
12194 | LOCALTIMESTAMP '(' Iconst ')'
12195 {
12196 $$ = cat_str(3,mm_strdup("localtimestamp ("),$3,mm_strdup(")"));
12197 }
12198 | CURRENT_ROLE
12199 {
12200 $$ = mm_strdup("current_role");
12201 }
12202 | CURRENT_USER
12203 {
12204 $$ = mm_strdup("current_user");
12205 }
12206 | SESSION_USER
12207 {
12208 $$ = mm_strdup("session_user");
12209 }
12210 | USER
12211 {
12212 $$ = mm_strdup("user");
12213 }
12214 | CURRENT_CATALOG
12215 {
12216 $$ = mm_strdup("current_catalog");
12217 }
12218 | CURRENT_SCHEMA
12219 {
12220 $$ = mm_strdup("current_schema");
12221 }
12222 | CAST '(' a_expr AS Typename ')'
12223 {
12224 $$ = cat_str(5,mm_strdup("cast ("),$3,mm_strdup("as"),$5,mm_strdup(")"));
12225 }
12226 | EXTRACT '(' extract_list ')'
12227 {
12228 $$ = cat_str(3,mm_strdup("extract ("),$3,mm_strdup(")"));
12229 }
12230 | NORMALIZE '(' a_expr ')'
12231 {
12232 $$ = cat_str(3,mm_strdup("normalize ("),$3,mm_strdup(")"));
12233 }
12234 | NORMALIZE '(' a_expr ',' unicode_normal_form ')'
12235 {
12236 $$ = cat_str(5,mm_strdup("normalize ("),$3,mm_strdup(","),$5,mm_strdup(")"));
12237 }
12238 | OVERLAY '(' overlay_list ')'
12239 {
12240 $$ = cat_str(3,mm_strdup("overlay ("),$3,mm_strdup(")"));
12241 }
12242 | OVERLAY '(' func_arg_list_opt ')'
12243 {
12244 $$ = cat_str(3,mm_strdup("overlay ("),$3,mm_strdup(")"));
12245 }
12246 | POSITION '(' position_list ')'
12247 {
12248 $$ = cat_str(3,mm_strdup("position ("),$3,mm_strdup(")"));
12249 }
12250 | SUBSTRING '(' substr_list ')'
12251 {
12252 $$ = cat_str(3,mm_strdup("substring ("),$3,mm_strdup(")"));
12253 }
12254 | SUBSTRING '(' func_arg_list_opt ')'
12255 {
12256 $$ = cat_str(3,mm_strdup("substring ("),$3,mm_strdup(")"));
12257 }
12258 | TREAT '(' a_expr AS Typename ')'
12259 {
12260 $$ = cat_str(5,mm_strdup("treat ("),$3,mm_strdup("as"),$5,mm_strdup(")"));
12261 }
12262 | TRIM '(' BOTH trim_list ')'
12263 {
12264 $$ = cat_str(3,mm_strdup("trim ( both"),$4,mm_strdup(")"));
12265 }
12266 | TRIM '(' LEADING trim_list ')'
12267 {
12268 $$ = cat_str(3,mm_strdup("trim ( leading"),$4,mm_strdup(")"));
12269 }
12270 | TRIM '(' TRAILING trim_list ')'
12271 {
12272 $$ = cat_str(3,mm_strdup("trim ( trailing"),$4,mm_strdup(")"));
12273 }
12274 | TRIM '(' trim_list ')'
12275 {
12276 $$ = cat_str(3,mm_strdup("trim ("),$3,mm_strdup(")"));
12277 }
12278 | NULLIF '(' a_expr ',' a_expr ')'
12279 {
12280 $$ = cat_str(5,mm_strdup("nullif ("),$3,mm_strdup(","),$5,mm_strdup(")"));
12281 }
12282 | COALESCE '(' expr_list ')'
12283 {
12284 $$ = cat_str(3,mm_strdup("coalesce ("),$3,mm_strdup(")"));
12285 }
12286 | GREATEST '(' expr_list ')'
12287 {
12288 $$ = cat_str(3,mm_strdup("greatest ("),$3,mm_strdup(")"));
12289 }
12290 | LEAST '(' expr_list ')'
12291 {
12292 $$ = cat_str(3,mm_strdup("least ("),$3,mm_strdup(")"));
12293 }
12294 | XMLCONCAT '(' expr_list ')'
12295 {
12296 $$ = cat_str(3,mm_strdup("xmlconcat ("),$3,mm_strdup(")"));
12297 }
12298 | XMLELEMENT '(' NAME_P ColLabel ')'
12299 {
12300 $$ = cat_str(3,mm_strdup("xmlelement ( name"),$4,mm_strdup(")"));
12301 }
12302 | XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ')'
12303 {
12304 $$ = cat_str(5,mm_strdup("xmlelement ( name"),$4,mm_strdup(","),$6,mm_strdup(")"));
12305 }
12306 | XMLELEMENT '(' NAME_P ColLabel ',' expr_list ')'
12307 {
12308 $$ = cat_str(5,mm_strdup("xmlelement ( name"),$4,mm_strdup(","),$6,mm_strdup(")"));
12309 }
12310 | XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ',' expr_list ')'
12311 {
12312 $$ = cat_str(7,mm_strdup("xmlelement ( name"),$4,mm_strdup(","),$6,mm_strdup(","),$8,mm_strdup(")"));
12313 }
12314 | XMLEXISTS '(' c_expr xmlexists_argument ')'
12315 {
12316 $$ = cat_str(4,mm_strdup("xmlexists ("),$3,$4,mm_strdup(")"));
12317 }
12318 | XMLFOREST '(' xml_attribute_list ')'
12319 {
12320 $$ = cat_str(3,mm_strdup("xmlforest ("),$3,mm_strdup(")"));
12321 }
12322 | XMLPARSE '(' document_or_content a_expr xml_whitespace_option ')'
12323 {
12324 $$ = cat_str(5,mm_strdup("xmlparse ("),$3,$4,$5,mm_strdup(")"));
12325 }
12326 | XMLPI '(' NAME_P ColLabel ')'
12327 {
12328 $$ = cat_str(3,mm_strdup("xmlpi ( name"),$4,mm_strdup(")"));
12329 }
12330 | XMLPI '(' NAME_P ColLabel ',' a_expr ')'
12331 {
12332 $$ = cat_str(5,mm_strdup("xmlpi ( name"),$4,mm_strdup(","),$6,mm_strdup(")"));
12333 }
12334 | XMLROOT '(' a_expr ',' xml_root_version opt_xml_root_standalone ')'
12335 {
12336 $$ = cat_str(6,mm_strdup("xmlroot ("),$3,mm_strdup(","),$5,$6,mm_strdup(")"));
12337 }
12338 | XMLSERIALIZE '(' document_or_content a_expr AS SimpleTypename ')'
12339 {
12340 $$ = cat_str(6,mm_strdup("xmlserialize ("),$3,$4,mm_strdup("as"),$6,mm_strdup(")"));
12341 }
12342 ;
12343
12344
12345 xml_root_version:
12346 VERSION_P a_expr
12347 {
12348 $$ = cat_str(2,mm_strdup("version"),$2);
12349 }
12350 | VERSION_P NO VALUE_P
12351 {
12352 $$ = mm_strdup("version no value");
12353 }
12354 ;
12355
12356
12357 opt_xml_root_standalone:
12358 ',' STANDALONE_P YES_P
12359 {
12360 $$ = mm_strdup(", standalone yes");
12361 }
12362 | ',' STANDALONE_P NO
12363 {
12364 $$ = mm_strdup(", standalone no");
12365 }
12366 | ',' STANDALONE_P NO VALUE_P
12367 {
12368 $$ = mm_strdup(", standalone no value");
12369 }
12370 |
12371 {
12372 $$=EMPTY; }
12373 ;
12374
12375
12376 xml_attributes:
12377 XMLATTRIBUTES '(' xml_attribute_list ')'
12378 {
12379 $$ = cat_str(3,mm_strdup("xmlattributes ("),$3,mm_strdup(")"));
12380 }
12381 ;
12382
12383
12384 xml_attribute_list:
12385 xml_attribute_el
12386 {
12387 $$ = $1;
12388 }
12389 | xml_attribute_list ',' xml_attribute_el
12390 {
12391 $$ = cat_str(3,$1,mm_strdup(","),$3);
12392 }
12393 ;
12394
12395
12396 xml_attribute_el:
12397 a_expr AS ColLabel
12398 {
12399 $$ = cat_str(3,$1,mm_strdup("as"),$3);
12400 }
12401 | a_expr
12402 {
12403 $$ = $1;
12404 }
12405 ;
12406
12407
12408 document_or_content:
12409 DOCUMENT_P
12410 {
12411 $$ = mm_strdup("document");
12412 }
12413 | CONTENT_P
12414 {
12415 $$ = mm_strdup("content");
12416 }
12417 ;
12418
12419
12420 xml_whitespace_option:
12421 PRESERVE WHITESPACE_P
12422 {
12423 $$ = mm_strdup("preserve whitespace");
12424 }
12425 | STRIP_P WHITESPACE_P
12426 {
12427 $$ = mm_strdup("strip whitespace");
12428 }
12429 |
12430 {
12431 $$=EMPTY; }
12432 ;
12433
12434
12435 xmlexists_argument:
12436 PASSING c_expr
12437 {
12438 $$ = cat_str(2,mm_strdup("passing"),$2);
12439 }
12440 | PASSING c_expr xml_passing_mech
12441 {
12442 $$ = cat_str(3,mm_strdup("passing"),$2,$3);
12443 }
12444 | PASSING xml_passing_mech c_expr
12445 {
12446 $$ = cat_str(3,mm_strdup("passing"),$2,$3);
12447 }
12448 | PASSING xml_passing_mech c_expr xml_passing_mech
12449 {
12450 $$ = cat_str(4,mm_strdup("passing"),$2,$3,$4);
12451 }
12452 ;
12453
12454
12455 xml_passing_mech:
12456 BY REF
12457 {
12458 $$ = mm_strdup("by ref");
12459 }
12460 | BY VALUE_P
12461 {
12462 $$ = mm_strdup("by value");
12463 }
12464 ;
12465
12466
12467 within_group_clause:
12468 WITHIN GROUP_P '(' sort_clause ')'
12469 {
12470 $$ = cat_str(3,mm_strdup("within group ("),$4,mm_strdup(")"));
12471 }
12472 |
12473 {
12474 $$=EMPTY; }
12475 ;
12476
12477
12478 filter_clause:
12479 FILTER '(' WHERE a_expr ')'
12480 {
12481 $$ = cat_str(3,mm_strdup("filter ( where"),$4,mm_strdup(")"));
12482 }
12483 |
12484 {
12485 $$=EMPTY; }
12486 ;
12487
12488
12489 window_clause:
12490 WINDOW window_definition_list
12491 {
12492 $$ = cat_str(2,mm_strdup("window"),$2);
12493 }
12494 |
12495 {
12496 $$=EMPTY; }
12497 ;
12498
12499
12500 window_definition_list:
12501 window_definition
12502 {
12503 $$ = $1;
12504 }
12505 | window_definition_list ',' window_definition
12506 {
12507 $$ = cat_str(3,$1,mm_strdup(","),$3);
12508 }
12509 ;
12510
12511
12512 window_definition:
12513 ColId AS window_specification
12514 {
12515 $$ = cat_str(3,$1,mm_strdup("as"),$3);
12516 }
12517 ;
12518
12519
12520 over_clause:
12521 OVER window_specification
12522 {
12523 $$ = cat_str(2,mm_strdup("over"),$2);
12524 }
12525 | OVER ColId
12526 {
12527 $$ = cat_str(2,mm_strdup("over"),$2);
12528 }
12529 |
12530 {
12531 $$=EMPTY; }
12532 ;
12533
12534
12535 window_specification:
12536 '(' opt_existing_window_name opt_partition_clause opt_sort_clause opt_frame_clause ')'
12537 {
12538 $$ = cat_str(6,mm_strdup("("),$2,$3,$4,$5,mm_strdup(")"));
12539 }
12540 ;
12541
12542
12543 opt_existing_window_name:
12544 ColId
12545 {
12546 $$ = $1;
12547 }
12548 | %prec Op
12549 {
12550 $$=EMPTY; }
12551 ;
12552
12553
12554 opt_partition_clause:
12555 PARTITION BY expr_list
12556 {
12557 $$ = cat_str(2,mm_strdup("partition by"),$3);
12558 }
12559 |
12560 {
12561 $$=EMPTY; }
12562 ;
12563
12564
12565 opt_frame_clause:
12566 RANGE frame_extent opt_window_exclusion_clause
12567 {
12568 $$ = cat_str(3,mm_strdup("range"),$2,$3);
12569 }
12570 | ROWS frame_extent opt_window_exclusion_clause
12571 {
12572 $$ = cat_str(3,mm_strdup("rows"),$2,$3);
12573 }
12574 | GROUPS frame_extent opt_window_exclusion_clause
12575 {
12576 $$ = cat_str(3,mm_strdup("groups"),$2,$3);
12577 }
12578 |
12579 {
12580 $$=EMPTY; }
12581 ;
12582
12583
12584 frame_extent:
12585 frame_bound
12586 {
12587 $$ = $1;
12588 }
12589 | BETWEEN frame_bound AND frame_bound
12590 {
12591 $$ = cat_str(4,mm_strdup("between"),$2,mm_strdup("and"),$4);
12592 }
12593 ;
12594
12595
12596 frame_bound:
12597 UNBOUNDED PRECEDING
12598 {
12599 $$ = mm_strdup("unbounded preceding");
12600 }
12601 | UNBOUNDED FOLLOWING
12602 {
12603 $$ = mm_strdup("unbounded following");
12604 }
12605 | CURRENT_P ROW
12606 {
12607 $$ = mm_strdup("current row");
12608 }
12609 | a_expr PRECEDING
12610 {
12611 $$ = cat_str(2,$1,mm_strdup("preceding"));
12612 }
12613 | a_expr FOLLOWING
12614 {
12615 $$ = cat_str(2,$1,mm_strdup("following"));
12616 }
12617 ;
12618
12619
12620 opt_window_exclusion_clause:
12621 EXCLUDE CURRENT_P ROW
12622 {
12623 $$ = mm_strdup("exclude current row");
12624 }
12625 | EXCLUDE GROUP_P
12626 {
12627 $$ = mm_strdup("exclude group");
12628 }
12629 | EXCLUDE TIES
12630 {
12631 $$ = mm_strdup("exclude ties");
12632 }
12633 | EXCLUDE NO OTHERS
12634 {
12635 $$ = mm_strdup("exclude no others");
12636 }
12637 |
12638 {
12639 $$=EMPTY; }
12640 ;
12641
12642
12643 row:
12644 ROW '(' expr_list ')'
12645 {
12646 $$ = cat_str(3,mm_strdup("row ("),$3,mm_strdup(")"));
12647 }
12648 | ROW '(' ')'
12649 {
12650 $$ = mm_strdup("row ( )");
12651 }
12652 | '(' expr_list ',' a_expr ')'
12653 {
12654 $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(","),$4,mm_strdup(")"));
12655 }
12656 ;
12657
12658
12659 explicit_row:
12660 ROW '(' expr_list ')'
12661 {
12662 $$ = cat_str(3,mm_strdup("row ("),$3,mm_strdup(")"));
12663 }
12664 | ROW '(' ')'
12665 {
12666 $$ = mm_strdup("row ( )");
12667 }
12668 ;
12669
12670
12671 implicit_row:
12672 '(' expr_list ',' a_expr ')'
12673 {
12674 $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(","),$4,mm_strdup(")"));
12675 }
12676 ;
12677
12678
12679 sub_type:
12680 ANY
12681 {
12682 $$ = mm_strdup("any");
12683 }
12684 | SOME
12685 {
12686 $$ = mm_strdup("some");
12687 }
12688 | ALL
12689 {
12690 $$ = mm_strdup("all");
12691 }
12692 ;
12693
12694
12695 all_Op:
12696 Op
12697 {
12698 $$ = $1;
12699 }
12700 | MathOp
12701 {
12702 $$ = $1;
12703 }
12704 ;
12705
12706
12707 MathOp:
12708 '+'
12709 {
12710 $$ = mm_strdup("+");
12711 }
12712 | '-'
12713 {
12714 $$ = mm_strdup("-");
12715 }
12716 | '*'
12717 {
12718 $$ = mm_strdup("*");
12719 }
12720 | '/'
12721 {
12722 $$ = mm_strdup("/");
12723 }
12724 | '%'
12725 {
12726 $$ = mm_strdup("%");
12727 }
12728 | '^'
12729 {
12730 $$ = mm_strdup("^");
12731 }
12732 | '<'
12733 {
12734 $$ = mm_strdup("<");
12735 }
12736 | '>'
12737 {
12738 $$ = mm_strdup(">");
12739 }
12740 | '='
12741 {
12742 $$ = mm_strdup("=");
12743 }
12744 | LESS_EQUALS
12745 {
12746 $$ = mm_strdup("<=");
12747 }
12748 | GREATER_EQUALS
12749 {
12750 $$ = mm_strdup(">=");
12751 }
12752 | NOT_EQUALS
12753 {
12754 $$ = mm_strdup("<>");
12755 }
12756 ;
12757
12758
12759 qual_Op:
12760 Op
12761 {
12762 $$ = $1;
12763 }
12764 | OPERATOR '(' any_operator ')'
12765 {
12766 $$ = cat_str(3,mm_strdup("operator ("),$3,mm_strdup(")"));
12767 }
12768 ;
12769
12770
12771 qual_all_Op:
12772 all_Op
12773 {
12774 $$ = $1;
12775 }
12776 | OPERATOR '(' any_operator ')'
12777 {
12778 $$ = cat_str(3,mm_strdup("operator ("),$3,mm_strdup(")"));
12779 }
12780 ;
12781
12782
12783 subquery_Op:
12784 all_Op
12785 {
12786 $$ = $1;
12787 }
12788 | OPERATOR '(' any_operator ')'
12789 {
12790 $$ = cat_str(3,mm_strdup("operator ("),$3,mm_strdup(")"));
12791 }
12792 | LIKE
12793 {
12794 $$ = mm_strdup("like");
12795 }
12796 | NOT_LA LIKE
12797 {
12798 $$ = mm_strdup("not like");
12799 }
12800 | ILIKE
12801 {
12802 $$ = mm_strdup("ilike");
12803 }
12804 | NOT_LA ILIKE
12805 {
12806 $$ = mm_strdup("not ilike");
12807 }
12808 ;
12809
12810
12811 expr_list:
12812 a_expr
12813 {
12814 $$ = $1;
12815 }
12816 | expr_list ',' a_expr
12817 {
12818 $$ = cat_str(3,$1,mm_strdup(","),$3);
12819 }
12820 ;
12821
12822
12823 func_arg_list:
12824 func_arg_expr
12825 {
12826 $$ = $1;
12827 }
12828 | func_arg_list ',' func_arg_expr
12829 {
12830 $$ = cat_str(3,$1,mm_strdup(","),$3);
12831 }
12832 ;
12833
12834
12835 func_arg_expr:
12836 a_expr
12837 {
12838 $$ = $1;
12839 }
12840 | param_name COLON_EQUALS a_expr
12841 {
12842 $$ = cat_str(3,$1,mm_strdup(":="),$3);
12843 }
12844 | param_name EQUALS_GREATER a_expr
12845 {
12846 $$ = cat_str(3,$1,mm_strdup("=>"),$3);
12847 }
12848 ;
12849
12850
12851 func_arg_list_opt:
12852 func_arg_list
12853 {
12854 $$ = $1;
12855 }
12856 |
12857 {
12858 $$=EMPTY; }
12859 ;
12860
12861
12862 type_list:
12863 Typename
12864 {
12865 $$ = $1;
12866 }
12867 | type_list ',' Typename
12868 {
12869 $$ = cat_str(3,$1,mm_strdup(","),$3);
12870 }
12871 ;
12872
12873
12874 array_expr:
12875 '[' expr_list ']'
12876 {
12877 $$ = cat_str(3,mm_strdup("["),$2,mm_strdup("]"));
12878 }
12879 | '[' array_expr_list ']'
12880 {
12881 $$ = cat_str(3,mm_strdup("["),$2,mm_strdup("]"));
12882 }
12883 | '[' ']'
12884 {
12885 $$ = mm_strdup("[ ]");
12886 }
12887 ;
12888
12889
12890 array_expr_list:
12891 array_expr
12892 {
12893 $$ = $1;
12894 }
12895 | array_expr_list ',' array_expr
12896 {
12897 $$ = cat_str(3,$1,mm_strdup(","),$3);
12898 }
12899 ;
12900
12901
12902 extract_list:
12903 extract_arg FROM a_expr
12904 {
12905 $$ = cat_str(3,$1,mm_strdup("from"),$3);
12906 }
12907 ;
12908
12909
12910 extract_arg:
12911 ecpg_ident
12912 {
12913 $$ = $1;
12914 }
12915 | YEAR_P
12916 {
12917 $$ = mm_strdup("year");
12918 }
12919 | MONTH_P
12920 {
12921 $$ = mm_strdup("month");
12922 }
12923 | DAY_P
12924 {
12925 $$ = mm_strdup("day");
12926 }
12927 | HOUR_P
12928 {
12929 $$ = mm_strdup("hour");
12930 }
12931 | MINUTE_P
12932 {
12933 $$ = mm_strdup("minute");
12934 }
12935 | SECOND_P
12936 {
12937 $$ = mm_strdup("second");
12938 }
12939 | ecpg_sconst
12940 {
12941 $$ = $1;
12942 }
12943 ;
12944
12945
12946 unicode_normal_form:
12947 NFC
12948 {
12949 $$ = mm_strdup("nfc");
12950 }
12951 | NFD
12952 {
12953 $$ = mm_strdup("nfd");
12954 }
12955 | NFKC
12956 {
12957 $$ = mm_strdup("nfkc");
12958 }
12959 | NFKD
12960 {
12961 $$ = mm_strdup("nfkd");
12962 }
12963 ;
12964
12965
12966 overlay_list:
12967 a_expr PLACING a_expr FROM a_expr FOR a_expr
12968 {
12969 $$ = cat_str(7,$1,mm_strdup("placing"),$3,mm_strdup("from"),$5,mm_strdup("for"),$7);
12970 }
12971 | a_expr PLACING a_expr FROM a_expr
12972 {
12973 $$ = cat_str(5,$1,mm_strdup("placing"),$3,mm_strdup("from"),$5);
12974 }
12975 ;
12976
12977
12978 position_list:
12979 b_expr IN_P b_expr
12980 {
12981 $$ = cat_str(3,$1,mm_strdup("in"),$3);
12982 }
12983 ;
12984
12985
12986 substr_list:
12987 a_expr FROM a_expr FOR a_expr
12988 {
12989 $$ = cat_str(5,$1,mm_strdup("from"),$3,mm_strdup("for"),$5);
12990 }
12991 | a_expr FOR a_expr FROM a_expr
12992 {
12993 $$ = cat_str(5,$1,mm_strdup("for"),$3,mm_strdup("from"),$5);
12994 }
12995 | a_expr FROM a_expr
12996 {
12997 $$ = cat_str(3,$1,mm_strdup("from"),$3);
12998 }
12999 | a_expr FOR a_expr
13000 {
13001 $$ = cat_str(3,$1,mm_strdup("for"),$3);
13002 }
13003 | a_expr SIMILAR a_expr ESCAPE a_expr
13004 {
13005 $$ = cat_str(5,$1,mm_strdup("similar"),$3,mm_strdup("escape"),$5);
13006 }
13007 ;
13008
13009
13010 trim_list:
13011 a_expr FROM expr_list
13012 {
13013 $$ = cat_str(3,$1,mm_strdup("from"),$3);
13014 }
13015 | FROM expr_list
13016 {
13017 $$ = cat_str(2,mm_strdup("from"),$2);
13018 }
13019 | expr_list
13020 {
13021 $$ = $1;
13022 }
13023 ;
13024
13025
13026 in_expr:
13027 select_with_parens
13028 {
13029 $$ = $1;
13030 }
13031 | '(' expr_list ')'
13032 {
13033 $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
13034 }
13035 ;
13036
13037
13038 case_expr:
13039 CASE case_arg when_clause_list case_default END_P
13040 {
13041 $$ = cat_str(5,mm_strdup("case"),$2,$3,$4,mm_strdup("end"));
13042 }
13043 ;
13044
13045
13046 when_clause_list:
13047 when_clause
13048 {
13049 $$ = $1;
13050 }
13051 | when_clause_list when_clause
13052 {
13053 $$ = cat_str(2,$1,$2);
13054 }
13055 ;
13056
13057
13058 when_clause:
13059 WHEN a_expr THEN a_expr
13060 {
13061 $$ = cat_str(4,mm_strdup("when"),$2,mm_strdup("then"),$4);
13062 }
13063 ;
13064
13065
13066 case_default:
13067 ELSE a_expr
13068 {
13069 $$ = cat_str(2,mm_strdup("else"),$2);
13070 }
13071 |
13072 {
13073 $$=EMPTY; }
13074 ;
13075
13076
13077 case_arg:
13078 a_expr
13079 {
13080 $$ = $1;
13081 }
13082 |
13083 {
13084 $$=EMPTY; }
13085 ;
13086
13087
13088 columnref:
13089 ColId
13090 {
13091 $$ = $1;
13092 }
13093 | ColId indirection
13094 {
13095 $$ = cat_str(2,$1,$2);
13096 }
13097 ;
13098
13099
13100 indirection_el:
13101 '.' attr_name
13102 {
13103 $$ = cat_str(2,mm_strdup("."),$2);
13104 }
13105 | '.' '*'
13106 {
13107 $$ = mm_strdup(". *");
13108 }
13109 | '[' a_expr ']'
13110 {
13111 $$ = cat_str(3,mm_strdup("["),$2,mm_strdup("]"));
13112 }
13113 | '[' opt_slice_bound ':' opt_slice_bound ']'
13114 {
13115 $$ = cat_str(5,mm_strdup("["),$2,mm_strdup(":"),$4,mm_strdup("]"));
13116 }
13117 ;
13118
13119
13120 opt_slice_bound:
13121 a_expr
13122 {
13123 $$ = $1;
13124 }
13125 |
13126 {
13127 $$=EMPTY; }
13128 ;
13129
13130
13131 indirection:
13132 indirection_el
13133 {
13134 $$ = $1;
13135 }
13136 | indirection indirection_el
13137 {
13138 $$ = cat_str(2,$1,$2);
13139 }
13140 ;
13141
13142
13143 opt_indirection:
13144
13145 {
13146 $$=EMPTY; }
13147 | opt_indirection indirection_el
13148 {
13149 $$ = cat_str(2,$1,$2);
13150 }
13151 ;
13152
13153
13154 opt_asymmetric:
13155 ASYMMETRIC
13156 {
13157 $$ = mm_strdup("asymmetric");
13158 }
13159 |
13160 {
13161 $$=EMPTY; }
13162 ;
13163
13164
13165 opt_target_list:
13166 target_list
13167 {
13168 $$ = $1;
13169 }
13170 |
13171 {
13172 $$=EMPTY; }
13173 ;
13174
13175
13176 target_list:
13177 target_el
13178 {
13179 $$ = $1;
13180 }
13181 | target_list ',' target_el
13182 {
13183 $$ = cat_str(3,$1,mm_strdup(","),$3);
13184 }
13185 ;
13186
13187
13188 target_el:
13189 a_expr AS ColLabel
13190 {
13191 $$ = cat_str(3,$1,mm_strdup("as"),$3);
13192 }
13193 | a_expr BareColLabel
13194 {
13195 $$ = cat_str(2,$1,$2);
13196 }
13197 | a_expr
13198 {
13199 $$ = $1;
13200 }
13201 | '*'
13202 {
13203 $$ = mm_strdup("*");
13204 }
13205 ;
13206
13207
13208 qualified_name_list:
13209 qualified_name
13210 {
13211 $$ = $1;
13212 }
13213 | qualified_name_list ',' qualified_name
13214 {
13215 $$ = cat_str(3,$1,mm_strdup(","),$3);
13216 }
13217 ;
13218
13219
13220 qualified_name:
13221 ColId
13222 {
13223 $$ = $1;
13224 }
13225 | ColId indirection
13226 {
13227 $$ = cat_str(2,$1,$2);
13228 }
13229 ;
13230
13231
13232 name_list:
13233 name
13234 {
13235 $$ = $1;
13236 }
13237 | name_list ',' name
13238 {
13239 $$ = cat_str(3,$1,mm_strdup(","),$3);
13240 }
13241 ;
13242
13243
13244 name:
13245 ColId
13246 {
13247 $$ = $1;
13248 }
13249 ;
13250
13251
13252 attr_name:
13253 ColLabel
13254 {
13255 $$ = $1;
13256 }
13257 ;
13258
13259
13260 file_name:
13261 ecpg_sconst
13262 {
13263 $$ = $1;
13264 }
13265 ;
13266
13267
13268 func_name:
13269 type_function_name
13270 {
13271 $$ = $1;
13272 }
13273 | ColId indirection
13274 {
13275 $$ = cat_str(2,$1,$2);
13276 }
13277 ;
13278
13279
13280 AexprConst:
13281 Iconst
13282 {
13283 $$ = $1;
13284 }
13285 | ecpg_fconst
13286 {
13287 $$ = $1;
13288 }
13289 | ecpg_sconst
13290 {
13291 $$ = $1;
13292 }
13293 | ecpg_bconst
13294 {
13295 $$ = $1;
13296 }
13297 | ecpg_xconst
13298 {
13299 $$ = $1;
13300 }
13301 | func_name ecpg_sconst
13302 {
13303 $$ = cat_str(2,$1,$2);
13304 }
13305 | func_name '(' func_arg_list opt_sort_clause ')' ecpg_sconst
13306 {
13307 $$ = cat_str(6,$1,mm_strdup("("),$3,$4,mm_strdup(")"),$6);
13308 }
13309 | ConstTypename ecpg_sconst
13310 {
13311 $$ = cat_str(2,$1,$2);
13312 }
13313 | ConstInterval ecpg_sconst opt_interval
13314 {
13315 $$ = cat_str(3,$1,$2,$3);
13316 }
13317 | ConstInterval '(' Iconst ')' ecpg_sconst
13318 {
13319 $$ = cat_str(5,$1,mm_strdup("("),$3,mm_strdup(")"),$5);
13320 }
13321 | TRUE_P
13322 {
13323 $$ = mm_strdup("true");
13324 }
13325 | FALSE_P
13326 {
13327 $$ = mm_strdup("false");
13328 }
13329 | NULL_P
13330 {
13331 $$ = mm_strdup("null");
13332 }
13333 | civar { $$ = $1; }
13334 | civarind { $$ = $1; }
13335 ;
13336
13337
13338 Iconst:
13339 ICONST
13340 { $$ = make_name(); }
13341 ;
13342
13343
13344 SignedIconst:
13345 Iconst
13346 {
13347 $$ = $1;
13348 }
13349 | civar { $$ = $1; }
13350 | '+' Iconst
13351 {
13352 $$ = cat_str(2,mm_strdup("+"),$2);
13353 }
13354 | '-' Iconst
13355 {
13356 $$ = cat_str(2,mm_strdup("-"),$2);
13357 }
13358 ;
13359
13360
13361 RoleId:
13362 RoleSpec
13363 {
13364 $$ = $1;
13365 }
13366 ;
13367
13368
13369 RoleSpec:
13370 NonReservedWord
13371 {
13372 $$ = $1;
13373 }
13374 | CURRENT_ROLE
13375 {
13376 $$ = mm_strdup("current_role");
13377 }
13378 | CURRENT_USER
13379 {
13380 $$ = mm_strdup("current_user");
13381 }
13382 | SESSION_USER
13383 {
13384 $$ = mm_strdup("session_user");
13385 }
13386 ;
13387
13388
13389 role_list:
13390 RoleSpec
13391 {
13392 $$ = $1;
13393 }
13394 | role_list ',' RoleSpec
13395 {
13396 $$ = cat_str(3,$1,mm_strdup(","),$3);
13397 }
13398 ;
13399
13400
13401 NonReservedWord:
13402 ecpg_ident
13403 {
13404 $$ = $1;
13405 }
13406 | unreserved_keyword
13407 {
13408 $$ = $1;
13409 }
13410 | col_name_keyword
13411 {
13412 $$ = $1;
13413 }
13414 | type_func_name_keyword
13415 {
13416 $$ = $1;
13417 }
13418 ;
13419
13420
13421 BareColLabel:
13422 ecpg_ident
13423 {
13424 $$ = $1;
13425 }
13426 | bare_label_keyword
13427 {
13428 $$ = $1;
13429 }
13430 ;
13431
13432
13433 unreserved_keyword:
13434 ABORT_P
13435 {
13436 $$ = mm_strdup("abort");
13437 }
13438 | ABSOLUTE_P
13439 {
13440 $$ = mm_strdup("absolute");
13441 }
13442 | ACCESS
13443 {
13444 $$ = mm_strdup("access");
13445 }
13446 | ACTION
13447 {
13448 $$ = mm_strdup("action");
13449 }
13450 | ADD_P
13451 {
13452 $$ = mm_strdup("add");
13453 }
13454 | ADMIN
13455 {
13456 $$ = mm_strdup("admin");
13457 }
13458 | AFTER
13459 {
13460 $$ = mm_strdup("after");
13461 }
13462 | AGGREGATE
13463 {
13464 $$ = mm_strdup("aggregate");
13465 }
13466 | ALSO
13467 {
13468 $$ = mm_strdup("also");
13469 }
13470 | ALTER
13471 {
13472 $$ = mm_strdup("alter");
13473 }
13474 | ALWAYS
13475 {
13476 $$ = mm_strdup("always");
13477 }
13478 | ASENSITIVE
13479 {
13480 $$ = mm_strdup("asensitive");
13481 }
13482 | ASSERTION
13483 {
13484 $$ = mm_strdup("assertion");
13485 }
13486 | ASSIGNMENT
13487 {
13488 $$ = mm_strdup("assignment");
13489 }
13490 | AT
13491 {
13492 $$ = mm_strdup("at");
13493 }
13494 | ATOMIC
13495 {
13496 $$ = mm_strdup("atomic");
13497 }
13498 | ATTACH
13499 {
13500 $$ = mm_strdup("attach");
13501 }
13502 | ATTRIBUTE
13503 {
13504 $$ = mm_strdup("attribute");
13505 }
13506 | BACKWARD
13507 {
13508 $$ = mm_strdup("backward");
13509 }
13510 | BEFORE
13511 {
13512 $$ = mm_strdup("before");
13513 }
13514 | BEGIN_P
13515 {
13516 $$ = mm_strdup("begin");
13517 }
13518 | BREADTH
13519 {
13520 $$ = mm_strdup("breadth");
13521 }
13522 | BY
13523 {
13524 $$ = mm_strdup("by");
13525 }
13526 | CACHE
13527 {
13528 $$ = mm_strdup("cache");
13529 }
13530 | CALL
13531 {
13532 $$ = mm_strdup("call");
13533 }
13534 | CALLED
13535 {
13536 $$ = mm_strdup("called");
13537 }
13538 | CASCADE
13539 {
13540 $$ = mm_strdup("cascade");
13541 }
13542 | CASCADED
13543 {
13544 $$ = mm_strdup("cascaded");
13545 }
13546 | CATALOG_P
13547 {
13548 $$ = mm_strdup("catalog");
13549 }
13550 | CHAIN
13551 {
13552 $$ = mm_strdup("chain");
13553 }
13554 | CHARACTERISTICS
13555 {
13556 $$ = mm_strdup("characteristics");
13557 }
13558 | CHECKPOINT
13559 {
13560 $$ = mm_strdup("checkpoint");
13561 }
13562 | CLASS
13563 {
13564 $$ = mm_strdup("class");
13565 }
13566 | CLOSE
13567 {
13568 $$ = mm_strdup("close");
13569 }
13570 | CLUSTER
13571 {
13572 $$ = mm_strdup("cluster");
13573 }
13574 | COLUMNS
13575 {
13576 $$ = mm_strdup("columns");
13577 }
13578 | COMMENT
13579 {
13580 $$ = mm_strdup("comment");
13581 }
13582 | COMMENTS
13583 {
13584 $$ = mm_strdup("comments");
13585 }
13586 | COMMIT
13587 {
13588 $$ = mm_strdup("commit");
13589 }
13590 | COMMITTED
13591 {
13592 $$ = mm_strdup("committed");
13593 }
13594 | COMPRESSION
13595 {
13596 $$ = mm_strdup("compression");
13597 }
13598 | CONFIGURATION
13599 {
13600 $$ = mm_strdup("configuration");
13601 }
13602 | CONFLICT
13603 {
13604 $$ = mm_strdup("conflict");
13605 }
13606 | CONSTRAINTS
13607 {
13608 $$ = mm_strdup("constraints");
13609 }
13610 | CONTENT_P
13611 {
13612 $$ = mm_strdup("content");
13613 }
13614 | CONTINUE_P
13615 {
13616 $$ = mm_strdup("continue");
13617 }
13618 | CONVERSION_P
13619 {
13620 $$ = mm_strdup("conversion");
13621 }
13622 | COPY
13623 {
13624 $$ = mm_strdup("copy");
13625 }
13626 | COST
13627 {
13628 $$ = mm_strdup("cost");
13629 }
13630 | CSV
13631 {
13632 $$ = mm_strdup("csv");
13633 }
13634 | CUBE
13635 {
13636 $$ = mm_strdup("cube");
13637 }
13638 | CURSOR
13639 {
13640 $$ = mm_strdup("cursor");
13641 }
13642 | CYCLE
13643 {
13644 $$ = mm_strdup("cycle");
13645 }
13646 | DATA_P
13647 {
13648 $$ = mm_strdup("data");
13649 }
13650 | DATABASE
13651 {
13652 $$ = mm_strdup("database");
13653 }
13654 | DEALLOCATE
13655 {
13656 $$ = mm_strdup("deallocate");
13657 }
13658 | DECLARE
13659 {
13660 $$ = mm_strdup("declare");
13661 }
13662 | DEFAULTS
13663 {
13664 $$ = mm_strdup("defaults");
13665 }
13666 | DEFERRED
13667 {
13668 $$ = mm_strdup("deferred");
13669 }
13670 | DEFINER
13671 {
13672 $$ = mm_strdup("definer");
13673 }
13674 | DELETE_P
13675 {
13676 $$ = mm_strdup("delete");
13677 }
13678 | DELIMITER
13679 {
13680 $$ = mm_strdup("delimiter");
13681 }
13682 | DELIMITERS
13683 {
13684 $$ = mm_strdup("delimiters");
13685 }
13686 | DEPENDS
13687 {
13688 $$ = mm_strdup("depends");
13689 }
13690 | DEPTH
13691 {
13692 $$ = mm_strdup("depth");
13693 }
13694 | DETACH
13695 {
13696 $$ = mm_strdup("detach");
13697 }
13698 | DICTIONARY
13699 {
13700 $$ = mm_strdup("dictionary");
13701 }
13702 | DISABLE_P
13703 {
13704 $$ = mm_strdup("disable");
13705 }
13706 | DISCARD
13707 {
13708 $$ = mm_strdup("discard");
13709 }
13710 | DOCUMENT_P
13711 {
13712 $$ = mm_strdup("document");
13713 }
13714 | DOMAIN_P
13715 {
13716 $$ = mm_strdup("domain");
13717 }
13718 | DOUBLE_P
13719 {
13720 $$ = mm_strdup("double");
13721 }
13722 | DROP
13723 {
13724 $$ = mm_strdup("drop");
13725 }
13726 | EACH
13727 {
13728 $$ = mm_strdup("each");
13729 }
13730 | ENABLE_P
13731 {
13732 $$ = mm_strdup("enable");
13733 }
13734 | ENCODING
13735 {
13736 $$ = mm_strdup("encoding");
13737 }
13738 | ENCRYPTED
13739 {
13740 $$ = mm_strdup("encrypted");
13741 }
13742 | ENUM_P
13743 {
13744 $$ = mm_strdup("enum");
13745 }
13746 | ESCAPE
13747 {
13748 $$ = mm_strdup("escape");
13749 }
13750 | EVENT
13751 {
13752 $$ = mm_strdup("event");
13753 }
13754 | EXCLUDE
13755 {
13756 $$ = mm_strdup("exclude");
13757 }
13758 | EXCLUDING
13759 {
13760 $$ = mm_strdup("excluding");
13761 }
13762 | EXCLUSIVE
13763 {
13764 $$ = mm_strdup("exclusive");
13765 }
13766 | EXECUTE
13767 {
13768 $$ = mm_strdup("execute");
13769 }
13770 | EXPLAIN
13771 {
13772 $$ = mm_strdup("explain");
13773 }
13774 | EXPRESSION
13775 {
13776 $$ = mm_strdup("expression");
13777 }
13778 | EXTENSION
13779 {
13780 $$ = mm_strdup("extension");
13781 }
13782 | EXTERNAL
13783 {
13784 $$ = mm_strdup("external");
13785 }
13786 | FAMILY
13787 {
13788 $$ = mm_strdup("family");
13789 }
13790 | FILTER
13791 {
13792 $$ = mm_strdup("filter");
13793 }
13794 | FINALIZE
13795 {
13796 $$ = mm_strdup("finalize");
13797 }
13798 | FIRST_P
13799 {
13800 $$ = mm_strdup("first");
13801 }
13802 | FOLLOWING
13803 {
13804 $$ = mm_strdup("following");
13805 }
13806 | FORCE
13807 {
13808 $$ = mm_strdup("force");
13809 }
13810 | FORWARD
13811 {
13812 $$ = mm_strdup("forward");
13813 }
13814 | FUNCTION
13815 {
13816 $$ = mm_strdup("function");
13817 }
13818 | FUNCTIONS
13819 {
13820 $$ = mm_strdup("functions");
13821 }
13822 | GENERATED
13823 {
13824 $$ = mm_strdup("generated");
13825 }
13826 | GLOBAL
13827 {
13828 $$ = mm_strdup("global");
13829 }
13830 | GRANTED
13831 {
13832 $$ = mm_strdup("granted");
13833 }
13834 | GROUPS
13835 {
13836 $$ = mm_strdup("groups");
13837 }
13838 | HANDLER
13839 {
13840 $$ = mm_strdup("handler");
13841 }
13842 | HEADER_P
13843 {
13844 $$ = mm_strdup("header");
13845 }
13846 | HOLD
13847 {
13848 $$ = mm_strdup("hold");
13849 }
13850 | IDENTITY_P
13851 {
13852 $$ = mm_strdup("identity");
13853 }
13854 | IF_P
13855 {
13856 $$ = mm_strdup("if");
13857 }
13858 | IMMEDIATE
13859 {
13860 $$ = mm_strdup("immediate");
13861 }
13862 | IMMUTABLE
13863 {
13864 $$ = mm_strdup("immutable");
13865 }
13866 | IMPLICIT_P
13867 {
13868 $$ = mm_strdup("implicit");
13869 }
13870 | IMPORT_P
13871 {
13872 $$ = mm_strdup("import");
13873 }
13874 | INCLUDE
13875 {
13876 $$ = mm_strdup("include");
13877 }
13878 | INCLUDING
13879 {
13880 $$ = mm_strdup("including");
13881 }
13882 | INCREMENT
13883 {
13884 $$ = mm_strdup("increment");
13885 }
13886 | INDEX
13887 {
13888 $$ = mm_strdup("index");
13889 }
13890 | INDEXES
13891 {
13892 $$ = mm_strdup("indexes");
13893 }
13894 | INHERIT
13895 {
13896 $$ = mm_strdup("inherit");
13897 }
13898 | INHERITS
13899 {
13900 $$ = mm_strdup("inherits");
13901 }
13902 | INLINE_P
13903 {
13904 $$ = mm_strdup("inline");
13905 }
13906 | INSENSITIVE
13907 {
13908 $$ = mm_strdup("insensitive");
13909 }
13910 | INSERT
13911 {
13912 $$ = mm_strdup("insert");
13913 }
13914 | INSTEAD
13915 {
13916 $$ = mm_strdup("instead");
13917 }
13918 | INVOKER
13919 {
13920 $$ = mm_strdup("invoker");
13921 }
13922 | ISOLATION
13923 {
13924 $$ = mm_strdup("isolation");
13925 }
13926 | KEY
13927 {
13928 $$ = mm_strdup("key");
13929 }
13930 | LABEL
13931 {
13932 $$ = mm_strdup("label");
13933 }
13934 | LANGUAGE
13935 {
13936 $$ = mm_strdup("language");
13937 }
13938 | LARGE_P
13939 {
13940 $$ = mm_strdup("large");
13941 }
13942 | LAST_P
13943 {
13944 $$ = mm_strdup("last");
13945 }
13946 | LEAKPROOF
13947 {
13948 $$ = mm_strdup("leakproof");
13949 }
13950 | LEVEL
13951 {
13952 $$ = mm_strdup("level");
13953 }
13954 | LISTEN
13955 {
13956 $$ = mm_strdup("listen");
13957 }
13958 | LOAD
13959 {
13960 $$ = mm_strdup("load");
13961 }
13962 | LOCAL
13963 {
13964 $$ = mm_strdup("local");
13965 }
13966 | LOCATION
13967 {
13968 $$ = mm_strdup("location");
13969 }
13970 | LOCK_P
13971 {
13972 $$ = mm_strdup("lock");
13973 }
13974 | LOCKED
13975 {
13976 $$ = mm_strdup("locked");
13977 }
13978 | LOGGED
13979 {
13980 $$ = mm_strdup("logged");
13981 }
13982 | MAPPING
13983 {
13984 $$ = mm_strdup("mapping");
13985 }
13986 | MATCH
13987 {
13988 $$ = mm_strdup("match");
13989 }
13990 | MATERIALIZED
13991 {
13992 $$ = mm_strdup("materialized");
13993 }
13994 | MAXVALUE
13995 {
13996 $$ = mm_strdup("maxvalue");
13997 }
13998 | METHOD
13999 {
14000 $$ = mm_strdup("method");
14001 }
14002 | MINVALUE
14003 {
14004 $$ = mm_strdup("minvalue");
14005 }
14006 | MODE
14007 {
14008 $$ = mm_strdup("mode");
14009 }
14010 | MOVE
14011 {
14012 $$ = mm_strdup("move");
14013 }
14014 | NAME_P
14015 {
14016 $$ = mm_strdup("name");
14017 }
14018 | NAMES
14019 {
14020 $$ = mm_strdup("names");
14021 }
14022 | NEW
14023 {
14024 $$ = mm_strdup("new");
14025 }
14026 | NEXT
14027 {
14028 $$ = mm_strdup("next");
14029 }
14030 | NFC
14031 {
14032 $$ = mm_strdup("nfc");
14033 }
14034 | NFD
14035 {
14036 $$ = mm_strdup("nfd");
14037 }
14038 | NFKC
14039 {
14040 $$ = mm_strdup("nfkc");
14041 }
14042 | NFKD
14043 {
14044 $$ = mm_strdup("nfkd");
14045 }
14046 | NO
14047 {
14048 $$ = mm_strdup("no");
14049 }
14050 | NORMALIZED
14051 {
14052 $$ = mm_strdup("normalized");
14053 }
14054 | NOTHING
14055 {
14056 $$ = mm_strdup("nothing");
14057 }
14058 | NOTIFY
14059 {
14060 $$ = mm_strdup("notify");
14061 }
14062 | NOWAIT
14063 {
14064 $$ = mm_strdup("nowait");
14065 }
14066 | NULLS_P
14067 {
14068 $$ = mm_strdup("nulls");
14069 }
14070 | OBJECT_P
14071 {
14072 $$ = mm_strdup("object");
14073 }
14074 | OF
14075 {
14076 $$ = mm_strdup("of");
14077 }
14078 | OFF
14079 {
14080 $$ = mm_strdup("off");
14081 }
14082 | OIDS
14083 {
14084 $$ = mm_strdup("oids");
14085 }
14086 | OLD
14087 {
14088 $$ = mm_strdup("old");
14089 }
14090 | OPERATOR
14091 {
14092 $$ = mm_strdup("operator");
14093 }
14094 | OPTION
14095 {
14096 $$ = mm_strdup("option");
14097 }
14098 | OPTIONS
14099 {
14100 $$ = mm_strdup("options");
14101 }
14102 | ORDINALITY
14103 {
14104 $$ = mm_strdup("ordinality");
14105 }
14106 | OTHERS
14107 {
14108 $$ = mm_strdup("others");
14109 }
14110 | OVER
14111 {
14112 $$ = mm_strdup("over");
14113 }
14114 | OVERRIDING
14115 {
14116 $$ = mm_strdup("overriding");
14117 }
14118 | OWNED
14119 {
14120 $$ = mm_strdup("owned");
14121 }
14122 | OWNER
14123 {
14124 $$ = mm_strdup("owner");
14125 }
14126 | PARALLEL
14127 {
14128 $$ = mm_strdup("parallel");
14129 }
14130 | PARSER
14131 {
14132 $$ = mm_strdup("parser");
14133 }
14134 | PARTIAL
14135 {
14136 $$ = mm_strdup("partial");
14137 }
14138 | PARTITION
14139 {
14140 $$ = mm_strdup("partition");
14141 }
14142 | PASSING
14143 {
14144 $$ = mm_strdup("passing");
14145 }
14146 | PASSWORD
14147 {
14148 $$ = mm_strdup("password");
14149 }
14150 | PLANS
14151 {
14152 $$ = mm_strdup("plans");
14153 }
14154 | POLICY
14155 {
14156 $$ = mm_strdup("policy");
14157 }
14158 | PRECEDING
14159 {
14160 $$ = mm_strdup("preceding");
14161 }
14162 | PREPARE
14163 {
14164 $$ = mm_strdup("prepare");
14165 }
14166 | PREPARED
14167 {
14168 $$ = mm_strdup("prepared");
14169 }
14170 | PRESERVE
14171 {
14172 $$ = mm_strdup("preserve");
14173 }
14174 | PRIOR
14175 {
14176 $$ = mm_strdup("prior");
14177 }
14178 | PRIVILEGES
14179 {
14180 $$ = mm_strdup("privileges");
14181 }
14182 | PROCEDURAL
14183 {
14184 $$ = mm_strdup("procedural");
14185 }
14186 | PROCEDURE
14187 {
14188 $$ = mm_strdup("procedure");
14189 }
14190 | PROCEDURES
14191 {
14192 $$ = mm_strdup("procedures");
14193 }
14194 | PROGRAM
14195 {
14196 $$ = mm_strdup("program");
14197 }
14198 | PUBLICATION
14199 {
14200 $$ = mm_strdup("publication");
14201 }
14202 | QUOTE
14203 {
14204 $$ = mm_strdup("quote");
14205 }
14206 | RANGE
14207 {
14208 $$ = mm_strdup("range");
14209 }
14210 | READ
14211 {
14212 $$ = mm_strdup("read");
14213 }
14214 | REASSIGN
14215 {
14216 $$ = mm_strdup("reassign");
14217 }
14218 | RECHECK
14219 {
14220 $$ = mm_strdup("recheck");
14221 }
14222 | RECURSIVE
14223 {
14224 $$ = mm_strdup("recursive");
14225 }
14226 | REF
14227 {
14228 $$ = mm_strdup("ref");
14229 }
14230 | REFERENCING
14231 {
14232 $$ = mm_strdup("referencing");
14233 }
14234 | REFRESH
14235 {
14236 $$ = mm_strdup("refresh");
14237 }
14238 | REINDEX
14239 {
14240 $$ = mm_strdup("reindex");
14241 }
14242 | RELATIVE_P
14243 {
14244 $$ = mm_strdup("relative");
14245 }
14246 | RELEASE
14247 {
14248 $$ = mm_strdup("release");
14249 }
14250 | RENAME
14251 {
14252 $$ = mm_strdup("rename");
14253 }
14254 | REPEATABLE
14255 {
14256 $$ = mm_strdup("repeatable");
14257 }
14258 | REPLACE
14259 {
14260 $$ = mm_strdup("replace");
14261 }
14262 | REPLICA
14263 {
14264 $$ = mm_strdup("replica");
14265 }
14266 | RESET
14267 {
14268 $$ = mm_strdup("reset");
14269 }
14270 | RESTART
14271 {
14272 $$ = mm_strdup("restart");
14273 }
14274 | RESTRICT
14275 {
14276 $$ = mm_strdup("restrict");
14277 }
14278 | RETURN
14279 {
14280 $$ = mm_strdup("return");
14281 }
14282 | RETURNS
14283 {
14284 $$ = mm_strdup("returns");
14285 }
14286 | REVOKE
14287 {
14288 $$ = mm_strdup("revoke");
14289 }
14290 | ROLE
14291 {
14292 $$ = mm_strdup("role");
14293 }
14294 | ROLLBACK
14295 {
14296 $$ = mm_strdup("rollback");
14297 }
14298 | ROLLUP
14299 {
14300 $$ = mm_strdup("rollup");
14301 }
14302 | ROUTINE
14303 {
14304 $$ = mm_strdup("routine");
14305 }
14306 | ROUTINES
14307 {
14308 $$ = mm_strdup("routines");
14309 }
14310 | ROWS
14311 {
14312 $$ = mm_strdup("rows");
14313 }
14314 | RULE
14315 {
14316 $$ = mm_strdup("rule");
14317 }
14318 | SAVEPOINT
14319 {
14320 $$ = mm_strdup("savepoint");
14321 }
14322 | SCHEMA
14323 {
14324 $$ = mm_strdup("schema");
14325 }
14326 | SCHEMAS
14327 {
14328 $$ = mm_strdup("schemas");
14329 }
14330 | SCROLL
14331 {
14332 $$ = mm_strdup("scroll");
14333 }
14334 | SEARCH
14335 {
14336 $$ = mm_strdup("search");
14337 }
14338 | SECURITY
14339 {
14340 $$ = mm_strdup("security");
14341 }
14342 | SEQUENCE
14343 {
14344 $$ = mm_strdup("sequence");
14345 }
14346 | SEQUENCES
14347 {
14348 $$ = mm_strdup("sequences");
14349 }
14350 | SERIALIZABLE
14351 {
14352 $$ = mm_strdup("serializable");
14353 }
14354 | SERVER
14355 {
14356 $$ = mm_strdup("server");
14357 }
14358 | SESSION
14359 {
14360 $$ = mm_strdup("session");
14361 }
14362 | SET
14363 {
14364 $$ = mm_strdup("set");
14365 }
14366 | SETS
14367 {
14368 $$ = mm_strdup("sets");
14369 }
14370 | SHARE
14371 {
14372 $$ = mm_strdup("share");
14373 }
14374 | SHOW
14375 {
14376 $$ = mm_strdup("show");
14377 }
14378 | SIMPLE
14379 {
14380 $$ = mm_strdup("simple");
14381 }
14382 | SKIP
14383 {
14384 $$ = mm_strdup("skip");
14385 }
14386 | SNAPSHOT
14387 {
14388 $$ = mm_strdup("snapshot");
14389 }
14390 | SQL_P
14391 {
14392 $$ = mm_strdup("sql");
14393 }
14394 | STABLE
14395 {
14396 $$ = mm_strdup("stable");
14397 }
14398 | STANDALONE_P
14399 {
14400 $$ = mm_strdup("standalone");
14401 }
14402 | START
14403 {
14404 $$ = mm_strdup("start");
14405 }
14406 | STATEMENT
14407 {
14408 $$ = mm_strdup("statement");
14409 }
14410 | STATISTICS
14411 {
14412 $$ = mm_strdup("statistics");
14413 }
14414 | STDIN
14415 {
14416 $$ = mm_strdup("stdin");
14417 }
14418 | STDOUT
14419 {
14420 $$ = mm_strdup("stdout");
14421 }
14422 | STORAGE
14423 {
14424 $$ = mm_strdup("storage");
14425 }
14426 | STORED
14427 {
14428 $$ = mm_strdup("stored");
14429 }
14430 | STRICT_P
14431 {
14432 $$ = mm_strdup("strict");
14433 }
14434 | STRIP_P
14435 {
14436 $$ = mm_strdup("strip");
14437 }
14438 | SUBSCRIPTION
14439 {
14440 $$ = mm_strdup("subscription");
14441 }
14442 | SUPPORT
14443 {
14444 $$ = mm_strdup("support");
14445 }
14446 | SYSID
14447 {
14448 $$ = mm_strdup("sysid");
14449 }
14450 | SYSTEM_P
14451 {
14452 $$ = mm_strdup("system");
14453 }
14454 | TABLES
14455 {
14456 $$ = mm_strdup("tables");
14457 }
14458 | TABLESPACE
14459 {
14460 $$ = mm_strdup("tablespace");
14461 }
14462 | TEMP
14463 {
14464 $$ = mm_strdup("temp");
14465 }
14466 | TEMPLATE
14467 {
14468 $$ = mm_strdup("template");
14469 }
14470 | TEMPORARY
14471 {
14472 $$ = mm_strdup("temporary");
14473 }
14474 | TEXT_P
14475 {
14476 $$ = mm_strdup("text");
14477 }
14478 | TIES
14479 {
14480 $$ = mm_strdup("ties");
14481 }
14482 | TRANSACTION
14483 {
14484 $$ = mm_strdup("transaction");
14485 }
14486 | TRANSFORM
14487 {
14488 $$ = mm_strdup("transform");
14489 }
14490 | TRIGGER
14491 {
14492 $$ = mm_strdup("trigger");
14493 }
14494 | TRUNCATE
14495 {
14496 $$ = mm_strdup("truncate");
14497 }
14498 | TRUSTED
14499 {
14500 $$ = mm_strdup("trusted");
14501 }
14502 | TYPE_P
14503 {
14504 $$ = mm_strdup("type");
14505 }
14506 | TYPES_P
14507 {
14508 $$ = mm_strdup("types");
14509 }
14510 | UESCAPE
14511 {
14512 $$ = mm_strdup("uescape");
14513 }
14514 | UNBOUNDED
14515 {
14516 $$ = mm_strdup("unbounded");
14517 }
14518 | UNCOMMITTED
14519 {
14520 $$ = mm_strdup("uncommitted");
14521 }
14522 | UNENCRYPTED
14523 {
14524 $$ = mm_strdup("unencrypted");
14525 }
14526 | UNKNOWN
14527 {
14528 $$ = mm_strdup("unknown");
14529 }
14530 | UNLISTEN
14531 {
14532 $$ = mm_strdup("unlisten");
14533 }
14534 | UNLOGGED
14535 {
14536 $$ = mm_strdup("unlogged");
14537 }
14538 | UNTIL
14539 {
14540 $$ = mm_strdup("until");
14541 }
14542 | UPDATE
14543 {
14544 $$ = mm_strdup("update");
14545 }
14546 | VACUUM
14547 {
14548 $$ = mm_strdup("vacuum");
14549 }
14550 | VALID
14551 {
14552 $$ = mm_strdup("valid");
14553 }
14554 | VALIDATE
14555 {
14556 $$ = mm_strdup("validate");
14557 }
14558 | VALIDATOR
14559 {
14560 $$ = mm_strdup("validator");
14561 }
14562 | VALUE_P
14563 {
14564 $$ = mm_strdup("value");
14565 }
14566 | VARYING
14567 {
14568 $$ = mm_strdup("varying");
14569 }
14570 | VERSION_P
14571 {
14572 $$ = mm_strdup("version");
14573 }
14574 | VIEW
14575 {
14576 $$ = mm_strdup("view");
14577 }
14578 | VIEWS
14579 {
14580 $$ = mm_strdup("views");
14581 }
14582 | VOLATILE
14583 {
14584 $$ = mm_strdup("volatile");
14585 }
14586 | WHITESPACE_P
14587 {
14588 $$ = mm_strdup("whitespace");
14589 }
14590 | WITHIN
14591 {
14592 $$ = mm_strdup("within");
14593 }
14594 | WITHOUT
14595 {
14596 $$ = mm_strdup("without");
14597 }
14598 | WORK
14599 {
14600 $$ = mm_strdup("work");
14601 }
14602 | WRAPPER
14603 {
14604 $$ = mm_strdup("wrapper");
14605 }
14606 | WRITE
14607 {
14608 $$ = mm_strdup("write");
14609 }
14610 | XML_P
14611 {
14612 $$ = mm_strdup("xml");
14613 }
14614 | YES_P
14615 {
14616 $$ = mm_strdup("yes");
14617 }
14618 | ZONE
14619 {
14620 $$ = mm_strdup("zone");
14621 }
14622 ;
14623
14624
14625 col_name_keyword:
14626 BETWEEN
14627 {
14628 $$ = mm_strdup("between");
14629 }
14630 | BIGINT
14631 {
14632 $$ = mm_strdup("bigint");
14633 }
14634 | BIT
14635 {
14636 $$ = mm_strdup("bit");
14637 }
14638 | BOOLEAN_P
14639 {
14640 $$ = mm_strdup("boolean");
14641 }
14642 | CHARACTER
14643 {
14644 $$ = mm_strdup("character");
14645 }
14646 | COALESCE
14647 {
14648 $$ = mm_strdup("coalesce");
14649 }
14650 | DEC
14651 {
14652 $$ = mm_strdup("dec");
14653 }
14654 | DECIMAL_P
14655 {
14656 $$ = mm_strdup("decimal");
14657 }
14658 | EXISTS
14659 {
14660 $$ = mm_strdup("exists");
14661 }
14662 | EXTRACT
14663 {
14664 $$ = mm_strdup("extract");
14665 }
14666 | FLOAT_P
14667 {
14668 $$ = mm_strdup("float");
14669 }
14670 | GREATEST
14671 {
14672 $$ = mm_strdup("greatest");
14673 }
14674 | GROUPING
14675 {
14676 $$ = mm_strdup("grouping");
14677 }
14678 | INOUT
14679 {
14680 $$ = mm_strdup("inout");
14681 }
14682 | INTEGER
14683 {
14684 $$ = mm_strdup("integer");
14685 }
14686 | INTERVAL
14687 {
14688 $$ = mm_strdup("interval");
14689 }
14690 | LEAST
14691 {
14692 $$ = mm_strdup("least");
14693 }
14694 | NATIONAL
14695 {
14696 $$ = mm_strdup("national");
14697 }
14698 | NCHAR
14699 {
14700 $$ = mm_strdup("nchar");
14701 }
14702 | NONE
14703 {
14704 $$ = mm_strdup("none");
14705 }
14706 | NORMALIZE
14707 {
14708 $$ = mm_strdup("normalize");
14709 }
14710 | NULLIF
14711 {
14712 $$ = mm_strdup("nullif");
14713 }
14714 | NUMERIC
14715 {
14716 $$ = mm_strdup("numeric");
14717 }
14718 | OUT_P
14719 {
14720 $$ = mm_strdup("out");
14721 }
14722 | OVERLAY
14723 {
14724 $$ = mm_strdup("overlay");
14725 }
14726 | POSITION
14727 {
14728 $$ = mm_strdup("position");
14729 }
14730 | PRECISION
14731 {
14732 $$ = mm_strdup("precision");
14733 }
14734 | REAL
14735 {
14736 $$ = mm_strdup("real");
14737 }
14738 | ROW
14739 {
14740 $$ = mm_strdup("row");
14741 }
14742 | SETOF
14743 {
14744 $$ = mm_strdup("setof");
14745 }
14746 | SMALLINT
14747 {
14748 $$ = mm_strdup("smallint");
14749 }
14750 | SUBSTRING
14751 {
14752 $$ = mm_strdup("substring");
14753 }
14754 | TIME
14755 {
14756 $$ = mm_strdup("time");
14757 }
14758 | TIMESTAMP
14759 {
14760 $$ = mm_strdup("timestamp");
14761 }
14762 | TREAT
14763 {
14764 $$ = mm_strdup("treat");
14765 }
14766 | TRIM
14767 {
14768 $$ = mm_strdup("trim");
14769 }
14770 | VARCHAR
14771 {
14772 $$ = mm_strdup("varchar");
14773 }
14774 | XMLATTRIBUTES
14775 {
14776 $$ = mm_strdup("xmlattributes");
14777 }
14778 | XMLCONCAT
14779 {
14780 $$ = mm_strdup("xmlconcat");
14781 }
14782 | XMLELEMENT
14783 {
14784 $$ = mm_strdup("xmlelement");
14785 }
14786 | XMLEXISTS
14787 {
14788 $$ = mm_strdup("xmlexists");
14789 }
14790 | XMLFOREST
14791 {
14792 $$ = mm_strdup("xmlforest");
14793 }
14794 | XMLNAMESPACES
14795 {
14796 $$ = mm_strdup("xmlnamespaces");
14797 }
14798 | XMLPARSE
14799 {
14800 $$ = mm_strdup("xmlparse");
14801 }
14802 | XMLPI
14803 {
14804 $$ = mm_strdup("xmlpi");
14805 }
14806 | XMLROOT
14807 {
14808 $$ = mm_strdup("xmlroot");
14809 }
14810 | XMLSERIALIZE
14811 {
14812 $$ = mm_strdup("xmlserialize");
14813 }
14814 | XMLTABLE
14815 {
14816 $$ = mm_strdup("xmltable");
14817 }
14818 ;
14819
14820
14821 type_func_name_keyword:
14822 AUTHORIZATION
14823 {
14824 $$ = mm_strdup("authorization");
14825 }
14826 | BINARY
14827 {
14828 $$ = mm_strdup("binary");
14829 }
14830 | COLLATION
14831 {
14832 $$ = mm_strdup("collation");
14833 }
14834 | CONCURRENTLY
14835 {
14836 $$ = mm_strdup("concurrently");
14837 }
14838 | CROSS
14839 {
14840 $$ = mm_strdup("cross");
14841 }
14842 | CURRENT_SCHEMA
14843 {
14844 $$ = mm_strdup("current_schema");
14845 }
14846 | FREEZE
14847 {
14848 $$ = mm_strdup("freeze");
14849 }
14850 | FULL
14851 {
14852 $$ = mm_strdup("full");
14853 }
14854 | ILIKE
14855 {
14856 $$ = mm_strdup("ilike");
14857 }
14858 | INNER_P
14859 {
14860 $$ = mm_strdup("inner");
14861 }
14862 | IS
14863 {
14864 $$ = mm_strdup("is");
14865 }
14866 | ISNULL
14867 {
14868 $$ = mm_strdup("isnull");
14869 }
14870 | JOIN
14871 {
14872 $$ = mm_strdup("join");
14873 }
14874 | LEFT
14875 {
14876 $$ = mm_strdup("left");
14877 }
14878 | LIKE
14879 {
14880 $$ = mm_strdup("like");
14881 }
14882 | NATURAL
14883 {
14884 $$ = mm_strdup("natural");
14885 }
14886 | NOTNULL
14887 {
14888 $$ = mm_strdup("notnull");
14889 }
14890 | OUTER_P
14891 {
14892 $$ = mm_strdup("outer");
14893 }
14894 | OVERLAPS
14895 {
14896 $$ = mm_strdup("overlaps");
14897 }
14898 | RIGHT
14899 {
14900 $$ = mm_strdup("right");
14901 }
14902 | SIMILAR
14903 {
14904 $$ = mm_strdup("similar");
14905 }
14906 | TABLESAMPLE
14907 {
14908 $$ = mm_strdup("tablesample");
14909 }
14910 | VERBOSE
14911 {
14912 $$ = mm_strdup("verbose");
14913 }
14914 ;
14915
14916
14917 reserved_keyword:
14918 ALL
14919 {
14920 $$ = mm_strdup("all");
14921 }
14922 | ANALYSE
14923 {
14924 $$ = mm_strdup("analyse");
14925 }
14926 | ANALYZE
14927 {
14928 $$ = mm_strdup("analyze");
14929 }
14930 | AND
14931 {
14932 $$ = mm_strdup("and");
14933 }
14934 | ANY
14935 {
14936 $$ = mm_strdup("any");
14937 }
14938 | ARRAY
14939 {
14940 $$ = mm_strdup("array");
14941 }
14942 | AS
14943 {
14944 $$ = mm_strdup("as");
14945 }
14946 | ASC
14947 {
14948 $$ = mm_strdup("asc");
14949 }
14950 | ASYMMETRIC
14951 {
14952 $$ = mm_strdup("asymmetric");
14953 }
14954 | BOTH
14955 {
14956 $$ = mm_strdup("both");
14957 }
14958 | CASE
14959 {
14960 $$ = mm_strdup("case");
14961 }
14962 | CAST
14963 {
14964 $$ = mm_strdup("cast");
14965 }
14966 | CHECK
14967 {
14968 $$ = mm_strdup("check");
14969 }
14970 | COLLATE
14971 {
14972 $$ = mm_strdup("collate");
14973 }
14974 | COLUMN
14975 {
14976 $$ = mm_strdup("column");
14977 }
14978 | CONSTRAINT
14979 {
14980 $$ = mm_strdup("constraint");
14981 }
14982 | CREATE
14983 {
14984 $$ = mm_strdup("create");
14985 }
14986 | CURRENT_CATALOG
14987 {
14988 $$ = mm_strdup("current_catalog");
14989 }
14990 | CURRENT_DATE
14991 {
14992 $$ = mm_strdup("current_date");
14993 }
14994 | CURRENT_ROLE
14995 {
14996 $$ = mm_strdup("current_role");
14997 }
14998 | CURRENT_TIME
14999 {
15000 $$ = mm_strdup("current_time");
15001 }
15002 | CURRENT_TIMESTAMP
15003 {
15004 $$ = mm_strdup("current_timestamp");
15005 }
15006 | CURRENT_USER
15007 {
15008 $$ = mm_strdup("current_user");
15009 }
15010 | DEFAULT
15011 {
15012 $$ = mm_strdup("default");
15013 }
15014 | DEFERRABLE
15015 {
15016 $$ = mm_strdup("deferrable");
15017 }
15018 | DESC
15019 {
15020 $$ = mm_strdup("desc");
15021 }
15022 | DISTINCT
15023 {
15024 $$ = mm_strdup("distinct");
15025 }
15026 | DO
15027 {
15028 $$ = mm_strdup("do");
15029 }
15030 | ELSE
15031 {
15032 $$ = mm_strdup("else");
15033 }
15034 | END_P
15035 {
15036 $$ = mm_strdup("end");
15037 }
15038 | EXCEPT
15039 {
15040 $$ = mm_strdup("except");
15041 }
15042 | FALSE_P
15043 {
15044 $$ = mm_strdup("false");
15045 }
15046 | FETCH
15047 {
15048 $$ = mm_strdup("fetch");
15049 }
15050 | FOR
15051 {
15052 $$ = mm_strdup("for");
15053 }
15054 | FOREIGN
15055 {
15056 $$ = mm_strdup("foreign");
15057 }
15058 | FROM
15059 {
15060 $$ = mm_strdup("from");
15061 }
15062 | GRANT
15063 {
15064 $$ = mm_strdup("grant");
15065 }
15066 | GROUP_P
15067 {
15068 $$ = mm_strdup("group");
15069 }
15070 | HAVING
15071 {
15072 $$ = mm_strdup("having");
15073 }
15074 | IN_P
15075 {
15076 $$ = mm_strdup("in");
15077 }
15078 | INITIALLY
15079 {
15080 $$ = mm_strdup("initially");
15081 }
15082 | INTERSECT
15083 {
15084 $$ = mm_strdup("intersect");
15085 }
15086 | INTO
15087 {
15088 $$ = mm_strdup("into");
15089 }
15090 | LATERAL_P
15091 {
15092 $$ = mm_strdup("lateral");
15093 }
15094 | LEADING
15095 {
15096 $$ = mm_strdup("leading");
15097 }
15098 | LIMIT
15099 {
15100 $$ = mm_strdup("limit");
15101 }
15102 | LOCALTIME
15103 {
15104 $$ = mm_strdup("localtime");
15105 }
15106 | LOCALTIMESTAMP
15107 {
15108 $$ = mm_strdup("localtimestamp");
15109 }
15110 | NOT
15111 {
15112 $$ = mm_strdup("not");
15113 }
15114 | NULL_P
15115 {
15116 $$ = mm_strdup("null");
15117 }
15118 | OFFSET
15119 {
15120 $$ = mm_strdup("offset");
15121 }
15122 | ON
15123 {
15124 $$ = mm_strdup("on");
15125 }
15126 | ONLY
15127 {
15128 $$ = mm_strdup("only");
15129 }
15130 | OR
15131 {
15132 $$ = mm_strdup("or");
15133 }
15134 | ORDER
15135 {
15136 $$ = mm_strdup("order");
15137 }
15138 | PLACING
15139 {
15140 $$ = mm_strdup("placing");
15141 }
15142 | PRIMARY
15143 {
15144 $$ = mm_strdup("primary");
15145 }
15146 | REFERENCES
15147 {
15148 $$ = mm_strdup("references");
15149 }
15150 | RETURNING
15151 {
15152 $$ = mm_strdup("returning");
15153 }
15154 | SELECT
15155 {
15156 $$ = mm_strdup("select");
15157 }
15158 | SESSION_USER
15159 {
15160 $$ = mm_strdup("session_user");
15161 }
15162 | SOME
15163 {
15164 $$ = mm_strdup("some");
15165 }
15166 | SYMMETRIC
15167 {
15168 $$ = mm_strdup("symmetric");
15169 }
15170 | TABLE
15171 {
15172 $$ = mm_strdup("table");
15173 }
15174 | THEN
15175 {
15176 $$ = mm_strdup("then");
15177 }
15178 | TRAILING
15179 {
15180 $$ = mm_strdup("trailing");
15181 }
15182 | TRUE_P
15183 {
15184 $$ = mm_strdup("true");
15185 }
15186 | UNIQUE
15187 {
15188 $$ = mm_strdup("unique");
15189 }
15190 | USER
15191 {
15192 $$ = mm_strdup("user");
15193 }
15194 | USING
15195 {
15196 $$ = mm_strdup("using");
15197 }
15198 | VARIADIC
15199 {
15200 $$ = mm_strdup("variadic");
15201 }
15202 | WHEN
15203 {
15204 $$ = mm_strdup("when");
15205 }
15206 | WHERE
15207 {
15208 $$ = mm_strdup("where");
15209 }
15210 | WINDOW
15211 {
15212 $$ = mm_strdup("window");
15213 }
15214 | WITH
15215 {
15216 $$ = mm_strdup("with");
15217 }
15218 ;
15219
15220
15221 bare_label_keyword:
15222 ABORT_P
15223 {
15224 $$ = mm_strdup("abort");
15225 }
15226 | ABSOLUTE_P
15227 {
15228 $$ = mm_strdup("absolute");
15229 }
15230 | ACCESS
15231 {
15232 $$ = mm_strdup("access");
15233 }
15234 | ACTION
15235 {
15236 $$ = mm_strdup("action");
15237 }
15238 | ADD_P
15239 {
15240 $$ = mm_strdup("add");
15241 }
15242 | ADMIN
15243 {
15244 $$ = mm_strdup("admin");
15245 }
15246 | AFTER
15247 {
15248 $$ = mm_strdup("after");
15249 }
15250 | AGGREGATE
15251 {
15252 $$ = mm_strdup("aggregate");
15253 }
15254 | ALL
15255 {
15256 $$ = mm_strdup("all");
15257 }
15258 | ALSO
15259 {
15260 $$ = mm_strdup("also");
15261 }
15262 | ALTER
15263 {
15264 $$ = mm_strdup("alter");
15265 }
15266 | ALWAYS
15267 {
15268 $$ = mm_strdup("always");
15269 }
15270 | ANALYSE
15271 {
15272 $$ = mm_strdup("analyse");
15273 }
15274 | ANALYZE
15275 {
15276 $$ = mm_strdup("analyze");
15277 }
15278 | AND
15279 {
15280 $$ = mm_strdup("and");
15281 }
15282 | ANY
15283 {
15284 $$ = mm_strdup("any");
15285 }
15286 | ASC
15287 {
15288 $$ = mm_strdup("asc");
15289 }
15290 | ASENSITIVE
15291 {
15292 $$ = mm_strdup("asensitive");
15293 }
15294 | ASSERTION
15295 {
15296 $$ = mm_strdup("assertion");
15297 }
15298 | ASSIGNMENT
15299 {
15300 $$ = mm_strdup("assignment");
15301 }
15302 | ASYMMETRIC
15303 {
15304 $$ = mm_strdup("asymmetric");
15305 }
15306 | AT
15307 {
15308 $$ = mm_strdup("at");
15309 }
15310 | ATOMIC
15311 {
15312 $$ = mm_strdup("atomic");
15313 }
15314 | ATTACH
15315 {
15316 $$ = mm_strdup("attach");
15317 }
15318 | ATTRIBUTE
15319 {
15320 $$ = mm_strdup("attribute");
15321 }
15322 | AUTHORIZATION
15323 {
15324 $$ = mm_strdup("authorization");
15325 }
15326 | BACKWARD
15327 {
15328 $$ = mm_strdup("backward");
15329 }
15330 | BEFORE
15331 {
15332 $$ = mm_strdup("before");
15333 }
15334 | BEGIN_P
15335 {
15336 $$ = mm_strdup("begin");
15337 }
15338 | BETWEEN
15339 {
15340 $$ = mm_strdup("between");
15341 }
15342 | BIGINT
15343 {
15344 $$ = mm_strdup("bigint");
15345 }
15346 | BINARY
15347 {
15348 $$ = mm_strdup("binary");
15349 }
15350 | BIT
15351 {
15352 $$ = mm_strdup("bit");
15353 }
15354 | BOOLEAN_P
15355 {
15356 $$ = mm_strdup("boolean");
15357 }
15358 | BOTH
15359 {
15360 $$ = mm_strdup("both");
15361 }
15362 | BREADTH
15363 {
15364 $$ = mm_strdup("breadth");
15365 }
15366 | BY
15367 {
15368 $$ = mm_strdup("by");
15369 }
15370 | CACHE
15371 {
15372 $$ = mm_strdup("cache");
15373 }
15374 | CALL
15375 {
15376 $$ = mm_strdup("call");
15377 }
15378 | CALLED
15379 {
15380 $$ = mm_strdup("called");
15381 }
15382 | CASCADE
15383 {
15384 $$ = mm_strdup("cascade");
15385 }
15386 | CASCADED
15387 {
15388 $$ = mm_strdup("cascaded");
15389 }
15390 | CASE
15391 {
15392 $$ = mm_strdup("case");
15393 }
15394 | CAST
15395 {
15396 $$ = mm_strdup("cast");
15397 }
15398 | CATALOG_P
15399 {
15400 $$ = mm_strdup("catalog");
15401 }
15402 | CHAIN
15403 {
15404 $$ = mm_strdup("chain");
15405 }
15406 | CHARACTERISTICS
15407 {
15408 $$ = mm_strdup("characteristics");
15409 }
15410 | CHECK
15411 {
15412 $$ = mm_strdup("check");
15413 }
15414 | CHECKPOINT
15415 {
15416 $$ = mm_strdup("checkpoint");
15417 }
15418 | CLASS
15419 {
15420 $$ = mm_strdup("class");
15421 }
15422 | CLOSE
15423 {
15424 $$ = mm_strdup("close");
15425 }
15426 | CLUSTER
15427 {
15428 $$ = mm_strdup("cluster");
15429 }
15430 | COALESCE
15431 {
15432 $$ = mm_strdup("coalesce");
15433 }
15434 | COLLATE
15435 {
15436 $$ = mm_strdup("collate");
15437 }
15438 | COLLATION
15439 {
15440 $$ = mm_strdup("collation");
15441 }
15442 | COLUMN
15443 {
15444 $$ = mm_strdup("column");
15445 }
15446 | COLUMNS
15447 {
15448 $$ = mm_strdup("columns");
15449 }
15450 | COMMENT
15451 {
15452 $$ = mm_strdup("comment");
15453 }
15454 | COMMENTS
15455 {
15456 $$ = mm_strdup("comments");
15457 }
15458 | COMMIT
15459 {
15460 $$ = mm_strdup("commit");
15461 }
15462 | COMMITTED
15463 {
15464 $$ = mm_strdup("committed");
15465 }
15466 | COMPRESSION
15467 {
15468 $$ = mm_strdup("compression");
15469 }
15470 | CONCURRENTLY
15471 {
15472 $$ = mm_strdup("concurrently");
15473 }
15474 | CONFIGURATION
15475 {
15476 $$ = mm_strdup("configuration");
15477 }
15478 | CONFLICT
15479 {
15480 $$ = mm_strdup("conflict");
15481 }
15482 | CONNECTION
15483 {
15484 $$ = mm_strdup("connection");
15485 }
15486 | CONSTRAINT
15487 {
15488 $$ = mm_strdup("constraint");
15489 }
15490 | CONSTRAINTS
15491 {
15492 $$ = mm_strdup("constraints");
15493 }
15494 | CONTENT_P
15495 {
15496 $$ = mm_strdup("content");
15497 }
15498 | CONTINUE_P
15499 {
15500 $$ = mm_strdup("continue");
15501 }
15502 | CONVERSION_P
15503 {
15504 $$ = mm_strdup("conversion");
15505 }
15506 | COPY
15507 {
15508 $$ = mm_strdup("copy");
15509 }
15510 | COST
15511 {
15512 $$ = mm_strdup("cost");
15513 }
15514 | CROSS
15515 {
15516 $$ = mm_strdup("cross");
15517 }
15518 | CSV
15519 {
15520 $$ = mm_strdup("csv");
15521 }
15522 | CUBE
15523 {
15524 $$ = mm_strdup("cube");
15525 }
15526 | CURRENT_P
15527 {
15528 $$ = mm_strdup("current");
15529 }
15530 | CURRENT_CATALOG
15531 {
15532 $$ = mm_strdup("current_catalog");
15533 }
15534 | CURRENT_DATE
15535 {
15536 $$ = mm_strdup("current_date");
15537 }
15538 | CURRENT_ROLE
15539 {
15540 $$ = mm_strdup("current_role");
15541 }
15542 | CURRENT_SCHEMA
15543 {
15544 $$ = mm_strdup("current_schema");
15545 }
15546 | CURRENT_TIME
15547 {
15548 $$ = mm_strdup("current_time");
15549 }
15550 | CURRENT_TIMESTAMP
15551 {
15552 $$ = mm_strdup("current_timestamp");
15553 }
15554 | CURRENT_USER
15555 {
15556 $$ = mm_strdup("current_user");
15557 }
15558 | CURSOR
15559 {
15560 $$ = mm_strdup("cursor");
15561 }
15562 | CYCLE
15563 {
15564 $$ = mm_strdup("cycle");
15565 }
15566 | DATA_P
15567 {
15568 $$ = mm_strdup("data");
15569 }
15570 | DATABASE
15571 {
15572 $$ = mm_strdup("database");
15573 }
15574 | DEALLOCATE
15575 {
15576 $$ = mm_strdup("deallocate");
15577 }
15578 | DEC
15579 {
15580 $$ = mm_strdup("dec");
15581 }
15582 | DECIMAL_P
15583 {
15584 $$ = mm_strdup("decimal");
15585 }
15586 | DECLARE
15587 {
15588 $$ = mm_strdup("declare");
15589 }
15590 | DEFAULT
15591 {
15592 $$ = mm_strdup("default");
15593 }
15594 | DEFAULTS
15595 {
15596 $$ = mm_strdup("defaults");
15597 }
15598 | DEFERRABLE
15599 {
15600 $$ = mm_strdup("deferrable");
15601 }
15602 | DEFERRED
15603 {
15604 $$ = mm_strdup("deferred");
15605 }
15606 | DEFINER
15607 {
15608 $$ = mm_strdup("definer");
15609 }
15610 | DELETE_P
15611 {
15612 $$ = mm_strdup("delete");
15613 }
15614 | DELIMITER
15615 {
15616 $$ = mm_strdup("delimiter");
15617 }
15618 | DELIMITERS
15619 {
15620 $$ = mm_strdup("delimiters");
15621 }
15622 | DEPENDS
15623 {
15624 $$ = mm_strdup("depends");
15625 }
15626 | DEPTH
15627 {
15628 $$ = mm_strdup("depth");
15629 }
15630 | DESC
15631 {
15632 $$ = mm_strdup("desc");
15633 }
15634 | DETACH
15635 {
15636 $$ = mm_strdup("detach");
15637 }
15638 | DICTIONARY
15639 {
15640 $$ = mm_strdup("dictionary");
15641 }
15642 | DISABLE_P
15643 {
15644 $$ = mm_strdup("disable");
15645 }
15646 | DISCARD
15647 {
15648 $$ = mm_strdup("discard");
15649 }
15650 | DISTINCT
15651 {
15652 $$ = mm_strdup("distinct");
15653 }
15654 | DO
15655 {
15656 $$ = mm_strdup("do");
15657 }
15658 | DOCUMENT_P
15659 {
15660 $$ = mm_strdup("document");
15661 }
15662 | DOMAIN_P
15663 {
15664 $$ = mm_strdup("domain");
15665 }
15666 | DOUBLE_P
15667 {
15668 $$ = mm_strdup("double");
15669 }
15670 | DROP
15671 {
15672 $$ = mm_strdup("drop");
15673 }
15674 | EACH
15675 {
15676 $$ = mm_strdup("each");
15677 }
15678 | ELSE
15679 {
15680 $$ = mm_strdup("else");
15681 }
15682 | ENABLE_P
15683 {
15684 $$ = mm_strdup("enable");
15685 }
15686 | ENCODING
15687 {
15688 $$ = mm_strdup("encoding");
15689 }
15690 | ENCRYPTED
15691 {
15692 $$ = mm_strdup("encrypted");
15693 }
15694 | END_P
15695 {
15696 $$ = mm_strdup("end");
15697 }
15698 | ENUM_P
15699 {
15700 $$ = mm_strdup("enum");
15701 }
15702 | ESCAPE
15703 {
15704 $$ = mm_strdup("escape");
15705 }
15706 | EVENT
15707 {
15708 $$ = mm_strdup("event");
15709 }
15710 | EXCLUDE
15711 {
15712 $$ = mm_strdup("exclude");
15713 }
15714 | EXCLUDING
15715 {
15716 $$ = mm_strdup("excluding");
15717 }
15718 | EXCLUSIVE
15719 {
15720 $$ = mm_strdup("exclusive");
15721 }
15722 | EXECUTE
15723 {
15724 $$ = mm_strdup("execute");
15725 }
15726 | EXISTS
15727 {
15728 $$ = mm_strdup("exists");
15729 }
15730 | EXPLAIN
15731 {
15732 $$ = mm_strdup("explain");
15733 }
15734 | EXPRESSION
15735 {
15736 $$ = mm_strdup("expression");
15737 }
15738 | EXTENSION
15739 {
15740 $$ = mm_strdup("extension");
15741 }
15742 | EXTERNAL
15743 {
15744 $$ = mm_strdup("external");
15745 }
15746 | EXTRACT
15747 {
15748 $$ = mm_strdup("extract");
15749 }
15750 | FALSE_P
15751 {
15752 $$ = mm_strdup("false");
15753 }
15754 | FAMILY
15755 {
15756 $$ = mm_strdup("family");
15757 }
15758 | FINALIZE
15759 {
15760 $$ = mm_strdup("finalize");
15761 }
15762 | FIRST_P
15763 {
15764 $$ = mm_strdup("first");
15765 }
15766 | FLOAT_P
15767 {
15768 $$ = mm_strdup("float");
15769 }
15770 | FOLLOWING
15771 {
15772 $$ = mm_strdup("following");
15773 }
15774 | FORCE
15775 {
15776 $$ = mm_strdup("force");
15777 }
15778 | FOREIGN
15779 {
15780 $$ = mm_strdup("foreign");
15781 }
15782 | FORWARD
15783 {
15784 $$ = mm_strdup("forward");
15785 }
15786 | FREEZE
15787 {
15788 $$ = mm_strdup("freeze");
15789 }
15790 | FULL
15791 {
15792 $$ = mm_strdup("full");
15793 }
15794 | FUNCTION
15795 {
15796 $$ = mm_strdup("function");
15797 }
15798 | FUNCTIONS
15799 {
15800 $$ = mm_strdup("functions");
15801 }
15802 | GENERATED
15803 {
15804 $$ = mm_strdup("generated");
15805 }
15806 | GLOBAL
15807 {
15808 $$ = mm_strdup("global");
15809 }
15810 | GRANTED
15811 {
15812 $$ = mm_strdup("granted");
15813 }
15814 | GREATEST
15815 {
15816 $$ = mm_strdup("greatest");
15817 }
15818 | GROUPING
15819 {
15820 $$ = mm_strdup("grouping");
15821 }
15822 | GROUPS
15823 {
15824 $$ = mm_strdup("groups");
15825 }
15826 | HANDLER
15827 {
15828 $$ = mm_strdup("handler");
15829 }
15830 | HEADER_P
15831 {
15832 $$ = mm_strdup("header");
15833 }
15834 | HOLD
15835 {
15836 $$ = mm_strdup("hold");
15837 }
15838 | IDENTITY_P
15839 {
15840 $$ = mm_strdup("identity");
15841 }
15842 | IF_P
15843 {
15844 $$ = mm_strdup("if");
15845 }
15846 | ILIKE
15847 {
15848 $$ = mm_strdup("ilike");
15849 }
15850 | IMMEDIATE
15851 {
15852 $$ = mm_strdup("immediate");
15853 }
15854 | IMMUTABLE
15855 {
15856 $$ = mm_strdup("immutable");
15857 }
15858 | IMPLICIT_P
15859 {
15860 $$ = mm_strdup("implicit");
15861 }
15862 | IMPORT_P
15863 {
15864 $$ = mm_strdup("import");
15865 }
15866 | IN_P
15867 {
15868 $$ = mm_strdup("in");
15869 }
15870 | INCLUDE
15871 {
15872 $$ = mm_strdup("include");
15873 }
15874 | INCLUDING
15875 {
15876 $$ = mm_strdup("including");
15877 }
15878 | INCREMENT
15879 {
15880 $$ = mm_strdup("increment");
15881 }
15882 | INDEX
15883 {
15884 $$ = mm_strdup("index");
15885 }
15886 | INDEXES
15887 {
15888 $$ = mm_strdup("indexes");
15889 }
15890 | INHERIT
15891 {
15892 $$ = mm_strdup("inherit");
15893 }
15894 | INHERITS
15895 {
15896 $$ = mm_strdup("inherits");
15897 }
15898 | INITIALLY
15899 {
15900 $$ = mm_strdup("initially");
15901 }
15902 | INLINE_P
15903 {
15904 $$ = mm_strdup("inline");
15905 }
15906 | INNER_P
15907 {
15908 $$ = mm_strdup("inner");
15909 }
15910 | INOUT
15911 {
15912 $$ = mm_strdup("inout");
15913 }
15914 | INPUT_P
15915 {
15916 $$ = mm_strdup("input");
15917 }
15918 | INSENSITIVE
15919 {
15920 $$ = mm_strdup("insensitive");
15921 }
15922 | INSERT
15923 {
15924 $$ = mm_strdup("insert");
15925 }
15926 | INSTEAD
15927 {
15928 $$ = mm_strdup("instead");
15929 }
15930 | INT_P
15931 {
15932 $$ = mm_strdup("int");
15933 }
15934 | INTEGER
15935 {
15936 $$ = mm_strdup("integer");
15937 }
15938 | INTERVAL
15939 {
15940 $$ = mm_strdup("interval");
15941 }
15942 | INVOKER
15943 {
15944 $$ = mm_strdup("invoker");
15945 }
15946 | IS
15947 {
15948 $$ = mm_strdup("is");
15949 }
15950 | ISOLATION
15951 {
15952 $$ = mm_strdup("isolation");
15953 }
15954 | JOIN
15955 {
15956 $$ = mm_strdup("join");
15957 }
15958 | KEY
15959 {
15960 $$ = mm_strdup("key");
15961 }
15962 | LABEL
15963 {
15964 $$ = mm_strdup("label");
15965 }
15966 | LANGUAGE
15967 {
15968 $$ = mm_strdup("language");
15969 }
15970 | LARGE_P
15971 {
15972 $$ = mm_strdup("large");
15973 }
15974 | LAST_P
15975 {
15976 $$ = mm_strdup("last");
15977 }
15978 | LATERAL_P
15979 {
15980 $$ = mm_strdup("lateral");
15981 }
15982 | LEADING
15983 {
15984 $$ = mm_strdup("leading");
15985 }
15986 | LEAKPROOF
15987 {
15988 $$ = mm_strdup("leakproof");
15989 }
15990 | LEAST
15991 {
15992 $$ = mm_strdup("least");
15993 }
15994 | LEFT
15995 {
15996 $$ = mm_strdup("left");
15997 }
15998 | LEVEL
15999 {
16000 $$ = mm_strdup("level");
16001 }
16002 | LIKE
16003 {
16004 $$ = mm_strdup("like");
16005 }
16006 | LISTEN
16007 {
16008 $$ = mm_strdup("listen");
16009 }
16010 | LOAD
16011 {
16012 $$ = mm_strdup("load");
16013 }
16014 | LOCAL
16015 {
16016 $$ = mm_strdup("local");
16017 }
16018 | LOCALTIME
16019 {
16020 $$ = mm_strdup("localtime");
16021 }
16022 | LOCALTIMESTAMP
16023 {
16024 $$ = mm_strdup("localtimestamp");
16025 }
16026 | LOCATION
16027 {
16028 $$ = mm_strdup("location");
16029 }
16030 | LOCK_P
16031 {
16032 $$ = mm_strdup("lock");
16033 }
16034 | LOCKED
16035 {
16036 $$ = mm_strdup("locked");
16037 }
16038 | LOGGED
16039 {
16040 $$ = mm_strdup("logged");
16041 }
16042 | MAPPING
16043 {
16044 $$ = mm_strdup("mapping");
16045 }
16046 | MATCH
16047 {
16048 $$ = mm_strdup("match");
16049 }
16050 | MATERIALIZED
16051 {
16052 $$ = mm_strdup("materialized");
16053 }
16054 | MAXVALUE
16055 {
16056 $$ = mm_strdup("maxvalue");
16057 }
16058 | METHOD
16059 {
16060 $$ = mm_strdup("method");
16061 }
16062 | MINVALUE
16063 {
16064 $$ = mm_strdup("minvalue");
16065 }
16066 | MODE
16067 {
16068 $$ = mm_strdup("mode");
16069 }
16070 | MOVE
16071 {
16072 $$ = mm_strdup("move");
16073 }
16074 | NAME_P
16075 {
16076 $$ = mm_strdup("name");
16077 }
16078 | NAMES
16079 {
16080 $$ = mm_strdup("names");
16081 }
16082 | NATIONAL
16083 {
16084 $$ = mm_strdup("national");
16085 }
16086 | NATURAL
16087 {
16088 $$ = mm_strdup("natural");
16089 }
16090 | NCHAR
16091 {
16092 $$ = mm_strdup("nchar");
16093 }
16094 | NEW
16095 {
16096 $$ = mm_strdup("new");
16097 }
16098 | NEXT
16099 {
16100 $$ = mm_strdup("next");
16101 }
16102 | NFC
16103 {
16104 $$ = mm_strdup("nfc");
16105 }
16106 | NFD
16107 {
16108 $$ = mm_strdup("nfd");
16109 }
16110 | NFKC
16111 {
16112 $$ = mm_strdup("nfkc");
16113 }
16114 | NFKD
16115 {
16116 $$ = mm_strdup("nfkd");
16117 }
16118 | NO
16119 {
16120 $$ = mm_strdup("no");
16121 }
16122 | NONE
16123 {
16124 $$ = mm_strdup("none");
16125 }
16126 | NORMALIZE
16127 {
16128 $$ = mm_strdup("normalize");
16129 }
16130 | NORMALIZED
16131 {
16132 $$ = mm_strdup("normalized");
16133 }
16134 | NOT
16135 {
16136 $$ = mm_strdup("not");
16137 }
16138 | NOTHING
16139 {
16140 $$ = mm_strdup("nothing");
16141 }
16142 | NOTIFY
16143 {
16144 $$ = mm_strdup("notify");
16145 }
16146 | NOWAIT
16147 {
16148 $$ = mm_strdup("nowait");
16149 }
16150 | NULL_P
16151 {
16152 $$ = mm_strdup("null");
16153 }
16154 | NULLIF
16155 {
16156 $$ = mm_strdup("nullif");
16157 }
16158 | NULLS_P
16159 {
16160 $$ = mm_strdup("nulls");
16161 }
16162 | NUMERIC
16163 {
16164 $$ = mm_strdup("numeric");
16165 }
16166 | OBJECT_P
16167 {
16168 $$ = mm_strdup("object");
16169 }
16170 | OF
16171 {
16172 $$ = mm_strdup("of");
16173 }
16174 | OFF
16175 {
16176 $$ = mm_strdup("off");
16177 }
16178 | OIDS
16179 {
16180 $$ = mm_strdup("oids");
16181 }
16182 | OLD
16183 {
16184 $$ = mm_strdup("old");
16185 }
16186 | ONLY
16187 {
16188 $$ = mm_strdup("only");
16189 }
16190 | OPERATOR
16191 {
16192 $$ = mm_strdup("operator");
16193 }
16194 | OPTION
16195 {
16196 $$ = mm_strdup("option");
16197 }
16198 | OPTIONS
16199 {
16200 $$ = mm_strdup("options");
16201 }
16202 | OR
16203 {
16204 $$ = mm_strdup("or");
16205 }
16206 | ORDINALITY
16207 {
16208 $$ = mm_strdup("ordinality");
16209 }
16210 | OTHERS
16211 {
16212 $$ = mm_strdup("others");
16213 }
16214 | OUT_P
16215 {
16216 $$ = mm_strdup("out");
16217 }
16218 | OUTER_P
16219 {
16220 $$ = mm_strdup("outer");
16221 }
16222 | OVERLAY
16223 {
16224 $$ = mm_strdup("overlay");
16225 }
16226 | OVERRIDING
16227 {
16228 $$ = mm_strdup("overriding");
16229 }
16230 | OWNED
16231 {
16232 $$ = mm_strdup("owned");
16233 }
16234 | OWNER
16235 {
16236 $$ = mm_strdup("owner");
16237 }
16238 | PARALLEL
16239 {
16240 $$ = mm_strdup("parallel");
16241 }
16242 | PARSER
16243 {
16244 $$ = mm_strdup("parser");
16245 }
16246 | PARTIAL
16247 {
16248 $$ = mm_strdup("partial");
16249 }
16250 | PARTITION
16251 {
16252 $$ = mm_strdup("partition");
16253 }
16254 | PASSING
16255 {
16256 $$ = mm_strdup("passing");
16257 }
16258 | PASSWORD
16259 {
16260 $$ = mm_strdup("password");
16261 }
16262 | PLACING
16263 {
16264 $$ = mm_strdup("placing");
16265 }
16266 | PLANS
16267 {
16268 $$ = mm_strdup("plans");
16269 }
16270 | POLICY
16271 {
16272 $$ = mm_strdup("policy");
16273 }
16274 | POSITION
16275 {
16276 $$ = mm_strdup("position");
16277 }
16278 | PRECEDING
16279 {
16280 $$ = mm_strdup("preceding");
16281 }
16282 | PREPARE
16283 {
16284 $$ = mm_strdup("prepare");
16285 }
16286 | PREPARED
16287 {
16288 $$ = mm_strdup("prepared");
16289 }
16290 | PRESERVE
16291 {
16292 $$ = mm_strdup("preserve");
16293 }
16294 | PRIMARY
16295 {
16296 $$ = mm_strdup("primary");
16297 }
16298 | PRIOR
16299 {
16300 $$ = mm_strdup("prior");
16301 }
16302 | PRIVILEGES
16303 {
16304 $$ = mm_strdup("privileges");
16305 }
16306 | PROCEDURAL
16307 {
16308 $$ = mm_strdup("procedural");
16309 }
16310 | PROCEDURE
16311 {
16312 $$ = mm_strdup("procedure");
16313 }
16314 | PROCEDURES
16315 {
16316 $$ = mm_strdup("procedures");
16317 }
16318 | PROGRAM
16319 {
16320 $$ = mm_strdup("program");
16321 }
16322 | PUBLICATION
16323 {
16324 $$ = mm_strdup("publication");
16325 }
16326 | QUOTE
16327 {
16328 $$ = mm_strdup("quote");
16329 }
16330 | RANGE
16331 {
16332 $$ = mm_strdup("range");
16333 }
16334 | READ
16335 {
16336 $$ = mm_strdup("read");
16337 }
16338 | REAL
16339 {
16340 $$ = mm_strdup("real");
16341 }
16342 | REASSIGN
16343 {
16344 $$ = mm_strdup("reassign");
16345 }
16346 | RECHECK
16347 {
16348 $$ = mm_strdup("recheck");
16349 }
16350 | RECURSIVE
16351 {
16352 $$ = mm_strdup("recursive");
16353 }
16354 | REF
16355 {
16356 $$ = mm_strdup("ref");
16357 }
16358 | REFERENCES
16359 {
16360 $$ = mm_strdup("references");
16361 }
16362 | REFERENCING
16363 {
16364 $$ = mm_strdup("referencing");
16365 }
16366 | REFRESH
16367 {
16368 $$ = mm_strdup("refresh");
16369 }
16370 | REINDEX
16371 {
16372 $$ = mm_strdup("reindex");
16373 }
16374 | RELATIVE_P
16375 {
16376 $$ = mm_strdup("relative");
16377 }
16378 | RELEASE
16379 {
16380 $$ = mm_strdup("release");
16381 }
16382 | RENAME
16383 {
16384 $$ = mm_strdup("rename");
16385 }
16386 | REPEATABLE
16387 {
16388 $$ = mm_strdup("repeatable");
16389 }
16390 | REPLACE
16391 {
16392 $$ = mm_strdup("replace");
16393 }
16394 | REPLICA
16395 {
16396 $$ = mm_strdup("replica");
16397 }
16398 | RESET
16399 {
16400 $$ = mm_strdup("reset");
16401 }
16402 | RESTART
16403 {
16404 $$ = mm_strdup("restart");
16405 }
16406 | RESTRICT
16407 {
16408 $$ = mm_strdup("restrict");
16409 }
16410 | RETURN
16411 {
16412 $$ = mm_strdup("return");
16413 }
16414 | RETURNS
16415 {
16416 $$ = mm_strdup("returns");
16417 }
16418 | REVOKE
16419 {
16420 $$ = mm_strdup("revoke");
16421 }
16422 | RIGHT
16423 {
16424 $$ = mm_strdup("right");
16425 }
16426 | ROLE
16427 {
16428 $$ = mm_strdup("role");
16429 }
16430 | ROLLBACK
16431 {
16432 $$ = mm_strdup("rollback");
16433 }
16434 | ROLLUP
16435 {
16436 $$ = mm_strdup("rollup");
16437 }
16438 | ROUTINE
16439 {
16440 $$ = mm_strdup("routine");
16441 }
16442 | ROUTINES
16443 {
16444 $$ = mm_strdup("routines");
16445 }
16446 | ROW
16447 {
16448 $$ = mm_strdup("row");
16449 }
16450 | ROWS
16451 {
16452 $$ = mm_strdup("rows");
16453 }
16454 | RULE
16455 {
16456 $$ = mm_strdup("rule");
16457 }
16458 | SAVEPOINT
16459 {
16460 $$ = mm_strdup("savepoint");
16461 }
16462 | SCHEMA
16463 {
16464 $$ = mm_strdup("schema");
16465 }
16466 | SCHEMAS
16467 {
16468 $$ = mm_strdup("schemas");
16469 }
16470 | SCROLL
16471 {
16472 $$ = mm_strdup("scroll");
16473 }
16474 | SEARCH
16475 {
16476 $$ = mm_strdup("search");
16477 }
16478 | SECURITY
16479 {
16480 $$ = mm_strdup("security");
16481 }
16482 | SELECT
16483 {
16484 $$ = mm_strdup("select");
16485 }
16486 | SEQUENCE
16487 {
16488 $$ = mm_strdup("sequence");
16489 }
16490 | SEQUENCES
16491 {
16492 $$ = mm_strdup("sequences");
16493 }
16494 | SERIALIZABLE
16495 {
16496 $$ = mm_strdup("serializable");
16497 }
16498 | SERVER
16499 {
16500 $$ = mm_strdup("server");
16501 }
16502 | SESSION
16503 {
16504 $$ = mm_strdup("session");
16505 }
16506 | SESSION_USER
16507 {
16508 $$ = mm_strdup("session_user");
16509 }
16510 | SET
16511 {
16512 $$ = mm_strdup("set");
16513 }
16514 | SETOF
16515 {
16516 $$ = mm_strdup("setof");
16517 }
16518 | SETS
16519 {
16520 $$ = mm_strdup("sets");
16521 }
16522 | SHARE
16523 {
16524 $$ = mm_strdup("share");
16525 }
16526 | SHOW
16527 {
16528 $$ = mm_strdup("show");
16529 }
16530 | SIMILAR
16531 {
16532 $$ = mm_strdup("similar");
16533 }
16534 | SIMPLE
16535 {
16536 $$ = mm_strdup("simple");
16537 }
16538 | SKIP
16539 {
16540 $$ = mm_strdup("skip");
16541 }
16542 | SMALLINT
16543 {
16544 $$ = mm_strdup("smallint");
16545 }
16546 | SNAPSHOT
16547 {
16548 $$ = mm_strdup("snapshot");
16549 }
16550 | SOME
16551 {
16552 $$ = mm_strdup("some");
16553 }
16554 | SQL_P
16555 {
16556 $$ = mm_strdup("sql");
16557 }
16558 | STABLE
16559 {
16560 $$ = mm_strdup("stable");
16561 }
16562 | STANDALONE_P
16563 {
16564 $$ = mm_strdup("standalone");
16565 }
16566 | START
16567 {
16568 $$ = mm_strdup("start");
16569 }
16570 | STATEMENT
16571 {
16572 $$ = mm_strdup("statement");
16573 }
16574 | STATISTICS
16575 {
16576 $$ = mm_strdup("statistics");
16577 }
16578 | STDIN
16579 {
16580 $$ = mm_strdup("stdin");
16581 }
16582 | STDOUT
16583 {
16584 $$ = mm_strdup("stdout");
16585 }
16586 | STORAGE
16587 {
16588 $$ = mm_strdup("storage");
16589 }
16590 | STORED
16591 {
16592 $$ = mm_strdup("stored");
16593 }
16594 | STRICT_P
16595 {
16596 $$ = mm_strdup("strict");
16597 }
16598 | STRIP_P
16599 {
16600 $$ = mm_strdup("strip");
16601 }
16602 | SUBSCRIPTION
16603 {
16604 $$ = mm_strdup("subscription");
16605 }
16606 | SUBSTRING
16607 {
16608 $$ = mm_strdup("substring");
16609 }
16610 | SUPPORT
16611 {
16612 $$ = mm_strdup("support");
16613 }
16614 | SYMMETRIC
16615 {
16616 $$ = mm_strdup("symmetric");
16617 }
16618 | SYSID
16619 {
16620 $$ = mm_strdup("sysid");
16621 }
16622 | SYSTEM_P
16623 {
16624 $$ = mm_strdup("system");
16625 }
16626 | TABLE
16627 {
16628 $$ = mm_strdup("table");
16629 }
16630 | TABLES
16631 {
16632 $$ = mm_strdup("tables");
16633 }
16634 | TABLESAMPLE
16635 {
16636 $$ = mm_strdup("tablesample");
16637 }
16638 | TABLESPACE
16639 {
16640 $$ = mm_strdup("tablespace");
16641 }
16642 | TEMP
16643 {
16644 $$ = mm_strdup("temp");
16645 }
16646 | TEMPLATE
16647 {
16648 $$ = mm_strdup("template");
16649 }
16650 | TEMPORARY
16651 {
16652 $$ = mm_strdup("temporary");
16653 }
16654 | TEXT_P
16655 {
16656 $$ = mm_strdup("text");
16657 }
16658 | THEN
16659 {
16660 $$ = mm_strdup("then");
16661 }
16662 | TIES
16663 {
16664 $$ = mm_strdup("ties");
16665 }
16666 | TIME
16667 {
16668 $$ = mm_strdup("time");
16669 }
16670 | TIMESTAMP
16671 {
16672 $$ = mm_strdup("timestamp");
16673 }
16674 | TRAILING
16675 {
16676 $$ = mm_strdup("trailing");
16677 }
16678 | TRANSACTION
16679 {
16680 $$ = mm_strdup("transaction");
16681 }
16682 | TRANSFORM
16683 {
16684 $$ = mm_strdup("transform");
16685 }
16686 | TREAT
16687 {
16688 $$ = mm_strdup("treat");
16689 }
16690 | TRIGGER
16691 {
16692 $$ = mm_strdup("trigger");
16693 }
16694 | TRIM
16695 {
16696 $$ = mm_strdup("trim");
16697 }
16698 | TRUE_P
16699 {
16700 $$ = mm_strdup("true");
16701 }
16702 | TRUNCATE
16703 {
16704 $$ = mm_strdup("truncate");
16705 }
16706 | TRUSTED
16707 {
16708 $$ = mm_strdup("trusted");
16709 }
16710 | TYPE_P
16711 {
16712 $$ = mm_strdup("type");
16713 }
16714 | TYPES_P
16715 {
16716 $$ = mm_strdup("types");
16717 }
16718 | UESCAPE
16719 {
16720 $$ = mm_strdup("uescape");
16721 }
16722 | UNBOUNDED
16723 {
16724 $$ = mm_strdup("unbounded");
16725 }
16726 | UNCOMMITTED
16727 {
16728 $$ = mm_strdup("uncommitted");
16729 }
16730 | UNENCRYPTED
16731 {
16732 $$ = mm_strdup("unencrypted");
16733 }
16734 | UNIQUE
16735 {
16736 $$ = mm_strdup("unique");
16737 }
16738 | UNKNOWN
16739 {
16740 $$ = mm_strdup("unknown");
16741 }
16742 | UNLISTEN
16743 {
16744 $$ = mm_strdup("unlisten");
16745 }
16746 | UNLOGGED
16747 {
16748 $$ = mm_strdup("unlogged");
16749 }
16750 | UNTIL
16751 {
16752 $$ = mm_strdup("until");
16753 }
16754 | UPDATE
16755 {
16756 $$ = mm_strdup("update");
16757 }
16758 | USER
16759 {
16760 $$ = mm_strdup("user");
16761 }
16762 | USING
16763 {
16764 $$ = mm_strdup("using");
16765 }
16766 | VACUUM
16767 {
16768 $$ = mm_strdup("vacuum");
16769 }
16770 | VALID
16771 {
16772 $$ = mm_strdup("valid");
16773 }
16774 | VALIDATE
16775 {
16776 $$ = mm_strdup("validate");
16777 }
16778 | VALIDATOR
16779 {
16780 $$ = mm_strdup("validator");
16781 }
16782 | VALUE_P
16783 {
16784 $$ = mm_strdup("value");
16785 }
16786 | VALUES
16787 {
16788 $$ = mm_strdup("values");
16789 }
16790 | VARCHAR
16791 {
16792 $$ = mm_strdup("varchar");
16793 }
16794 | VARIADIC
16795 {
16796 $$ = mm_strdup("variadic");
16797 }
16798 | VERBOSE
16799 {
16800 $$ = mm_strdup("verbose");
16801 }
16802 | VERSION_P
16803 {
16804 $$ = mm_strdup("version");
16805 }
16806 | VIEW
16807 {
16808 $$ = mm_strdup("view");
16809 }
16810 | VIEWS
16811 {
16812 $$ = mm_strdup("views");
16813 }
16814 | VOLATILE
16815 {
16816 $$ = mm_strdup("volatile");
16817 }
16818 | WHEN
16819 {
16820 $$ = mm_strdup("when");
16821 }
16822 | WHITESPACE_P
16823 {
16824 $$ = mm_strdup("whitespace");
16825 }
16826 | WORK
16827 {
16828 $$ = mm_strdup("work");
16829 }
16830 | WRAPPER
16831 {
16832 $$ = mm_strdup("wrapper");
16833 }
16834 | WRITE
16835 {
16836 $$ = mm_strdup("write");
16837 }
16838 | XML_P
16839 {
16840 $$ = mm_strdup("xml");
16841 }
16842 | XMLATTRIBUTES
16843 {
16844 $$ = mm_strdup("xmlattributes");
16845 }
16846 | XMLCONCAT
16847 {
16848 $$ = mm_strdup("xmlconcat");
16849 }
16850 | XMLELEMENT
16851 {
16852 $$ = mm_strdup("xmlelement");
16853 }
16854 | XMLEXISTS
16855 {
16856 $$ = mm_strdup("xmlexists");
16857 }
16858 | XMLFOREST
16859 {
16860 $$ = mm_strdup("xmlforest");
16861 }
16862 | XMLNAMESPACES
16863 {
16864 $$ = mm_strdup("xmlnamespaces");
16865 }
16866 | XMLPARSE
16867 {
16868 $$ = mm_strdup("xmlparse");
16869 }
16870 | XMLPI
16871 {
16872 $$ = mm_strdup("xmlpi");
16873 }
16874 | XMLROOT
16875 {
16876 $$ = mm_strdup("xmlroot");
16877 }
16878 | XMLSERIALIZE
16879 {
16880 $$ = mm_strdup("xmlserialize");
16881 }
16882 | XMLTABLE
16883 {
16884 $$ = mm_strdup("xmltable");
16885 }
16886 | YES_P
16887 {
16888 $$ = mm_strdup("yes");
16889 }
16890 | ZONE
16891 {
16892 $$ = mm_strdup("zone");
16893 }
16894 ;
16895
16896
16897 /* trailer */
16898 /* src/interfaces/ecpg/preproc/ecpg.trailer */
16899
16900 statements: /*EMPTY*/
16901 | statements statement
16902 ;
16903
16904 statement: ecpgstart at toplevel_stmt ';'
16905 {
16906 if (connection)
16907 free(connection);
16908 connection = NULL;
16909 }
16910 | ecpgstart toplevel_stmt ';'
16911 {
16912 if (connection)
16913 free(connection);
16914 connection = NULL;
16915 }
16916 | ecpgstart ECPGVarDeclaration
16917 {
16918 fprintf(base_yyout, "%s", $2);
16919 free($2);
16920 output_line_number();
16921 }
16922 | ECPGDeclaration
16923 | c_thing { fprintf(base_yyout, "%s", $1); free($1); }
16924 | CPP_LINE { fprintf(base_yyout, "%s", $1); free($1); }
16925 | '{' { braces_open++; fputs("{", base_yyout); }
16926 | '}'
16927 {
16928 remove_typedefs(braces_open);
16929 remove_variables(braces_open--);
16930 if (braces_open == 0)
16931 {
16932 free(current_function);
16933 current_function = NULL;
16934 }
16935 fputs("}", base_yyout);
16936 }
16937 ;
16938
16939 CreateAsStmt: CREATE OptTemp TABLE create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
16940 {
16941 if (FoundInto == 1)
16942 mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE AS cannot specify INTO");
16943
16944 $$ = cat_str(7, mm_strdup("create"), $2, mm_strdup("table"), $4, mm_strdup("as"), $7, $8);
16945 }
16946 | CREATE OptTemp TABLE IF_P NOT EXISTS create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
16947 {
16948 if (FoundInto == 1)
16949 mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE AS cannot specify INTO");
16950
16951 $$ = cat_str(7, mm_strdup("create"), $2, mm_strdup("table if not exists"), $7, mm_strdup("as"), $10, $11);
16952 }
16953 ;
16954
16955 at: AT connection_object
16956 {
16957 connection = $2;
16958 /*
16959 * Do we have a variable as connection target? Remove the variable
16960 * from the variable list or else it will be used twice.
16961 */
16962 if (argsinsert != NULL)
16963 argsinsert = NULL;
16964 }
16965 ;
16966
16967 /*
16968 * the exec sql connect statement: connect to the given database
16969 */
16970 ECPGConnect: SQL_CONNECT TO connection_target opt_connection_name opt_user
16971 { $$ = cat_str(5, $3, mm_strdup(","), $5, mm_strdup(","), $4); }
16972 | SQL_CONNECT TO DEFAULT
16973 { $$ = mm_strdup("NULL, NULL, NULL, \"DEFAULT\""); }
16974 /* also allow ORACLE syntax */
16975 | SQL_CONNECT ora_user
16976 { $$ = cat_str(3, mm_strdup("NULL,"), $2, mm_strdup(", NULL")); }
16977 | DATABASE connection_target
16978 { $$ = cat2_str($2, mm_strdup(", NULL, NULL, NULL")); }
16979 ;
16980
16981 connection_target: opt_database_name opt_server opt_port
16982 {
16983 /* old style: dbname[@server][:port] */
16984 if (strlen($2) > 0 && *($2) != '@')
16985 mmerror(PARSE_ERROR, ET_ERROR, "expected \"@\", found \"%s\"", $2);
16986
16987 /* C strings need to be handled differently */
16988 if ($1[0] == '\"')
16989 $$ = $1;
16990 else
16991 $$ = make3_str(mm_strdup("\""), make3_str($1, $2, $3), mm_strdup("\""));
16992 }
16993 | db_prefix ':' server opt_port '/' opt_database_name opt_options
16994 {
16995 /* new style: <tcp|unix>:postgresql://server[:port][/dbname] */
16996 if (strncmp($1, "unix:postgresql", strlen("unix:postgresql")) != 0 && strncmp($1, "tcp:postgresql", strlen("tcp:postgresql")) != 0)
16997 mmerror(PARSE_ERROR, ET_ERROR, "only protocols \"tcp\" and \"unix\" and database type \"postgresql\" are supported");
16998
16999 if (strncmp($3, "//", strlen("//")) != 0)
17000 mmerror(PARSE_ERROR, ET_ERROR, "expected \"://\", found \"%s\"", $3);
17001
17002 if (strncmp($1, "unix", strlen("unix")) == 0 &&
17003 strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0 &&
17004 strncmp($3 + strlen("//"), "127.0.0.1", strlen("127.0.0.1")) != 0)
17005 mmerror(PARSE_ERROR, ET_ERROR, "Unix-domain sockets only work on \"localhost\" but not on \"%s\"", $3 + strlen("//"));
17006
17007 $$ = make3_str(make3_str(mm_strdup("\""), $1, mm_strdup(":")), $3, make3_str(make3_str($4, mm_strdup("/"), $6), $7, mm_strdup("\"")));
17008 }
17009 | char_variable
17010 {
17011 $$ = $1;
17012 }
17013 | ecpg_sconst
17014 {
17015 /* We can only process double quoted strings not single quotes ones,
17016 * so we change the quotes.
17017 * Note, that the rule for ecpg_sconst adds these single quotes. */
17018 $1[0] = '\"';
17019 $1[strlen($1)-1] = '\"';
17020 $$ = $1;
17021 }
17022 ;
17023
17024 opt_database_name: name { $$ = $1; }
17025 | /*EMPTY*/ { $$ = EMPTY; }
17026 ;
17027
17028 db_prefix: ecpg_ident cvariable
17029 {
17030 if (strcmp($2, "postgresql") != 0 && strcmp($2, "postgres") != 0)
17031 mmerror(PARSE_ERROR, ET_ERROR, "expected \"postgresql\", found \"%s\"", $2);
17032
17033 if (strcmp($1, "tcp") != 0 && strcmp($1, "unix") != 0)
17034 mmerror(PARSE_ERROR, ET_ERROR, "invalid connection type: %s", $1);
17035
17036 $$ = make3_str($1, mm_strdup(":"), $2);
17037 }
17038 ;
17039
17040 server: Op server_name
17041 {
17042 if (strcmp($1, "@") != 0 && strcmp($1, "//") != 0)
17043 mmerror(PARSE_ERROR, ET_ERROR, "expected \"@\" or \"://\", found \"%s\"", $1);
17044
17045 $$ = make2_str($1, $2);
17046 }
17047 ;
17048
17049 opt_server: server { $$ = $1; }
17050 | /*EMPTY*/ { $$ = EMPTY; }
17051 ;
17052
17053 server_name: ColId { $$ = $1; }
17054 | ColId '.' server_name { $$ = make3_str($1, mm_strdup("."), $3); }
17055 | IP { $$ = make_name(); }
17056 ;
17057
17058 opt_port: ':' Iconst { $$ = make2_str(mm_strdup(":"), $2); }
17059 | /*EMPTY*/ { $$ = EMPTY; }
17060 ;
17061
17062 opt_connection_name: AS connection_object { $$ = $2; }
17063 | /*EMPTY*/ { $$ = mm_strdup("NULL"); }
17064 ;
17065
17066 opt_user: USER ora_user { $$ = $2; }
17067 | /*EMPTY*/ { $$ = mm_strdup("NULL, NULL"); }
17068 ;
17069
17070 ora_user: user_name
17071 { $$ = cat2_str($1, mm_strdup(", NULL")); }
17072 | user_name '/' user_name
17073 { $$ = cat_str(3, $1, mm_strdup(","), $3); }
17074 | user_name SQL_IDENTIFIED BY user_name
17075 { $$ = cat_str(3, $1, mm_strdup(","), $4); }
17076 | user_name USING user_name
17077 { $$ = cat_str(3, $1, mm_strdup(","), $3); }
17078 ;
17079
17080 user_name: RoleId
17081 {
17082 if ($1[0] == '\"')
17083 $$ = $1;
17084 else
17085 $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
17086 }
17087 | ecpg_sconst
17088 {
17089 if ($1[0] == '\"')
17090 $$ = $1;
17091 else
17092 $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
17093 }
17094 | civar
17095 {
17096 enum ECPGttype type = argsinsert->variable->type->type;
17097
17098 /* if array see what's inside */
17099 if (type == ECPGt_array)
17100 type = argsinsert->variable->type->u.element->type;
17101
17102 /* handle varchars */
17103 if (type == ECPGt_varchar)
17104 $$ = make2_str(mm_strdup(argsinsert->variable->name), mm_strdup(".arr"));
17105 else
17106 $$ = mm_strdup(argsinsert->variable->name);
17107 }
17108 ;
17109
17110 char_variable: cvariable
17111 {
17112 /* check if we have a string variable */
17113 struct variable *p = find_variable($1);
17114 enum ECPGttype type = p->type->type;
17115
17116 /* If we have just one character this is not a string */
17117 if (atol(p->type->size) == 1)
17118 mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
17119 else
17120 {
17121 /* if array see what's inside */
17122 if (type == ECPGt_array)
17123 type = p->type->u.element->type;
17124
17125 switch (type)
17126 {
17127 case ECPGt_char:
17128 case ECPGt_unsigned_char:
17129 case ECPGt_string:
17130 $$ = $1;
17131 break;
17132 case ECPGt_varchar:
17133 $$ = make2_str($1, mm_strdup(".arr"));
17134 break;
17135 default:
17136 mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
17137 $$ = $1;
17138 break;
17139 }
17140 }
17141 }
17142 ;
17143
17144 opt_options: Op connect_options
17145 {
17146 if (strlen($1) == 0)
17147 mmerror(PARSE_ERROR, ET_ERROR, "incomplete statement");
17148
17149 if (strcmp($1, "?") != 0)
17150 mmerror(PARSE_ERROR, ET_ERROR, "unrecognized token \"%s\"", $1);
17151
17152 $$ = make2_str(mm_strdup("?"), $2);
17153 }
17154 | /*EMPTY*/ { $$ = EMPTY; }
17155 ;
17156
17157 connect_options: ColId opt_opt_value
17158 {
17159 $$ = make2_str($1, $2);
17160 }
17161 | ColId opt_opt_value Op connect_options
17162 {
17163 if (strlen($3) == 0)
17164 mmerror(PARSE_ERROR, ET_ERROR, "incomplete statement");
17165
17166 if (strcmp($3, "&") != 0)
17167 mmerror(PARSE_ERROR, ET_ERROR, "unrecognized token \"%s\"", $3);
17168
17169 $$ = cat_str(3, make2_str($1, $2), $3, $4);
17170 }
17171 ;
17172
17173 opt_opt_value: /*EMPTY*/
17174 { $$ = EMPTY; }
17175 | '=' Iconst
17176 { $$ = make2_str(mm_strdup("="), $2); }
17177 | '=' ecpg_ident
17178 { $$ = make2_str(mm_strdup("="), $2); }
17179 | '=' civar
17180 { $$ = make2_str(mm_strdup("="), $2); }
17181 ;
17182
17183 prepared_name: name
17184 {
17185 if ($1[0] == '\"' && $1[strlen($1)-1] == '\"') /* already quoted? */
17186 $$ = $1;
17187 else /* not quoted => convert to lowercase */
17188 {
17189 size_t i;
17190
17191 for (i = 0; i< strlen($1); i++)
17192 $1[i] = tolower((unsigned char) $1[i]);
17193
17194 $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
17195 }
17196 }
17197 | char_variable { $$ = $1; }
17198 ;
17199
17200 /*
17201 * Declare Statement
17202 */
17203 ECPGDeclareStmt: DECLARE prepared_name STATEMENT
17204 {
17205 struct declared_list *ptr = NULL;
17206 /* Check whether the declared name has been defined or not */
17207 for (ptr = g_declared_list; ptr != NULL; ptr = ptr->next)
17208 {
17209 if (strcmp($2, ptr->name) == 0)
17210 {
17211 /* re-definition is not allowed */
17212 mmerror(PARSE_ERROR, ET_ERROR, "name \"%s\" is already declared", ptr->name);
17213 }
17214 }
17215
17216 /* Add a new declared name into the g_declared_list */
17217 ptr = NULL;
17218 ptr = (struct declared_list *)mm_alloc(sizeof(struct declared_list));
17219 if (ptr)
17220 {
17221 /* initial definition */
17222 ptr -> name = $2;
17223 if (connection)
17224 ptr -> connection = mm_strdup(connection);
17225 else
17226 ptr -> connection = NULL;
17227
17228 ptr -> next = g_declared_list;
17229 g_declared_list = ptr;
17230 }
17231
17232 $$ = cat_str(3 , mm_strdup("/* declare "), mm_strdup($2), mm_strdup(" as an SQL identifier */"));
17233 }
17234 ;
17235
17236 /*
17237 * Declare a prepared cursor. The syntax is different from the standard
17238 * declare statement, so we create a new rule.
17239 */
17240 ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name
17241 {
17242 struct cursor *ptr, *this;
17243 char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : mm_strdup($2);
17244 int (* strcmp_fn)(const char *, const char *) = (($2[0] == ':' || $2[0] == '"') ? strcmp : pg_strcasecmp);
17245 struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
17246 char *comment;
17247 char *con;
17248
17249 if (INFORMIX_MODE && pg_strcasecmp($2, "database") == 0)
17250 mmfatal(PARSE_ERROR, "\"database\" cannot be used as cursor name in INFORMIX mode");
17251
17252 check_declared_list($7);
17253 con = connection ? connection : "NULL";
17254 for (ptr = cur; ptr != NULL; ptr = ptr->next)
17255 {
17256 if (strcmp_fn($2, ptr->name) == 0)
17257 {
17258 /* re-definition is a bug */
17259 if ($2[0] == ':')
17260 mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
17261 else
17262 mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
17263 }
17264 }
17265
17266 this = (struct cursor *) mm_alloc(sizeof(struct cursor));
17267
17268 /* initial definition */
17269 this->next = cur;
17270 this->name = $2;
17271 this->function = (current_function ? mm_strdup(current_function) : NULL);
17272 this->connection = connection ? mm_strdup(connection) : NULL;
17273 this->command = cat_str(6, mm_strdup("declare"), cursor_marker, $3, mm_strdup("cursor"), $5, mm_strdup("for $1"));
17274 this->argsresult = NULL;
17275 this->argsresult_oos = NULL;
17276
17277 thisquery->type = &ecpg_query;
17278 thisquery->brace_level = 0;
17279 thisquery->next = NULL;
17280 thisquery->name = (char *) mm_alloc(sizeof("ECPGprepared_statement(, , __LINE__)") + strlen(con) + strlen($7));
17281 sprintf(thisquery->name, "ECPGprepared_statement(%s, %s, __LINE__)", con, $7);
17282
17283 this->argsinsert = NULL;
17284 this->argsinsert_oos = NULL;
17285 if ($2[0] == ':')
17286 {
17287 struct variable *var = find_variable($2 + 1);
17288 remove_variable_from_list(&argsinsert, var);
17289 add_variable_to_head(&(this->argsinsert), var, &no_indicator);
17290 }
17291 add_variable_to_head(&(this->argsinsert), thisquery, &no_indicator);
17292
17293 cur = this;
17294
17295 comment = cat_str(3, mm_strdup("/*"), mm_strdup(this->command), mm_strdup("*/"));
17296
17297 $$ = cat_str(2, adjust_outofscope_cursor_vars(this),
17298 comment);
17299 }
17300 ;
17301
17302 ECPGExecuteImmediateStmt: EXECUTE IMMEDIATE execstring
17303 {
17304 /* execute immediate means prepare the statement and
17305 * immediately execute it */
17306 $$ = $3;
17307 };
17308 /*
17309 * variable declaration outside exec sql declare block
17310 */
17311 ECPGVarDeclaration: single_vt_declaration;
17312
17313 single_vt_declaration: type_declaration { $$ = $1; }
17314 | var_declaration { $$ = $1; }
17315 ;
17316
17317 precision: NumericOnly { $$ = $1; };
17318
17319 opt_scale: ',' NumericOnly { $$ = $2; }
17320 | /* EMPTY */ { $$ = EMPTY; }
17321 ;
17322
17323 ecpg_interval: opt_interval { $$ = $1; }
17324 | YEAR_P TO MINUTE_P { $$ = mm_strdup("year to minute"); }
17325 | YEAR_P TO SECOND_P { $$ = mm_strdup("year to second"); }
17326 | DAY_P TO DAY_P { $$ = mm_strdup("day to day"); }
17327 | MONTH_P TO MONTH_P { $$ = mm_strdup("month to month"); }
17328 ;
17329
17330 /*
17331 * variable declaration inside exec sql declare block
17332 */
17333 ECPGDeclaration: sql_startdeclare
17334 { fputs("/* exec sql begin declare section */", base_yyout); }
17335 var_type_declarations sql_enddeclare
17336 {
17337 fprintf(base_yyout, "%s/* exec sql end declare section */", $3);
17338 free($3);
17339 output_line_number();
17340 }
17341 ;
17342
17343 sql_startdeclare: ecpgstart BEGIN_P DECLARE SQL_SECTION ';' {};
17344
17345 sql_enddeclare: ecpgstart END_P DECLARE SQL_SECTION ';' {};
17346
17347 var_type_declarations: /*EMPTY*/ { $$ = EMPTY; }
17348 | vt_declarations { $$ = $1; }
17349 ;
17350
17351 vt_declarations: single_vt_declaration { $$ = $1; }
17352 | CPP_LINE { $$ = $1; }
17353 | vt_declarations single_vt_declaration { $$ = cat2_str($1, $2); }
17354 | vt_declarations CPP_LINE { $$ = cat2_str($1, $2); }
17355 ;
17356
17357 variable_declarations: var_declaration { $$ = $1; }
17358 | variable_declarations var_declaration { $$ = cat2_str($1, $2); }
17359 ;
17360
17361 type_declaration: S_TYPEDEF
17362 {
17363 /* reset this variable so we see if there was */
17364 /* an initializer specified */
17365 initializer = 0;
17366 }
17367 var_type opt_pointer ECPGColLabelCommon opt_array_bounds ';'
17368 {
17369 add_typedef($5, $6.index1, $6.index2, $3.type_enum, $3.type_dimension, $3.type_index, initializer, *$4 ? 1 : 0);
17370
17371 fprintf(base_yyout, "typedef %s %s %s %s;\n", $3.type_str, *$4 ? "*" : "", $5, $6.str);
17372 output_line_number();
17373 $$ = mm_strdup("");
17374 };
17375
17376 var_declaration: storage_declaration
17377 var_type
17378 {
17379 actual_type[struct_level].type_enum = $2.type_enum;
17380 actual_type[struct_level].type_str = $2.type_str;
17381 actual_type[struct_level].type_dimension = $2.type_dimension;
17382 actual_type[struct_level].type_index = $2.type_index;
17383 actual_type[struct_level].type_sizeof = $2.type_sizeof;
17384
17385 actual_startline[struct_level] = hashline_number();
17386 }
17387 variable_list ';'
17388 {
17389 $$ = cat_str(5, actual_startline[struct_level], $1, $2.type_str, $4, mm_strdup(";\n"));
17390 }
17391 | var_type
17392 {
17393 actual_type[struct_level].type_enum = $1.type_enum;
17394 actual_type[struct_level].type_str = $1.type_str;
17395 actual_type[struct_level].type_dimension = $1.type_dimension;
17396 actual_type[struct_level].type_index = $1.type_index;
17397 actual_type[struct_level].type_sizeof = $1.type_sizeof;
17398
17399 actual_startline[struct_level] = hashline_number();
17400 }
17401 variable_list ';'
17402 {
17403 $$ = cat_str(4, actual_startline[struct_level], $1.type_str, $3, mm_strdup(";\n"));
17404 }
17405 | struct_union_type_with_symbol ';'
17406 {
17407 $$ = cat2_str($1, mm_strdup(";"));
17408 }
17409 ;
17410
17411 opt_bit_field: ':' Iconst { $$ =cat2_str(mm_strdup(":"), $2); }
17412 | /* EMPTY */ { $$ = EMPTY; }
17413 ;
17414
17415 storage_declaration: storage_clause storage_modifier
17416 {$$ = cat2_str ($1, $2); }
17417 | storage_clause {$$ = $1; }
17418 | storage_modifier {$$ = $1; }
17419 ;
17420
17421 storage_clause : S_EXTERN { $$ = mm_strdup("extern"); }
17422 | S_STATIC { $$ = mm_strdup("static"); }
17423 | S_REGISTER { $$ = mm_strdup("register"); }
17424 | S_AUTO { $$ = mm_strdup("auto"); }
17425 ;
17426
17427 storage_modifier : S_CONST { $$ = mm_strdup("const"); }
17428 | S_VOLATILE { $$ = mm_strdup("volatile"); }
17429 ;
17430
17431 var_type: simple_type
17432 {
17433 $$.type_enum = $1;
17434 $$.type_str = mm_strdup(ecpg_type_name($1));
17435 $$.type_dimension = mm_strdup("-1");
17436 $$.type_index = mm_strdup("-1");
17437 $$.type_sizeof = NULL;
17438 }
17439 | struct_union_type
17440 {
17441 $$.type_str = $1;
17442 $$.type_dimension = mm_strdup("-1");
17443 $$.type_index = mm_strdup("-1");
17444
17445 if (strncmp($1, "struct", sizeof("struct")-1) == 0)
17446 {
17447 $$.type_enum = ECPGt_struct;
17448 $$.type_sizeof = ECPGstruct_sizeof;
17449 }
17450 else
17451 {
17452 $$.type_enum = ECPGt_union;
17453 $$.type_sizeof = NULL;
17454 }
17455 }
17456 | enum_type
17457 {
17458 $$.type_str = $1;
17459 $$.type_enum = ECPGt_int;
17460 $$.type_dimension = mm_strdup("-1");
17461 $$.type_index = mm_strdup("-1");
17462 $$.type_sizeof = NULL;
17463 }
17464 | ECPGColLabelCommon '(' precision opt_scale ')'
17465 {
17466 if (strcmp($1, "numeric") == 0)
17467 {
17468 $$.type_enum = ECPGt_numeric;
17469 $$.type_str = mm_strdup("numeric");
17470 }
17471 else if (strcmp($1, "decimal") == 0)
17472 {
17473 $$.type_enum = ECPGt_decimal;
17474 $$.type_str = mm_strdup("decimal");
17475 }
17476 else
17477 {
17478 mmerror(PARSE_ERROR, ET_ERROR, "only data types numeric and decimal have precision/scale argument");
17479 $$.type_enum = ECPGt_numeric;
17480 $$.type_str = mm_strdup("numeric");
17481 }
17482
17483 $$.type_dimension = mm_strdup("-1");
17484 $$.type_index = mm_strdup("-1");
17485 $$.type_sizeof = NULL;
17486 }
17487 | ECPGColLabelCommon ecpg_interval
17488 {
17489 if (strlen($2) != 0 && strcmp ($1, "datetime") != 0 && strcmp ($1, "interval") != 0)
17490 mmerror (PARSE_ERROR, ET_ERROR, "interval specification not allowed here");
17491
17492 /*
17493 * Check for type names that the SQL grammar treats as
17494 * unreserved keywords
17495 */
17496 if (strcmp($1, "varchar") == 0)
17497 {
17498 $$.type_enum = ECPGt_varchar;
17499 $$.type_str = EMPTY; /*mm_strdup("varchar");*/
17500 $$.type_dimension = mm_strdup("-1");
17501 $$.type_index = mm_strdup("-1");
17502 $$.type_sizeof = NULL;
17503 }
17504 else if (strcmp($1, "bytea") == 0)
17505 {
17506 $$.type_enum = ECPGt_bytea;
17507 $$.type_str = EMPTY;
17508 $$.type_dimension = mm_strdup("-1");
17509 $$.type_index = mm_strdup("-1");
17510 $$.type_sizeof = NULL;
17511 }
17512 else if (strcmp($1, "float") == 0)
17513 {
17514 $$.type_enum = ECPGt_float;
17515 $$.type_str = mm_strdup("float");
17516 $$.type_dimension = mm_strdup("-1");
17517 $$.type_index = mm_strdup("-1");
17518 $$.type_sizeof = NULL;
17519 }
17520 else if (strcmp($1, "double") == 0)
17521 {
17522 $$.type_enum = ECPGt_double;
17523 $$.type_str = mm_strdup("double");
17524 $$.type_dimension = mm_strdup("-1");
17525 $$.type_index = mm_strdup("-1");
17526 $$.type_sizeof = NULL;
17527 }
17528 else if (strcmp($1, "numeric") == 0)
17529 {
17530 $$.type_enum = ECPGt_numeric;
17531 $$.type_str = mm_strdup("numeric");
17532 $$.type_dimension = mm_strdup("-1");
17533 $$.type_index = mm_strdup("-1");
17534 $$.type_sizeof = NULL;
17535 }
17536 else if (strcmp($1, "decimal") == 0)
17537 {
17538 $$.type_enum = ECPGt_decimal;
17539 $$.type_str = mm_strdup("decimal");
17540 $$.type_dimension = mm_strdup("-1");
17541 $$.type_index = mm_strdup("-1");
17542 $$.type_sizeof = NULL;
17543 }
17544 else if (strcmp($1, "date") == 0)
17545 {
17546 $$.type_enum = ECPGt_date;
17547 $$.type_str = mm_strdup("date");
17548 $$.type_dimension = mm_strdup("-1");
17549 $$.type_index = mm_strdup("-1");
17550 $$.type_sizeof = NULL;
17551 }
17552 else if (strcmp($1, "timestamp") == 0)
17553 {
17554 $$.type_enum = ECPGt_timestamp;
17555 $$.type_str = mm_strdup("timestamp");
17556 $$.type_dimension = mm_strdup("-1");
17557 $$.type_index = mm_strdup("-1");
17558 $$.type_sizeof = NULL;
17559 }
17560 else if (strcmp($1, "interval") == 0)
17561 {
17562 $$.type_enum = ECPGt_interval;
17563 $$.type_str = mm_strdup("interval");
17564 $$.type_dimension = mm_strdup("-1");
17565 $$.type_index = mm_strdup("-1");
17566 $$.type_sizeof = NULL;
17567 }
17568 else if (strcmp($1, "datetime") == 0)
17569 {
17570 $$.type_enum = ECPGt_timestamp;
17571 $$.type_str = mm_strdup("timestamp");
17572 $$.type_dimension = mm_strdup("-1");
17573 $$.type_index = mm_strdup("-1");
17574 $$.type_sizeof = NULL;
17575 }
17576 else if ((strcmp($1, "string") == 0) && INFORMIX_MODE)
17577 {
17578 $$.type_enum = ECPGt_string;
17579 $$.type_str = mm_strdup("char");
17580 $$.type_dimension = mm_strdup("-1");
17581 $$.type_index = mm_strdup("-1");
17582 $$.type_sizeof = NULL;
17583 }
17584 else
17585 {
17586 /* this is for typedef'ed types */
17587 struct typedefs *this = get_typedef($1);
17588
17589 $$.type_str = (this->type->type_enum == ECPGt_varchar || this->type->type_enum == ECPGt_bytea) ? EMPTY : mm_strdup(this->name);
17590 $$.type_enum = this->type->type_enum;
17591 $$.type_dimension = this->type->type_dimension;
17592 $$.type_index = this->type->type_index;
17593 if (this->type->type_sizeof && strlen(this->type->type_sizeof) != 0)
17594 $$.type_sizeof = this->type->type_sizeof;
17595 else
17596 $$.type_sizeof = cat_str(3, mm_strdup("sizeof("), mm_strdup(this->name), mm_strdup(")"));
17597
17598 struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
17599 }
17600 }
17601 | s_struct_union_symbol
17602 {
17603 /* this is for named structs/unions */
17604 char *name;
17605 struct typedefs *this;
17606 bool forward = (forward_name != NULL && strcmp($1.symbol, forward_name) == 0 && strcmp($1.su, "struct") == 0);
17607
17608 name = cat2_str($1.su, $1.symbol);
17609 /* Do we have a forward definition? */
17610 if (!forward)
17611 {
17612 /* No */
17613
17614 this = get_typedef(name);
17615 $$.type_str = mm_strdup(this->name);
17616 $$.type_enum = this->type->type_enum;
17617 $$.type_dimension = this->type->type_dimension;
17618 $$.type_index = this->type->type_index;
17619 $$.type_sizeof = this->type->type_sizeof;
17620 struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
17621 free(name);
17622 }
17623 else
17624 {
17625 $$.type_str = name;
17626 $$.type_enum = ECPGt_long;
17627 $$.type_dimension = mm_strdup("-1");
17628 $$.type_index = mm_strdup("-1");
17629 $$.type_sizeof = mm_strdup("");
17630 struct_member_list[struct_level] = NULL;
17631 }
17632 }
17633 ;
17634
17635 enum_type: ENUM_P symbol enum_definition
17636 { $$ = cat_str(3, mm_strdup("enum"), $2, $3); }
17637 | ENUM_P enum_definition
17638 { $$ = cat2_str(mm_strdup("enum"), $2); }
17639 | ENUM_P symbol
17640 { $$ = cat2_str(mm_strdup("enum"), $2); }
17641 ;
17642
17643 enum_definition: '{' c_list '}'
17644 { $$ = cat_str(3, mm_strdup("{"), $2, mm_strdup("}")); };
17645
17646 struct_union_type_with_symbol: s_struct_union_symbol
17647 {
17648 struct_member_list[struct_level++] = NULL;
17649 if (struct_level >= STRUCT_DEPTH)
17650 mmerror(PARSE_ERROR, ET_ERROR, "too many levels in nested structure/union definition");
17651 forward_name = mm_strdup($1.symbol);
17652 }
17653 '{' variable_declarations '}'
17654 {
17655 struct typedefs *ptr, *this;
17656 struct this_type su_type;
17657
17658 ECPGfree_struct_member(struct_member_list[struct_level]);
17659 struct_member_list[struct_level] = NULL;
17660 struct_level--;
17661 if (strncmp($1.su, "struct", sizeof("struct")-1) == 0)
17662 su_type.type_enum = ECPGt_struct;
17663 else
17664 su_type.type_enum = ECPGt_union;
17665 su_type.type_str = cat2_str($1.su, $1.symbol);
17666 free(forward_name);
17667 forward_name = NULL;
17668
17669 /* This is essentially a typedef but needs the keyword struct/union as well.
17670 * So we create the typedef for each struct definition with symbol */
17671 for (ptr = types; ptr != NULL; ptr = ptr->next)
17672 {
17673 if (strcmp(su_type.type_str, ptr->name) == 0)
17674 /* re-definition is a bug */
17675 mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", su_type.type_str);
17676 }
17677
17678 this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
17679
17680 /* initial definition */
17681 this->next = types;
17682 this->name = mm_strdup(su_type.type_str);
17683 this->brace_level = braces_open;
17684 this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
17685 this->type->type_enum = su_type.type_enum;
17686 this->type->type_str = mm_strdup(su_type.type_str);
17687 this->type->type_dimension = mm_strdup("-1"); /* dimension of array */
17688 this->type->type_index = mm_strdup("-1"); /* length of string */
17689 this->type->type_sizeof = ECPGstruct_sizeof;
17690 this->struct_member_list = struct_member_list[struct_level];
17691
17692 types = this;
17693 $$ = cat_str(4, su_type.type_str, mm_strdup("{"), $4, mm_strdup("}"));
17694 }
17695 ;
17696
17697 struct_union_type: struct_union_type_with_symbol { $$ = $1; }
17698 | s_struct_union
17699 {
17700 struct_member_list[struct_level++] = NULL;
17701 if (struct_level >= STRUCT_DEPTH)
17702 mmerror(PARSE_ERROR, ET_ERROR, "too many levels in nested structure/union definition");
17703 }
17704 '{' variable_declarations '}'
17705 {
17706 ECPGfree_struct_member(struct_member_list[struct_level]);
17707 struct_member_list[struct_level] = NULL;
17708 struct_level--;
17709 $$ = cat_str(4, $1, mm_strdup("{"), $4, mm_strdup("}"));
17710 }
17711 ;
17712
17713 s_struct_union_symbol: SQL_STRUCT symbol
17714 {
17715 $$.su = mm_strdup("struct");
17716 $$.symbol = $2;
17717 ECPGstruct_sizeof = cat_str(3, mm_strdup("sizeof("), cat2_str(mm_strdup($$.su), mm_strdup($$.symbol)), mm_strdup(")"));
17718 }
17719 | UNION symbol
17720 {
17721 $$.su = mm_strdup("union");
17722 $$.symbol = $2;
17723 }
17724 ;
17725
17726 s_struct_union: SQL_STRUCT
17727 {
17728 ECPGstruct_sizeof = mm_strdup(""); /* This must not be NULL to distinguish from simple types. */
17729 $$ = mm_strdup("struct");
17730 }
17731 | UNION
17732 {
17733 $$ = mm_strdup("union");
17734 }
17735 ;
17736
17737 simple_type: unsigned_type { $$=$1; }
17738 | opt_signed signed_type { $$=$2; }
17739 ;
17740
17741 unsigned_type: SQL_UNSIGNED SQL_SHORT { $$ = ECPGt_unsigned_short; }
17742 | SQL_UNSIGNED SQL_SHORT INT_P { $$ = ECPGt_unsigned_short; }
17743 | SQL_UNSIGNED { $$ = ECPGt_unsigned_int; }
17744 | SQL_UNSIGNED INT_P { $$ = ECPGt_unsigned_int; }
17745 | SQL_UNSIGNED SQL_LONG { $$ = ECPGt_unsigned_long; }
17746 | SQL_UNSIGNED SQL_LONG INT_P { $$ = ECPGt_unsigned_long; }
17747 | SQL_UNSIGNED SQL_LONG SQL_LONG { $$ = ECPGt_unsigned_long_long; }
17748 | SQL_UNSIGNED SQL_LONG SQL_LONG INT_P { $$ = ECPGt_unsigned_long_long; }
17749 | SQL_UNSIGNED CHAR_P { $$ = ECPGt_unsigned_char; }
17750 ;
17751
17752 signed_type: SQL_SHORT { $$ = ECPGt_short; }
17753 | SQL_SHORT INT_P { $$ = ECPGt_short; }
17754 | INT_P { $$ = ECPGt_int; }
17755 | SQL_LONG { $$ = ECPGt_long; }
17756 | SQL_LONG INT_P { $$ = ECPGt_long; }
17757 | SQL_LONG SQL_LONG { $$ = ECPGt_long_long; }
17758 | SQL_LONG SQL_LONG INT_P { $$ = ECPGt_long_long; }
17759 | SQL_BOOL { $$ = ECPGt_bool; }
17760 | CHAR_P { $$ = ECPGt_char; }
17761 | DOUBLE_P { $$ = ECPGt_double; }
17762 ;
17763
17764 opt_signed: SQL_SIGNED
17765 | /* EMPTY */
17766 ;
17767
17768 variable_list: variable
17769 { $$ = $1; }
17770 | variable_list ',' variable
17771 {
17772 if (actual_type[struct_level].type_enum == ECPGt_varchar || actual_type[struct_level].type_enum == ECPGt_bytea)
17773 $$ = cat_str(3, $1, mm_strdup(";"), $3);
17774 else
17775 $$ = cat_str(3, $1, mm_strdup(","), $3);
17776 }
17777 ;
17778
17779 variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initializer
17780 {
17781 struct ECPGtype * type;
17782 char *dimension = $3.index1; /* dimension of array */
17783 char *length = $3.index2; /* length of string */
17784 char *dim_str;
17785 char *vcn;
17786 int *varlen_type_counter;
17787 char *struct_name;
17788
17789 adjust_array(actual_type[struct_level].type_enum, &dimension, &length, actual_type[struct_level].type_dimension, actual_type[struct_level].type_index, strlen($1), false);
17790 switch (actual_type[struct_level].type_enum)
17791 {
17792 case ECPGt_struct:
17793 case ECPGt_union:
17794 if (atoi(dimension) < 0)
17795 type = ECPGmake_struct_type(struct_member_list[struct_level], actual_type[struct_level].type_enum, actual_type[struct_level].type_str, actual_type[struct_level].type_sizeof);
17796 else
17797 type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], actual_type[struct_level].type_enum, actual_type[struct_level].type_str, actual_type[struct_level].type_sizeof), dimension);
17798
17799 $$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
17800 break;
17801
17802 case ECPGt_varchar:
17803 case ECPGt_bytea:
17804 if (actual_type[struct_level].type_enum == ECPGt_varchar)
17805 {
17806 varlen_type_counter = &varchar_counter;
17807 struct_name = " struct varchar_";
17808 }
17809 else
17810 {
17811 varlen_type_counter = &bytea_counter;
17812 struct_name = " struct bytea_";
17813 }
17814 if (atoi(dimension) < 0)
17815 type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, *varlen_type_counter);
17816 else
17817 type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, *varlen_type_counter), dimension);
17818
17819 if (strcmp(dimension, "0") == 0 || abs(atoi(dimension)) == 1)
17820 dim_str=mm_strdup("");
17821 else
17822 dim_str=cat_str(3, mm_strdup("["), mm_strdup(dimension), mm_strdup("]"));
17823 /* cannot check for atoi <= 0 because a defined constant will yield 0 here as well */
17824 if (atoi(length) < 0 || strcmp(length, "0") == 0)
17825 mmerror(PARSE_ERROR, ET_ERROR, "pointers to varchar are not implemented");
17826
17827 /* make sure varchar struct name is unique by adding a unique counter to its definition */
17828 vcn = (char *) mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
17829 sprintf(vcn, "%d", *varlen_type_counter);
17830 if (strcmp(dimension, "0") == 0)
17831 $$ = cat_str(7, make2_str(mm_strdup(struct_name), vcn), mm_strdup(" { int len; char arr["), mm_strdup(length), mm_strdup("]; } *"), mm_strdup($2), $4, $5);
17832 else
17833 $$ = cat_str(8, make2_str(mm_strdup(struct_name), vcn), mm_strdup(" { int len; char arr["), mm_strdup(length), mm_strdup("]; } "), mm_strdup($2), dim_str, $4, $5);
17834 (*varlen_type_counter)++;
17835 break;
17836
17837 case ECPGt_char:
17838 case ECPGt_unsigned_char:
17839 case ECPGt_string:
17840 if (atoi(dimension) == -1)
17841 {
17842 int i = strlen($5);
17843
17844 if (atoi(length) == -1 && i > 0) /* char <var>[] = "string" */
17845 {
17846 /* if we have an initializer but no string size set, let's use the initializer's length */
17847 free(length);
17848 length = mm_alloc(i+sizeof("sizeof()"));
17849 sprintf(length, "sizeof(%s)", $5+2);
17850 }
17851 type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0);
17852 }
17853 else
17854 type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0), dimension);
17855
17856 $$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
17857 break;
17858
17859 default:
17860 if (atoi(dimension) < 0)
17861 type = ECPGmake_simple_type(actual_type[struct_level].type_enum, mm_strdup("1"), 0);
17862 else
17863 type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, mm_strdup("1"), 0), dimension);
17864
17865 $$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
17866 break;
17867 }
17868
17869 if (struct_level == 0)
17870 new_variable($2, type, braces_open);
17871 else
17872 ECPGmake_struct_member($2, type, &(struct_member_list[struct_level - 1]));
17873
17874 free($2);
17875 }
17876 ;
17877
17878 opt_initializer: /*EMPTY*/
17879 { $$ = EMPTY; }
17880 | '=' c_term
17881 {
17882 initializer = 1;
17883 $$ = cat2_str(mm_strdup("="), $2);
17884 }
17885 ;
17886
17887 opt_pointer: /*EMPTY*/ { $$ = EMPTY; }
17888 | '*' { $$ = mm_strdup("*"); }
17889 | '*' '*' { $$ = mm_strdup("**"); }
17890 ;
17891
17892 /*
17893 * We try to simulate the correct DECLARE syntax here so we get dynamic SQL
17894 */
17895 ECPGDeclare: DECLARE STATEMENT ecpg_ident
17896 {
17897 /* this is only supported for compatibility */
17898 $$ = cat_str(3, mm_strdup("/* declare statement"), $3, mm_strdup("*/"));
17899 }
17900 ;
17901 /*
17902 * the exec sql disconnect statement: disconnect from the given database
17903 */
17904 ECPGDisconnect: SQL_DISCONNECT dis_name { $$ = $2; }
17905 ;
17906
17907 dis_name: connection_object { $$ = $1; }
17908 | CURRENT_P { $$ = mm_strdup("\"CURRENT\""); }
17909 | ALL { $$ = mm_strdup("\"ALL\""); }
17910 | /* EMPTY */ { $$ = mm_strdup("\"CURRENT\""); }
17911 ;
17912
17913 connection_object: name { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
17914 | DEFAULT { $$ = mm_strdup("\"DEFAULT\""); }
17915 | char_variable { $$ = $1; }
17916 ;
17917
17918 execstring: char_variable
17919 { $$ = $1; }
17920 | CSTRING
17921 { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
17922 ;
17923
17924 /*
17925 * the exec sql free command to deallocate a previously
17926 * prepared statement
17927 */
17928 ECPGFree: SQL_FREE cursor_name { $$ = $2; }
17929 | SQL_FREE ALL { $$ = mm_strdup("all"); }
17930 ;
17931
17932 /*
17933 * open is an open cursor, at the moment this has to be removed
17934 */
17935 ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using
17936 {
17937 if ($2[0] == ':')
17938 remove_variable_from_list(&argsinsert, find_variable($2 + 1));
17939 $$ = $2;
17940 }
17941 ;
17942
17943 opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
17944 | ecpg_using { $$ = $1; }
17945 ;
17946
17947 ecpg_using: USING using_list { $$ = EMPTY; }
17948 | using_descriptor { $$ = $1; }
17949 ;
17950
17951 using_descriptor: USING SQL_P SQL_DESCRIPTOR quoted_ident_stringvar
17952 {
17953 add_variable_to_head(&argsinsert, descriptor_variable($4,0), &no_indicator);
17954 $$ = EMPTY;
17955 }
17956 | USING SQL_DESCRIPTOR name
17957 {
17958 add_variable_to_head(&argsinsert, sqlda_variable($3), &no_indicator);
17959 $$ = EMPTY;
17960 }
17961 ;
17962
17963 into_descriptor: INTO SQL_P SQL_DESCRIPTOR quoted_ident_stringvar
17964 {
17965 add_variable_to_head(&argsresult, descriptor_variable($4,1), &no_indicator);
17966 $$ = EMPTY;
17967 }
17968 | INTO SQL_DESCRIPTOR name
17969 {
17970 add_variable_to_head(&argsresult, sqlda_variable($3), &no_indicator);
17971 $$ = EMPTY;
17972 }
17973 ;
17974
17975 into_sqlda: INTO name
17976 {
17977 add_variable_to_head(&argsresult, sqlda_variable($2), &no_indicator);
17978 $$ = EMPTY;
17979 }
17980 ;
17981
17982 using_list: UsingValue | UsingValue ',' using_list;
17983
17984 UsingValue: UsingConst
17985 {
17986 char *length = mm_alloc(32);
17987
17988 sprintf(length, "%zu", strlen($1));
17989 add_variable_to_head(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
17990 }
17991 | civar { $$ = EMPTY; }
17992 | civarind { $$ = EMPTY; }
17993 ;
17994
17995 UsingConst: Iconst { $$ = $1; }
17996 | '+' Iconst { $$ = cat_str(2, mm_strdup("+"), $2); }
17997 | '-' Iconst { $$ = cat_str(2, mm_strdup("-"), $2); }
17998 | ecpg_fconst { $$ = $1; }
17999 | '+' ecpg_fconst { $$ = cat_str(2, mm_strdup("+"), $2); }
18000 | '-' ecpg_fconst { $$ = cat_str(2, mm_strdup("-"), $2); }
18001 | ecpg_sconst { $$ = $1; }
18002 | ecpg_bconst { $$ = $1; }
18003 | ecpg_xconst { $$ = $1; }
18004 ;
18005
18006 /*
18007 * We accept DESCRIBE [OUTPUT] but do nothing with DESCRIBE INPUT so far.
18008 */
18009 ECPGDescribe: SQL_DESCRIBE INPUT_P prepared_name using_descriptor
18010 {
18011 $$.input = 1;
18012 $$.stmt_name = $3;
18013 }
18014 | SQL_DESCRIBE opt_output prepared_name using_descriptor
18015 {
18016 struct variable *var;
18017 var = argsinsert->variable;
18018 remove_variable_from_list(&argsinsert, var);
18019 add_variable_to_head(&argsresult, var, &no_indicator);
18020
18021 $$.input = 0;
18022 $$.stmt_name = $3;
18023 }
18024 | SQL_DESCRIBE opt_output prepared_name into_descriptor
18025 {
18026 $$.input = 0;
18027 $$.stmt_name = $3;
18028 }
18029 | SQL_DESCRIBE INPUT_P prepared_name into_sqlda
18030 {
18031 $$.input = 1;
18032 $$.stmt_name = $3;
18033 }
18034 | SQL_DESCRIBE opt_output prepared_name into_sqlda
18035 {
18036 $$.input = 0;
18037 $$.stmt_name = $3;
18038 }
18039 ;
18040
18041 opt_output: SQL_OUTPUT { $$ = mm_strdup("output"); }
18042 | /* EMPTY */ { $$ = EMPTY; }
18043 ;
18044
18045 /*
18046 * dynamic SQL: descriptor based access
18047 * originally written by Christof Petig <christof.petig@wtal.de>
18048 * and Peter Eisentraut <peter.eisentraut@credativ.de>
18049 */
18050
18051 /*
18052 * allocate a descriptor
18053 */
18054 ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
18055 {
18056 add_descriptor($3,connection);
18057 $$ = $3;
18058 }
18059 ;
18060
18061
18062 /*
18063 * deallocate a descriptor
18064 */
18065 ECPGDeallocateDescr: DEALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
18066 {
18067 drop_descriptor($3,connection);
18068 $$ = $3;
18069 }
18070 ;
18071
18072 /*
18073 * manipulate a descriptor header
18074 */
18075
18076 ECPGGetDescriptorHeader: SQL_GET SQL_DESCRIPTOR quoted_ident_stringvar ECPGGetDescHeaderItems
18077 { $$ = $3; }
18078 ;
18079
18080 ECPGGetDescHeaderItems: ECPGGetDescHeaderItem
18081 | ECPGGetDescHeaderItems ',' ECPGGetDescHeaderItem
18082 ;
18083
18084 ECPGGetDescHeaderItem: cvariable '=' desc_header_item
18085 { push_assignment($1, $3); }
18086 ;
18087
18088
18089 ECPGSetDescriptorHeader: SET SQL_DESCRIPTOR quoted_ident_stringvar ECPGSetDescHeaderItems
18090 { $$ = $3; }
18091 ;
18092
18093 ECPGSetDescHeaderItems: ECPGSetDescHeaderItem
18094 | ECPGSetDescHeaderItems ',' ECPGSetDescHeaderItem
18095 ;
18096
18097 ECPGSetDescHeaderItem: desc_header_item '=' IntConstVar
18098 {
18099 push_assignment($3, $1);
18100 }
18101 ;
18102
18103 IntConstVar: Iconst
18104 {
18105 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
18106
18107 sprintf(length, "%zu", strlen($1));
18108 new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
18109 $$ = $1;
18110 }
18111 | cvariable
18112 {
18113 $$ = $1;
18114 }
18115 ;
18116
18117 desc_header_item: SQL_COUNT { $$ = ECPGd_count; }
18118 ;
18119
18120 /*
18121 * manipulate a descriptor
18122 */
18123
18124 ECPGGetDescriptor: SQL_GET SQL_DESCRIPTOR quoted_ident_stringvar VALUE_P IntConstVar ECPGGetDescItems
18125 { $$.str = $5; $$.name = $3; }
18126 ;
18127
18128 ECPGGetDescItems: ECPGGetDescItem
18129 | ECPGGetDescItems ',' ECPGGetDescItem
18130 ;
18131
18132 ECPGGetDescItem: cvariable '=' descriptor_item { push_assignment($1, $3); };
18133
18134
18135 ECPGSetDescriptor: SET SQL_DESCRIPTOR quoted_ident_stringvar VALUE_P IntConstVar ECPGSetDescItems
18136 { $$.str = $5; $$.name = $3; }
18137 ;
18138
18139 ECPGSetDescItems: ECPGSetDescItem
18140 | ECPGSetDescItems ',' ECPGSetDescItem
18141 ;
18142
18143 ECPGSetDescItem: descriptor_item '=' AllConstVar
18144 {
18145 push_assignment($3, $1);
18146 }
18147 ;
18148
18149 AllConstVar: ecpg_fconst
18150 {
18151 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
18152
18153 sprintf(length, "%zu", strlen($1));
18154 new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
18155 $$ = $1;
18156 }
18157
18158 | IntConstVar
18159 {
18160 $$ = $1;
18161 }
18162
18163 | '-' ecpg_fconst
18164 {
18165 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
18166 char *var = cat2_str(mm_strdup("-"), $2);
18167
18168 sprintf(length, "%zu", strlen(var));
18169 new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
18170 $$ = var;
18171 }
18172
18173 | '-' Iconst
18174 {
18175 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
18176 char *var = cat2_str(mm_strdup("-"), $2);
18177
18178 sprintf(length, "%zu", strlen(var));
18179 new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
18180 $$ = var;
18181 }
18182
18183 | ecpg_sconst
18184 {
18185 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
18186 char *var = $1 + 1;
18187
18188 var[strlen(var) - 1] = '\0';
18189 sprintf(length, "%zu", strlen(var));
18190 new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
18191 $$ = var;
18192 }
18193 ;
18194
18195 descriptor_item: SQL_CARDINALITY { $$ = ECPGd_cardinality; }
18196 | DATA_P { $$ = ECPGd_data; }
18197 | SQL_DATETIME_INTERVAL_CODE { $$ = ECPGd_di_code; }
18198 | SQL_DATETIME_INTERVAL_PRECISION { $$ = ECPGd_di_precision; }
18199 | SQL_INDICATOR { $$ = ECPGd_indicator; }
18200 | SQL_KEY_MEMBER { $$ = ECPGd_key_member; }
18201 | SQL_LENGTH { $$ = ECPGd_length; }
18202 | NAME_P { $$ = ECPGd_name; }
18203 | SQL_NULLABLE { $$ = ECPGd_nullable; }
18204 | SQL_OCTET_LENGTH { $$ = ECPGd_octet; }
18205 | PRECISION { $$ = ECPGd_precision; }
18206 | SQL_RETURNED_LENGTH { $$ = ECPGd_length; }
18207 | SQL_RETURNED_OCTET_LENGTH { $$ = ECPGd_ret_octet; }
18208 | SQL_SCALE { $$ = ECPGd_scale; }
18209 | TYPE_P { $$ = ECPGd_type; }
18210 ;
18211
18212 /*
18213 * set/reset the automatic transaction mode, this needs a different handling
18214 * as the other set commands
18215 */
18216 ECPGSetAutocommit: SET SQL_AUTOCOMMIT '=' on_off { $$ = $4; }
18217 | SET SQL_AUTOCOMMIT TO on_off { $$ = $4; }
18218 ;
18219
18220 on_off: ON { $$ = mm_strdup("on"); }
18221 | OFF { $$ = mm_strdup("off"); }
18222 ;
18223
18224 /*
18225 * set the actual connection, this needs a different handling as the other
18226 * set commands
18227 */
18228 ECPGSetConnection: SET CONNECTION TO connection_object { $$ = $4; }
18229 | SET CONNECTION '=' connection_object { $$ = $4; }
18230 | SET CONNECTION connection_object { $$ = $3; }
18231 ;
18232
18233 /*
18234 * define a new type for embedded SQL
18235 */
18236 ECPGTypedef: TYPE_P
18237 {
18238 /* reset this variable so we see if there was */
18239 /* an initializer specified */
18240 initializer = 0;
18241 }
18242 ECPGColLabelCommon IS var_type opt_array_bounds opt_reference
18243 {
18244 add_typedef($3, $6.index1, $6.index2, $5.type_enum, $5.type_dimension, $5.type_index, initializer, *$7 ? 1 : 0);
18245
18246 if (auto_create_c == false)
18247 $$ = cat_str(7, mm_strdup("/* exec sql type"), mm_strdup($3), mm_strdup("is"), mm_strdup($5.type_str), mm_strdup($6.str), $7, mm_strdup("*/"));
18248 else
18249 $$ = cat_str(6, mm_strdup("typedef "), mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($3), mm_strdup($6.str), mm_strdup(";"));
18250 }
18251 ;
18252
18253 opt_reference: SQL_REFERENCE { $$ = mm_strdup("reference"); }
18254 | /*EMPTY*/ { $$ = EMPTY; }
18255 ;
18256
18257 /*
18258 * define the type of one variable for embedded SQL
18259 */
18260 ECPGVar: SQL_VAR
18261 {
18262 /* reset this variable so we see if there was */
18263 /* an initializer specified */
18264 initializer = 0;
18265 }
18266 ColLabel IS var_type opt_array_bounds opt_reference
18267 {
18268 struct variable *p = find_variable($3);
18269 char *dimension = $6.index1;
18270 char *length = $6.index2;
18271 struct ECPGtype * type;
18272
18273 if (($5.type_enum == ECPGt_struct ||
18274 $5.type_enum == ECPGt_union) &&
18275 initializer == 1)
18276 mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in EXEC SQL VAR command");
18277 else
18278 {
18279 adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0, false);
18280
18281 switch ($5.type_enum)
18282 {
18283 case ECPGt_struct:
18284 case ECPGt_union:
18285 if (atoi(dimension) < 0)
18286 type = ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof);
18287 else
18288 type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof), dimension);
18289 break;
18290
18291 case ECPGt_varchar:
18292 case ECPGt_bytea:
18293 if (atoi(dimension) == -1)
18294 type = ECPGmake_simple_type($5.type_enum, length, 0);
18295 else
18296 type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
18297 break;
18298
18299 case ECPGt_char:
18300 case ECPGt_unsigned_char:
18301 case ECPGt_string:
18302 if (atoi(dimension) == -1)
18303 type = ECPGmake_simple_type($5.type_enum, length, 0);
18304 else
18305 type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
18306 break;
18307
18308 default:
18309 if (atoi(length) >= 0)
18310 mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
18311
18312 if (atoi(dimension) < 0)
18313 type = ECPGmake_simple_type($5.type_enum, mm_strdup("1"), 0);
18314 else
18315 type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, mm_strdup("1"), 0), dimension);
18316 break;
18317 }
18318
18319 ECPGfree_type(p->type);
18320 p->type = type;
18321 }
18322
18323 $$ = cat_str(7, mm_strdup("/* exec sql var"), mm_strdup($3), mm_strdup("is"), mm_strdup($5.type_str), mm_strdup($6.str), $7, mm_strdup("*/"));
18324 }
18325 ;
18326
18327 /*
18328 * whenever statement: decide what to do in case of error/no data found
18329 * according to SQL standards we lack: SQLSTATE, CONSTRAINT and SQLEXCEPTION
18330 */
18331 ECPGWhenever: SQL_WHENEVER SQL_SQLERROR action
18332 {
18333 when_error.code = $<action>3.code;
18334 when_error.command = $<action>3.command;
18335 $$ = cat_str(3, mm_strdup("/* exec sql whenever sqlerror "), $3.str, mm_strdup("; */"));
18336 }
18337 | SQL_WHENEVER NOT SQL_FOUND action
18338 {
18339 when_nf.code = $<action>4.code;
18340 when_nf.command = $<action>4.command;
18341 $$ = cat_str(3, mm_strdup("/* exec sql whenever not found "), $4.str, mm_strdup("; */"));
18342 }
18343 | SQL_WHENEVER SQL_SQLWARNING action
18344 {
18345 when_warn.code = $<action>3.code;
18346 when_warn.command = $<action>3.command;
18347 $$ = cat_str(3, mm_strdup("/* exec sql whenever sql_warning "), $3.str, mm_strdup("; */"));
18348 }
18349 ;
18350
18351 action : CONTINUE_P
18352 {
18353 $<action>$.code = W_NOTHING;
18354 $<action>$.command = NULL;
18355 $<action>$.str = mm_strdup("continue");
18356 }
18357 | SQL_SQLPRINT
18358 {
18359 $<action>$.code = W_SQLPRINT;
18360 $<action>$.command = NULL;
18361 $<action>$.str = mm_strdup("sqlprint");
18362 }
18363 | SQL_STOP
18364 {
18365 $<action>$.code = W_STOP;
18366 $<action>$.command = NULL;
18367 $<action>$.str = mm_strdup("stop");
18368 }
18369 | SQL_GOTO name
18370 {
18371 $<action>$.code = W_GOTO;
18372 $<action>$.command = mm_strdup($2);
18373 $<action>$.str = cat2_str(mm_strdup("goto "), $2);
18374 }
18375 | SQL_GO TO name
18376 {
18377 $<action>$.code = W_GOTO;
18378 $<action>$.command = mm_strdup($3);
18379 $<action>$.str = cat2_str(mm_strdup("goto "), $3);
18380 }
18381 | DO name '(' c_args ')'
18382 {
18383 $<action>$.code = W_DO;
18384 $<action>$.command = cat_str(4, $2, mm_strdup("("), $4, mm_strdup(")"));
18385 $<action>$.str = cat2_str(mm_strdup("do"), mm_strdup($<action>$.command));
18386 }
18387 | DO SQL_BREAK
18388 {
18389 $<action>$.code = W_BREAK;
18390 $<action>$.command = NULL;
18391 $<action>$.str = mm_strdup("break");
18392 }
18393 | DO CONTINUE_P
18394 {
18395 $<action>$.code = W_CONTINUE;
18396 $<action>$.command = NULL;
18397 $<action>$.str = mm_strdup("continue");
18398 }
18399 | CALL name '(' c_args ')'
18400 {
18401 $<action>$.code = W_DO;
18402 $<action>$.command = cat_str(4, $2, mm_strdup("("), $4, mm_strdup(")"));
18403 $<action>$.str = cat2_str(mm_strdup("call"), mm_strdup($<action>$.command));
18404 }
18405 | CALL name
18406 {
18407 $<action>$.code = W_DO;
18408 $<action>$.command = cat2_str($2, mm_strdup("()"));
18409 $<action>$.str = cat2_str(mm_strdup("call"), mm_strdup($<action>$.command));
18410 }
18411 ;
18412
18413 /* some other stuff for ecpg */
18414
18415 /* additional unreserved keywords */
18416 ECPGKeywords: ECPGKeywords_vanames { $$ = $1; }
18417 | ECPGKeywords_rest { $$ = $1; }
18418 ;
18419
18420 ECPGKeywords_vanames: SQL_BREAK { $$ = mm_strdup("break"); }
18421 | SQL_CARDINALITY { $$ = mm_strdup("cardinality"); }
18422 | SQL_COUNT { $$ = mm_strdup("count"); }
18423 | SQL_DATETIME_INTERVAL_CODE { $$ = mm_strdup("datetime_interval_code"); }
18424 | SQL_DATETIME_INTERVAL_PRECISION { $$ = mm_strdup("datetime_interval_precision"); }
18425 | SQL_FOUND { $$ = mm_strdup("found"); }
18426 | SQL_GO { $$ = mm_strdup("go"); }
18427 | SQL_GOTO { $$ = mm_strdup("goto"); }
18428 | SQL_IDENTIFIED { $$ = mm_strdup("identified"); }
18429 | SQL_INDICATOR { $$ = mm_strdup("indicator"); }
18430 | SQL_KEY_MEMBER { $$ = mm_strdup("key_member"); }
18431 | SQL_LENGTH { $$ = mm_strdup("length"); }
18432 | SQL_NULLABLE { $$ = mm_strdup("nullable"); }
18433 | SQL_OCTET_LENGTH { $$ = mm_strdup("octet_length"); }
18434 | SQL_RETURNED_LENGTH { $$ = mm_strdup("returned_length"); }
18435 | SQL_RETURNED_OCTET_LENGTH { $$ = mm_strdup("returned_octet_length"); }
18436 | SQL_SCALE { $$ = mm_strdup("scale"); }
18437 | SQL_SECTION { $$ = mm_strdup("section"); }
18438 | SQL_SQLERROR { $$ = mm_strdup("sqlerror"); }
18439 | SQL_SQLPRINT { $$ = mm_strdup("sqlprint"); }
18440 | SQL_SQLWARNING { $$ = mm_strdup("sqlwarning"); }
18441 | SQL_STOP { $$ = mm_strdup("stop"); }
18442 ;
18443
18444 ECPGKeywords_rest: SQL_CONNECT { $$ = mm_strdup("connect"); }
18445 | SQL_DESCRIBE { $$ = mm_strdup("describe"); }
18446 | SQL_DISCONNECT { $$ = mm_strdup("disconnect"); }
18447 | SQL_OPEN { $$ = mm_strdup("open"); }
18448 | SQL_VAR { $$ = mm_strdup("var"); }
18449 | SQL_WHENEVER { $$ = mm_strdup("whenever"); }
18450 ;
18451
18452 /* additional keywords that can be SQL type names (but not ECPGColLabels) */
18453 ECPGTypeName: SQL_BOOL { $$ = mm_strdup("bool"); }
18454 | SQL_LONG { $$ = mm_strdup("long"); }
18455 | SQL_OUTPUT { $$ = mm_strdup("output"); }
18456 | SQL_SHORT { $$ = mm_strdup("short"); }
18457 | SQL_STRUCT { $$ = mm_strdup("struct"); }
18458 | SQL_SIGNED { $$ = mm_strdup("signed"); }
18459 | SQL_UNSIGNED { $$ = mm_strdup("unsigned"); }
18460 ;
18461
18462 symbol: ColLabel { $$ = $1; }
18463 ;
18464
18465 ECPGColId: ecpg_ident { $$ = $1; }
18466 | unreserved_keyword { $$ = $1; }
18467 | col_name_keyword { $$ = $1; }
18468 | ECPGunreserved_interval { $$ = $1; }
18469 | ECPGKeywords { $$ = $1; }
18470 | ECPGCKeywords { $$ = $1; }
18471 | CHAR_P { $$ = mm_strdup("char"); }
18472 | VALUES { $$ = mm_strdup("values"); }
18473 ;
18474
18475 /*
18476 * Name classification hierarchy.
18477 *
18478 * These productions should match those in the core grammar, except that
18479 * we use all_unreserved_keyword instead of unreserved_keyword, and
18480 * where possible include ECPG keywords as well as core keywords.
18481 */
18482
18483 /* Column identifier --- names that can be column, table, etc names.
18484 */
18485 ColId: ecpg_ident { $$ = $1; }
18486 | all_unreserved_keyword { $$ = $1; }
18487 | col_name_keyword { $$ = $1; }
18488 | ECPGKeywords { $$ = $1; }
18489 | ECPGCKeywords { $$ = $1; }
18490 | CHAR_P { $$ = mm_strdup("char"); }
18491 | VALUES { $$ = mm_strdup("values"); }
18492 ;
18493
18494 /* Type/function identifier --- names that can be type or function names.
18495 */
18496 type_function_name: ecpg_ident { $$ = $1; }
18497 | all_unreserved_keyword { $$ = $1; }
18498 | type_func_name_keyword { $$ = $1; }
18499 | ECPGKeywords { $$ = $1; }
18500 | ECPGCKeywords { $$ = $1; }
18501 | ECPGTypeName { $$ = $1; }
18502 ;
18503
18504 /* Column label --- allowed labels in "AS" clauses.
18505 * This presently includes *all* Postgres keywords.
18506 */
18507 ColLabel: ECPGColLabel { $$ = $1; }
18508 | ECPGTypeName { $$ = $1; }
18509 | CHAR_P { $$ = mm_strdup("char"); }
18510 | CURRENT_P { $$ = mm_strdup("current"); }
18511 | INPUT_P { $$ = mm_strdup("input"); }
18512 | INT_P { $$ = mm_strdup("int"); }
18513 | TO { $$ = mm_strdup("to"); }
18514 | UNION { $$ = mm_strdup("union"); }
18515 | VALUES { $$ = mm_strdup("values"); }
18516 | ECPGCKeywords { $$ = $1; }
18517 | ECPGunreserved_interval { $$ = $1; }
18518 ;
18519
18520 ECPGColLabel: ECPGColLabelCommon { $$ = $1; }
18521 | unreserved_keyword { $$ = $1; }
18522 | reserved_keyword { $$ = $1; }
18523 | ECPGKeywords_rest { $$ = $1; }
18524 | CONNECTION { $$ = mm_strdup("connection"); }
18525 ;
18526
18527 ECPGColLabelCommon: ecpg_ident { $$ = $1; }
18528 | col_name_keyword { $$ = $1; }
18529 | type_func_name_keyword { $$ = $1; }
18530 | ECPGKeywords_vanames { $$ = $1; }
18531 ;
18532
18533 ECPGCKeywords: S_AUTO { $$ = mm_strdup("auto"); }
18534 | S_CONST { $$ = mm_strdup("const"); }
18535 | S_EXTERN { $$ = mm_strdup("extern"); }
18536 | S_REGISTER { $$ = mm_strdup("register"); }
18537 | S_STATIC { $$ = mm_strdup("static"); }
18538 | S_TYPEDEF { $$ = mm_strdup("typedef"); }
18539 | S_VOLATILE { $$ = mm_strdup("volatile"); }
18540 ;
18541
18542 /* "Unreserved" keywords --- available for use as any kind of name.
18543 */
18544
18545 /*
18546 * The following symbols must be excluded from ECPGColLabel and directly
18547 * included into ColLabel to enable C variables to get names from ECPGColLabel:
18548 * DAY_P, HOUR_P, MINUTE_P, MONTH_P, SECOND_P, YEAR_P.
18549 *
18550 * We also have to exclude CONNECTION, CURRENT, and INPUT for various reasons.
18551 * CONNECTION can be added back in all_unreserved_keyword, but CURRENT and
18552 * INPUT are reserved for ecpg purposes.
18553 *
18554 * The mentioned exclusions are done by $replace_line settings in parse.pl.
18555 */
18556 all_unreserved_keyword: unreserved_keyword { $$ = $1; }
18557 | ECPGunreserved_interval { $$ = $1; }
18558 | CONNECTION { $$ = mm_strdup("connection"); }
18559 ;
18560
18561 ECPGunreserved_interval: DAY_P { $$ = mm_strdup("day"); }
18562 | HOUR_P { $$ = mm_strdup("hour"); }
18563 | MINUTE_P { $$ = mm_strdup("minute"); }
18564 | MONTH_P { $$ = mm_strdup("month"); }
18565 | SECOND_P { $$ = mm_strdup("second"); }
18566 | YEAR_P { $$ = mm_strdup("year"); }
18567 ;
18568
18569
18570 into_list : coutputvariable | into_list ',' coutputvariable
18571 ;
18572
18573 ecpgstart: SQL_START {
18574 reset_variables();
18575 pacounter = 1;
18576 }
18577 ;
18578
18579 c_args: /*EMPTY*/ { $$ = EMPTY; }
18580 | c_list { $$ = $1; }
18581 ;
18582
18583 coutputvariable: cvariable indicator
18584 { add_variable_to_head(&argsresult, find_variable($1), find_variable($2)); }
18585 | cvariable
18586 { add_variable_to_head(&argsresult, find_variable($1), &no_indicator); }
18587 ;
18588
18589
18590 civarind: cvariable indicator
18591 {
18592 if (find_variable($2)->type->type == ECPGt_array)
18593 mmerror(PARSE_ERROR, ET_ERROR, "arrays of indicators are not allowed on input");
18594
18595 add_variable_to_head(&argsinsert, find_variable($1), find_variable($2));
18596 $$ = create_questionmarks($1, false);
18597 }
18598 ;
18599
18600 char_civar: char_variable
18601 {
18602 char *ptr = strstr($1, ".arr");
18603
18604 if (ptr) /* varchar, we need the struct name here, not the struct element */
18605 *ptr = '\0';
18606 add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
18607 $$ = $1;
18608 }
18609 ;
18610
18611 civar: cvariable
18612 {
18613 add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
18614 $$ = create_questionmarks($1, false);
18615 }
18616 ;
18617
18618 indicator: cvariable { check_indicator((find_variable($1))->type); $$ = $1; }
18619 | SQL_INDICATOR cvariable { check_indicator((find_variable($2))->type); $$ = $2; }
18620 | SQL_INDICATOR name { check_indicator((find_variable($2))->type); $$ = $2; }
18621 ;
18622
18623 cvariable: CVARIABLE
18624 {
18625 /* As long as multidimensional arrays are not implemented we have to check for those here */
18626 char *ptr = $1;
18627 int brace_open=0, brace = false;
18628
18629 for (; *ptr; ptr++)
18630 {
18631 switch (*ptr)
18632 {
18633 case '[':
18634 if (brace)
18635 mmfatal(PARSE_ERROR, "multidimensional arrays for simple data types are not supported");
18636 brace_open++;
18637 break;
18638 case ']':
18639 brace_open--;
18640 if (brace_open == 0)
18641 brace = true;
18642 break;
18643 case '\t':
18644 case ' ':
18645 break;
18646 default:
18647 if (brace_open == 0)
18648 brace = false;
18649 break;
18650 }
18651 }
18652 $$ = $1;
18653 }
18654 ;
18655
18656 ecpg_param: PARAM { $$ = make_name(); } ;
18657
18658 ecpg_bconst: BCONST { $$ = $1; } ;
18659
18660 ecpg_fconst: FCONST { $$ = make_name(); } ;
18661
18662 ecpg_sconst: SCONST { $$ = $1; } ;
18663
18664 ecpg_xconst: XCONST { $$ = $1; } ;
18665
18666 ecpg_ident: IDENT { $$ = $1; }
18667 | CSTRING { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
18668 ;
18669
18670 quoted_ident_stringvar: name
18671 { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
18672 | char_variable
18673 { $$ = make3_str(mm_strdup("("), $1, mm_strdup(")")); }
18674 ;
18675
18676 /*
18677 * C stuff
18678 */
18679
18680 c_stuff_item: c_anything { $$ = $1; }
18681 | '(' ')' { $$ = mm_strdup("()"); }
18682 | '(' c_stuff ')'
18683 { $$ = cat_str(3, mm_strdup("("), $2, mm_strdup(")")); }
18684 ;
18685
18686 c_stuff: c_stuff_item { $$ = $1; }
18687 | c_stuff c_stuff_item
18688 { $$ = cat2_str($1, $2); }
18689 ;
18690
18691 c_list: c_term { $$ = $1; }
18692 | c_list ',' c_term { $$ = cat_str(3, $1, mm_strdup(","), $3); }
18693 ;
18694
18695 c_term: c_stuff { $$ = $1; }
18696 | '{' c_list '}' { $$ = cat_str(3, mm_strdup("{"), $2, mm_strdup("}")); }
18697 ;
18698
18699 c_thing: c_anything { $$ = $1; }
18700 | '(' { $$ = mm_strdup("("); }
18701 | ')' { $$ = mm_strdup(")"); }
18702 | ',' { $$ = mm_strdup(","); }
18703 | ';' { $$ = mm_strdup(";"); }
18704 ;
18705
18706 c_anything: ecpg_ident { $$ = $1; }
18707 | Iconst { $$ = $1; }
18708 | ecpg_fconst { $$ = $1; }
18709 | ecpg_sconst { $$ = $1; }
18710 | '*' { $$ = mm_strdup("*"); }
18711 | '+' { $$ = mm_strdup("+"); }
18712 | '-' { $$ = mm_strdup("-"); }
18713 | '/' { $$ = mm_strdup("/"); }
18714 | '%' { $$ = mm_strdup("%"); }
18715 | NULL_P { $$ = mm_strdup("NULL"); }
18716 | S_ADD { $$ = mm_strdup("+="); }
18717 | S_AND { $$ = mm_strdup("&&"); }
18718 | S_ANYTHING { $$ = make_name(); }
18719 | S_AUTO { $$ = mm_strdup("auto"); }
18720 | S_CONST { $$ = mm_strdup("const"); }
18721 | S_DEC { $$ = mm_strdup("--"); }
18722 | S_DIV { $$ = mm_strdup("/="); }
18723 | S_DOTPOINT { $$ = mm_strdup(".*"); }
18724 | S_EQUAL { $$ = mm_strdup("=="); }
18725 | S_EXTERN { $$ = mm_strdup("extern"); }
18726 | S_INC { $$ = mm_strdup("++"); }
18727 | S_LSHIFT { $$ = mm_strdup("<<"); }
18728 | S_MEMBER { $$ = mm_strdup("->"); }
18729 | S_MEMPOINT { $$ = mm_strdup("->*"); }
18730 | S_MOD { $$ = mm_strdup("%="); }
18731 | S_MUL { $$ = mm_strdup("*="); }
18732 | S_NEQUAL { $$ = mm_strdup("!="); }
18733 | S_OR { $$ = mm_strdup("||"); }
18734 | S_REGISTER { $$ = mm_strdup("register"); }
18735 | S_RSHIFT { $$ = mm_strdup(">>"); }
18736 | S_STATIC { $$ = mm_strdup("static"); }
18737 | S_SUB { $$ = mm_strdup("-="); }
18738 | S_TYPEDEF { $$ = mm_strdup("typedef"); }
18739 | S_VOLATILE { $$ = mm_strdup("volatile"); }
18740 | SQL_BOOL { $$ = mm_strdup("bool"); }
18741 | ENUM_P { $$ = mm_strdup("enum"); }
18742 | HOUR_P { $$ = mm_strdup("hour"); }
18743 | INT_P { $$ = mm_strdup("int"); }
18744 | SQL_LONG { $$ = mm_strdup("long"); }
18745 | MINUTE_P { $$ = mm_strdup("minute"); }
18746 | MONTH_P { $$ = mm_strdup("month"); }
18747 | SECOND_P { $$ = mm_strdup("second"); }
18748 | SQL_SHORT { $$ = mm_strdup("short"); }
18749 | SQL_SIGNED { $$ = mm_strdup("signed"); }
18750 | SQL_STRUCT { $$ = mm_strdup("struct"); }
18751 | SQL_UNSIGNED { $$ = mm_strdup("unsigned"); }
18752 | YEAR_P { $$ = mm_strdup("year"); }
18753 | CHAR_P { $$ = mm_strdup("char"); }
18754 | FLOAT_P { $$ = mm_strdup("float"); }
18755 | TO { $$ = mm_strdup("to"); }
18756 | UNION { $$ = mm_strdup("union"); }
18757 | VARCHAR { $$ = mm_strdup("varchar"); }
18758 | '[' { $$ = mm_strdup("["); }
18759 | ']' { $$ = mm_strdup("]"); }
18760 | '=' { $$ = mm_strdup("="); }
18761 | ':' { $$ = mm_strdup(":"); }
18762 ;
18763
18764 DeallocateStmt: DEALLOCATE prepared_name { check_declared_list($2); $$ = $2; }
18765 | DEALLOCATE PREPARE prepared_name { check_declared_list($3); $$ = $3; }
18766 | DEALLOCATE ALL { $$ = mm_strdup("all"); }
18767 | DEALLOCATE PREPARE ALL { $$ = mm_strdup("all"); }
18768 ;
18769
18770 Iresult: Iconst { $$ = $1; }
18771 | '(' Iresult ')' { $$ = cat_str(3, mm_strdup("("), $2, mm_strdup(")")); }
18772 | Iresult '+' Iresult { $$ = cat_str(3, $1, mm_strdup("+"), $3); }
18773 | Iresult '-' Iresult { $$ = cat_str(3, $1, mm_strdup("-"), $3); }
18774 | Iresult '*' Iresult { $$ = cat_str(3, $1, mm_strdup("*"), $3); }
18775 | Iresult '/' Iresult { $$ = cat_str(3, $1, mm_strdup("/"), $3); }
18776 | Iresult '%' Iresult { $$ = cat_str(3, $1, mm_strdup("%"), $3); }
18777 | ecpg_sconst { $$ = $1; }
18778 | ColId { $$ = $1; }
18779 | ColId '(' var_type ')' { if (pg_strcasecmp($1, "sizeof") != 0)
18780 mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition");
18781 else
18782 $$ = cat_str(4, $1, mm_strdup("("), $3.type_str, mm_strdup(")"));
18783 }
18784 ;
18785
18786 execute_rest: /* EMPTY */ { $$ = EMPTY; }
18787 | ecpg_using opt_ecpg_into { $$ = EMPTY; }
18788 | ecpg_into ecpg_using { $$ = EMPTY; }
18789 | ecpg_into { $$ = EMPTY; }
18790 ;
18791
18792 ecpg_into: INTO into_list { $$ = EMPTY; }
18793 | into_descriptor { $$ = $1; }
18794 ;
18795
18796 opt_ecpg_into: /* EMPTY */ { $$ = EMPTY; }
18797 | ecpg_into { $$ = $1; }
18798 ;
18799
18800 ecpg_fetch_into: ecpg_into { $$ = $1; }
18801 | using_descriptor
18802 {
18803 struct variable *var;
18804
18805 var = argsinsert->variable;
18806 remove_variable_from_list(&argsinsert, var);
18807 add_variable_to_head(&argsresult, var, &no_indicator);
18808 $$ = $1;
18809 }
18810 ;
18811
18812 opt_ecpg_fetch_into: /* EMPTY */ { $$ = EMPTY; }
18813 | ecpg_fetch_into { $$ = $1; }
18814 ;
18815
18816 %%
18817
18818 void base_yyerror(const char *error)
18819 {
18820 /* translator: %s is typically the translation of "syntax error" */
18821 mmerror(PARSE_ERROR, ET_ERROR, "%s at or near \"%s\"",
18822 _(error), token_start ? token_start : base_yytext);
18823 }
18824
parser_init(void)18825 void parser_init(void)
18826 {
18827 /* This function is empty. It only exists for compatibility with the backend parser right now. */
18828 }
18829