LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/preproc - preproc.y (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 1483 4964 29.9 %
Date: 2024-05-09 16:10:48 Functions: 10 15 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       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 *name);
      69             : 
      70             : /*
      71             :  * Handle parsing errors and warnings
      72             :  */
      73             : static void
      74           0 : vmmerror(int error_code, enum errortype type, const char *error, va_list ap)
      75             : {
      76             :     /* localize the error message string */
      77           0 :     error = _(error);
      78             : 
      79           0 :     fprintf(stderr, "%s:%d: ", input_filename, base_yylineno);
      80             : 
      81           0 :     switch(type)
      82             :     {
      83           0 :         case ET_WARNING:
      84           0 :             fprintf(stderr, _("WARNING: "));
      85           0 :             break;
      86           0 :         case ET_ERROR:
      87           0 :             fprintf(stderr, _("ERROR: "));
      88           0 :             break;
      89             :     }
      90             : 
      91           0 :     vfprintf(stderr, error, ap);
      92             : 
      93           0 :     fprintf(stderr, "\n");
      94             : 
      95           0 :     switch(type)
      96             :     {
      97           0 :         case ET_WARNING:
      98           0 :             break;
      99           0 :         case ET_ERROR:
     100           0 :             ret_value = error_code;
     101           0 :             break;
     102             :     }
     103           0 : }
     104             : 
     105             : void
     106           0 : mmerror(int error_code, enum errortype type, const char *error, ...)
     107             : {
     108             :     va_list     ap;
     109             : 
     110           0 :     va_start(ap, error);
     111           0 :     vmmerror(error_code, type, error, ap);
     112           0 :     va_end(ap);
     113           0 : }
     114             : 
     115             : void
     116           0 : mmfatal(int error_code, const char *error, ...)
     117             : {
     118             :     va_list     ap;
     119             : 
     120           0 :     va_start(ap, error);
     121           0 :     vmmerror(error_code, ET_ERROR, error, ap);
     122           0 :     va_end(ap);
     123             : 
     124           0 :     if (base_yyin)
     125           0 :         fclose(base_yyin);
     126           0 :     if (base_yyout)
     127           0 :         fclose(base_yyout);
     128             : 
     129           0 :     if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0)
     130           0 :         fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);
     131           0 :     exit(error_code);
     132             : }
     133             : 
     134             : /*
     135             :  * string concatenation
     136             :  */
     137             : 
     138             : static char *
     139       23366 : cat2_str(char *str1, char *str2)
     140             : {
     141       23366 :     char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + 2);
     142             : 
     143       23366 :     strcpy(res_str, str1);
     144       23366 :     if (strlen(str1) != 0 && strlen(str2) != 0)
     145       14026 :         strcat(res_str, " ");
     146       23366 :     strcat(res_str, str2);
     147       23366 :     free(str1);
     148       23366 :     free(str2);
     149       23366 :     return res_str;
     150             : }
     151             : 
     152             : static char *
     153        7486 : cat_str(int count, ...)
     154             : {
     155             :     va_list     args;
     156             :     int         i;
     157             :     char        *res_str;
     158             : 
     159        7486 :     va_start(args, count);
     160             : 
     161        7486 :     res_str = va_arg(args, char *);
     162             : 
     163             :     /* now add all other strings */
     164       29286 :     for (i = 1; i < count; i++)
     165       21800 :         res_str = cat2_str(res_str, va_arg(args, char *));
     166             : 
     167        7486 :     va_end(args);
     168             : 
     169        7486 :     return res_str;
     170             : }
     171             : 
     172             : static char *
     173         100 : make2_str(char *str1, char *str2)
     174             : {
     175         100 :     char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) + 1);
     176             : 
     177         100 :     strcpy(res_str, str1);
     178         100 :     strcat(res_str, str2);
     179         100 :     free(str1);
     180         100 :     free(str2);
     181         100 :     return res_str;
     182             : }
     183             : 
     184             : static char *
     185        3542 : make3_str(char *str1, char *str2, char *str3)
     186             : {
     187        3542 :     char * res_str  = (char *)mm_alloc(strlen(str1) + strlen(str2) +strlen(str3) + 1);
     188             : 
     189        3542 :     strcpy(res_str, str1);
     190        3542 :     strcat(res_str, str2);
     191        3542 :     strcat(res_str, str3);
     192        3542 :     free(str1);
     193        3542 :     free(str2);
     194        3542 :     free(str3);
     195        3542 :     return res_str;
     196             : }
     197             : 
     198             : /* and the rest */
     199             : static char *
     200        4682 : make_name(void)
     201             : {
     202        4682 :     return mm_strdup(base_yytext);
     203             : }
     204             : 
     205             : static char *
     206         246 : create_questionmarks(char *name, bool array)
     207             : {
     208         246 :     struct variable *p = find_variable(name);
     209             :     int count;
     210         246 :     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         246 :     if (p->type->type == ECPGt_struct || (array && p->type->type == ECPGt_array && p->type->u.element->type == ECPGt_struct))
     218           0 :     {
     219             :         struct ECPGstruct_member *m;
     220             : 
     221           0 :         if (p->type->type == ECPGt_struct)
     222           0 :             m = p->type->u.members;
     223             :         else
     224           0 :             m = p->type->u.element->u.members;
     225             : 
     226           0 :         for (count = 0; m != NULL; m=m->next, count++);
     227             :     }
     228             :     else
     229         246 :         count = 1;
     230             : 
     231         492 :     for (; count > 0; count --)
     232             :     {
     233         246 :         sprintf(pacounter_buffer, "$%d", pacounter++);
     234         246 :         result = cat_str(3, result, mm_strdup(pacounter_buffer), mm_strdup(" , "));
     235             :     }
     236             : 
     237             :     /* removed the trailing " ," */
     238             : 
     239         246 :     result[strlen(result)-3] = '\0';
     240         246 :     return result;
     241             : }
     242             : 
     243             : static char *
     244          74 : 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          74 :     char *result = EMPTY;
     258             :     int insert;
     259             : 
     260         222 :     for (insert = 1; insert >= 0; insert--)
     261             :     {
     262             :         struct arguments *list;
     263             :         struct arguments *ptr;
     264         148 :         struct arguments *newlist = NULL;
     265             :         struct variable *newvar, *newind;
     266             : 
     267         148 :         list = (insert ? cur->argsinsert : cur->argsresult);
     268             : 
     269         214 :         for (ptr = list; ptr != NULL; ptr = ptr->next)
     270             :         {
     271             :             char var_text[20];
     272             :             char *original_var;
     273          66 :             bool skip_set_var = false;
     274          66 :             bool var_ptr = false;
     275             : 
     276             :             /* change variable name to "ECPGget_var(<counter>)" */
     277          66 :             original_var = ptr->variable->name;
     278          66 :             sprintf(var_text, "%d))", ecpg_internal_var);
     279             : 
     280             :             /* Don't emit ECPGset_var() calls for global variables */
     281          66 :             if (ptr->variable->brace_level == 0)
     282             :             {
     283          40 :                 newvar = ptr->variable;
     284          40 :                 skip_set_var = true;
     285             :             }
     286          26 :             else if ((ptr->variable->type->type == ECPGt_char_variable)
     287           0 :                      && (strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement")) == 0))
     288             :             {
     289           0 :                 newvar = ptr->variable;
     290           0 :                 skip_set_var = true;
     291             :             }
     292          26 :             else if ((ptr->variable->type->type != ECPGt_varchar
     293          24 :                       && ptr->variable->type->type != ECPGt_char
     294          14 :                       && ptr->variable->type->type != ECPGt_unsigned_char
     295          14 :                       && ptr->variable->type->type != ECPGt_string
     296          14 :                       && ptr->variable->type->type != ECPGt_bytea)
     297          12 :                      && atoi(ptr->variable->type->size) > 1)
     298             :             {
     299           0 :                 newvar = new_variable(cat_str(4, mm_strdup("("),
     300           0 :                                               mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)),
     301             :                                               mm_strdup(" *)(ECPGget_var("),
     302             :                                               mm_strdup(var_text)),
     303           0 :                                       ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
     304             :                                                                                mm_strdup("1"),
     305           0 :                                                                                ptr->variable->type->u.element->counter),
     306           0 :                                                           ptr->variable->type->size),
     307             :                                       0);
     308             :             }
     309          26 :             else if ((ptr->variable->type->type == ECPGt_varchar
     310          24 :                       || ptr->variable->type->type == ECPGt_char
     311          14 :                       || ptr->variable->type->type == ECPGt_unsigned_char
     312          14 :                       || ptr->variable->type->type == ECPGt_string
     313          14 :                       || ptr->variable->type->type == ECPGt_bytea)
     314          14 :                      && atoi(ptr->variable->type->size) > 1)
     315             :             {
     316          12 :                 newvar = new_variable(cat_str(4, mm_strdup("("),
     317           6 :                                               mm_strdup(ecpg_type_name(ptr->variable->type->type)),
     318             :                                               mm_strdup(" *)(ECPGget_var("),
     319             :                                               mm_strdup(var_text)),
     320           6 :                                       ECPGmake_simple_type(ptr->variable->type->type,
     321           6 :                                                            ptr->variable->type->size,
     322           6 :                                                            ptr->variable->type->counter),
     323             :                                       0);
     324           6 :                 if (ptr->variable->type->type == ECPGt_varchar ||
     325           4 :                     ptr->variable->type->type == ECPGt_bytea)
     326           4 :                     var_ptr = true;
     327             :             }
     328          20 :             else if (ptr->variable->type->type == ECPGt_struct
     329          20 :                      || ptr->variable->type->type == ECPGt_union)
     330             :             {
     331           0 :                 newvar = new_variable(cat_str(5, mm_strdup("(*("),
     332           0 :                                               mm_strdup(ptr->variable->type->type_name),
     333             :                                               mm_strdup(" *)(ECPGget_var("),
     334             :                                               mm_strdup(var_text),
     335             :                                               mm_strdup(")")),
     336           0 :                                       ECPGmake_struct_type(ptr->variable->type->u.members,
     337           0 :                                                            ptr->variable->type->type,
     338           0 :                                                            ptr->variable->type->type_name,
     339           0 :                                                            ptr->variable->type->struct_sizeof),
     340             :                                       0);
     341           0 :                 var_ptr = true;
     342             :             }
     343          20 :             else if (ptr->variable->type->type == ECPGt_array)
     344             :             {
     345           2 :                 if (ptr->variable->type->u.element->type == ECPGt_struct
     346           0 :                     || ptr->variable->type->u.element->type == ECPGt_union)
     347             :                 {
     348           4 :                     newvar = new_variable(cat_str(5, mm_strdup("(*("),
     349           2 :                                               mm_strdup(ptr->variable->type->u.element->type_name),
     350             :                                               mm_strdup(" *)(ECPGget_var("),
     351             :                                               mm_strdup(var_text),
     352             :                                               mm_strdup(")")),
     353           2 :                                           ECPGmake_struct_type(ptr->variable->type->u.element->u.members,
     354           2 :                                                                ptr->variable->type->u.element->type,
     355           2 :                                                                ptr->variable->type->u.element->type_name,
     356           2 :                                                                ptr->variable->type->u.element->struct_sizeof),
     357             :                                           0);
     358             :                 }
     359             :                 else
     360             :                 {
     361           0 :                     newvar = new_variable(cat_str(4, mm_strdup("("),
     362           0 :                                                   mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)),
     363             :                                                   mm_strdup(" *)(ECPGget_var("),
     364             :                                                   mm_strdup(var_text)),
     365           0 :                                           ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
     366           0 :                                                                                    ptr->variable->type->u.element->size,
     367           0 :                                                                                    ptr->variable->type->u.element->counter),
     368           0 :                                                               ptr->variable->type->size),
     369             :                                           0);
     370           0 :                     var_ptr = true;
     371             :                 }
     372             :             }
     373             :             else
     374             :             {
     375          36 :                 newvar = new_variable(cat_str(4, mm_strdup("*("),
     376          18 :                                               mm_strdup(ecpg_type_name(ptr->variable->type->type)),
     377             :                                               mm_strdup(" *)(ECPGget_var("),
     378             :                                               mm_strdup(var_text)),
     379          18 :                                       ECPGmake_simple_type(ptr->variable->type->type,
     380          18 :                                                            ptr->variable->type->size,
     381          18 :                                                            ptr->variable->type->counter),
     382             :                                       0);
     383          18 :                 var_ptr = true;
     384             :             }
     385             : 
     386             :             /* create call to "ECPGset_var(<counter>, <connection>, <pointer>. <line number>)" */
     387          66 :             if (!skip_set_var)
     388             :             {
     389          26 :                 sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
     390          26 :                 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          66 :             if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
     397             :             {
     398          64 :                 newind = ptr->indicator;
     399             :             }
     400             :             else
     401             :             {
     402             :                 /* change variable name to "ECPGget_var(<counter>)" */
     403           2 :                 original_var = ptr->indicator->name;
     404           2 :                 sprintf(var_text, "%d))", ecpg_internal_var);
     405           2 :                 var_ptr = false;
     406             : 
     407           2 :                 if (ptr->indicator->type->type == ECPGt_struct
     408           2 :                     || ptr->indicator->type->type == ECPGt_union)
     409             :                 {
     410           0 :                     newind = new_variable(cat_str(5, mm_strdup("(*("),
     411           0 :                                               mm_strdup(ptr->indicator->type->type_name),
     412             :                                               mm_strdup(" *)(ECPGget_var("),
     413             :                                               mm_strdup(var_text),
     414             :                                               mm_strdup(")")),
     415           0 :                                           ECPGmake_struct_type(ptr->indicator->type->u.members,
     416           0 :                                                                ptr->indicator->type->type,
     417           0 :                                                                ptr->indicator->type->type_name,
     418           0 :                                                                ptr->indicator->type->struct_sizeof),
     419             :                                           0);
     420           0 :                     var_ptr = true;
     421             :                 }
     422           2 :                 else if (ptr->indicator->type->type == ECPGt_array)
     423             :                 {
     424           2 :                     if (ptr->indicator->type->u.element->type == ECPGt_struct
     425           0 :                         || ptr->indicator->type->u.element->type == ECPGt_union)
     426             :                     {
     427           4 :                         newind = new_variable(cat_str(5, mm_strdup("(*("),
     428           2 :                                               mm_strdup(ptr->indicator->type->u.element->type_name),
     429             :                                               mm_strdup(" *)(ECPGget_var("),
     430             :                                               mm_strdup(var_text),
     431             :                                               mm_strdup(")")),
     432           2 :                                               ECPGmake_struct_type(ptr->indicator->type->u.element->u.members,
     433           2 :                                                                    ptr->indicator->type->u.element->type,
     434           2 :                                                                    ptr->indicator->type->u.element->type_name,
     435           2 :                                                                    ptr->indicator->type->u.element->struct_sizeof),
     436             :                                               0);
     437             :                     }
     438             :                     else
     439             :                     {
     440           0 :                         newind = new_variable(cat_str(4, mm_strdup("("),
     441           0 :                                                       mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)),
     442             :                                                       mm_strdup(" *)(ECPGget_var("), mm_strdup(var_text)),
     443           0 :                                               ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type,
     444           0 :                                                                                        ptr->indicator->type->u.element->size,
     445           0 :                                                                                        ptr->indicator->type->u.element->counter),
     446           0 :                                                                   ptr->indicator->type->size),
     447             :                                               0);
     448           0 :                         var_ptr = true;
     449             :                     }
     450             :                 }
     451           0 :                 else if (atoi(ptr->indicator->type->size) > 1)
     452             :                 {
     453           0 :                     newind = new_variable(cat_str(4, mm_strdup("("),
     454           0 :                                                   mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
     455             :                                                   mm_strdup(" *)(ECPGget_var("),
     456             :                                                   mm_strdup(var_text)),
     457           0 :                                           ECPGmake_simple_type(ptr->indicator->type->type,
     458           0 :                                                                ptr->indicator->type->size,
     459           0 :                                                                ptr->variable->type->counter),
     460             :                                           0);
     461             :                 }
     462             :                 else
     463             :                 {
     464           0 :                     newind = new_variable(cat_str(4, mm_strdup("*("),
     465           0 :                                                   mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
     466             :                                                   mm_strdup(" *)(ECPGget_var("),
     467             :                                                   mm_strdup(var_text)),
     468           0 :                                           ECPGmake_simple_type(ptr->indicator->type->type,
     469           0 :                                                                ptr->indicator->type->size,
     470           0 :                                                                ptr->variable->type->counter),
     471             :                                           0);
     472           0 :                     var_ptr = true;
     473             :                 }
     474             : 
     475             :                 /* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
     476           2 :                 sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
     477           2 :                 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          66 :             add_variable_to_tail(&newlist, newvar, newind);
     483             :         }
     484             : 
     485         148 :         if (insert)
     486          74 :             cur->argsinsert_oos = newlist;
     487             :         else
     488          74 :             cur->argsresult_oos = newlist;
     489             :     }
     490             : 
     491          74 :     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 *
     500         202 : add_additional_variables(char *name, bool insert)
     501             : {
     502             :     struct cursor *ptr;
     503             :     struct arguments *p;
     504         202 :     int (* strcmp_fn)(const char *, const char *) = ((name[0] == ':' || name[0] == '"') ? strcmp : pg_strcasecmp);
     505             : 
     506         216 :     for (ptr = cur; ptr != NULL; ptr=ptr->next)
     507             :     {
     508         216 :         if (strcmp_fn(ptr->name, name) == 0)
     509         202 :             break;
     510             :     }
     511             : 
     512         202 :     if (ptr == NULL)
     513             :     {
     514           0 :         mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" does not exist", name);
     515           0 :         return NULL;
     516             :     }
     517             : 
     518         202 :     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         136 :         for (p = (SAMEFUNC(ptr) ? ptr->argsinsert : ptr->argsinsert_oos); p; p = p->next)
     523          60 :             add_variable_to_tail(&argsinsert, p->variable, p->indicator);
     524             :     }
     525             : 
     526             :     /* add all those output variables that were given earlier */
     527         238 :     for (p = (SAMEFUNC(ptr) ? ptr->argsresult : ptr->argsresult_oos); p; p = p->next)
     528          36 :         add_variable_to_tail(&argsresult, p->variable, p->indicator);
     529             : 
     530         202 :     return ptr;
     531             : }
     532             : 
     533             : static void
     534          44 : 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          44 :     if ((type_enum == ECPGt_struct ||
     541          20 :          type_enum == ECPGt_union) &&
     542             :         initializer == 1)
     543           0 :         mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
     544          44 :     else if (INFORMIX_MODE && strcmp(name, "string") == 0)
     545           0 :         mmerror(PARSE_ERROR, ET_ERROR, "type name \"string\" is reserved in Informix mode");
     546             :     else
     547             :     {
     548         116 :         for (ptr = types; ptr != NULL; ptr = ptr->next)
     549             :         {
     550          72 :             if (strcmp(name, ptr->name) == 0)
     551             :                 /* re-definition is a bug */
     552           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", name);
     553             :         }
     554          44 :         adjust_array(type_enum, &dimension, &length, type_dimension, type_index, array, true);
     555             : 
     556          44 :         this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
     557             : 
     558             :         /* initial definition */
     559          44 :         this->next = types;
     560          44 :         this->name = name;
     561          44 :         this->brace_level = braces_open;
     562          44 :         this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
     563          44 :         this->type->type_enum = type_enum;
     564          44 :         this->type->type_str = mm_strdup(name);
     565          44 :         this->type->type_dimension = dimension; /* dimension of array */
     566          44 :         this->type->type_index = length;  /* length of string */
     567          44 :         this->type->type_sizeof = ECPGstruct_sizeof;
     568          28 :         this->struct_member_list = (type_enum == ECPGt_struct || type_enum == ECPGt_union) ?
     569          72 :         ECPGstruct_member_dup(struct_member_list[struct_level]) : NULL;
     570             : 
     571          44 :         if (type_enum != ECPGt_varchar &&
     572          40 :             type_enum != ECPGt_bytea &&
     573          28 :             type_enum != ECPGt_char &&
     574          28 :             type_enum != ECPGt_unsigned_char &&
     575          28 :             type_enum != ECPGt_string &&
     576          28 :             atoi(this->type->type_index) >= 0)
     577           0 :             mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
     578             : 
     579          44 :         types = this;
     580             :     }
     581          44 : }
     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
     589         328 : check_declared_list(const char *name)
     590             : {
     591         328 :     struct declared_list *ptr = NULL;
     592         376 :     for (ptr = g_declared_list; ptr != NULL; ptr = ptr -> next)
     593             :     {
     594          62 :         if (!ptr->connection)
     595          36 :             continue;
     596          26 :         if (strcmp(name, ptr -> name) == 0)
     597             :         {
     598          14 :             if (connection && strcmp(ptr->connection, connection) != 0)
     599           0 :                 mmerror(PARSE_ERROR, ET_WARNING, "connection %s is overwritten with %s by DECLARE statement %s", connection, ptr->connection, name);
     600          14 :             connection = mm_strdup(ptr -> connection);
     601          14 :             return true;
     602             :         }
     603             :     }
     604         314 :     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> opt_single_name
     659             : %type <str> opt_qualified_name
     660             : %type <str> opt_concurrently
     661             : %type <str> opt_drop_behavior
     662             : %type <str> CallStmt
     663             : %type <str> CreateRoleStmt
     664             : %type <str> opt_with
     665             : %type <str> OptRoleList
     666             : %type <str> AlterOptRoleList
     667             : %type <str> AlterOptRoleElem
     668             : %type <str> CreateOptRoleElem
     669             : %type <str> CreateUserStmt
     670             : %type <str> AlterRoleStmt
     671             : %type <str> opt_in_database
     672             : %type <str> AlterRoleSetStmt
     673             : %type <str> DropRoleStmt
     674             : %type <str> CreateGroupStmt
     675             : %type <str> AlterGroupStmt
     676             : %type <str> add_drop
     677             : %type <str> CreateSchemaStmt
     678             : %type <str> OptSchemaEltList
     679             : %type <str> schema_stmt
     680             : %type <str> VariableSetStmt
     681             : %type <str> set_rest
     682             : %type <str> generic_set
     683             : %type <str> set_rest_more
     684             : %type <str> var_name
     685             : %type <str> var_list
     686             : %type <str> var_value
     687             : %type <str> iso_level
     688             : %type <str> opt_boolean_or_string
     689             : %type <str> zone_value
     690             : %type <str> opt_encoding
     691             : %type <str> NonReservedWord_or_Sconst
     692             : %type <str> VariableResetStmt
     693             : %type <str> reset_rest
     694             : %type <str> generic_reset
     695             : %type <str> SetResetClause
     696             : %type <str> FunctionSetResetClause
     697             : %type <str> VariableShowStmt
     698             : %type <str> ConstraintsSetStmt
     699             : %type <str> constraints_set_list
     700             : %type <str> constraints_set_mode
     701             : %type <str> CheckPointStmt
     702             : %type <str> DiscardStmt
     703             : %type <str> AlterTableStmt
     704             : %type <str> alter_table_cmds
     705             : %type <str> partitions_list
     706             : %type <str> SinglePartitionSpec
     707             : %type <str> partition_cmd
     708             : %type <str> index_partition_cmd
     709             : %type <str> alter_table_cmd
     710             : %type <str> alter_column_default
     711             : %type <str> opt_collate_clause
     712             : %type <str> alter_using
     713             : %type <str> replica_identity
     714             : %type <str> reloptions
     715             : %type <str> opt_reloptions
     716             : %type <str> reloption_list
     717             : %type <str> reloption_elem
     718             : %type <str> alter_identity_column_option_list
     719             : %type <str> alter_identity_column_option
     720             : %type <str> set_statistics_value
     721             : %type <str> set_access_method_name
     722             : %type <str> PartitionBoundSpec
     723             : %type <str> hash_partbound_elem
     724             : %type <str> hash_partbound
     725             : %type <str> AlterCompositeTypeStmt
     726             : %type <str> alter_type_cmds
     727             : %type <str> alter_type_cmd
     728             : %type <str> ClosePortalStmt
     729             : %type <str> CopyStmt
     730             : %type <str> copy_from
     731             : %type <str> opt_program
     732             : %type <str> copy_file_name
     733             : %type <str> copy_options
     734             : %type <str> copy_opt_list
     735             : %type <str> copy_opt_item
     736             : %type <str> opt_binary
     737             : %type <str> copy_delimiter
     738             : %type <str> opt_using
     739             : %type <str> copy_generic_opt_list
     740             : %type <str> copy_generic_opt_elem
     741             : %type <str> copy_generic_opt_arg
     742             : %type <str> copy_generic_opt_arg_list
     743             : %type <str> copy_generic_opt_arg_list_item
     744             : %type <str> CreateStmt
     745             : %type <str> OptTemp
     746             : %type <str> OptTableElementList
     747             : %type <str> OptTypedTableElementList
     748             : %type <str> TableElementList
     749             : %type <str> TypedTableElementList
     750             : %type <str> TableElement
     751             : %type <str> TypedTableElement
     752             : %type <str> columnDef
     753             : %type <str> columnOptions
     754             : %type <str> column_compression
     755             : %type <str> opt_column_compression
     756             : %type <str> column_storage
     757             : %type <str> opt_column_storage
     758             : %type <str> ColQualList
     759             : %type <str> ColConstraint
     760             : %type <str> ColConstraintElem
     761             : %type <str> opt_unique_null_treatment
     762             : %type <str> generated_when
     763             : %type <str> ConstraintAttr
     764             : %type <str> TableLikeClause
     765             : %type <str> TableLikeOptionList
     766             : %type <str> TableLikeOption
     767             : %type <str> TableConstraint
     768             : %type <str> ConstraintElem
     769             : %type <str> DomainConstraint
     770             : %type <str> DomainConstraintElem
     771             : %type <str> opt_no_inherit
     772             : %type <str> opt_without_overlaps
     773             : %type <str> opt_column_list
     774             : %type <str> columnList
     775             : %type <str> optionalPeriodName
     776             : %type <str> opt_column_and_period_list
     777             : %type <str> columnElem
     778             : %type <str> opt_c_include
     779             : %type <str> key_match
     780             : %type <str> ExclusionConstraintList
     781             : %type <str> ExclusionConstraintElem
     782             : %type <str> OptWhereClause
     783             : %type <str> key_actions
     784             : %type <str> key_update
     785             : %type <str> key_delete
     786             : %type <str> key_action
     787             : %type <str> OptInherit
     788             : %type <str> OptPartitionSpec
     789             : %type <str> PartitionSpec
     790             : %type <str> part_params
     791             : %type <str> part_elem
     792             : %type <str> table_access_method_clause
     793             : %type <str> OptWith
     794             : %type <str> OnCommitOption
     795             : %type <str> OptTableSpace
     796             : %type <str> OptConsTableSpace
     797             : %type <str> ExistingIndex
     798             : %type <str> CreateStatsStmt
     799             : %type <str> stats_params
     800             : %type <str> stats_param
     801             : %type <str> AlterStatsStmt
     802             : %type <str> create_as_target
     803             : %type <str> opt_with_data
     804             : %type <str> CreateMatViewStmt
     805             : %type <str> create_mv_target
     806             : %type <str> OptNoLog
     807             : %type <str> RefreshMatViewStmt
     808             : %type <str> CreateSeqStmt
     809             : %type <str> AlterSeqStmt
     810             : %type <str> OptSeqOptList
     811             : %type <str> OptParenthesizedSeqOptList
     812             : %type <str> SeqOptList
     813             : %type <str> SeqOptElem
     814             : %type <str> opt_by
     815             : %type <str> NumericOnly
     816             : %type <str> NumericOnly_list
     817             : %type <str> CreatePLangStmt
     818             : %type <str> opt_trusted
     819             : %type <str> handler_name
     820             : %type <str> opt_inline_handler
     821             : %type <str> validator_clause
     822             : %type <str> opt_validator
     823             : %type <str> opt_procedural
     824             : %type <str> CreateTableSpaceStmt
     825             : %type <str> OptTableSpaceOwner
     826             : %type <str> DropTableSpaceStmt
     827             : %type <str> CreateExtensionStmt
     828             : %type <str> create_extension_opt_list
     829             : %type <str> create_extension_opt_item
     830             : %type <str> AlterExtensionStmt
     831             : %type <str> alter_extension_opt_list
     832             : %type <str> alter_extension_opt_item
     833             : %type <str> AlterExtensionContentsStmt
     834             : %type <str> CreateFdwStmt
     835             : %type <str> fdw_option
     836             : %type <str> fdw_options
     837             : %type <str> opt_fdw_options
     838             : %type <str> AlterFdwStmt
     839             : %type <str> create_generic_options
     840             : %type <str> generic_option_list
     841             : %type <str> alter_generic_options
     842             : %type <str> alter_generic_option_list
     843             : %type <str> alter_generic_option_elem
     844             : %type <str> generic_option_elem
     845             : %type <str> generic_option_name
     846             : %type <str> generic_option_arg
     847             : %type <str> CreateForeignServerStmt
     848             : %type <str> opt_type
     849             : %type <str> foreign_server_version
     850             : %type <str> opt_foreign_server_version
     851             : %type <str> AlterForeignServerStmt
     852             : %type <str> CreateForeignTableStmt
     853             : %type <str> ImportForeignSchemaStmt
     854             : %type <str> import_qualification_type
     855             : %type <str> import_qualification
     856             : %type <str> CreateUserMappingStmt
     857             : %type <str> auth_ident
     858             : %type <str> DropUserMappingStmt
     859             : %type <str> AlterUserMappingStmt
     860             : %type <str> CreatePolicyStmt
     861             : %type <str> AlterPolicyStmt
     862             : %type <str> RowSecurityOptionalExpr
     863             : %type <str> RowSecurityOptionalWithCheck
     864             : %type <str> RowSecurityDefaultToRole
     865             : %type <str> RowSecurityOptionalToRole
     866             : %type <str> RowSecurityDefaultPermissive
     867             : %type <str> RowSecurityDefaultForCmd
     868             : %type <str> row_security_cmd
     869             : %type <str> CreateAmStmt
     870             : %type <str> am_type
     871             : %type <str> CreateTrigStmt
     872             : %type <str> TriggerActionTime
     873             : %type <str> TriggerEvents
     874             : %type <str> TriggerOneEvent
     875             : %type <str> TriggerReferencing
     876             : %type <str> TriggerTransitions
     877             : %type <str> TriggerTransition
     878             : %type <str> TransitionOldOrNew
     879             : %type <str> TransitionRowOrTable
     880             : %type <str> TransitionRelName
     881             : %type <str> TriggerForSpec
     882             : %type <str> TriggerForOptEach
     883             : %type <str> TriggerForType
     884             : %type <str> TriggerWhen
     885             : %type <str> FUNCTION_or_PROCEDURE
     886             : %type <str> TriggerFuncArgs
     887             : %type <str> TriggerFuncArg
     888             : %type <str> OptConstrFromTable
     889             : %type <str> ConstraintAttributeSpec
     890             : %type <str> ConstraintAttributeElem
     891             : %type <str> CreateEventTrigStmt
     892             : %type <str> event_trigger_when_list
     893             : %type <str> event_trigger_when_item
     894             : %type <str> event_trigger_value_list
     895             : %type <str> AlterEventTrigStmt
     896             : %type <str> enable_trigger
     897             : %type <str> CreateAssertionStmt
     898             : %type <str> DefineStmt
     899             : %type <str> definition
     900             : %type <str> def_list
     901             : %type <str> def_elem
     902             : %type <str> def_arg
     903             : %type <str> old_aggr_definition
     904             : %type <str> old_aggr_list
     905             : %type <str> old_aggr_elem
     906             : %type <str> opt_enum_val_list
     907             : %type <str> enum_val_list
     908             : %type <str> AlterEnumStmt
     909             : %type <str> opt_if_not_exists
     910             : %type <str> CreateOpClassStmt
     911             : %type <str> opclass_item_list
     912             : %type <str> opclass_item
     913             : %type <str> opt_default
     914             : %type <str> opt_opfamily
     915             : %type <str> opclass_purpose
     916             : %type <str> opt_recheck
     917             : %type <str> CreateOpFamilyStmt
     918             : %type <str> AlterOpFamilyStmt
     919             : %type <str> opclass_drop_list
     920             : %type <str> opclass_drop
     921             : %type <str> DropOpClassStmt
     922             : %type <str> DropOpFamilyStmt
     923             : %type <str> DropOwnedStmt
     924             : %type <str> ReassignOwnedStmt
     925             : %type <str> DropStmt
     926             : %type <str> object_type_any_name
     927             : %type <str> object_type_name
     928             : %type <str> drop_type_name
     929             : %type <str> object_type_name_on_any_name
     930             : %type <str> any_name_list
     931             : %type <str> any_name
     932             : %type <str> attrs
     933             : %type <str> type_name_list
     934             : %type <str> TruncateStmt
     935             : %type <str> opt_restart_seqs
     936             : %type <str> CommentStmt
     937             : %type <str> comment_text
     938             : %type <str> SecLabelStmt
     939             : %type <str> opt_provider
     940             : %type <str> security_label
     941             : %type <str> FetchStmt
     942             : %type <str> fetch_args
     943             : %type <str> from_in
     944             : %type <str> opt_from_in
     945             : %type <str> GrantStmt
     946             : %type <str> RevokeStmt
     947             : %type <str> privileges
     948             : %type <str> privilege_list
     949             : %type <str> privilege
     950             : %type <str> parameter_name_list
     951             : %type <str> parameter_name
     952             : %type <str> privilege_target
     953             : %type <str> grantee_list
     954             : %type <str> grantee
     955             : %type <str> opt_grant_grant_option
     956             : %type <str> GrantRoleStmt
     957             : %type <str> RevokeRoleStmt
     958             : %type <str> grant_role_opt_list
     959             : %type <str> grant_role_opt
     960             : %type <str> grant_role_opt_value
     961             : %type <str> opt_granted_by
     962             : %type <str> AlterDefaultPrivilegesStmt
     963             : %type <str> DefACLOptionList
     964             : %type <str> DefACLOption
     965             : %type <str> DefACLAction
     966             : %type <str> defacl_privilege_target
     967             : %type <str> IndexStmt
     968             : %type <str> opt_unique
     969             : %type <str> access_method_clause
     970             : %type <str> index_params
     971             : %type <str> index_elem_options
     972             : %type <str> index_elem
     973             : %type <str> opt_include
     974             : %type <str> index_including_params
     975             : %type <str> opt_collate
     976             : %type <str> opt_asc_desc
     977             : %type <str> opt_nulls_order
     978             : %type <str> CreateFunctionStmt
     979             : %type <str> opt_or_replace
     980             : %type <str> func_args
     981             : %type <str> func_args_list
     982             : %type <str> function_with_argtypes_list
     983             : %type <str> function_with_argtypes
     984             : %type <str> func_args_with_defaults
     985             : %type <str> func_args_with_defaults_list
     986             : %type <str> func_arg
     987             : %type <str> arg_class
     988             : %type <str> param_name
     989             : %type <str> func_return
     990             : %type <str> func_type
     991             : %type <str> func_arg_with_default
     992             : %type <str> aggr_arg
     993             : %type <str> aggr_args
     994             : %type <str> aggr_args_list
     995             : %type <str> aggregate_with_argtypes
     996             : %type <str> aggregate_with_argtypes_list
     997             : %type <str> opt_createfunc_opt_list
     998             : %type <str> createfunc_opt_list
     999             : %type <str> common_func_opt_item
    1000             : %type <str> createfunc_opt_item
    1001             : %type <str> func_as
    1002             : %type <str> ReturnStmt
    1003             : %type <str> opt_routine_body
    1004             : %type <str> routine_body_stmt_list
    1005             : %type <str> routine_body_stmt
    1006             : %type <str> transform_type_list
    1007             : %type <str> opt_definition
    1008             : %type <str> table_func_column
    1009             : %type <str> table_func_column_list
    1010             : %type <str> AlterFunctionStmt
    1011             : %type <str> alterfunc_opt_list
    1012             : %type <str> opt_restrict
    1013             : %type <str> RemoveFuncStmt
    1014             : %type <str> RemoveAggrStmt
    1015             : %type <str> RemoveOperStmt
    1016             : %type <str> oper_argtypes
    1017             : %type <str> any_operator
    1018             : %type <str> operator_with_argtypes_list
    1019             : %type <str> operator_with_argtypes
    1020             : %type <str> DoStmt
    1021             : %type <str> dostmt_opt_list
    1022             : %type <str> dostmt_opt_item
    1023             : %type <str> CreateCastStmt
    1024             : %type <str> cast_context
    1025             : %type <str> DropCastStmt
    1026             : %type <str> opt_if_exists
    1027             : %type <str> CreateTransformStmt
    1028             : %type <str> transform_element_list
    1029             : %type <str> DropTransformStmt
    1030             : %type <str> ReindexStmt
    1031             : %type <str> reindex_target_relation
    1032             : %type <str> reindex_target_all
    1033             : %type <str> opt_reindex_option_list
    1034             : %type <str> AlterTblSpcStmt
    1035             : %type <str> RenameStmt
    1036             : %type <str> opt_column
    1037             : %type <str> opt_set_data
    1038             : %type <str> AlterObjectDependsStmt
    1039             : %type <str> opt_no
    1040             : %type <str> AlterObjectSchemaStmt
    1041             : %type <str> AlterOperatorStmt
    1042             : %type <str> operator_def_list
    1043             : %type <str> operator_def_elem
    1044             : %type <str> operator_def_arg
    1045             : %type <str> AlterTypeStmt
    1046             : %type <str> AlterOwnerStmt
    1047             : %type <str> CreatePublicationStmt
    1048             : %type <str> PublicationObjSpec
    1049             : %type <str> pub_obj_list
    1050             : %type <str> AlterPublicationStmt
    1051             : %type <str> CreateSubscriptionStmt
    1052             : %type <str> AlterSubscriptionStmt
    1053             : %type <str> DropSubscriptionStmt
    1054             : %type <str> RuleStmt
    1055             : %type <str> RuleActionList
    1056             : %type <str> RuleActionMulti
    1057             : %type <str> RuleActionStmt
    1058             : %type <str> RuleActionStmtOrEmpty
    1059             : %type <str> event
    1060             : %type <str> opt_instead
    1061             : %type <str> NotifyStmt
    1062             : %type <str> notify_payload
    1063             : %type <str> ListenStmt
    1064             : %type <str> UnlistenStmt
    1065             : %type <str> TransactionStmt
    1066             : %type <str> TransactionStmtLegacy
    1067             : %type <str> opt_transaction
    1068             : %type <str> transaction_mode_item
    1069             : %type <str> transaction_mode_list
    1070             : %type <str> transaction_mode_list_or_empty
    1071             : %type <str> opt_transaction_chain
    1072             : %type <str> ViewStmt
    1073             : %type <str> opt_check_option
    1074             : %type <str> LoadStmt
    1075             : %type <str> CreatedbStmt
    1076             : %type <str> createdb_opt_list
    1077             : %type <str> createdb_opt_items
    1078             : %type <str> createdb_opt_item
    1079             : %type <str> createdb_opt_name
    1080             : %type <str> opt_equal
    1081             : %type <str> AlterDatabaseStmt
    1082             : %type <str> AlterDatabaseSetStmt
    1083             : %type <str> DropdbStmt
    1084             : %type <str> drop_option_list
    1085             : %type <str> drop_option
    1086             : %type <str> AlterCollationStmt
    1087             : %type <str> AlterSystemStmt
    1088             : %type <str> CreateDomainStmt
    1089             : %type <str> AlterDomainStmt
    1090             : %type <str> opt_as
    1091             : %type <str> AlterTSDictionaryStmt
    1092             : %type <str> AlterTSConfigurationStmt
    1093             : %type <str> any_with
    1094             : %type <str> CreateConversionStmt
    1095             : %type <str> ClusterStmt
    1096             : %type <str> cluster_index_specification
    1097             : %type <str> VacuumStmt
    1098             : %type <str> AnalyzeStmt
    1099             : %type <str> utility_option_list
    1100             : %type <str> analyze_keyword
    1101             : %type <str> utility_option_elem
    1102             : %type <str> utility_option_name
    1103             : %type <str> utility_option_arg
    1104             : %type <str> opt_analyze
    1105             : %type <str> opt_verbose
    1106             : %type <str> opt_full
    1107             : %type <str> opt_freeze
    1108             : %type <str> opt_name_list
    1109             : %type <str> vacuum_relation
    1110             : %type <str> vacuum_relation_list
    1111             : %type <str> opt_vacuum_relation_list
    1112             : %type <str> ExplainStmt
    1113             : %type <str> ExplainableStmt
    1114             : %type <prep> PrepareStmt
    1115             : %type <str> prep_type_clause
    1116             : %type <str> PreparableStmt
    1117             : %type <exec> ExecuteStmt
    1118             : %type <str> execute_param_clause
    1119             : %type <str> InsertStmt
    1120             : %type <str> insert_target
    1121             : %type <str> insert_rest
    1122             : %type <str> override_kind
    1123             : %type <str> insert_column_list
    1124             : %type <str> insert_column_item
    1125             : %type <str> opt_on_conflict
    1126             : %type <str> opt_conf_expr
    1127             : %type <str> returning_clause
    1128             : %type <str> DeleteStmt
    1129             : %type <str> using_clause
    1130             : %type <str> LockStmt
    1131             : %type <str> opt_lock
    1132             : %type <str> lock_type
    1133             : %type <str> opt_nowait
    1134             : %type <str> opt_nowait_or_skip
    1135             : %type <str> UpdateStmt
    1136             : %type <str> set_clause_list
    1137             : %type <str> set_clause
    1138             : %type <str> set_target
    1139             : %type <str> set_target_list
    1140             : %type <str> MergeStmt
    1141             : %type <str> merge_when_list
    1142             : %type <str> merge_when_clause
    1143             : %type <str> merge_when_tgt_matched
    1144             : %type <str> merge_when_tgt_not_matched
    1145             : %type <str> opt_merge_when_condition
    1146             : %type <str> merge_update
    1147             : %type <str> merge_delete
    1148             : %type <str> merge_insert
    1149             : %type <str> merge_values_clause
    1150             : %type <str> DeclareCursorStmt
    1151             : %type <str> cursor_name
    1152             : %type <str> cursor_options
    1153             : %type <str> opt_hold
    1154             : %type <str> SelectStmt
    1155             : %type <str> select_with_parens
    1156             : %type <str> select_no_parens
    1157             : %type <str> select_clause
    1158             : %type <str> simple_select
    1159             : %type <str> with_clause
    1160             : %type <str> cte_list
    1161             : %type <str> common_table_expr
    1162             : %type <str> opt_materialized
    1163             : %type <str> opt_search_clause
    1164             : %type <str> opt_cycle_clause
    1165             : %type <str> opt_with_clause
    1166             : %type <str> into_clause
    1167             : %type <str> OptTempTableName
    1168             : %type <str> opt_table
    1169             : %type <str> set_quantifier
    1170             : %type <str> distinct_clause
    1171             : %type <str> opt_all_clause
    1172             : %type <str> opt_sort_clause
    1173             : %type <str> sort_clause
    1174             : %type <str> sortby_list
    1175             : %type <str> sortby
    1176             : %type <str> select_limit
    1177             : %type <str> opt_select_limit
    1178             : %type <str> limit_clause
    1179             : %type <str> offset_clause
    1180             : %type <str> select_limit_value
    1181             : %type <str> select_offset_value
    1182             : %type <str> select_fetch_first_value
    1183             : %type <str> I_or_F_const
    1184             : %type <str> row_or_rows
    1185             : %type <str> first_or_next
    1186             : %type <str> group_clause
    1187             : %type <str> group_by_list
    1188             : %type <str> group_by_item
    1189             : %type <str> empty_grouping_set
    1190             : %type <str> rollup_clause
    1191             : %type <str> cube_clause
    1192             : %type <str> grouping_sets_clause
    1193             : %type <str> having_clause
    1194             : %type <str> for_locking_clause
    1195             : %type <str> opt_for_locking_clause
    1196             : %type <str> for_locking_items
    1197             : %type <str> for_locking_item
    1198             : %type <str> for_locking_strength
    1199             : %type <str> locked_rels_list
    1200             : %type <str> values_clause
    1201             : %type <str> from_clause
    1202             : %type <str> from_list
    1203             : %type <str> table_ref
    1204             : %type <str> joined_table
    1205             : %type <str> alias_clause
    1206             : %type <str> opt_alias_clause
    1207             : %type <str> opt_alias_clause_for_join_using
    1208             : %type <str> func_alias_clause
    1209             : %type <str> join_type
    1210             : %type <str> opt_outer
    1211             : %type <str> join_qual
    1212             : %type <str> relation_expr
    1213             : %type <str> extended_relation_expr
    1214             : %type <str> relation_expr_list
    1215             : %type <str> relation_expr_opt_alias
    1216             : %type <str> tablesample_clause
    1217             : %type <str> opt_repeatable_clause
    1218             : %type <str> func_table
    1219             : %type <str> rowsfrom_item
    1220             : %type <str> rowsfrom_list
    1221             : %type <str> opt_col_def_list
    1222             : %type <str> opt_ordinality
    1223             : %type <str> where_clause
    1224             : %type <str> where_or_current_clause
    1225             : %type <str> OptTableFuncElementList
    1226             : %type <str> TableFuncElementList
    1227             : %type <str> TableFuncElement
    1228             : %type <str> xmltable
    1229             : %type <str> xmltable_column_list
    1230             : %type <str> xmltable_column_el
    1231             : %type <str> xmltable_column_option_list
    1232             : %type <str> xmltable_column_option_el
    1233             : %type <str> xml_namespace_list
    1234             : %type <str> xml_namespace_el
    1235             : %type <str> json_table
    1236             : %type <str> json_table_path_name_opt
    1237             : %type <str> json_table_column_definition_list
    1238             : %type <str> json_table_column_definition
    1239             : %type <str> path_opt
    1240             : %type <str> json_table_column_path_clause_opt
    1241             : %type <str> Typename
    1242             : %type <index> opt_array_bounds
    1243             : %type <str> SimpleTypename
    1244             : %type <str> ConstTypename
    1245             : %type <str> GenericType
    1246             : %type <str> opt_type_modifiers
    1247             : %type <str> Numeric
    1248             : %type <str> opt_float
    1249             : %type <str> Bit
    1250             : %type <str> ConstBit
    1251             : %type <str> BitWithLength
    1252             : %type <str> BitWithoutLength
    1253             : %type <str> Character
    1254             : %type <str> ConstCharacter
    1255             : %type <str> CharacterWithLength
    1256             : %type <str> CharacterWithoutLength
    1257             : %type <str> character
    1258             : %type <str> opt_varying
    1259             : %type <str> ConstDatetime
    1260             : %type <str> ConstInterval
    1261             : %type <str> opt_timezone
    1262             : %type <str> opt_interval
    1263             : %type <str> interval_second
    1264             : %type <str> JsonType
    1265             : %type <str> a_expr
    1266             : %type <str> b_expr
    1267             : %type <str> c_expr
    1268             : %type <str> func_application
    1269             : %type <str> func_expr
    1270             : %type <str> func_expr_windowless
    1271             : %type <str> func_expr_common_subexpr
    1272             : %type <str> xml_root_version
    1273             : %type <str> opt_xml_root_standalone
    1274             : %type <str> xml_attributes
    1275             : %type <str> xml_attribute_list
    1276             : %type <str> xml_attribute_el
    1277             : %type <str> document_or_content
    1278             : %type <str> xml_indent_option
    1279             : %type <str> xml_whitespace_option
    1280             : %type <str> xmlexists_argument
    1281             : %type <str> xml_passing_mech
    1282             : %type <str> within_group_clause
    1283             : %type <str> filter_clause
    1284             : %type <str> window_clause
    1285             : %type <str> window_definition_list
    1286             : %type <str> window_definition
    1287             : %type <str> over_clause
    1288             : %type <str> window_specification
    1289             : %type <str> opt_existing_window_name
    1290             : %type <str> opt_partition_clause
    1291             : %type <str> opt_frame_clause
    1292             : %type <str> frame_extent
    1293             : %type <str> frame_bound
    1294             : %type <str> opt_window_exclusion_clause
    1295             : %type <str> row
    1296             : %type <str> explicit_row
    1297             : %type <str> implicit_row
    1298             : %type <str> sub_type
    1299             : %type <str> all_Op
    1300             : %type <str> MathOp
    1301             : %type <str> qual_Op
    1302             : %type <str> qual_all_Op
    1303             : %type <str> subquery_Op
    1304             : %type <str> expr_list
    1305             : %type <str> func_arg_list
    1306             : %type <str> func_arg_expr
    1307             : %type <str> func_arg_list_opt
    1308             : %type <str> type_list
    1309             : %type <str> array_expr
    1310             : %type <str> array_expr_list
    1311             : %type <str> extract_list
    1312             : %type <str> extract_arg
    1313             : %type <str> unicode_normal_form
    1314             : %type <str> overlay_list
    1315             : %type <str> position_list
    1316             : %type <str> substr_list
    1317             : %type <str> trim_list
    1318             : %type <str> in_expr
    1319             : %type <str> case_expr
    1320             : %type <str> when_clause_list
    1321             : %type <str> when_clause
    1322             : %type <str> case_default
    1323             : %type <str> case_arg
    1324             : %type <str> columnref
    1325             : %type <str> indirection_el
    1326             : %type <str> opt_slice_bound
    1327             : %type <str> indirection
    1328             : %type <str> opt_indirection
    1329             : %type <str> opt_asymmetric
    1330             : %type <str> json_passing_clause_opt
    1331             : %type <str> json_arguments
    1332             : %type <str> json_argument
    1333             : %type <str> json_wrapper_behavior
    1334             : %type <str> json_behavior
    1335             : %type <str> json_behavior_type
    1336             : %type <str> json_behavior_clause_opt
    1337             : %type <str> json_on_error_clause_opt
    1338             : %type <str> json_value_expr
    1339             : %type <str> json_format_clause
    1340             : %type <str> json_format_clause_opt
    1341             : %type <str> json_quotes_clause_opt
    1342             : %type <str> json_returning_clause_opt
    1343             : %type <str> json_predicate_type_constraint
    1344             : %type <str> json_key_uniqueness_constraint_opt
    1345             : %type <str> json_name_and_value_list
    1346             : %type <str> json_name_and_value
    1347             : %type <str> json_object_constructor_null_clause_opt
    1348             : %type <str> json_array_constructor_null_clause_opt
    1349             : %type <str> json_value_expr_list
    1350             : %type <str> json_aggregate_func
    1351             : %type <str> json_array_aggregate_order_by_clause_opt
    1352             : %type <str> opt_target_list
    1353             : %type <str> target_list
    1354             : %type <str> target_el
    1355             : %type <str> qualified_name_list
    1356             : %type <str> qualified_name
    1357             : %type <str> name_list
    1358             : %type <str> name
    1359             : %type <str> attr_name
    1360             : %type <str> file_name
    1361             : %type <str> func_name
    1362             : %type <str> AexprConst
    1363             : %type <str> Iconst
    1364             : %type <str> SignedIconst
    1365             : %type <str> RoleId
    1366             : %type <str> RoleSpec
    1367             : %type <str> role_list
    1368             : %type <str> NonReservedWord
    1369             : %type <str> BareColLabel
    1370             : %type <str> unreserved_keyword
    1371             : %type <str> col_name_keyword
    1372             : %type <str> type_func_name_keyword
    1373             : %type <str> reserved_keyword
    1374             : %type <str> bare_label_keyword
    1375             : /* ecpgtype */
    1376             : /* src/interfaces/ecpg/preproc/ecpg.type */
    1377             : %type <str> ECPGAllocateDescr
    1378             : %type <str> ECPGCKeywords
    1379             : %type <str> ECPGColId
    1380             : %type <str> ECPGColLabel
    1381             : %type <str> ECPGConnect
    1382             : %type <str> ECPGCursorStmt
    1383             : %type <str> ECPGDeallocateDescr
    1384             : %type <str> ECPGDeclaration
    1385             : %type <str> ECPGDeclare
    1386             : %type <str> ECPGDeclareStmt
    1387             : %type <str> ECPGDisconnect
    1388             : %type <str> ECPGExecuteImmediateStmt
    1389             : %type <str> ECPGFree
    1390             : %type <str> ECPGGetDescHeaderItem
    1391             : %type <str> ECPGGetDescItem
    1392             : %type <str> ECPGGetDescriptorHeader
    1393             : %type <str> ECPGKeywords
    1394             : %type <str> ECPGKeywords_rest
    1395             : %type <str> ECPGKeywords_vanames
    1396             : %type <str> ECPGOpen
    1397             : %type <str> ECPGSetAutocommit
    1398             : %type <str> ECPGSetConnection
    1399             : %type <str> ECPGSetDescHeaderItem
    1400             : %type <str> ECPGSetDescItem
    1401             : %type <str> ECPGSetDescriptorHeader
    1402             : %type <str> ECPGTypeName
    1403             : %type <str> ECPGTypedef
    1404             : %type <str> ECPGVar
    1405             : %type <str> ECPGVarDeclaration
    1406             : %type <str> ECPGWhenever
    1407             : %type <str> ECPGunreserved_interval
    1408             : %type <str> UsingConst
    1409             : %type <str> UsingValue
    1410             : %type <str> all_unreserved_keyword
    1411             : %type <str> c_anything
    1412             : %type <str> c_args
    1413             : %type <str> c_list
    1414             : %type <str> c_stuff
    1415             : %type <str> c_stuff_item
    1416             : %type <str> c_term
    1417             : %type <str> c_thing
    1418             : %type <str> char_variable
    1419             : %type <str> char_civar
    1420             : %type <str> civar
    1421             : %type <str> civarind
    1422             : %type <str> ColId
    1423             : %type <str> ColLabel
    1424             : %type <str> connect_options
    1425             : %type <str> connection_object
    1426             : %type <str> connection_target
    1427             : %type <str> coutputvariable
    1428             : %type <str> cvariable
    1429             : %type <str> db_prefix
    1430             : %type <str> CreateAsStmt
    1431             : %type <str> DeallocateStmt
    1432             : %type <str> dis_name
    1433             : %type <str> ecpg_bconst
    1434             : %type <str> ecpg_fconst
    1435             : %type <str> ecpg_ident
    1436             : %type <str> ecpg_interval
    1437             : %type <str> ecpg_into
    1438             : %type <str> ecpg_fetch_into
    1439             : %type <str> ecpg_param
    1440             : %type <str> ecpg_sconst
    1441             : %type <str> ecpg_using
    1442             : %type <str> ecpg_xconst
    1443             : %type <str> enum_definition
    1444             : %type <str> enum_type
    1445             : %type <str> execstring
    1446             : %type <str> execute_rest
    1447             : %type <str> indicator
    1448             : %type <str> into_descriptor
    1449             : %type <str> into_sqlda
    1450             : %type <str> Iresult
    1451             : %type <str> on_off
    1452             : %type <str> opt_bit_field
    1453             : %type <str> opt_connection_name
    1454             : %type <str> opt_database_name
    1455             : %type <str> opt_ecpg_into
    1456             : %type <str> opt_ecpg_fetch_into
    1457             : %type <str> opt_ecpg_using
    1458             : %type <str> opt_initializer
    1459             : %type <str> opt_options
    1460             : %type <str> opt_output
    1461             : %type <str> opt_pointer
    1462             : %type <str> opt_port
    1463             : %type <str> opt_reference
    1464             : %type <str> opt_scale
    1465             : %type <str> opt_server
    1466             : %type <str> opt_user
    1467             : %type <str> opt_opt_value
    1468             : %type <str> ora_user
    1469             : %type <str> precision
    1470             : %type <str> prepared_name
    1471             : %type <str> quoted_ident_stringvar
    1472             : %type <str> s_struct_union
    1473             : %type <str> server
    1474             : %type <str> server_name
    1475             : %type <str> single_vt_declaration
    1476             : %type <str> storage_clause
    1477             : %type <str> storage_declaration
    1478             : %type <str> storage_modifier
    1479             : %type <str> struct_union_type
    1480             : %type <str> struct_union_type_with_symbol
    1481             : %type <str> symbol
    1482             : %type <str> type_declaration
    1483             : %type <str> type_function_name
    1484             : %type <str> user_name
    1485             : %type <str> using_descriptor
    1486             : %type <str> var_declaration
    1487             : %type <str> var_type_declarations
    1488             : %type <str> variable
    1489             : %type <str> variable_declarations
    1490             : %type <str> variable_list
    1491             : %type <str> vt_declarations
    1492             : 
    1493             : %type <str> Op
    1494             : %type <str> IntConstVar
    1495             : %type <str> AllConstVar
    1496             : %type <str> CSTRING
    1497             : %type <str> CPP_LINE
    1498             : %type <str> CVARIABLE
    1499             : %type <str> BCONST
    1500             : %type <str> SCONST
    1501             : %type <str> XCONST
    1502             : %type <str> IDENT
    1503             : 
    1504             : %type  <struct_union> s_struct_union_symbol
    1505             : 
    1506             : %type  <descriptor> ECPGGetDescriptor
    1507             : %type  <descriptor> ECPGSetDescriptor
    1508             : 
    1509             : %type  <type_enum> simple_type
    1510             : %type  <type_enum> signed_type
    1511             : %type  <type_enum> unsigned_type
    1512             : 
    1513             : %type  <dtype_enum> descriptor_item
    1514             : %type  <dtype_enum> desc_header_item
    1515             : 
    1516             : %type  <type>   var_type
    1517             : 
    1518             : %type  <action> action
    1519             : 
    1520             : %type  <describe> ECPGDescribe
    1521             : /* orig_tokens */
    1522             :  %token IDENT UIDENT FCONST SCONST USCONST BCONST XCONST Op
    1523             :  %token ICONST PARAM
    1524             :  %token TYPECAST DOT_DOT COLON_EQUALS EQUALS_GREATER
    1525             :  %token LESS_EQUALS GREATER_EQUALS NOT_EQUALS
    1526             : 
    1527             : 
    1528             : 
    1529             : 
    1530             : 
    1531             : 
    1532             : 
    1533             : 
    1534             : 
    1535             :  %token ABORT_P ABSENT ABSOLUTE_P ACCESS ACTION ADD_P ADMIN AFTER
    1536             :  AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARRAY AS ASC
    1537             :  ASENSITIVE ASSERTION ASSIGNMENT ASYMMETRIC ATOMIC AT ATTACH ATTRIBUTE AUTHORIZATION
    1538             : 
    1539             :  BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
    1540             :  BOOLEAN_P BOTH BREADTH BY
    1541             : 
    1542             :  CACHE CALL CALLED CASCADE CASCADED CASE CAST CATALOG_P CHAIN CHAR_P
    1543             :  CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE
    1544             :  CLUSTER COALESCE COLLATE COLLATION COLUMN COLUMNS COMMENT COMMENTS COMMIT
    1545             :  COMMITTED COMPRESSION CONCURRENTLY CONDITIONAL CONFIGURATION CONFLICT
    1546             :  CONNECTION CONSTRAINT CONSTRAINTS CONTENT_P CONTINUE_P CONVERSION_P COPY
    1547             :  COST CREATE CROSS CSV CUBE CURRENT_P
    1548             :  CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA
    1549             :  CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
    1550             : 
    1551             :  DATA_P DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
    1552             :  DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS DEPENDS DEPTH DESC
    1553             :  DETACH DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P
    1554             :  DOUBLE_P DROP
    1555             : 
    1556             :  EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENUM_P ERROR_P ESCAPE
    1557             :  EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN EXPRESSION
    1558             :  EXTENSION EXTERNAL EXTRACT
    1559             : 
    1560             :  FALSE_P FAMILY FETCH FILTER FINALIZE FIRST_P FLOAT_P FOLLOWING FOR
    1561             :  FORCE FOREIGN FORMAT FORWARD FREEZE FROM FULL FUNCTION FUNCTIONS
    1562             : 
    1563             :  GENERATED GLOBAL GRANT GRANTED GREATEST GROUP_P GROUPING GROUPS
    1564             : 
    1565             :  HANDLER HAVING HEADER_P HOLD HOUR_P
    1566             : 
    1567             :  IDENTITY_P IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IMPORT_P IN_P INCLUDE
    1568             :  INCLUDING INCREMENT INDENT INDEX INDEXES INHERIT INHERITS INITIALLY INLINE_P
    1569             :  INNER_P INOUT INPUT_P INSENSITIVE INSERT INSTEAD INT_P INTEGER
    1570             :  INTERSECT INTERVAL INTO INVOKER IS ISNULL ISOLATION
    1571             : 
    1572             :  JOIN JSON JSON_ARRAY JSON_ARRAYAGG JSON_EXISTS JSON_OBJECT JSON_OBJECTAGG
    1573             :  JSON_QUERY JSON_SCALAR JSON_SERIALIZE JSON_TABLE JSON_VALUE
    1574             : 
    1575             :  KEEP KEY KEYS
    1576             : 
    1577             :  LABEL LANGUAGE LARGE_P LAST_P LATERAL_P
    1578             :  LEADING LEAKPROOF LEAST LEFT LEVEL LIKE LIMIT LISTEN LOAD LOCAL
    1579             :  LOCALTIME LOCALTIMESTAMP LOCATION LOCK_P LOCKED LOGGED
    1580             : 
    1581             :  MAPPING MATCH MATCHED MATERIALIZED MAXVALUE MERGE MERGE_ACTION METHOD
    1582             :  MINUTE_P MINVALUE MODE MONTH_P MOVE
    1583             : 
    1584             :  NAME_P NAMES NATIONAL NATURAL NCHAR NESTED NEW NEXT NFC NFD NFKC NFKD NO
    1585             :  NONE NORMALIZE NORMALIZED
    1586             :  NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
    1587             :  NULLS_P NUMERIC
    1588             : 
    1589             :  OBJECT_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
    1590             :  ORDER ORDINALITY OTHERS OUT_P OUTER_P
    1591             :  OVER OVERLAPS OVERLAY OVERRIDING OWNED OWNER
    1592             : 
    1593             :  PARALLEL PARAMETER PARSER PARTIAL PARTITION PARTITIONS PASSING PASSWORD PATH
    1594             :  PERIOD PLACING PLAN PLANS POLICY
    1595             : 
    1596             :  POSITION PRECEDING PRECISION PRESERVE PREPARE PREPARED PRIMARY
    1597             :  PRIOR PRIVILEGES PROCEDURAL PROCEDURE PROCEDURES PROGRAM PUBLICATION
    1598             : 
    1599             :  QUOTE QUOTES
    1600             : 
    1601             :  RANGE READ REAL REASSIGN RECHECK RECURSIVE REF_P REFERENCES REFERENCING
    1602             :  REFRESH REINDEX RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA
    1603             :  RESET RESTART RESTRICT RETURN RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
    1604             :  ROUTINE ROUTINES ROW ROWS RULE
    1605             : 
    1606             :  SAVEPOINT SCALAR SCHEMA SCHEMAS SCROLL SEARCH SECOND_P SECURITY SELECT
    1607             :  SEQUENCE SEQUENCES
    1608             :  SERIALIZABLE SERVER SESSION SESSION_USER SET SETS SETOF SHARE SHOW
    1609             :  SIMILAR SIMPLE SKIP SMALLINT SNAPSHOT SOME SPLIT SOURCE SQL_P STABLE STANDALONE_P
    1610             :  START STATEMENT STATISTICS STDIN STDOUT STORAGE STORED STRICT_P STRING_P STRIP_P
    1611             :  SUBSCRIPTION SUBSTRING SUPPORT SYMMETRIC SYSID SYSTEM_P SYSTEM_USER
    1612             : 
    1613             :  TABLE TABLES TABLESAMPLE TABLESPACE TARGET TEMP TEMPLATE TEMPORARY TEXT_P THEN
    1614             :  TIES TIME TIMESTAMP TO TRAILING TRANSACTION TRANSFORM
    1615             :  TREAT TRIGGER TRIM TRUE_P
    1616             :  TRUNCATE TRUSTED TYPE_P TYPES_P
    1617             : 
    1618             :  UESCAPE UNBOUNDED UNCONDITIONAL UNCOMMITTED UNENCRYPTED UNION UNIQUE UNKNOWN
    1619             :  UNLISTEN UNLOGGED UNTIL UPDATE USER USING
    1620             : 
    1621             :  VACUUM VALID VALIDATE VALIDATOR VALUE_P VALUES VARCHAR VARIADIC VARYING
    1622             :  VERBOSE VERSION_P VIEW VIEWS VOLATILE
    1623             : 
    1624             :  WHEN WHERE WHITESPACE_P WINDOW WITH WITHIN WITHOUT WORK WRAPPER WRITE
    1625             : 
    1626             :  XML_P XMLATTRIBUTES XMLCONCAT XMLELEMENT XMLEXISTS XMLFOREST XMLNAMESPACES
    1627             :  XMLPARSE XMLPI XMLROOT XMLSERIALIZE XMLTABLE
    1628             : 
    1629             :  YEAR_P YES_P
    1630             : 
    1631             :  ZONE
    1632             : 
    1633             : 
    1634             : 
    1635             : 
    1636             : 
    1637             : 
    1638             : 
    1639             : 
    1640             : 
    1641             : 
    1642             : 
    1643             : 
    1644             :  %token FORMAT_LA NOT_LA NULLS_LA WITH_LA WITHOUT_LA
    1645             : 
    1646             : 
    1647             : 
    1648             : 
    1649             : 
    1650             : 
    1651             : 
    1652             : 
    1653             :  %token MODE_TYPE_NAME
    1654             :  %token MODE_PLPGSQL_EXPR
    1655             :  %token MODE_PLPGSQL_ASSIGN1
    1656             :  %token MODE_PLPGSQL_ASSIGN2
    1657             :  %token MODE_PLPGSQL_ASSIGN3
    1658             : 
    1659             : 
    1660             : 
    1661             :  %left UNION EXCEPT
    1662             :  %left INTERSECT
    1663             :  %left OR
    1664             :  %left AND
    1665             :  %right NOT
    1666             :  %nonassoc IS ISNULL NOTNULL
    1667             :  %nonassoc '<' '>' '=' LESS_EQUALS GREATER_EQUALS NOT_EQUALS
    1668             :  %nonassoc BETWEEN IN_P LIKE ILIKE SIMILAR NOT_LA
    1669             :  %nonassoc ESCAPE
    1670             : 
    1671             : 
    1672             : 
    1673             : 
    1674             : 
    1675             : 
    1676             : 
    1677             : 
    1678             : 
    1679             : 
    1680             : 
    1681             : 
    1682             : 
    1683             : 
    1684             : 
    1685             : 
    1686             : 
    1687             : 
    1688             : 
    1689             : 
    1690             : 
    1691             : 
    1692             : 
    1693             : 
    1694             : 
    1695             : 
    1696             : 
    1697             : 
    1698             : 
    1699             : 
    1700             : 
    1701             : 
    1702             : 
    1703             : 
    1704             : 
    1705             : 
    1706             : 
    1707             : 
    1708             : 
    1709             : 
    1710             : 
    1711             : 
    1712             : 
    1713             : 
    1714             : 
    1715             : 
    1716             : 
    1717             :  %nonassoc UNBOUNDED NESTED
    1718             :  %nonassoc IDENT
    1719             : %nonassoc CSTRING PARTITION RANGE ROWS GROUPS PRECEDING FOLLOWING CUBE ROLLUP
    1720             :  SET KEYS OBJECT_P SCALAR VALUE_P WITH WITHOUT PATH
    1721             :  %left Op OPERATOR
    1722             :  %left '+' '-'
    1723             :  %left '*' '/' '%'
    1724             :  %left '^'
    1725             : 
    1726             :  %left AT
    1727             :  %left COLLATE
    1728             :  %right UMINUS
    1729             :  %left '[' ']'
    1730             :  %left '(' ')'
    1731             :  %left TYPECAST
    1732             :  %left '.'
    1733             : 
    1734             : 
    1735             : 
    1736             : 
    1737             : 
    1738             : 
    1739             : 
    1740             :  %left JOIN CROSS LEFT FULL RIGHT INNER_P NATURAL
    1741             : 
    1742             : %%
    1743             : prog: statements;
    1744             : /* rules */
    1745             :  toplevel_stmt:
    1746             :  stmt
    1747             :  { 
    1748        2362 :  $$ = $1;
    1749             : }
    1750             : |  TransactionStmtLegacy
    1751             :     {
    1752          16 :         fprintf(base_yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
    1753          16 :         whenever_action(2);
    1754          16 :         free($1);
    1755             :     }
    1756             : ;
    1757             : 
    1758             : 
    1759             :  stmt:
    1760             :  AlterEventTrigStmt
    1761           0 :  { output_statement($1, 0, ECPGst_normal); }
    1762             : |  AlterCollationStmt
    1763           0 :  { output_statement($1, 0, ECPGst_normal); }
    1764             : |  AlterDatabaseStmt
    1765           0 :  { output_statement($1, 0, ECPGst_normal); }
    1766             : |  AlterDatabaseSetStmt
    1767           0 :  { output_statement($1, 0, ECPGst_normal); }
    1768             : |  AlterDefaultPrivilegesStmt
    1769           0 :  { output_statement($1, 0, ECPGst_normal); }
    1770             : |  AlterDomainStmt
    1771           0 :  { output_statement($1, 0, ECPGst_normal); }
    1772             : |  AlterEnumStmt
    1773           0 :  { output_statement($1, 0, ECPGst_normal); }
    1774             : |  AlterExtensionStmt
    1775           0 :  { output_statement($1, 0, ECPGst_normal); }
    1776             : |  AlterExtensionContentsStmt
    1777           0 :  { output_statement($1, 0, ECPGst_normal); }
    1778             : |  AlterFdwStmt
    1779           0 :  { output_statement($1, 0, ECPGst_normal); }
    1780             : |  AlterForeignServerStmt
    1781           0 :  { output_statement($1, 0, ECPGst_normal); }
    1782             : |  AlterFunctionStmt
    1783           0 :  { output_statement($1, 0, ECPGst_normal); }
    1784             : |  AlterGroupStmt
    1785           0 :  { output_statement($1, 0, ECPGst_normal); }
    1786             : |  AlterObjectDependsStmt
    1787           0 :  { output_statement($1, 0, ECPGst_normal); }
    1788             : |  AlterObjectSchemaStmt
    1789           0 :  { output_statement($1, 0, ECPGst_normal); }
    1790             : |  AlterOwnerStmt
    1791           0 :  { output_statement($1, 0, ECPGst_normal); }
    1792             : |  AlterOperatorStmt
    1793           0 :  { output_statement($1, 0, ECPGst_normal); }
    1794             : |  AlterTypeStmt
    1795           0 :  { output_statement($1, 0, ECPGst_normal); }
    1796             : |  AlterPolicyStmt
    1797           0 :  { output_statement($1, 0, ECPGst_normal); }
    1798             : |  AlterSeqStmt
    1799           0 :  { output_statement($1, 0, ECPGst_normal); }
    1800             : |  AlterSystemStmt
    1801           0 :  { output_statement($1, 0, ECPGst_normal); }
    1802             : |  AlterTableStmt
    1803           4 :  { output_statement($1, 0, ECPGst_normal); }
    1804             : |  AlterTblSpcStmt
    1805           0 :  { output_statement($1, 0, ECPGst_normal); }
    1806             : |  AlterCompositeTypeStmt
    1807           0 :  { output_statement($1, 0, ECPGst_normal); }
    1808             : |  AlterPublicationStmt
    1809           0 :  { output_statement($1, 0, ECPGst_normal); }
    1810             : |  AlterRoleSetStmt
    1811           0 :  { output_statement($1, 0, ECPGst_normal); }
    1812             : |  AlterRoleStmt
    1813           6 :  { output_statement($1, 0, ECPGst_normal); }
    1814             : |  AlterSubscriptionStmt
    1815           0 :  { output_statement($1, 0, ECPGst_normal); }
    1816             : |  AlterStatsStmt
    1817           0 :  { output_statement($1, 0, ECPGst_normal); }
    1818             : |  AlterTSConfigurationStmt
    1819           0 :  { output_statement($1, 0, ECPGst_normal); }
    1820             : |  AlterTSDictionaryStmt
    1821           0 :  { output_statement($1, 0, ECPGst_normal); }
    1822             : |  AlterUserMappingStmt
    1823           0 :  { output_statement($1, 0, ECPGst_normal); }
    1824             : |  AnalyzeStmt
    1825           0 :  { output_statement($1, 0, ECPGst_normal); }
    1826             : |  CallStmt
    1827           0 :  { output_statement($1, 0, ECPGst_normal); }
    1828             : |  CheckPointStmt
    1829           0 :  { output_statement($1, 0, ECPGst_normal); }
    1830             : |  ClosePortalStmt
    1831             :     {
    1832          76 :         if (INFORMIX_MODE)
    1833             :         {
    1834           8 :             if (pg_strcasecmp($1+strlen("close "), "database") == 0)
    1835             :             {
    1836           4 :                 if (connection)
    1837           0 :                     mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CLOSE DATABASE statement");
    1838             : 
    1839           4 :                 fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, \"CURRENT\");");
    1840           4 :                 whenever_action(2);
    1841           4 :                 free($1);
    1842           4 :                 break;
    1843             :             }
    1844             :         }
    1845             : 
    1846          72 :         output_statement($1, 0, ECPGst_normal);
    1847             :     }
    1848             : |  ClusterStmt
    1849           0 :  { output_statement($1, 0, ECPGst_normal); }
    1850             : |  CommentStmt
    1851           0 :  { output_statement($1, 0, ECPGst_normal); }
    1852             : |  ConstraintsSetStmt
    1853           0 :  { output_statement($1, 0, ECPGst_normal); }
    1854             : |  CopyStmt
    1855           2 :  { output_statement($1, 0, ECPGst_normal); }
    1856             : |  CreateAmStmt
    1857           0 :  { output_statement($1, 0, ECPGst_normal); }
    1858             : |  CreateAsStmt
    1859           4 :  { output_statement($1, 0, ECPGst_normal); }
    1860             : |  CreateAssertionStmt
    1861           0 :  { output_statement($1, 0, ECPGst_normal); }
    1862             : |  CreateCastStmt
    1863           0 :  { output_statement($1, 0, ECPGst_normal); }
    1864             : |  CreateConversionStmt
    1865           0 :  { output_statement($1, 0, ECPGst_normal); }
    1866             : |  CreateDomainStmt
    1867           0 :  { output_statement($1, 0, ECPGst_normal); }
    1868             : |  CreateExtensionStmt
    1869           0 :  { output_statement($1, 0, ECPGst_normal); }
    1870             : |  CreateFdwStmt
    1871           0 :  { output_statement($1, 0, ECPGst_normal); }
    1872             : |  CreateForeignServerStmt
    1873           0 :  { output_statement($1, 0, ECPGst_normal); }
    1874             : |  CreateForeignTableStmt
    1875           0 :  { output_statement($1, 0, ECPGst_normal); }
    1876             : |  CreateFunctionStmt
    1877           2 :  { output_statement($1, 0, ECPGst_normal); }
    1878             : |  CreateGroupStmt
    1879           0 :  { output_statement($1, 0, ECPGst_normal); }
    1880             : |  CreateMatViewStmt
    1881           0 :  { output_statement($1, 0, ECPGst_normal); }
    1882             : |  CreateOpClassStmt
    1883           0 :  { output_statement($1, 0, ECPGst_normal); }
    1884             : |  CreateOpFamilyStmt
    1885           0 :  { output_statement($1, 0, ECPGst_normal); }
    1886             : |  CreatePublicationStmt
    1887           0 :  { output_statement($1, 0, ECPGst_normal); }
    1888             : |  AlterOpFamilyStmt
    1889           0 :  { output_statement($1, 0, ECPGst_normal); }
    1890             : |  CreatePolicyStmt
    1891           0 :  { output_statement($1, 0, ECPGst_normal); }
    1892             : |  CreatePLangStmt
    1893           0 :  { output_statement($1, 0, ECPGst_normal); }
    1894             : |  CreateSchemaStmt
    1895           0 :  { output_statement($1, 0, ECPGst_normal); }
    1896             : |  CreateSeqStmt
    1897           0 :  { output_statement($1, 0, ECPGst_normal); }
    1898             : |  CreateStmt
    1899         100 :  { output_statement($1, 0, ECPGst_normal); }
    1900             : |  CreateSubscriptionStmt
    1901           0 :  { output_statement($1, 0, ECPGst_normal); }
    1902             : |  CreateStatsStmt
    1903           0 :  { output_statement($1, 0, ECPGst_normal); }
    1904             : |  CreateTableSpaceStmt
    1905           0 :  { output_statement($1, 0, ECPGst_normal); }
    1906             : |  CreateTransformStmt
    1907           0 :  { output_statement($1, 0, ECPGst_normal); }
    1908             : |  CreateTrigStmt
    1909           2 :  { output_statement($1, 0, ECPGst_normal); }
    1910             : |  CreateEventTrigStmt
    1911           0 :  { output_statement($1, 0, ECPGst_normal); }
    1912             : |  CreateRoleStmt
    1913           0 :  { output_statement($1, 0, ECPGst_normal); }
    1914             : |  CreateUserStmt
    1915           0 :  { output_statement($1, 0, ECPGst_normal); }
    1916             : |  CreateUserMappingStmt
    1917           0 :  { output_statement($1, 0, ECPGst_normal); }
    1918             : |  CreatedbStmt
    1919           0 :  { output_statement($1, 0, ECPGst_normal); }
    1920             : |  DeallocateStmt
    1921             :     {
    1922          76 :         output_deallocate_prepare_statement($1);
    1923             :     }
    1924             : |  DeclareCursorStmt
    1925          34 :     { output_simple_statement($1, (strncmp($1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0); }
    1926             : |  DefineStmt
    1927           0 :  { output_statement($1, 0, ECPGst_normal); }
    1928             : |  DeleteStmt
    1929           4 :     { output_statement($1, 1, ECPGst_prepnormal); }
    1930             : |  DiscardStmt
    1931           0 :     { output_statement($1, 1, ECPGst_normal); }
    1932             : |  DoStmt
    1933           0 :  { output_statement($1, 0, ECPGst_normal); }
    1934             : |  DropCastStmt
    1935           0 :  { output_statement($1, 0, ECPGst_normal); }
    1936             : |  DropOpClassStmt
    1937           0 :  { output_statement($1, 0, ECPGst_normal); }
    1938             : |  DropOpFamilyStmt
    1939           0 :  { output_statement($1, 0, ECPGst_normal); }
    1940             : |  DropOwnedStmt
    1941           0 :  { output_statement($1, 0, ECPGst_normal); }
    1942             : |  DropStmt
    1943          76 :  { output_statement($1, 0, ECPGst_normal); }
    1944             : |  DropSubscriptionStmt
    1945           0 :  { output_statement($1, 0, ECPGst_normal); }
    1946             : |  DropTableSpaceStmt
    1947           0 :  { output_statement($1, 0, ECPGst_normal); }
    1948             : |  DropTransformStmt
    1949           0 :  { output_statement($1, 0, ECPGst_normal); }
    1950             : |  DropRoleStmt
    1951           0 :  { output_statement($1, 0, ECPGst_normal); }
    1952             : |  DropUserMappingStmt
    1953           0 :  { output_statement($1, 0, ECPGst_normal); }
    1954             : |  DropdbStmt
    1955           0 :  { output_statement($1, 0, ECPGst_normal); }
    1956             : |  ExecuteStmt
    1957             :     {
    1958          66 :         check_declared_list($1.name);
    1959          66 :         if ($1.type == NULL || strlen($1.type) == 0)
    1960          48 :             output_statement($1.name, 1, ECPGst_execute);
    1961             :         else
    1962             :         {
    1963          18 :             if ($1.name[0] != '"')
    1964             :                 /* case of char_variable */
    1965           8 :                 add_variable_to_tail(&argsinsert, find_variable($1.name), &no_indicator);
    1966             :             else
    1967             :             {
    1968             :                 /* case of ecpg_ident or CSTRING */
    1969          10 :                 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
    1970          10 :                 char *str = mm_strdup($1.name + 1);
    1971             : 
    1972             :                 /* It must be cut off double quotation because new_variable() double-quotes. */
    1973          10 :                 str[strlen(str) - 1] = '\0';
    1974          10 :                 sprintf(length, "%zu", strlen(str));
    1975          10 :                 add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
    1976             :             }
    1977          18 :             output_statement(cat_str(3, mm_strdup("execute"), mm_strdup("$0"), $1.type), 0, ECPGst_exec_with_exprlist);
    1978             :         }
    1979             :     }
    1980             : |  ExplainStmt
    1981           0 :  { output_statement($1, 0, ECPGst_normal); }
    1982             : |  FetchStmt
    1983         126 :     { output_statement($1, 1, ECPGst_normal); }
    1984             : |  GrantStmt
    1985           0 :  { output_statement($1, 0, ECPGst_normal); }
    1986             : |  GrantRoleStmt
    1987           0 :  { output_statement($1, 0, ECPGst_normal); }
    1988             : |  ImportForeignSchemaStmt
    1989           0 :  { output_statement($1, 0, ECPGst_normal); }
    1990             : |  IndexStmt
    1991           0 :  { output_statement($1, 0, ECPGst_normal); }
    1992             : |  InsertStmt
    1993         224 :     { output_statement($1, 1, ECPGst_prepnormal); }
    1994             : |  ListenStmt
    1995           0 :  { output_statement($1, 0, ECPGst_normal); }
    1996             : |  RefreshMatViewStmt
    1997           0 :  { output_statement($1, 0, ECPGst_normal); }
    1998             : |  LoadStmt
    1999           0 :  { output_statement($1, 0, ECPGst_normal); }
    2000             : |  LockStmt
    2001           0 :  { output_statement($1, 0, ECPGst_normal); }
    2002             : |  MergeStmt
    2003           0 :  { output_statement($1, 0, ECPGst_normal); }
    2004             : |  NotifyStmt
    2005           0 :  { output_statement($1, 0, ECPGst_normal); }
    2006             : |  PrepareStmt
    2007             :     {
    2008         106 :         check_declared_list($1.name);
    2009         106 :         if ($1.type == NULL)
    2010          94 :             output_prepare_statement($1.name, $1.stmt);
    2011          12 :         else if (strlen($1.type) == 0)
    2012             :         {
    2013           2 :             char *stmt = cat_str(3, mm_strdup("\""), $1.stmt, mm_strdup("\""));
    2014           2 :             output_prepare_statement($1.name, stmt);
    2015             :         }
    2016             :         else
    2017             :         {
    2018          10 :             if ($1.name[0] != '"')
    2019             :                 /* case of char_variable */
    2020           4 :                 add_variable_to_tail(&argsinsert, find_variable($1.name), &no_indicator);
    2021             :             else
    2022             :             {
    2023           6 :                 char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
    2024           6 :                 char *str = mm_strdup($1.name + 1);
    2025             : 
    2026             :                 /* It must be cut off double quotation because new_variable() double-quotes. */
    2027           6 :                 str[strlen(str) - 1] = '\0';
    2028           6 :                 sprintf(length, "%zu", strlen(str));
    2029           6 :                 add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
    2030             :             }
    2031          10 :             output_statement(cat_str(5, mm_strdup("prepare"), mm_strdup("$0"), $1.type, mm_strdup("as"), $1.stmt), 0, ECPGst_prepare);
    2032             :         }
    2033             :     }
    2034             : |  ReassignOwnedStmt
    2035           0 :  { output_statement($1, 0, ECPGst_normal); }
    2036             : |  ReindexStmt
    2037           0 :  { output_statement($1, 0, ECPGst_normal); }
    2038             : |  RemoveAggrStmt
    2039           0 :  { output_statement($1, 0, ECPGst_normal); }
    2040             : |  RemoveFuncStmt
    2041           2 :  { output_statement($1, 0, ECPGst_normal); }
    2042             : |  RemoveOperStmt
    2043           0 :  { output_statement($1, 0, ECPGst_normal); }
    2044             : |  RenameStmt
    2045           0 :  { output_statement($1, 0, ECPGst_normal); }
    2046             : |  RevokeStmt
    2047           0 :  { output_statement($1, 0, ECPGst_normal); }
    2048             : |  RevokeRoleStmt
    2049           0 :  { output_statement($1, 0, ECPGst_normal); }
    2050             : |  RuleStmt
    2051           0 :  { output_statement($1, 0, ECPGst_normal); }
    2052             : |  SecLabelStmt
    2053           0 :  { output_statement($1, 0, ECPGst_normal); }
    2054             : |  SelectStmt
    2055         202 :     { output_statement($1, 1, ECPGst_prepnormal); }
    2056             : |  TransactionStmt
    2057             :     {
    2058         158 :         fprintf(base_yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", $1);
    2059         158 :         whenever_action(2);
    2060         158 :         free($1);
    2061             :     }
    2062             : |  TruncateStmt
    2063          44 :  { output_statement($1, 0, ECPGst_normal); }
    2064             : |  UnlistenStmt
    2065           0 :  { output_statement($1, 0, ECPGst_normal); }
    2066             : |  UpdateStmt
    2067          10 :     { output_statement($1, 1, ECPGst_prepnormal); }
    2068             : |  VacuumStmt
    2069           0 :  { output_statement($1, 0, ECPGst_normal); }
    2070             : |  VariableResetStmt
    2071           0 :  { output_statement($1, 0, ECPGst_normal); }
    2072             : |  VariableSetStmt
    2073          46 :  { output_statement($1, 0, ECPGst_normal); }
    2074             : |  VariableShowStmt
    2075          14 :  { output_statement($1, 0, ECPGst_normal); }
    2076             : |  ViewStmt
    2077           0 :  { output_statement($1, 0, ECPGst_normal); }
    2078             :     | ECPGAllocateDescr
    2079             :     {
    2080          36 :         fprintf(base_yyout,"ECPGallocate_desc(__LINE__, %s);",$1);
    2081          36 :         whenever_action(0);
    2082          36 :         free($1);
    2083             :     }
    2084             :     | ECPGConnect
    2085             :     {
    2086         186 :         if (connection)
    2087           0 :             mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CONNECT statement");
    2088             : 
    2089         186 :         fprintf(base_yyout, "{ ECPGconnect(__LINE__, %d, %s, %d); ", compat, $1, autocommit);
    2090         186 :         reset_variables();
    2091         186 :         whenever_action(2);
    2092         186 :         free($1);
    2093             :     }
    2094             :     | ECPGDeclareStmt
    2095             :     {
    2096          10 :         output_simple_statement($1, 0);
    2097             :     }
    2098             :     | ECPGCursorStmt
    2099             :     {
    2100          40 :          output_simple_statement($1, (strncmp($1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0);
    2101             :     }
    2102             :     | ECPGDeallocateDescr
    2103             :     {
    2104          32 :         fprintf(base_yyout,"ECPGdeallocate_desc(__LINE__, %s);",$1);
    2105          32 :         whenever_action(0);
    2106          32 :         free($1);
    2107             :     }
    2108             :     | ECPGDeclare
    2109             :     {
    2110           0 :         output_simple_statement($1, 0);
    2111             :     }
    2112             :     | ECPGDescribe
    2113             :     {
    2114          42 :         check_declared_list($1.stmt_name);
    2115             : 
    2116          42 :         fprintf(base_yyout, "{ ECPGdescribe(__LINE__, %d, %d, %s, %s,", compat, $1.input, connection ? connection : "NULL", $1.stmt_name);
    2117          42 :         dump_variables(argsresult, 1);
    2118          42 :         fputs("ECPGt_EORT);", base_yyout);
    2119          42 :         fprintf(base_yyout, "}");
    2120          42 :         output_line_number();
    2121             : 
    2122          42 :         free($1.stmt_name);
    2123             :     }
    2124             :     | ECPGDisconnect
    2125             :     {
    2126         172 :         if (connection)
    2127           0 :             mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DISCONNECT statement");
    2128             : 
    2129         172 :         fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, %s);",
    2130         172 :                 $1 ? $1 : "\"CURRENT\"");
    2131         172 :         whenever_action(2);
    2132         172 :         free($1);
    2133             :     }
    2134          14 :     | ECPGExecuteImmediateStmt  { output_statement($1, 0, ECPGst_exec_immediate); }
    2135             :     | ECPGFree
    2136             :     {
    2137           2 :         const char *con = connection ? connection : "NULL";
    2138             : 
    2139           2 :         if (strcmp($1, "all") == 0)
    2140           0 :             fprintf(base_yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con);
    2141           2 :         else if ($1[0] == ':')
    2142           0 :             fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, %s);", compat, con, $1+1);
    2143             :         else
    2144           2 :             fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, \"%s\");", compat, con, $1);
    2145             : 
    2146           2 :         whenever_action(2);
    2147           2 :         free($1);
    2148             :     }
    2149             :     | ECPGGetDescriptor
    2150             :     {
    2151          62 :         lookup_descriptor($1.name, connection);
    2152          62 :         output_get_descr($1.name, $1.str);
    2153          62 :         free($1.name);
    2154          62 :         free($1.str);
    2155             :     }
    2156             :     | ECPGGetDescriptorHeader
    2157             :     {
    2158          22 :         lookup_descriptor($1, connection);
    2159          22 :         output_get_descr_header($1);
    2160          22 :         free($1);
    2161             :     }
    2162             :     | ECPGOpen
    2163             :     {
    2164             :         struct cursor *ptr;
    2165             : 
    2166          76 :         if ((ptr = add_additional_variables($1, true)) != NULL)
    2167             :         {
    2168          76 :             connection = ptr->connection ? mm_strdup(ptr->connection) : NULL;
    2169          76 :             output_statement(mm_strdup(ptr->command), 0, ECPGst_normal);
    2170          76 :             ptr->opened = true;
    2171             :         }
    2172             :     }
    2173             :     | ECPGSetAutocommit
    2174             :     {
    2175          26 :         fprintf(base_yyout, "{ ECPGsetcommit(__LINE__, \"%s\", %s);", $1, connection ? connection : "NULL");
    2176          26 :         whenever_action(2);
    2177          26 :         free($1);
    2178             :     }
    2179             :     | ECPGSetConnection
    2180             :     {
    2181           4 :         if (connection)
    2182           0 :             mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in SET CONNECTION statement");
    2183             : 
    2184           4 :         fprintf(base_yyout, "{ ECPGsetconn(__LINE__, %s);", $1);
    2185           4 :         whenever_action(2);
    2186           4 :         free($1);
    2187             :     }
    2188             :     | ECPGSetDescriptor
    2189             :     {
    2190          22 :         lookup_descriptor($1.name, connection);
    2191          22 :         output_set_descr($1.name, $1.str);
    2192          22 :         free($1.name);
    2193          22 :         free($1.str);
    2194             :     }
    2195             :     | ECPGSetDescriptorHeader
    2196             :     {
    2197           2 :         lookup_descriptor($1, connection);
    2198           2 :         output_set_descr_header($1);
    2199           2 :         free($1);
    2200             :     }
    2201             :     | ECPGTypedef
    2202             :     {
    2203          26 :         if (connection)
    2204           0 :             mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in TYPE statement");
    2205             : 
    2206          26 :         fprintf(base_yyout, "%s", $1);
    2207          26 :         free($1);
    2208          26 :         output_line_number();
    2209             :     }
    2210             :     | ECPGVar
    2211             :     {
    2212           4 :         if (connection)
    2213           0 :             mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in VAR statement");
    2214             : 
    2215           4 :         output_simple_statement($1, 0);
    2216             :     }
    2217             :     | ECPGWhenever
    2218             :     {
    2219         200 :         if (connection)
    2220           0 :             mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in WHENEVER statement");
    2221             : 
    2222         200 :         output_simple_statement($1, 0);
    2223             :     }
    2224             : | 
    2225           0 :  { $$ = NULL; }
    2226             : ;
    2227             : 
    2228             : 
    2229             :  opt_single_name:
    2230             :  ColId
    2231             :  { 
    2232           0 :  $$ = $1;
    2233             : }
    2234             : | 
    2235             :  { 
    2236           0 :  $$=EMPTY; }
    2237             : ;
    2238             : 
    2239             : 
    2240             :  opt_qualified_name:
    2241             :  any_name
    2242             :  { 
    2243           0 :  $$ = $1;
    2244             : }
    2245             : | 
    2246             :  { 
    2247           0 :  $$=EMPTY; }
    2248             : ;
    2249             : 
    2250             : 
    2251             :  opt_concurrently:
    2252             :  CONCURRENTLY
    2253             :  { 
    2254           0 :  $$ = mm_strdup("concurrently");
    2255             : }
    2256             : | 
    2257             :  { 
    2258           0 :  $$=EMPTY; }
    2259             : ;
    2260             : 
    2261             : 
    2262             :  opt_drop_behavior:
    2263             :  CASCADE
    2264             :  { 
    2265           0 :  $$ = mm_strdup("cascade");
    2266             : }
    2267             : |  RESTRICT
    2268             :  { 
    2269           0 :  $$ = mm_strdup("restrict");
    2270             : }
    2271             : | 
    2272             :  { 
    2273         122 :  $$=EMPTY; }
    2274             : ;
    2275             : 
    2276             : 
    2277             :  CallStmt:
    2278             :  CALL func_application
    2279             :  { 
    2280           0 :  $$ = cat_str(2,mm_strdup("call"),$2);
    2281             : }
    2282             : ;
    2283             : 
    2284             : 
    2285             :  CreateRoleStmt:
    2286             :  CREATE ROLE RoleId opt_with OptRoleList
    2287             :  { 
    2288           0 :  $$ = cat_str(4,mm_strdup("create role"),$3,$4,$5);
    2289             : }
    2290             : ;
    2291             : 
    2292             : 
    2293             :  opt_with:
    2294             :  WITH
    2295             :  { 
    2296           2 :  $$ = mm_strdup("with");
    2297             : }
    2298             : |  WITH_LA
    2299             :  { 
    2300           0 :  $$ = mm_strdup("with");
    2301             : }
    2302             : | 
    2303             :  { 
    2304           6 :  $$=EMPTY; }
    2305             : ;
    2306             : 
    2307             : 
    2308             :  OptRoleList:
    2309             :  OptRoleList CreateOptRoleElem
    2310             :  { 
    2311           0 :  $$ = cat_str(2,$1,$2);
    2312             : }
    2313             : | 
    2314             :  { 
    2315           0 :  $$=EMPTY; }
    2316             : ;
    2317             : 
    2318             : 
    2319             :  AlterOptRoleList:
    2320             :  AlterOptRoleList AlterOptRoleElem
    2321             :  { 
    2322           6 :  $$ = cat_str(2,$1,$2);
    2323             : }
    2324             : | 
    2325             :  { 
    2326           6 :  $$=EMPTY; }
    2327             : ;
    2328             : 
    2329             : 
    2330             :  AlterOptRoleElem:
    2331             :  PASSWORD ecpg_sconst
    2332             :  { 
    2333           0 :  $$ = cat_str(2,mm_strdup("password"),$2);
    2334             : }
    2335             : |  PASSWORD NULL_P
    2336             :  { 
    2337           0 :  $$ = mm_strdup("password null");
    2338             : }
    2339             : |  ENCRYPTED PASSWORD ecpg_sconst
    2340             :  { 
    2341           6 :  $$ = cat_str(2,mm_strdup("encrypted password"),$3);
    2342             : }
    2343             : |  UNENCRYPTED PASSWORD ecpg_sconst
    2344             :  { 
    2345           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
    2346           0 :  $$ = cat_str(2,mm_strdup("unencrypted password"),$3);
    2347             : }
    2348             : |  INHERIT
    2349             :  { 
    2350           0 :  $$ = mm_strdup("inherit");
    2351             : }
    2352             : |  CONNECTION LIMIT SignedIconst
    2353             :  { 
    2354           0 :  $$ = cat_str(2,mm_strdup("connection limit"),$3);
    2355             : }
    2356             : |  VALID UNTIL ecpg_sconst
    2357             :  { 
    2358           0 :  $$ = cat_str(2,mm_strdup("valid until"),$3);
    2359             : }
    2360             : |  USER role_list
    2361             :  { 
    2362           0 :  $$ = cat_str(2,mm_strdup("user"),$2);
    2363             : }
    2364             : |  ecpg_ident
    2365             :  { 
    2366           0 :  $$ = $1;
    2367             : }
    2368             : ;
    2369             : 
    2370             : 
    2371             :  CreateOptRoleElem:
    2372             :  AlterOptRoleElem
    2373             :  { 
    2374           0 :  $$ = $1;
    2375             : }
    2376             : |  SYSID Iconst
    2377             :  { 
    2378           0 :  $$ = cat_str(2,mm_strdup("sysid"),$2);
    2379             : }
    2380             : |  ADMIN role_list
    2381             :  { 
    2382           0 :  $$ = cat_str(2,mm_strdup("admin"),$2);
    2383             : }
    2384             : |  ROLE role_list
    2385             :  { 
    2386           0 :  $$ = cat_str(2,mm_strdup("role"),$2);
    2387             : }
    2388             : |  IN_P ROLE role_list
    2389             :  { 
    2390           0 :  $$ = cat_str(2,mm_strdup("in role"),$3);
    2391             : }
    2392             : |  IN_P GROUP_P role_list
    2393             :  { 
    2394           0 :  $$ = cat_str(2,mm_strdup("in group"),$3);
    2395             : }
    2396             : ;
    2397             : 
    2398             : 
    2399             :  CreateUserStmt:
    2400             :  CREATE USER RoleId opt_with OptRoleList
    2401             :  { 
    2402           0 :  $$ = cat_str(4,mm_strdup("create user"),$3,$4,$5);
    2403             : }
    2404             : ;
    2405             : 
    2406             : 
    2407             :  AlterRoleStmt:
    2408             :  ALTER ROLE RoleSpec opt_with AlterOptRoleList
    2409             :  { 
    2410           0 :  $$ = cat_str(4,mm_strdup("alter role"),$3,$4,$5);
    2411             : }
    2412             : |  ALTER USER RoleSpec opt_with AlterOptRoleList
    2413             :  { 
    2414           6 :  $$ = cat_str(4,mm_strdup("alter user"),$3,$4,$5);
    2415             : }
    2416             : ;
    2417             : 
    2418             : 
    2419             :  opt_in_database:
    2420             : 
    2421             :  { 
    2422           0 :  $$=EMPTY; }
    2423             : |  IN_P DATABASE name
    2424             :  { 
    2425           0 :  $$ = cat_str(2,mm_strdup("in database"),$3);
    2426             : }
    2427             : ;
    2428             : 
    2429             : 
    2430             :  AlterRoleSetStmt:
    2431             :  ALTER ROLE RoleSpec opt_in_database SetResetClause
    2432             :  { 
    2433           0 :  $$ = cat_str(4,mm_strdup("alter role"),$3,$4,$5);
    2434             : }
    2435             : |  ALTER ROLE ALL opt_in_database SetResetClause
    2436             :  { 
    2437           0 :  $$ = cat_str(3,mm_strdup("alter role all"),$4,$5);
    2438             : }
    2439             : |  ALTER USER RoleSpec opt_in_database SetResetClause
    2440             :  { 
    2441           0 :  $$ = cat_str(4,mm_strdup("alter user"),$3,$4,$5);
    2442             : }
    2443             : |  ALTER USER ALL opt_in_database SetResetClause
    2444             :  { 
    2445           0 :  $$ = cat_str(3,mm_strdup("alter user all"),$4,$5);
    2446             : }
    2447             : ;
    2448             : 
    2449             : 
    2450             :  DropRoleStmt:
    2451             :  DROP ROLE role_list
    2452             :  { 
    2453           0 :  $$ = cat_str(2,mm_strdup("drop role"),$3);
    2454             : }
    2455             : |  DROP ROLE IF_P EXISTS role_list
    2456             :  { 
    2457           0 :  $$ = cat_str(2,mm_strdup("drop role if exists"),$5);
    2458             : }
    2459             : |  DROP USER role_list
    2460             :  { 
    2461           0 :  $$ = cat_str(2,mm_strdup("drop user"),$3);
    2462             : }
    2463             : |  DROP USER IF_P EXISTS role_list
    2464             :  { 
    2465           0 :  $$ = cat_str(2,mm_strdup("drop user if exists"),$5);
    2466             : }
    2467             : |  DROP GROUP_P role_list
    2468             :  { 
    2469           0 :  $$ = cat_str(2,mm_strdup("drop group"),$3);
    2470             : }
    2471             : |  DROP GROUP_P IF_P EXISTS role_list
    2472             :  { 
    2473           0 :  $$ = cat_str(2,mm_strdup("drop group if exists"),$5);
    2474             : }
    2475             : ;
    2476             : 
    2477             : 
    2478             :  CreateGroupStmt:
    2479             :  CREATE GROUP_P RoleId opt_with OptRoleList
    2480             :  { 
    2481           0 :  $$ = cat_str(4,mm_strdup("create group"),$3,$4,$5);
    2482             : }
    2483             : ;
    2484             : 
    2485             : 
    2486             :  AlterGroupStmt:
    2487             :  ALTER GROUP_P RoleSpec add_drop USER role_list
    2488             :  { 
    2489           0 :  $$ = cat_str(5,mm_strdup("alter group"),$3,$4,mm_strdup("user"),$6);
    2490             : }
    2491             : ;
    2492             : 
    2493             : 
    2494             :  add_drop:
    2495             :  ADD_P
    2496             :  { 
    2497           0 :  $$ = mm_strdup("add");
    2498             : }
    2499             : |  DROP
    2500             :  { 
    2501           0 :  $$ = mm_strdup("drop");
    2502             : }
    2503             : ;
    2504             : 
    2505             : 
    2506             :  CreateSchemaStmt:
    2507             :  CREATE SCHEMA opt_single_name AUTHORIZATION RoleSpec OptSchemaEltList
    2508             :  { 
    2509           0 :  $$ = cat_str(5,mm_strdup("create schema"),$3,mm_strdup("authorization"),$5,$6);
    2510             : }
    2511             : |  CREATE SCHEMA ColId OptSchemaEltList
    2512             :  { 
    2513           0 :  $$ = cat_str(3,mm_strdup("create schema"),$3,$4);
    2514             : }
    2515             : |  CREATE SCHEMA IF_P NOT EXISTS opt_single_name AUTHORIZATION RoleSpec OptSchemaEltList
    2516             :  { 
    2517           0 :  $$ = cat_str(5,mm_strdup("create schema if not exists"),$6,mm_strdup("authorization"),$8,$9);
    2518             : }
    2519             : |  CREATE SCHEMA IF_P NOT EXISTS ColId OptSchemaEltList
    2520             :  { 
    2521           0 :  $$ = cat_str(3,mm_strdup("create schema if not exists"),$6,$7);
    2522             : }
    2523             : ;
    2524             : 
    2525             : 
    2526             :  OptSchemaEltList:
    2527             :  OptSchemaEltList schema_stmt
    2528             :  { 
    2529           0 :  $$ = cat_str(2,$1,$2);
    2530             : }
    2531             : | 
    2532             :  { 
    2533           0 :  $$=EMPTY; }
    2534             : ;
    2535             : 
    2536             : 
    2537             :  schema_stmt:
    2538             :  CreateStmt
    2539             :  { 
    2540           0 :  $$ = $1;
    2541             : }
    2542             : |  IndexStmt
    2543             :  { 
    2544           0 :  $$ = $1;
    2545             : }
    2546             : |  CreateSeqStmt
    2547             :  { 
    2548           0 :  $$ = $1;
    2549             : }
    2550             : |  CreateTrigStmt
    2551             :  { 
    2552           0 :  $$ = $1;
    2553             : }
    2554             : |  GrantStmt
    2555             :  { 
    2556           0 :  $$ = $1;
    2557             : }
    2558             : |  ViewStmt
    2559             :  { 
    2560           0 :  $$ = $1;
    2561             : }
    2562             : ;
    2563             : 
    2564             : 
    2565             :  VariableSetStmt:
    2566             :  SET set_rest
    2567             :  { 
    2568          46 :  $$ = cat_str(2,mm_strdup("set"),$2);
    2569             : }
    2570             : |  SET LOCAL set_rest
    2571             :  { 
    2572           0 :  $$ = cat_str(2,mm_strdup("set local"),$3);
    2573             : }
    2574             : |  SET SESSION set_rest
    2575             :  { 
    2576           0 :  $$ = cat_str(2,mm_strdup("set session"),$3);
    2577             : }
    2578             : ;
    2579             : 
    2580             : 
    2581             :  set_rest:
    2582             :  TRANSACTION transaction_mode_list
    2583             :  { 
    2584           2 :  $$ = cat_str(2,mm_strdup("transaction"),$2);
    2585             : }
    2586             : |  SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
    2587             :  { 
    2588           0 :  $$ = cat_str(2,mm_strdup("session characteristics as transaction"),$5);
    2589             : }
    2590             : |  set_rest_more
    2591             :  { 
    2592          44 :  $$ = $1;
    2593             : }
    2594             : ;
    2595             : 
    2596             : 
    2597             :  generic_set:
    2598             :  var_name TO var_list
    2599             :  { 
    2600          40 :  $$ = cat_str(3,$1,mm_strdup("to"),$3);
    2601             : }
    2602             : |  var_name '=' var_list
    2603             :  { 
    2604           2 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
    2605             : }
    2606             : |  var_name TO DEFAULT
    2607             :  { 
    2608           0 :  $$ = cat_str(2,$1,mm_strdup("to default"));
    2609             : }
    2610             : |  var_name '=' DEFAULT
    2611             :  { 
    2612           0 :  $$ = cat_str(2,$1,mm_strdup("= default"));
    2613             : }
    2614             : ;
    2615             : 
    2616             : 
    2617             :  set_rest_more:
    2618             :  generic_set
    2619             :  { 
    2620          42 :  $$ = $1;
    2621             : }
    2622             : |  var_name FROM CURRENT_P
    2623             :  { 
    2624           0 :  $$ = cat_str(2,$1,mm_strdup("from current"));
    2625             : }
    2626             : |  TIME ZONE zone_value
    2627             :  { 
    2628           2 :  $$ = cat_str(2,mm_strdup("time zone"),$3);
    2629             : }
    2630             : |  CATALOG_P ecpg_sconst
    2631             :  { 
    2632           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
    2633           0 :  $$ = cat_str(2,mm_strdup("catalog"),$2);
    2634             : }
    2635             : |  SCHEMA ecpg_sconst
    2636             :  { 
    2637           0 :  $$ = cat_str(2,mm_strdup("schema"),$2);
    2638             : }
    2639             : |  NAMES opt_encoding
    2640             :  { 
    2641           0 :  $$ = cat_str(2,mm_strdup("names"),$2);
    2642             : }
    2643             : |  ROLE NonReservedWord_or_Sconst
    2644             :  { 
    2645           0 :  $$ = cat_str(2,mm_strdup("role"),$2);
    2646             : }
    2647             : |  SESSION AUTHORIZATION NonReservedWord_or_Sconst
    2648             :  { 
    2649           0 :  $$ = cat_str(2,mm_strdup("session authorization"),$3);
    2650             : }
    2651             : |  SESSION AUTHORIZATION DEFAULT
    2652             :  { 
    2653           0 :  $$ = mm_strdup("session authorization default");
    2654             : }
    2655             : |  XML_P OPTION document_or_content
    2656             :  { 
    2657           0 :  $$ = cat_str(2,mm_strdup("xml option"),$3);
    2658             : }
    2659             : |  TRANSACTION SNAPSHOT ecpg_sconst
    2660             :  { 
    2661           0 :  $$ = cat_str(2,mm_strdup("transaction snapshot"),$3);
    2662             : }
    2663             : ;
    2664             : 
    2665             : 
    2666             :  var_name:
    2667             : ECPGColId
    2668             :  { 
    2669          52 :  $$ = $1;
    2670             : }
    2671             : |  var_name '.' ColId
    2672             :  { 
    2673           0 :  $$ = cat_str(3,$1,mm_strdup("."),$3);
    2674             : }
    2675             : ;
    2676             : 
    2677             : 
    2678             :  var_list:
    2679             :  var_value
    2680             :  { 
    2681          42 :  $$ = $1;
    2682             : }
    2683             : |  var_list ',' var_value
    2684             :  { 
    2685           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    2686             : }
    2687             : ;
    2688             : 
    2689             : 
    2690             :  var_value:
    2691             :  opt_boolean_or_string
    2692             :  { 
    2693          40 :  $$ = $1;
    2694             : }
    2695             : |  NumericOnly
    2696             :  { 
    2697           2 :         if ($1[0] == '$')
    2698             :         {
    2699           2 :             free($1);
    2700           2 :             $1 = mm_strdup("$0");
    2701             :         }
    2702             : 
    2703           2 :  $$ = $1;
    2704             : }
    2705             : ;
    2706             : 
    2707             : 
    2708             :  iso_level:
    2709             :  READ UNCOMMITTED
    2710             :  { 
    2711           0 :  $$ = mm_strdup("read uncommitted");
    2712             : }
    2713             : |  READ COMMITTED
    2714             :  { 
    2715           2 :  $$ = mm_strdup("read committed");
    2716             : }
    2717             : |  REPEATABLE READ
    2718             :  { 
    2719           0 :  $$ = mm_strdup("repeatable read");
    2720             : }
    2721             : |  SERIALIZABLE
    2722             :  { 
    2723           0 :  $$ = mm_strdup("serializable");
    2724             : }
    2725             : ;
    2726             : 
    2727             : 
    2728             :  opt_boolean_or_string:
    2729             :  TRUE_P
    2730             :  { 
    2731           0 :  $$ = mm_strdup("true");
    2732             : }
    2733             : |  FALSE_P
    2734             :  { 
    2735           0 :  $$ = mm_strdup("false");
    2736             : }
    2737             : |  ON
    2738             :  { 
    2739           4 :  $$ = mm_strdup("on");
    2740             : }
    2741             : |  NonReservedWord_or_Sconst
    2742             :  { 
    2743          36 :  $$ = $1;
    2744             : }
    2745             : ;
    2746             : 
    2747             : 
    2748             :  zone_value:
    2749             :  ecpg_sconst
    2750             :  { 
    2751           0 :  $$ = $1;
    2752             : }
    2753             : |  ecpg_ident
    2754             :  { 
    2755           2 :  $$ = $1;
    2756             : }
    2757             : |  ConstInterval ecpg_sconst opt_interval
    2758             :  { 
    2759           0 :  $$ = cat_str(3,$1,$2,$3);
    2760             : }
    2761             : |  ConstInterval '(' Iconst ')' ecpg_sconst
    2762             :  { 
    2763           0 :  $$ = cat_str(5,$1,mm_strdup("("),$3,mm_strdup(")"),$5);
    2764             : }
    2765             : |  NumericOnly
    2766             :  { 
    2767           0 :  $$ = $1;
    2768             : }
    2769             : |  DEFAULT
    2770             :  { 
    2771           0 :  $$ = mm_strdup("default");
    2772             : }
    2773             : |  LOCAL
    2774             :  { 
    2775           0 :  $$ = mm_strdup("local");
    2776             : }
    2777             : ;
    2778             : 
    2779             : 
    2780             :  opt_encoding:
    2781             :  ecpg_sconst
    2782             :  { 
    2783           0 :  $$ = $1;
    2784             : }
    2785             : |  DEFAULT
    2786             :  { 
    2787           0 :  $$ = mm_strdup("default");
    2788             : }
    2789             : | 
    2790             :  { 
    2791           0 :  $$=EMPTY; }
    2792             : ;
    2793             : 
    2794             : 
    2795             :  NonReservedWord_or_Sconst:
    2796             :  NonReservedWord
    2797             :  { 
    2798          32 :  $$ = $1;
    2799             : }
    2800             : |  ecpg_sconst
    2801             :  { 
    2802           6 :  $$ = $1;
    2803             : }
    2804             : ;
    2805             : 
    2806             : 
    2807             :  VariableResetStmt:
    2808             :  RESET reset_rest
    2809             :  { 
    2810           0 :  $$ = cat_str(2,mm_strdup("reset"),$2);
    2811             : }
    2812             : ;
    2813             : 
    2814             : 
    2815             :  reset_rest:
    2816             :  generic_reset
    2817             :  { 
    2818           0 :  $$ = $1;
    2819             : }
    2820             : |  TIME ZONE
    2821             :  { 
    2822           0 :  $$ = mm_strdup("time zone");
    2823             : }
    2824             : |  TRANSACTION ISOLATION LEVEL
    2825             :  { 
    2826           0 :  $$ = mm_strdup("transaction isolation level");
    2827             : }
    2828             : |  SESSION AUTHORIZATION
    2829             :  { 
    2830           0 :  $$ = mm_strdup("session authorization");
    2831             : }
    2832             : ;
    2833             : 
    2834             : 
    2835             :  generic_reset:
    2836             :  var_name
    2837             :  { 
    2838           0 :  $$ = $1;
    2839             : }
    2840             : |  ALL
    2841             :  { 
    2842           0 :  $$ = mm_strdup("all");
    2843             : }
    2844             : ;
    2845             : 
    2846             : 
    2847             :  SetResetClause:
    2848             :  SET set_rest
    2849             :  { 
    2850           0 :  $$ = cat_str(2,mm_strdup("set"),$2);
    2851             : }
    2852             : |  VariableResetStmt
    2853             :  { 
    2854           0 :  $$ = $1;
    2855             : }
    2856             : ;
    2857             : 
    2858             : 
    2859             :  FunctionSetResetClause:
    2860             :  SET set_rest_more
    2861             :  { 
    2862           0 :  $$ = cat_str(2,mm_strdup("set"),$2);
    2863             : }
    2864             : |  VariableResetStmt
    2865             :  { 
    2866           0 :  $$ = $1;
    2867             : }
    2868             : ;
    2869             : 
    2870             : 
    2871             :  VariableShowStmt:
    2872             : SHOW var_name ecpg_into
    2873             :  { 
    2874          10 :  $$ = cat_str(2,mm_strdup("show"),$2);
    2875             : }
    2876             : | SHOW TIME ZONE ecpg_into
    2877             :  { 
    2878           2 :  $$ = mm_strdup("show time zone");
    2879             : }
    2880             : | SHOW TRANSACTION ISOLATION LEVEL ecpg_into
    2881             :  { 
    2882           2 :  $$ = mm_strdup("show transaction isolation level");
    2883             : }
    2884             : | SHOW SESSION AUTHORIZATION ecpg_into
    2885             :  { 
    2886           0 :  $$ = mm_strdup("show session authorization");
    2887             : }
    2888             : |  SHOW ALL
    2889             :     {
    2890           0 :         mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL is not implemented");
    2891           0 :         $$ = EMPTY;
    2892             :     }
    2893             : ;
    2894             : 
    2895             : 
    2896             :  ConstraintsSetStmt:
    2897             :  SET CONSTRAINTS constraints_set_list constraints_set_mode
    2898             :  { 
    2899           0 :  $$ = cat_str(3,mm_strdup("set constraints"),$3,$4);
    2900             : }
    2901             : ;
    2902             : 
    2903             : 
    2904             :  constraints_set_list:
    2905             :  ALL
    2906             :  { 
    2907           0 :  $$ = mm_strdup("all");
    2908             : }
    2909             : |  qualified_name_list
    2910             :  { 
    2911           0 :  $$ = $1;
    2912             : }
    2913             : ;
    2914             : 
    2915             : 
    2916             :  constraints_set_mode:
    2917             :  DEFERRED
    2918             :  { 
    2919           0 :  $$ = mm_strdup("deferred");
    2920             : }
    2921             : |  IMMEDIATE
    2922             :  { 
    2923           0 :  $$ = mm_strdup("immediate");
    2924             : }
    2925             : ;
    2926             : 
    2927             : 
    2928             :  CheckPointStmt:
    2929             :  CHECKPOINT
    2930             :  { 
    2931           0 :  $$ = mm_strdup("checkpoint");
    2932             : }
    2933             : ;
    2934             : 
    2935             : 
    2936             :  DiscardStmt:
    2937             :  DISCARD ALL
    2938             :  { 
    2939           0 :  $$ = mm_strdup("discard all");
    2940             : }
    2941             : |  DISCARD TEMP
    2942             :  { 
    2943           0 :  $$ = mm_strdup("discard temp");
    2944             : }
    2945             : |  DISCARD TEMPORARY
    2946             :  { 
    2947           0 :  $$ = mm_strdup("discard temporary");
    2948             : }
    2949             : |  DISCARD PLANS
    2950             :  { 
    2951           0 :  $$ = mm_strdup("discard plans");
    2952             : }
    2953             : |  DISCARD SEQUENCES
    2954             :  { 
    2955           0 :  $$ = mm_strdup("discard sequences");
    2956             : }
    2957             : ;
    2958             : 
    2959             : 
    2960             :  AlterTableStmt:
    2961             :  ALTER TABLE relation_expr alter_table_cmds
    2962             :  { 
    2963           4 :  $$ = cat_str(3,mm_strdup("alter table"),$3,$4);
    2964             : }
    2965             : |  ALTER TABLE IF_P EXISTS relation_expr alter_table_cmds
    2966             :  { 
    2967           0 :  $$ = cat_str(3,mm_strdup("alter table if exists"),$5,$6);
    2968             : }
    2969             : |  ALTER TABLE relation_expr partition_cmd
    2970             :  { 
    2971           0 :  $$ = cat_str(3,mm_strdup("alter table"),$3,$4);
    2972             : }
    2973             : |  ALTER TABLE IF_P EXISTS relation_expr partition_cmd
    2974             :  { 
    2975           0 :  $$ = cat_str(3,mm_strdup("alter table if exists"),$5,$6);
    2976             : }
    2977             : |  ALTER TABLE ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
    2978             :  { 
    2979           0 :  $$ = cat_str(5,mm_strdup("alter table all in tablespace"),$6,mm_strdup("set tablespace"),$9,$10);
    2980             : }
    2981             : |  ALTER TABLE ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
    2982             :  { 
    2983           0 :  $$ = cat_str(7,mm_strdup("alter table all in tablespace"),$6,mm_strdup("owned by"),$9,mm_strdup("set tablespace"),$12,$13);
    2984             : }
    2985             : |  ALTER INDEX qualified_name alter_table_cmds
    2986             :  { 
    2987           0 :  $$ = cat_str(3,mm_strdup("alter index"),$3,$4);
    2988             : }
    2989             : |  ALTER INDEX IF_P EXISTS qualified_name alter_table_cmds
    2990             :  { 
    2991           0 :  $$ = cat_str(3,mm_strdup("alter index if exists"),$5,$6);
    2992             : }
    2993             : |  ALTER INDEX qualified_name index_partition_cmd
    2994             :  { 
    2995           0 :  $$ = cat_str(3,mm_strdup("alter index"),$3,$4);
    2996             : }
    2997             : |  ALTER INDEX ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
    2998             :  { 
    2999           0 :  $$ = cat_str(5,mm_strdup("alter index all in tablespace"),$6,mm_strdup("set tablespace"),$9,$10);
    3000             : }
    3001             : |  ALTER INDEX ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
    3002             :  { 
    3003           0 :  $$ = cat_str(7,mm_strdup("alter index all in tablespace"),$6,mm_strdup("owned by"),$9,mm_strdup("set tablespace"),$12,$13);
    3004             : }
    3005             : |  ALTER SEQUENCE qualified_name alter_table_cmds
    3006             :  { 
    3007           0 :  $$ = cat_str(3,mm_strdup("alter sequence"),$3,$4);
    3008             : }
    3009             : |  ALTER SEQUENCE IF_P EXISTS qualified_name alter_table_cmds
    3010             :  { 
    3011           0 :  $$ = cat_str(3,mm_strdup("alter sequence if exists"),$5,$6);
    3012             : }
    3013             : |  ALTER VIEW qualified_name alter_table_cmds
    3014             :  { 
    3015           0 :  $$ = cat_str(3,mm_strdup("alter view"),$3,$4);
    3016             : }
    3017             : |  ALTER VIEW IF_P EXISTS qualified_name alter_table_cmds
    3018             :  { 
    3019           0 :  $$ = cat_str(3,mm_strdup("alter view if exists"),$5,$6);
    3020             : }
    3021             : |  ALTER MATERIALIZED VIEW qualified_name alter_table_cmds
    3022             :  { 
    3023           0 :  $$ = cat_str(3,mm_strdup("alter materialized view"),$4,$5);
    3024             : }
    3025             : |  ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name alter_table_cmds
    3026             :  { 
    3027           0 :  $$ = cat_str(3,mm_strdup("alter materialized view if exists"),$6,$7);
    3028             : }
    3029             : |  ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
    3030             :  { 
    3031           0 :  $$ = cat_str(5,mm_strdup("alter materialized view all in tablespace"),$7,mm_strdup("set tablespace"),$10,$11);
    3032             : }
    3033             : |  ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
    3034             :  { 
    3035           0 :  $$ = cat_str(7,mm_strdup("alter materialized view all in tablespace"),$7,mm_strdup("owned by"),$10,mm_strdup("set tablespace"),$13,$14);
    3036             : }
    3037             : |  ALTER FOREIGN TABLE relation_expr alter_table_cmds
    3038             :  { 
    3039           0 :  $$ = cat_str(3,mm_strdup("alter foreign table"),$4,$5);
    3040             : }
    3041             : |  ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
    3042             :  { 
    3043           0 :  $$ = cat_str(3,mm_strdup("alter foreign table if exists"),$6,$7);
    3044             : }
    3045             : ;
    3046             : 
    3047             : 
    3048             :  alter_table_cmds:
    3049             :  alter_table_cmd
    3050             :  { 
    3051           4 :  $$ = $1;
    3052             : }
    3053             : |  alter_table_cmds ',' alter_table_cmd
    3054             :  { 
    3055           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3056             : }
    3057             : ;
    3058             : 
    3059             : 
    3060             :  partitions_list:
    3061             :  SinglePartitionSpec
    3062             :  { 
    3063           0 :  $$ = $1;
    3064             : }
    3065             : |  partitions_list ',' SinglePartitionSpec
    3066             :  { 
    3067           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3068             : }
    3069             : ;
    3070             : 
    3071             : 
    3072             :  SinglePartitionSpec:
    3073             :  PARTITION qualified_name PartitionBoundSpec
    3074             :  { 
    3075           0 :  $$ = cat_str(3,mm_strdup("partition"),$2,$3);
    3076             : }
    3077             : ;
    3078             : 
    3079             : 
    3080             :  partition_cmd:
    3081             :  ATTACH PARTITION qualified_name PartitionBoundSpec
    3082             :  { 
    3083           0 :  $$ = cat_str(3,mm_strdup("attach partition"),$3,$4);
    3084             : }
    3085             : |  DETACH PARTITION qualified_name opt_concurrently
    3086             :  { 
    3087           0 :  $$ = cat_str(3,mm_strdup("detach partition"),$3,$4);
    3088             : }
    3089             : |  DETACH PARTITION qualified_name FINALIZE
    3090             :  { 
    3091           0 :  $$ = cat_str(3,mm_strdup("detach partition"),$3,mm_strdup("finalize"));
    3092             : }
    3093             : |  SPLIT PARTITION qualified_name INTO '(' partitions_list ')'
    3094             :  { 
    3095           0 :  $$ = cat_str(5,mm_strdup("split partition"),$3,mm_strdup("into ("),$6,mm_strdup(")"));
    3096             : }
    3097             : |  MERGE PARTITIONS '(' qualified_name_list ')' INTO qualified_name
    3098             :  { 
    3099           0 :  $$ = cat_str(4,mm_strdup("merge partitions ("),$4,mm_strdup(") into"),$7);
    3100             : }
    3101             : ;
    3102             : 
    3103             : 
    3104             :  index_partition_cmd:
    3105             :  ATTACH PARTITION qualified_name
    3106             :  { 
    3107           0 :  $$ = cat_str(2,mm_strdup("attach partition"),$3);
    3108             : }
    3109             : ;
    3110             : 
    3111             : 
    3112             :  alter_table_cmd:
    3113             :  ADD_P columnDef
    3114             :  { 
    3115           0 :  $$ = cat_str(2,mm_strdup("add"),$2);
    3116             : }
    3117             : |  ADD_P IF_P NOT EXISTS columnDef
    3118             :  { 
    3119           0 :  $$ = cat_str(2,mm_strdup("add if not exists"),$5);
    3120             : }
    3121             : |  ADD_P COLUMN columnDef
    3122             :  { 
    3123           0 :  $$ = cat_str(2,mm_strdup("add column"),$3);
    3124             : }
    3125             : |  ADD_P COLUMN IF_P NOT EXISTS columnDef
    3126             :  { 
    3127           0 :  $$ = cat_str(2,mm_strdup("add column if not exists"),$6);
    3128             : }
    3129             : |  ALTER opt_column ColId alter_column_default
    3130             :  { 
    3131           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,$4);
    3132             : }
    3133             : |  ALTER opt_column ColId DROP NOT NULL_P
    3134             :  { 
    3135           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop not null"));
    3136             : }
    3137             : |  ALTER opt_column ColId SET NOT NULL_P
    3138             :  { 
    3139           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("set not null"));
    3140             : }
    3141             : |  ALTER opt_column ColId SET EXPRESSION AS '(' a_expr ')'
    3142             :  { 
    3143           0 :  $$ = cat_str(6,mm_strdup("alter"),$2,$3,mm_strdup("set expression as ("),$8,mm_strdup(")"));
    3144             : }
    3145             : |  ALTER opt_column ColId DROP EXPRESSION
    3146             :  { 
    3147           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop expression"));
    3148             : }
    3149             : |  ALTER opt_column ColId DROP EXPRESSION IF_P EXISTS
    3150             :  { 
    3151           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop expression if exists"));
    3152             : }
    3153             : |  ALTER opt_column ColId SET STATISTICS set_statistics_value
    3154             :  { 
    3155           0 :  $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set statistics"),$6);
    3156             : }
    3157             : |  ALTER opt_column Iconst SET STATISTICS set_statistics_value
    3158             :  { 
    3159           0 :  $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set statistics"),$6);
    3160             : }
    3161             : |  ALTER opt_column ColId SET reloptions
    3162             :  { 
    3163           0 :  $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set"),$5);
    3164             : }
    3165             : |  ALTER opt_column ColId RESET reloptions
    3166             :  { 
    3167           0 :  $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("reset"),$5);
    3168             : }
    3169             : |  ALTER opt_column ColId SET column_storage
    3170             :  { 
    3171           0 :  $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set"),$5);
    3172             : }
    3173             : |  ALTER opt_column ColId SET column_compression
    3174             :  { 
    3175           0 :  $$ = cat_str(5,mm_strdup("alter"),$2,$3,mm_strdup("set"),$5);
    3176             : }
    3177             : |  ALTER opt_column ColId ADD_P GENERATED generated_when AS IDENTITY_P OptParenthesizedSeqOptList
    3178             :  { 
    3179           0 :  $$ = cat_str(7,mm_strdup("alter"),$2,$3,mm_strdup("add generated"),$6,mm_strdup("as identity"),$9);
    3180             : }
    3181             : |  ALTER opt_column ColId alter_identity_column_option_list
    3182             :  { 
    3183           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,$4);
    3184             : }
    3185             : |  ALTER opt_column ColId DROP IDENTITY_P
    3186             :  { 
    3187           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop identity"));
    3188             : }
    3189             : |  ALTER opt_column ColId DROP IDENTITY_P IF_P EXISTS
    3190             :  { 
    3191           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,mm_strdup("drop identity if exists"));
    3192             : }
    3193             : |  DROP opt_column IF_P EXISTS ColId opt_drop_behavior
    3194             :  { 
    3195           0 :  $$ = cat_str(5,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,$6);
    3196             : }
    3197             : |  DROP opt_column ColId opt_drop_behavior
    3198             :  { 
    3199           0 :  $$ = cat_str(4,mm_strdup("drop"),$2,$3,$4);
    3200             : }
    3201             : |  ALTER opt_column ColId opt_set_data TYPE_P Typename opt_collate_clause alter_using
    3202             :  { 
    3203           4 :  $$ = cat_str(8,mm_strdup("alter"),$2,$3,$4,mm_strdup("type"),$6,$7,$8);
    3204             : }
    3205             : |  ALTER opt_column ColId alter_generic_options
    3206             :  { 
    3207           0 :  $$ = cat_str(4,mm_strdup("alter"),$2,$3,$4);
    3208             : }
    3209             : |  ADD_P TableConstraint
    3210             :  { 
    3211           0 :  $$ = cat_str(2,mm_strdup("add"),$2);
    3212             : }
    3213             : |  ALTER CONSTRAINT name ConstraintAttributeSpec
    3214             :  { 
    3215           0 :  $$ = cat_str(3,mm_strdup("alter constraint"),$3,$4);
    3216             : }
    3217             : |  VALIDATE CONSTRAINT name
    3218             :  { 
    3219           0 :  $$ = cat_str(2,mm_strdup("validate constraint"),$3);
    3220             : }
    3221             : |  DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
    3222             :  { 
    3223           0 :  $$ = cat_str(3,mm_strdup("drop constraint if exists"),$5,$6);
    3224             : }
    3225             : |  DROP CONSTRAINT name opt_drop_behavior
    3226             :  { 
    3227           0 :  $$ = cat_str(3,mm_strdup("drop constraint"),$3,$4);
    3228             : }
    3229             : |  SET WITHOUT OIDS
    3230             :  { 
    3231           0 :  $$ = mm_strdup("set without oids");
    3232             : }
    3233             : |  CLUSTER ON name
    3234             :  { 
    3235           0 :  $$ = cat_str(2,mm_strdup("cluster on"),$3);
    3236             : }
    3237             : |  SET WITHOUT CLUSTER
    3238             :  { 
    3239           0 :  $$ = mm_strdup("set without cluster");
    3240             : }
    3241             : |  SET LOGGED
    3242             :  { 
    3243           0 :  $$ = mm_strdup("set logged");
    3244             : }
    3245             : |  SET UNLOGGED
    3246             :  { 
    3247           0 :  $$ = mm_strdup("set unlogged");
    3248             : }
    3249             : |  ENABLE_P TRIGGER name
    3250             :  { 
    3251           0 :  $$ = cat_str(2,mm_strdup("enable trigger"),$3);
    3252             : }
    3253             : |  ENABLE_P ALWAYS TRIGGER name
    3254             :  { 
    3255           0 :  $$ = cat_str(2,mm_strdup("enable always trigger"),$4);
    3256             : }
    3257             : |  ENABLE_P REPLICA TRIGGER name
    3258             :  { 
    3259           0 :  $$ = cat_str(2,mm_strdup("enable replica trigger"),$4);
    3260             : }
    3261             : |  ENABLE_P TRIGGER ALL
    3262             :  { 
    3263           0 :  $$ = mm_strdup("enable trigger all");
    3264             : }
    3265             : |  ENABLE_P TRIGGER USER
    3266             :  { 
    3267           0 :  $$ = mm_strdup("enable trigger user");
    3268             : }
    3269             : |  DISABLE_P TRIGGER name
    3270             :  { 
    3271           0 :  $$ = cat_str(2,mm_strdup("disable trigger"),$3);
    3272             : }
    3273             : |  DISABLE_P TRIGGER ALL
    3274             :  { 
    3275           0 :  $$ = mm_strdup("disable trigger all");
    3276             : }
    3277             : |  DISABLE_P TRIGGER USER
    3278             :  { 
    3279           0 :  $$ = mm_strdup("disable trigger user");
    3280             : }
    3281             : |  ENABLE_P RULE name
    3282             :  { 
    3283           0 :  $$ = cat_str(2,mm_strdup("enable rule"),$3);
    3284             : }
    3285             : |  ENABLE_P ALWAYS RULE name
    3286             :  { 
    3287           0 :  $$ = cat_str(2,mm_strdup("enable always rule"),$4);
    3288             : }
    3289             : |  ENABLE_P REPLICA RULE name
    3290             :  { 
    3291           0 :  $$ = cat_str(2,mm_strdup("enable replica rule"),$4);
    3292             : }
    3293             : |  DISABLE_P RULE name
    3294             :  { 
    3295           0 :  $$ = cat_str(2,mm_strdup("disable rule"),$3);
    3296             : }
    3297             : |  INHERIT qualified_name
    3298             :  { 
    3299           0 :  $$ = cat_str(2,mm_strdup("inherit"),$2);
    3300             : }
    3301             : |  NO INHERIT qualified_name
    3302             :  { 
    3303           0 :  $$ = cat_str(2,mm_strdup("no inherit"),$3);
    3304             : }
    3305             : |  OF any_name
    3306             :  { 
    3307           0 :  $$ = cat_str(2,mm_strdup("of"),$2);
    3308             : }
    3309             : |  NOT OF
    3310             :  { 
    3311           0 :  $$ = mm_strdup("not of");
    3312             : }
    3313             : |  OWNER TO RoleSpec
    3314             :  { 
    3315           0 :  $$ = cat_str(2,mm_strdup("owner to"),$3);
    3316             : }
    3317             : |  SET ACCESS METHOD set_access_method_name
    3318             :  { 
    3319           0 :  $$ = cat_str(2,mm_strdup("set access method"),$4);
    3320             : }
    3321             : |  SET TABLESPACE name
    3322             :  { 
    3323           0 :  $$ = cat_str(2,mm_strdup("set tablespace"),$3);
    3324             : }
    3325             : |  SET reloptions
    3326             :  { 
    3327           0 :  $$ = cat_str(2,mm_strdup("set"),$2);
    3328             : }
    3329             : |  RESET reloptions
    3330             :  { 
    3331           0 :  $$ = cat_str(2,mm_strdup("reset"),$2);
    3332             : }
    3333             : |  REPLICA IDENTITY_P replica_identity
    3334             :  { 
    3335           0 :  $$ = cat_str(2,mm_strdup("replica identity"),$3);
    3336             : }
    3337             : |  ENABLE_P ROW LEVEL SECURITY
    3338             :  { 
    3339           0 :  $$ = mm_strdup("enable row level security");
    3340             : }
    3341             : |  DISABLE_P ROW LEVEL SECURITY
    3342             :  { 
    3343           0 :  $$ = mm_strdup("disable row level security");
    3344             : }
    3345             : |  FORCE ROW LEVEL SECURITY
    3346             :  { 
    3347           0 :  $$ = mm_strdup("force row level security");
    3348             : }
    3349             : |  NO FORCE ROW LEVEL SECURITY
    3350             :  { 
    3351           0 :  $$ = mm_strdup("no force row level security");
    3352             : }
    3353             : |  alter_generic_options
    3354             :  { 
    3355           0 :  $$ = $1;
    3356             : }
    3357             : ;
    3358             : 
    3359             : 
    3360             :  alter_column_default:
    3361             :  SET DEFAULT a_expr
    3362             :  { 
    3363           0 :  $$ = cat_str(2,mm_strdup("set default"),$3);
    3364             : }
    3365             : |  DROP DEFAULT
    3366             :  { 
    3367           0 :  $$ = mm_strdup("drop default");
    3368             : }
    3369             : ;
    3370             : 
    3371             : 
    3372             :  opt_collate_clause:
    3373             :  COLLATE any_name
    3374             :  { 
    3375           0 :  $$ = cat_str(2,mm_strdup("collate"),$2);
    3376             : }
    3377             : | 
    3378             :  { 
    3379           4 :  $$=EMPTY; }
    3380             : ;
    3381             : 
    3382             : 
    3383             :  alter_using:
    3384             :  USING a_expr
    3385             :  { 
    3386           0 :  $$ = cat_str(2,mm_strdup("using"),$2);
    3387             : }
    3388             : | 
    3389             :  { 
    3390           4 :  $$=EMPTY; }
    3391             : ;
    3392             : 
    3393             : 
    3394             :  replica_identity:
    3395             :  NOTHING
    3396             :  { 
    3397           0 :  $$ = mm_strdup("nothing");
    3398             : }
    3399             : |  FULL
    3400             :  { 
    3401           0 :  $$ = mm_strdup("full");
    3402             : }
    3403             : |  DEFAULT
    3404             :  { 
    3405           0 :  $$ = mm_strdup("default");
    3406             : }
    3407             : |  USING INDEX name
    3408             :  { 
    3409           0 :  $$ = cat_str(2,mm_strdup("using index"),$3);
    3410             : }
    3411             : ;
    3412             : 
    3413             : 
    3414             :  reloptions:
    3415             :  '(' reloption_list ')'
    3416             :  { 
    3417           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    3418             : }
    3419             : ;
    3420             : 
    3421             : 
    3422             :  opt_reloptions:
    3423             :  WITH reloptions
    3424             :  { 
    3425           0 :  $$ = cat_str(2,mm_strdup("with"),$2);
    3426             : }
    3427             : | 
    3428             :  { 
    3429           0 :  $$=EMPTY; }
    3430             : ;
    3431             : 
    3432             : 
    3433             :  reloption_list:
    3434             :  reloption_elem
    3435             :  { 
    3436           0 :  $$ = $1;
    3437             : }
    3438             : |  reloption_list ',' reloption_elem
    3439             :  { 
    3440           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3441             : }
    3442             : ;
    3443             : 
    3444             : 
    3445             :  reloption_elem:
    3446             :  ColLabel '=' def_arg
    3447             :  { 
    3448           0 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
    3449             : }
    3450             : |  ColLabel
    3451             :  { 
    3452           0 :  $$ = $1;
    3453             : }
    3454             : |  ColLabel '.' ColLabel '=' def_arg
    3455             :  { 
    3456           0 :  $$ = cat_str(5,$1,mm_strdup("."),$3,mm_strdup("="),$5);
    3457             : }
    3458             : |  ColLabel '.' ColLabel
    3459             :  { 
    3460           0 :  $$ = cat_str(3,$1,mm_strdup("."),$3);
    3461             : }
    3462             : ;
    3463             : 
    3464             : 
    3465             :  alter_identity_column_option_list:
    3466             :  alter_identity_column_option
    3467             :  { 
    3468           0 :  $$ = $1;
    3469             : }
    3470             : |  alter_identity_column_option_list alter_identity_column_option
    3471             :  { 
    3472           0 :  $$ = cat_str(2,$1,$2);
    3473             : }
    3474             : ;
    3475             : 
    3476             : 
    3477             :  alter_identity_column_option:
    3478             :  RESTART
    3479             :  { 
    3480           0 :  $$ = mm_strdup("restart");
    3481             : }
    3482             : |  RESTART opt_with NumericOnly
    3483             :  { 
    3484           0 :  $$ = cat_str(3,mm_strdup("restart"),$2,$3);
    3485             : }
    3486             : |  SET SeqOptElem
    3487             :  { 
    3488           0 :  $$ = cat_str(2,mm_strdup("set"),$2);
    3489             : }
    3490             : |  SET GENERATED generated_when
    3491             :  { 
    3492           0 :  $$ = cat_str(2,mm_strdup("set generated"),$3);
    3493             : }
    3494             : ;
    3495             : 
    3496             : 
    3497             :  set_statistics_value:
    3498             :  SignedIconst
    3499             :  { 
    3500           0 :  $$ = $1;
    3501             : }
    3502             : |  DEFAULT
    3503             :  { 
    3504           0 :  $$ = mm_strdup("default");
    3505             : }
    3506             : ;
    3507             : 
    3508             : 
    3509             :  set_access_method_name:
    3510             :  ColId
    3511             :  { 
    3512           0 :  $$ = $1;
    3513             : }
    3514             : |  DEFAULT
    3515             :  { 
    3516           0 :  $$ = mm_strdup("default");
    3517             : }
    3518             : ;
    3519             : 
    3520             : 
    3521             :  PartitionBoundSpec:
    3522             :  FOR VALUES WITH '(' hash_partbound ')'
    3523             :  { 
    3524           0 :  $$ = cat_str(3,mm_strdup("for values with ("),$5,mm_strdup(")"));
    3525             : }
    3526             : |  FOR VALUES IN_P '(' expr_list ')'
    3527             :  { 
    3528           0 :  $$ = cat_str(3,mm_strdup("for values in ("),$5,mm_strdup(")"));
    3529             : }
    3530             : |  FOR VALUES FROM '(' expr_list ')' TO '(' expr_list ')'
    3531             :  { 
    3532           0 :  $$ = cat_str(5,mm_strdup("for values from ("),$5,mm_strdup(") to ("),$9,mm_strdup(")"));
    3533             : }
    3534             : |  DEFAULT
    3535             :  { 
    3536           0 :  $$ = mm_strdup("default");
    3537             : }
    3538             : ;
    3539             : 
    3540             : 
    3541             :  hash_partbound_elem:
    3542             :  NonReservedWord Iconst
    3543             :  { 
    3544           0 :  $$ = cat_str(2,$1,$2);
    3545             : }
    3546             : ;
    3547             : 
    3548             : 
    3549             :  hash_partbound:
    3550             :  hash_partbound_elem
    3551             :  { 
    3552           0 :  $$ = $1;
    3553             : }
    3554             : |  hash_partbound ',' hash_partbound_elem
    3555             :  { 
    3556           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3557             : }
    3558             : ;
    3559             : 
    3560             : 
    3561             :  AlterCompositeTypeStmt:
    3562             :  ALTER TYPE_P any_name alter_type_cmds
    3563             :  { 
    3564           0 :  $$ = cat_str(3,mm_strdup("alter type"),$3,$4);
    3565             : }
    3566             : ;
    3567             : 
    3568             : 
    3569             :  alter_type_cmds:
    3570             :  alter_type_cmd
    3571             :  { 
    3572           0 :  $$ = $1;
    3573             : }
    3574             : |  alter_type_cmds ',' alter_type_cmd
    3575             :  { 
    3576           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3577             : }
    3578             : ;
    3579             : 
    3580             : 
    3581             :  alter_type_cmd:
    3582             :  ADD_P ATTRIBUTE TableFuncElement opt_drop_behavior
    3583             :  { 
    3584           0 :  $$ = cat_str(3,mm_strdup("add attribute"),$3,$4);
    3585             : }
    3586             : |  DROP ATTRIBUTE IF_P EXISTS ColId opt_drop_behavior
    3587             :  { 
    3588           0 :  $$ = cat_str(3,mm_strdup("drop attribute if exists"),$5,$6);
    3589             : }
    3590             : |  DROP ATTRIBUTE ColId opt_drop_behavior
    3591             :  { 
    3592           0 :  $$ = cat_str(3,mm_strdup("drop attribute"),$3,$4);
    3593             : }
    3594             : |  ALTER ATTRIBUTE ColId opt_set_data TYPE_P Typename opt_collate_clause opt_drop_behavior
    3595             :  { 
    3596           0 :  $$ = cat_str(7,mm_strdup("alter attribute"),$3,$4,mm_strdup("type"),$6,$7,$8);
    3597             : }
    3598             : ;
    3599             : 
    3600             : 
    3601             :  ClosePortalStmt:
    3602             :  CLOSE cursor_name
    3603             :     {
    3604          76 :         char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : $2;
    3605          76 :         struct cursor *ptr = NULL;
    3606          80 :         for (ptr = cur; ptr != NULL; ptr = ptr -> next)
    3607             :         {
    3608          76 :             if (strcmp($2, ptr -> name) == 0)
    3609             :             {
    3610          72 :                 if (ptr -> connection)
    3611          16 :                     connection = mm_strdup(ptr -> connection);
    3612             : 
    3613          72 :                 break;
    3614             :             }
    3615             :         }
    3616          76 :         $$ = cat2_str(mm_strdup("close"), cursor_marker);
    3617             :     }
    3618             : |  CLOSE ALL
    3619             :  { 
    3620           0 :  $$ = mm_strdup("close all");
    3621             : }
    3622             : ;
    3623             : 
    3624             : 
    3625             :  CopyStmt:
    3626             :  COPY opt_binary qualified_name opt_column_list copy_from opt_program copy_file_name copy_delimiter opt_with copy_options where_clause
    3627             :  { 
    3628           2 :             if (strcmp($6, "from") == 0 &&
    3629           0 :                (strcmp($7, "stdin") == 0 || strcmp($7, "stdout") == 0))
    3630           0 :                 mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not implemented");
    3631             : 
    3632           2 :  $$ = cat_str(11,mm_strdup("copy"),$2,$3,$4,$5,$6,$7,$8,$9,$10,$11);
    3633             : }
    3634             : |  COPY '(' PreparableStmt ')' TO opt_program copy_file_name opt_with copy_options
    3635             :  { 
    3636           0 :  $$ = cat_str(7,mm_strdup("copy ("),$3,mm_strdup(") to"),$6,$7,$8,$9);
    3637             : }
    3638             : ;
    3639             : 
    3640             : 
    3641             :  copy_from:
    3642             :  FROM
    3643             :  { 
    3644           0 :  $$ = mm_strdup("from");
    3645             : }
    3646             : |  TO
    3647             :  { 
    3648           2 :  $$ = mm_strdup("to");
    3649             : }
    3650             : ;
    3651             : 
    3652             : 
    3653             :  opt_program:
    3654             :  PROGRAM
    3655             :  { 
    3656           0 :  $$ = mm_strdup("program");
    3657             : }
    3658             : | 
    3659             :  { 
    3660           2 :  $$=EMPTY; }
    3661             : ;
    3662             : 
    3663             : 
    3664             :  copy_file_name:
    3665             :  ecpg_sconst
    3666             :  { 
    3667           0 :  $$ = $1;
    3668             : }
    3669             : |  STDIN
    3670             :  { 
    3671           0 :  $$ = mm_strdup("stdin");
    3672             : }
    3673             : |  STDOUT
    3674             :  { 
    3675           2 :  $$ = mm_strdup("stdout");
    3676             : }
    3677             : ;
    3678             : 
    3679             : 
    3680             :  copy_options:
    3681             :  copy_opt_list
    3682             :  { 
    3683           2 :  $$ = $1;
    3684             : }
    3685             : |  '(' copy_generic_opt_list ')'
    3686             :  { 
    3687           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    3688             : }
    3689             : ;
    3690             : 
    3691             : 
    3692             :  copy_opt_list:
    3693             :  copy_opt_list copy_opt_item
    3694             :  { 
    3695           2 :  $$ = cat_str(2,$1,$2);
    3696             : }
    3697             : | 
    3698             :  { 
    3699           2 :  $$=EMPTY; }
    3700             : ;
    3701             : 
    3702             : 
    3703             :  copy_opt_item:
    3704             :  BINARY
    3705             :  { 
    3706           0 :  $$ = mm_strdup("binary");
    3707             : }
    3708             : |  FREEZE
    3709             :  { 
    3710           0 :  $$ = mm_strdup("freeze");
    3711             : }
    3712             : |  DELIMITER opt_as ecpg_sconst
    3713             :  { 
    3714           2 :  $$ = cat_str(3,mm_strdup("delimiter"),$2,$3);
    3715             : }
    3716             : |  NULL_P opt_as ecpg_sconst
    3717             :  { 
    3718           0 :  $$ = cat_str(3,mm_strdup("null"),$2,$3);
    3719             : }
    3720             : |  CSV
    3721             :  { 
    3722           0 :  $$ = mm_strdup("csv");
    3723             : }
    3724             : |  HEADER_P
    3725             :  { 
    3726           0 :  $$ = mm_strdup("header");
    3727             : }
    3728             : |  QUOTE opt_as ecpg_sconst
    3729             :  { 
    3730           0 :  $$ = cat_str(3,mm_strdup("quote"),$2,$3);
    3731             : }
    3732             : |  ESCAPE opt_as ecpg_sconst
    3733             :  { 
    3734           0 :  $$ = cat_str(3,mm_strdup("escape"),$2,$3);
    3735             : }
    3736             : |  FORCE QUOTE columnList
    3737             :  { 
    3738           0 :  $$ = cat_str(2,mm_strdup("force quote"),$3);
    3739             : }
    3740             : |  FORCE QUOTE '*'
    3741             :  { 
    3742           0 :  $$ = mm_strdup("force quote *");
    3743             : }
    3744             : |  FORCE NOT NULL_P columnList
    3745             :  { 
    3746           0 :  $$ = cat_str(2,mm_strdup("force not null"),$4);
    3747             : }
    3748             : |  FORCE NOT NULL_P '*'
    3749             :  { 
    3750           0 :  $$ = mm_strdup("force not null *");
    3751             : }
    3752             : |  FORCE NULL_P columnList
    3753             :  { 
    3754           0 :  $$ = cat_str(2,mm_strdup("force null"),$3);
    3755             : }
    3756             : |  FORCE NULL_P '*'
    3757             :  { 
    3758           0 :  $$ = mm_strdup("force null *");
    3759             : }
    3760             : |  ENCODING ecpg_sconst
    3761             :  { 
    3762           0 :  $$ = cat_str(2,mm_strdup("encoding"),$2);
    3763             : }
    3764             : ;
    3765             : 
    3766             : 
    3767             :  opt_binary:
    3768             :  BINARY
    3769             :  { 
    3770           0 :  $$ = mm_strdup("binary");
    3771             : }
    3772             : | 
    3773             :  { 
    3774           2 :  $$=EMPTY; }
    3775             : ;
    3776             : 
    3777             : 
    3778             :  copy_delimiter:
    3779             :  opt_using DELIMITERS ecpg_sconst
    3780             :  { 
    3781           0 :  $$ = cat_str(3,$1,mm_strdup("delimiters"),$3);
    3782             : }
    3783             : | 
    3784             :  { 
    3785           2 :  $$=EMPTY; }
    3786             : ;
    3787             : 
    3788             : 
    3789             :  opt_using:
    3790             :  USING
    3791             :  { 
    3792           0 :  $$ = mm_strdup("using");
    3793             : }
    3794             : | 
    3795             :  { 
    3796           0 :  $$=EMPTY; }
    3797             : ;
    3798             : 
    3799             : 
    3800             :  copy_generic_opt_list:
    3801             :  copy_generic_opt_elem
    3802             :  { 
    3803           0 :  $$ = $1;
    3804             : }
    3805             : |  copy_generic_opt_list ',' copy_generic_opt_elem
    3806             :  { 
    3807           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3808             : }
    3809             : ;
    3810             : 
    3811             : 
    3812             :  copy_generic_opt_elem:
    3813             :  ColLabel copy_generic_opt_arg
    3814             :  { 
    3815           0 :  $$ = cat_str(2,$1,$2);
    3816             : }
    3817             : ;
    3818             : 
    3819             : 
    3820             :  copy_generic_opt_arg:
    3821             :  opt_boolean_or_string
    3822             :  { 
    3823           0 :  $$ = $1;
    3824             : }
    3825             : |  NumericOnly
    3826             :  { 
    3827           0 :  $$ = $1;
    3828             : }
    3829             : |  '*'
    3830             :  { 
    3831           0 :  $$ = mm_strdup("*");
    3832             : }
    3833             : |  DEFAULT
    3834             :  { 
    3835           0 :  $$ = mm_strdup("default");
    3836             : }
    3837             : |  '(' copy_generic_opt_arg_list ')'
    3838             :  { 
    3839           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    3840             : }
    3841             : | 
    3842             :  { 
    3843           0 :  $$=EMPTY; }
    3844             : ;
    3845             : 
    3846             : 
    3847             :  copy_generic_opt_arg_list:
    3848             :  copy_generic_opt_arg_list_item
    3849             :  { 
    3850           0 :  $$ = $1;
    3851             : }
    3852             : |  copy_generic_opt_arg_list ',' copy_generic_opt_arg_list_item
    3853             :  { 
    3854           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3855             : }
    3856             : ;
    3857             : 
    3858             : 
    3859             :  copy_generic_opt_arg_list_item:
    3860             :  opt_boolean_or_string
    3861             :  { 
    3862           0 :  $$ = $1;
    3863             : }
    3864             : ;
    3865             : 
    3866             : 
    3867             :  CreateStmt:
    3868             :  CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' OptInherit OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
    3869             :  { 
    3870          98 :  $$ = cat_str(13,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("("),$6,mm_strdup(")"),$8,$9,$10,$11,$12,$13);
    3871             : }
    3872             : |  CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name '(' OptTableElementList ')' OptInherit OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
    3873             :  { 
    3874           2 :  $$ = 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);
    3875             : }
    3876             : |  CREATE OptTemp TABLE qualified_name OF any_name OptTypedTableElementList OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
    3877             :  { 
    3878           0 :  $$ = cat_str(12,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("of"),$6,$7,$8,$9,$10,$11,$12);
    3879             : }
    3880             : |  CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name OF any_name OptTypedTableElementList OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
    3881             :  { 
    3882           0 :  $$ = cat_str(12,mm_strdup("create"),$2,mm_strdup("table if not exists"),$7,mm_strdup("of"),$9,$10,$11,$12,$13,$14,$15);
    3883             : }
    3884             : |  CREATE OptTemp TABLE qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
    3885             :  { 
    3886           0 :  $$ = cat_str(13,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("partition of"),$7,$8,$9,$10,$11,$12,$13,$14);
    3887             : }
    3888             : |  CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
    3889             :  { 
    3890           0 :  $$ = 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);
    3891             : }
    3892             : ;
    3893             : 
    3894             : 
    3895             :  OptTemp:
    3896             :  TEMPORARY
    3897             :  { 
    3898           0 :  $$ = mm_strdup("temporary");
    3899             : }
    3900             : |  TEMP
    3901             :  { 
    3902           0 :  $$ = mm_strdup("temp");
    3903             : }
    3904             : |  LOCAL TEMPORARY
    3905             :  { 
    3906           0 :  $$ = mm_strdup("local temporary");
    3907             : }
    3908             : |  LOCAL TEMP
    3909             :  { 
    3910           0 :  $$ = mm_strdup("local temp");
    3911             : }
    3912             : |  GLOBAL TEMPORARY
    3913             :  { 
    3914           0 :  $$ = mm_strdup("global temporary");
    3915             : }
    3916             : |  GLOBAL TEMP
    3917             :  { 
    3918           0 :  $$ = mm_strdup("global temp");
    3919             : }
    3920             : |  UNLOGGED
    3921             :  { 
    3922           0 :  $$ = mm_strdup("unlogged");
    3923             : }
    3924             : | 
    3925             :  { 
    3926         104 :  $$=EMPTY; }
    3927             : ;
    3928             : 
    3929             : 
    3930             :  OptTableElementList:
    3931             :  TableElementList
    3932             :  { 
    3933         100 :  $$ = $1;
    3934             : }
    3935             : | 
    3936             :  { 
    3937           0 :  $$=EMPTY; }
    3938             : ;
    3939             : 
    3940             : 
    3941             :  OptTypedTableElementList:
    3942             :  '(' TypedTableElementList ')'
    3943             :  { 
    3944           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    3945             : }
    3946             : | 
    3947             :  { 
    3948           0 :  $$=EMPTY; }
    3949             : ;
    3950             : 
    3951             : 
    3952             :  TableElementList:
    3953             :  TableElement
    3954             :  { 
    3955         100 :  $$ = $1;
    3956             : }
    3957             : |  TableElementList ',' TableElement
    3958             :  { 
    3959         212 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3960             : }
    3961             : ;
    3962             : 
    3963             : 
    3964             :  TypedTableElementList:
    3965             :  TypedTableElement
    3966             :  { 
    3967           0 :  $$ = $1;
    3968             : }
    3969             : |  TypedTableElementList ',' TypedTableElement
    3970             :  { 
    3971           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    3972             : }
    3973             : ;
    3974             : 
    3975             : 
    3976             :  TableElement:
    3977             :  columnDef
    3978             :  { 
    3979         308 :  $$ = $1;
    3980             : }
    3981             : |  TableLikeClause
    3982             :  { 
    3983           0 :  $$ = $1;
    3984             : }
    3985             : |  TableConstraint
    3986             :  { 
    3987           4 :  $$ = $1;
    3988             : }
    3989             : ;
    3990             : 
    3991             : 
    3992             :  TypedTableElement:
    3993             :  columnOptions
    3994             :  { 
    3995           0 :  $$ = $1;
    3996             : }
    3997             : |  TableConstraint
    3998             :  { 
    3999           0 :  $$ = $1;
    4000             : }
    4001             : ;
    4002             : 
    4003             : 
    4004             :  columnDef:
    4005             :  ColId Typename opt_column_storage opt_column_compression create_generic_options ColQualList
    4006             :  { 
    4007         308 :  $$ = cat_str(6,$1,$2,$3,$4,$5,$6);
    4008             : }
    4009             : ;
    4010             : 
    4011             : 
    4012             :  columnOptions:
    4013             :  ColId ColQualList
    4014             :  { 
    4015           0 :  $$ = cat_str(2,$1,$2);
    4016             : }
    4017             : |  ColId WITH OPTIONS ColQualList
    4018             :  { 
    4019           0 :  $$ = cat_str(3,$1,mm_strdup("with options"),$4);
    4020             : }
    4021             : ;
    4022             : 
    4023             : 
    4024             :  column_compression:
    4025             :  COMPRESSION ColId
    4026             :  { 
    4027           0 :  $$ = cat_str(2,mm_strdup("compression"),$2);
    4028             : }
    4029             : |  COMPRESSION DEFAULT
    4030             :  { 
    4031           0 :  $$ = mm_strdup("compression default");
    4032             : }
    4033             : ;
    4034             : 
    4035             : 
    4036             :  opt_column_compression:
    4037             :  column_compression
    4038             :  { 
    4039           0 :  $$ = $1;
    4040             : }
    4041             : | 
    4042             :  { 
    4043         308 :  $$=EMPTY; }
    4044             : ;
    4045             : 
    4046             : 
    4047             :  column_storage:
    4048             :  STORAGE ColId
    4049             :  { 
    4050           0 :  $$ = cat_str(2,mm_strdup("storage"),$2);
    4051             : }
    4052             : |  STORAGE DEFAULT
    4053             :  { 
    4054           0 :  $$ = mm_strdup("storage default");
    4055             : }
    4056             : ;
    4057             : 
    4058             : 
    4059             :  opt_column_storage:
    4060             :  column_storage
    4061             :  { 
    4062           0 :  $$ = $1;
    4063             : }
    4064             : | 
    4065             :  { 
    4066         308 :  $$=EMPTY; }
    4067             : ;
    4068             : 
    4069             : 
    4070             :  ColQualList:
    4071             :  ColQualList ColConstraint
    4072             :  { 
    4073          38 :  $$ = cat_str(2,$1,$2);
    4074             : }
    4075             : | 
    4076             :  { 
    4077         308 :  $$=EMPTY; }
    4078             : ;
    4079             : 
    4080             : 
    4081             :  ColConstraint:
    4082             :  CONSTRAINT name ColConstraintElem
    4083             :  { 
    4084           0 :  $$ = cat_str(3,mm_strdup("constraint"),$2,$3);
    4085             : }
    4086             : |  ColConstraintElem
    4087             :  { 
    4088          38 :  $$ = $1;
    4089             : }
    4090             : |  ConstraintAttr
    4091             :  { 
    4092           0 :  $$ = $1;
    4093             : }
    4094             : |  COLLATE any_name
    4095             :  { 
    4096           0 :  $$ = cat_str(2,mm_strdup("collate"),$2);
    4097             : }
    4098             : ;
    4099             : 
    4100             : 
    4101             :  ColConstraintElem:
    4102             :  NOT NULL_P opt_no_inherit
    4103             :  { 
    4104          16 :  $$ = cat_str(2,mm_strdup("not null"),$3);
    4105             : }
    4106             : |  NULL_P
    4107             :  { 
    4108           2 :  $$ = mm_strdup("null");
    4109             : }
    4110             : |  UNIQUE opt_unique_null_treatment opt_definition OptConsTableSpace
    4111             :  { 
    4112           0 :  $$ = cat_str(4,mm_strdup("unique"),$2,$3,$4);
    4113             : }
    4114             : |  PRIMARY KEY opt_definition OptConsTableSpace
    4115             :  { 
    4116          16 :  $$ = cat_str(3,mm_strdup("primary key"),$3,$4);
    4117             : }
    4118             : |  CHECK '(' a_expr ')' opt_no_inherit
    4119             :  { 
    4120           0 :  $$ = cat_str(4,mm_strdup("check ("),$3,mm_strdup(")"),$5);
    4121             : }
    4122             : |  DEFAULT b_expr
    4123             :  { 
    4124           4 :  $$ = cat_str(2,mm_strdup("default"),$2);
    4125             : }
    4126             : |  GENERATED generated_when AS IDENTITY_P OptParenthesizedSeqOptList
    4127             :  { 
    4128           0 :  $$ = cat_str(4,mm_strdup("generated"),$2,mm_strdup("as identity"),$5);
    4129             : }
    4130             : |  GENERATED generated_when AS '(' a_expr ')' STORED
    4131             :  { 
    4132           0 :  $$ = cat_str(5,mm_strdup("generated"),$2,mm_strdup("as ("),$5,mm_strdup(") stored"));
    4133             : }
    4134             : |  REFERENCES qualified_name opt_column_list key_match key_actions
    4135             :  { 
    4136           0 :  $$ = cat_str(5,mm_strdup("references"),$2,$3,$4,$5);
    4137             : }
    4138             : ;
    4139             : 
    4140             : 
    4141             :  opt_unique_null_treatment:
    4142             :  NULLS_P DISTINCT
    4143             :  { 
    4144           0 :  $$ = mm_strdup("nulls distinct");
    4145             : }
    4146             : |  NULLS_P NOT DISTINCT
    4147             :  { 
    4148           0 :  $$ = mm_strdup("nulls not distinct");
    4149             : }
    4150             : | 
    4151             :  { 
    4152           0 :  $$=EMPTY; }
    4153             : ;
    4154             : 
    4155             : 
    4156             :  generated_when:
    4157             :  ALWAYS
    4158             :  { 
    4159           0 :  $$ = mm_strdup("always");
    4160             : }
    4161             : |  BY DEFAULT
    4162             :  { 
    4163           0 :  $$ = mm_strdup("by default");
    4164             : }
    4165             : ;
    4166             : 
    4167             : 
    4168             :  ConstraintAttr:
    4169             :  DEFERRABLE
    4170             :  { 
    4171           0 :  $$ = mm_strdup("deferrable");
    4172             : }
    4173             : |  NOT DEFERRABLE
    4174             :  { 
    4175           0 :  $$ = mm_strdup("not deferrable");
    4176             : }
    4177             : |  INITIALLY DEFERRED
    4178             :  { 
    4179           0 :  $$ = mm_strdup("initially deferred");
    4180             : }
    4181             : |  INITIALLY IMMEDIATE
    4182             :  { 
    4183           0 :  $$ = mm_strdup("initially immediate");
    4184             : }
    4185             : ;
    4186             : 
    4187             : 
    4188             :  TableLikeClause:
    4189             :  LIKE qualified_name TableLikeOptionList
    4190             :  { 
    4191           0 :  $$ = cat_str(3,mm_strdup("like"),$2,$3);
    4192             : }
    4193             : ;
    4194             : 
    4195             : 
    4196             :  TableLikeOptionList:
    4197             :  TableLikeOptionList INCLUDING TableLikeOption
    4198             :  { 
    4199           0 :  $$ = cat_str(3,$1,mm_strdup("including"),$3);
    4200             : }
    4201             : |  TableLikeOptionList EXCLUDING TableLikeOption
    4202             :  { 
    4203           0 :  $$ = cat_str(3,$1,mm_strdup("excluding"),$3);
    4204             : }
    4205             : | 
    4206             :  { 
    4207           0 :  $$=EMPTY; }
    4208             : ;
    4209             : 
    4210             : 
    4211             :  TableLikeOption:
    4212             :  COMMENTS
    4213             :  { 
    4214           0 :  $$ = mm_strdup("comments");
    4215             : }
    4216             : |  COMPRESSION
    4217             :  { 
    4218           0 :  $$ = mm_strdup("compression");
    4219             : }
    4220             : |  CONSTRAINTS
    4221             :  { 
    4222           0 :  $$ = mm_strdup("constraints");
    4223             : }
    4224             : |  DEFAULTS
    4225             :  { 
    4226           0 :  $$ = mm_strdup("defaults");
    4227             : }
    4228             : |  IDENTITY_P
    4229             :  { 
    4230           0 :  $$ = mm_strdup("identity");
    4231             : }
    4232             : |  GENERATED
    4233             :  { 
    4234           0 :  $$ = mm_strdup("generated");
    4235             : }
    4236             : |  INDEXES
    4237             :  { 
    4238           0 :  $$ = mm_strdup("indexes");
    4239             : }
    4240             : |  STATISTICS
    4241             :  { 
    4242           0 :  $$ = mm_strdup("statistics");
    4243             : }
    4244             : |  STORAGE
    4245             :  { 
    4246           0 :  $$ = mm_strdup("storage");
    4247             : }
    4248             : |  ALL
    4249             :  { 
    4250           0 :  $$ = mm_strdup("all");
    4251             : }
    4252             : ;
    4253             : 
    4254             : 
    4255             :  TableConstraint:
    4256             :  CONSTRAINT name ConstraintElem
    4257             :  { 
    4258           0 :  $$ = cat_str(3,mm_strdup("constraint"),$2,$3);
    4259             : }
    4260             : |  ConstraintElem
    4261             :  { 
    4262           4 :  $$ = $1;
    4263             : }
    4264             : ;
    4265             : 
    4266             : 
    4267             :  ConstraintElem:
    4268             :  CHECK '(' a_expr ')' ConstraintAttributeSpec
    4269             :  { 
    4270           0 :  $$ = cat_str(4,mm_strdup("check ("),$3,mm_strdup(")"),$5);
    4271             : }
    4272             : |  NOT NULL_P ColId ConstraintAttributeSpec
    4273             :  { 
    4274           0 :  $$ = cat_str(3,mm_strdup("not null"),$3,$4);
    4275             : }
    4276             : |  UNIQUE opt_unique_null_treatment '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace ConstraintAttributeSpec
    4277             :  { 
    4278           0 :  $$ = cat_str(10,mm_strdup("unique"),$2,mm_strdup("("),$4,$5,mm_strdup(")"),$7,$8,$9,$10);
    4279             : }
    4280             : |  UNIQUE ExistingIndex ConstraintAttributeSpec
    4281             :  { 
    4282           0 :  $$ = cat_str(3,mm_strdup("unique"),$2,$3);
    4283             : }
    4284             : |  PRIMARY KEY '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace ConstraintAttributeSpec
    4285             :  { 
    4286           4 :  $$ = cat_str(8,mm_strdup("primary key ("),$4,$5,mm_strdup(")"),$7,$8,$9,$10);
    4287             : }
    4288             : |  PRIMARY KEY ExistingIndex ConstraintAttributeSpec
    4289             :  { 
    4290           0 :  $$ = cat_str(3,mm_strdup("primary key"),$3,$4);
    4291             : }
    4292             : |  EXCLUDE access_method_clause '(' ExclusionConstraintList ')' opt_c_include opt_definition OptConsTableSpace OptWhereClause ConstraintAttributeSpec
    4293             :  { 
    4294           0 :  $$ = cat_str(10,mm_strdup("exclude"),$2,mm_strdup("("),$4,mm_strdup(")"),$6,$7,$8,$9,$10);
    4295             : }
    4296             : |  FOREIGN KEY '(' columnList optionalPeriodName ')' REFERENCES qualified_name opt_column_and_period_list key_match key_actions ConstraintAttributeSpec
    4297             :  { 
    4298           0 :  $$ = cat_str(9,mm_strdup("foreign key ("),$4,$5,mm_strdup(") references"),$8,$9,$10,$11,$12);
    4299             : }
    4300             : ;
    4301             : 
    4302             : 
    4303             :  DomainConstraint:
    4304             :  CONSTRAINT name DomainConstraintElem
    4305             :  { 
    4306           0 :  $$ = cat_str(3,mm_strdup("constraint"),$2,$3);
    4307             : }
    4308             : |  DomainConstraintElem
    4309             :  { 
    4310           0 :  $$ = $1;
    4311             : }
    4312             : ;
    4313             : 
    4314             : 
    4315             :  DomainConstraintElem:
    4316             :  CHECK '(' a_expr ')' ConstraintAttributeSpec
    4317             :  { 
    4318           0 :  $$ = cat_str(4,mm_strdup("check ("),$3,mm_strdup(")"),$5);
    4319             : }
    4320             : |  NOT NULL_P ConstraintAttributeSpec
    4321             :  { 
    4322           0 :  $$ = cat_str(2,mm_strdup("not null"),$3);
    4323             : }
    4324             : ;
    4325             : 
    4326             : 
    4327             :  opt_no_inherit:
    4328             :  NO INHERIT
    4329             :  { 
    4330           0 :  $$ = mm_strdup("no inherit");
    4331             : }
    4332             : | 
    4333             :  { 
    4334          16 :  $$=EMPTY; }
    4335             : ;
    4336             : 
    4337             : 
    4338             :  opt_without_overlaps:
    4339             :  WITHOUT OVERLAPS
    4340             :  { 
    4341           0 :  $$ = mm_strdup("without overlaps");
    4342             : }
    4343             : | 
    4344             :  { 
    4345           4 :  $$=EMPTY; }
    4346             : ;
    4347             : 
    4348             : 
    4349             :  opt_column_list:
    4350             :  '(' columnList ')'
    4351             :  { 
    4352           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    4353             : }
    4354             : | 
    4355             :  { 
    4356           6 :  $$=EMPTY; }
    4357             : ;
    4358             : 
    4359             : 
    4360             :  columnList:
    4361             :  columnElem
    4362             :  { 
    4363           4 :  $$ = $1;
    4364             : }
    4365             : |  columnList ',' columnElem
    4366             :  { 
    4367           4 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    4368             : }
    4369             : ;
    4370             : 
    4371             : 
    4372             :  optionalPeriodName:
    4373             :  ',' PERIOD columnElem
    4374             :  { 
    4375           0 :  $$ = cat_str(2,mm_strdup(", period"),$3);
    4376             : }
    4377             : | 
    4378             :  { 
    4379           0 :  $$=EMPTY; }
    4380             : ;
    4381             : 
    4382             : 
    4383             :  opt_column_and_period_list:
    4384             :  '(' columnList optionalPeriodName ')'
    4385             :  { 
    4386           0 :  $$ = cat_str(4,mm_strdup("("),$2,$3,mm_strdup(")"));
    4387             : }
    4388             : | 
    4389             :  { 
    4390           0 :  $$=EMPTY; }
    4391             : ;
    4392             : 
    4393             : 
    4394             :  columnElem:
    4395             :  ColId
    4396             :  { 
    4397           8 :  $$ = $1;
    4398             : }
    4399             : ;
    4400             : 
    4401             : 
    4402             :  opt_c_include:
    4403             :  INCLUDE '(' columnList ')'
    4404             :  { 
    4405           0 :  $$ = cat_str(3,mm_strdup("include ("),$3,mm_strdup(")"));
    4406             : }
    4407             : | 
    4408             :  { 
    4409           4 :  $$=EMPTY; }
    4410             : ;
    4411             : 
    4412             : 
    4413             :  key_match:
    4414             :  MATCH FULL
    4415             :  { 
    4416           0 :  $$ = mm_strdup("match full");
    4417             : }
    4418             : |  MATCH PARTIAL
    4419             :  { 
    4420           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
    4421           0 :  $$ = mm_strdup("match partial");
    4422             : }
    4423             : |  MATCH SIMPLE
    4424             :  { 
    4425           0 :  $$ = mm_strdup("match simple");
    4426             : }
    4427             : | 
    4428             :  { 
    4429           0 :  $$=EMPTY; }
    4430             : ;
    4431             : 
    4432             : 
    4433             :  ExclusionConstraintList:
    4434             :  ExclusionConstraintElem
    4435             :  { 
    4436           0 :  $$ = $1;
    4437             : }
    4438             : |  ExclusionConstraintList ',' ExclusionConstraintElem
    4439             :  { 
    4440           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    4441             : }
    4442             : ;
    4443             : 
    4444             : 
    4445             :  ExclusionConstraintElem:
    4446             :  index_elem WITH any_operator
    4447             :  { 
    4448           0 :  $$ = cat_str(3,$1,mm_strdup("with"),$3);
    4449             : }
    4450             : |  index_elem WITH OPERATOR '(' any_operator ')'
    4451             :  { 
    4452           0 :  $$ = cat_str(4,$1,mm_strdup("with operator ("),$5,mm_strdup(")"));
    4453             : }
    4454             : ;
    4455             : 
    4456             : 
    4457             :  OptWhereClause:
    4458             :  WHERE '(' a_expr ')'
    4459             :  { 
    4460           0 :  $$ = cat_str(3,mm_strdup("where ("),$3,mm_strdup(")"));
    4461             : }
    4462             : | 
    4463             :  { 
    4464           0 :  $$=EMPTY; }
    4465             : ;
    4466             : 
    4467             : 
    4468             :  key_actions:
    4469             :  key_update
    4470             :  { 
    4471           0 :  $$ = $1;
    4472             : }
    4473             : |  key_delete
    4474             :  { 
    4475           0 :  $$ = $1;
    4476             : }
    4477             : |  key_update key_delete
    4478             :  { 
    4479           0 :  $$ = cat_str(2,$1,$2);
    4480             : }
    4481             : |  key_delete key_update
    4482             :  { 
    4483           0 :  $$ = cat_str(2,$1,$2);
    4484             : }
    4485             : | 
    4486             :  { 
    4487           0 :  $$=EMPTY; }
    4488             : ;
    4489             : 
    4490             : 
    4491             :  key_update:
    4492             :  ON UPDATE key_action
    4493             :  { 
    4494           0 :  $$ = cat_str(2,mm_strdup("on update"),$3);
    4495             : }
    4496             : ;
    4497             : 
    4498             : 
    4499             :  key_delete:
    4500             :  ON DELETE_P key_action
    4501             :  { 
    4502           0 :  $$ = cat_str(2,mm_strdup("on delete"),$3);
    4503             : }
    4504             : ;
    4505             : 
    4506             : 
    4507             :  key_action:
    4508             :  NO ACTION
    4509             :  { 
    4510           0 :  $$ = mm_strdup("no action");
    4511             : }
    4512             : |  RESTRICT
    4513             :  { 
    4514           0 :  $$ = mm_strdup("restrict");
    4515             : }
    4516             : |  CASCADE
    4517             :  { 
    4518           0 :  $$ = mm_strdup("cascade");
    4519             : }
    4520             : |  SET NULL_P opt_column_list
    4521             :  { 
    4522           0 :  $$ = cat_str(2,mm_strdup("set null"),$3);
    4523             : }
    4524             : |  SET DEFAULT opt_column_list
    4525             :  { 
    4526           0 :  $$ = cat_str(2,mm_strdup("set default"),$3);
    4527             : }
    4528             : ;
    4529             : 
    4530             : 
    4531             :  OptInherit:
    4532             :  INHERITS '(' qualified_name_list ')'
    4533             :  { 
    4534           0 :  $$ = cat_str(3,mm_strdup("inherits ("),$3,mm_strdup(")"));
    4535             : }
    4536             : | 
    4537             :  { 
    4538         100 :  $$=EMPTY; }
    4539             : ;
    4540             : 
    4541             : 
    4542             :  OptPartitionSpec:
    4543             :  PartitionSpec
    4544             :  { 
    4545           0 :  $$ = $1;
    4546             : }
    4547             : | 
    4548             :  { 
    4549         100 :  $$=EMPTY; }
    4550             : ;
    4551             : 
    4552             : 
    4553             :  PartitionSpec:
    4554             :  PARTITION BY ColId '(' part_params ')'
    4555             :  { 
    4556           0 :  $$ = cat_str(5,mm_strdup("partition by"),$3,mm_strdup("("),$5,mm_strdup(")"));
    4557             : }
    4558             : ;
    4559             : 
    4560             : 
    4561             :  part_params:
    4562             :  part_elem
    4563             :  { 
    4564           0 :  $$ = $1;
    4565             : }
    4566             : |  part_params ',' part_elem
    4567             :  { 
    4568           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    4569             : }
    4570             : ;
    4571             : 
    4572             : 
    4573             :  part_elem:
    4574             :  ColId opt_collate opt_qualified_name
    4575             :  { 
    4576           0 :  $$ = cat_str(3,$1,$2,$3);
    4577             : }
    4578             : |  func_expr_windowless opt_collate opt_qualified_name
    4579             :  { 
    4580           0 :  $$ = cat_str(3,$1,$2,$3);
    4581             : }
    4582             : |  '(' a_expr ')' opt_collate opt_qualified_name
    4583             :  { 
    4584           0 :  $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(")"),$4,$5);
    4585             : }
    4586             : ;
    4587             : 
    4588             : 
    4589             :  table_access_method_clause:
    4590             :  USING name
    4591             :  { 
    4592           0 :  $$ = cat_str(2,mm_strdup("using"),$2);
    4593             : }
    4594             : | 
    4595             :  { 
    4596         104 :  $$=EMPTY; }
    4597             : ;
    4598             : 
    4599             : 
    4600             :  OptWith:
    4601             :  WITH reloptions
    4602             :  { 
    4603           0 :  $$ = cat_str(2,mm_strdup("with"),$2);
    4604             : }
    4605             : |  WITHOUT OIDS
    4606             :  { 
    4607           0 :  $$ = mm_strdup("without oids");
    4608             : }
    4609             : | 
    4610             :  { 
    4611         104 :  $$=EMPTY; }
    4612             : ;
    4613             : 
    4614             : 
    4615             :  OnCommitOption:
    4616             :  ON COMMIT DROP
    4617             :  { 
    4618           0 :  $$ = mm_strdup("on commit drop");
    4619             : }
    4620             : |  ON COMMIT DELETE_P ROWS
    4621             :  { 
    4622           0 :  $$ = mm_strdup("on commit delete rows");
    4623             : }
    4624             : |  ON COMMIT PRESERVE ROWS
    4625             :  { 
    4626           0 :  $$ = mm_strdup("on commit preserve rows");
    4627             : }
    4628             : | 
    4629             :  { 
    4630         104 :  $$=EMPTY; }
    4631             : ;
    4632             : 
    4633             : 
    4634             :  OptTableSpace:
    4635             :  TABLESPACE name
    4636             :  { 
    4637           0 :  $$ = cat_str(2,mm_strdup("tablespace"),$2);
    4638             : }
    4639             : | 
    4640             :  { 
    4641         104 :  $$=EMPTY; }
    4642             : ;
    4643             : 
    4644             : 
    4645             :  OptConsTableSpace:
    4646             :  USING INDEX TABLESPACE name
    4647             :  { 
    4648           0 :  $$ = cat_str(2,mm_strdup("using index tablespace"),$4);
    4649             : }
    4650             : | 
    4651             :  { 
    4652          20 :  $$=EMPTY; }
    4653             : ;
    4654             : 
    4655             : 
    4656             :  ExistingIndex:
    4657             :  USING INDEX name
    4658             :  { 
    4659           0 :  $$ = cat_str(2,mm_strdup("using index"),$3);
    4660             : }
    4661             : ;
    4662             : 
    4663             : 
    4664             :  CreateStatsStmt:
    4665             :  CREATE STATISTICS opt_qualified_name opt_name_list ON stats_params FROM from_list
    4666             :  { 
    4667           0 :  $$ = cat_str(7,mm_strdup("create statistics"),$3,$4,mm_strdup("on"),$6,mm_strdup("from"),$8);
    4668             : }
    4669             : |  CREATE STATISTICS IF_P NOT EXISTS any_name opt_name_list ON stats_params FROM from_list
    4670             :  { 
    4671           0 :  $$ = cat_str(7,mm_strdup("create statistics if not exists"),$6,$7,mm_strdup("on"),$9,mm_strdup("from"),$11);
    4672             : }
    4673             : ;
    4674             : 
    4675             : 
    4676             :  stats_params:
    4677             :  stats_param
    4678             :  { 
    4679           0 :  $$ = $1;
    4680             : }
    4681             : |  stats_params ',' stats_param
    4682             :  { 
    4683           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    4684             : }
    4685             : ;
    4686             : 
    4687             : 
    4688             :  stats_param:
    4689             :  ColId
    4690             :  { 
    4691           0 :  $$ = $1;
    4692             : }
    4693             : |  func_expr_windowless
    4694             :  { 
    4695           0 :  $$ = $1;
    4696             : }
    4697             : |  '(' a_expr ')'
    4698             :  { 
    4699           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    4700             : }
    4701             : ;
    4702             : 
    4703             : 
    4704             :  AlterStatsStmt:
    4705             :  ALTER STATISTICS any_name SET STATISTICS set_statistics_value
    4706             :  { 
    4707           0 :  $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("set statistics"),$6);
    4708             : }
    4709             : |  ALTER STATISTICS IF_P EXISTS any_name SET STATISTICS set_statistics_value
    4710             :  { 
    4711           0 :  $$ = cat_str(4,mm_strdup("alter statistics if exists"),$5,mm_strdup("set statistics"),$8);
    4712             : }
    4713             : ;
    4714             : 
    4715             : 
    4716             :  create_as_target:
    4717             :  qualified_name opt_column_list table_access_method_clause OptWith OnCommitOption OptTableSpace
    4718             :  { 
    4719           4 :  $$ = cat_str(6,$1,$2,$3,$4,$5,$6);
    4720             : }
    4721             : ;
    4722             : 
    4723             : 
    4724             :  opt_with_data:
    4725             :  WITH DATA_P
    4726             :  { 
    4727           0 :  $$ = mm_strdup("with data");
    4728             : }
    4729             : |  WITH NO DATA_P
    4730             :  { 
    4731           2 :  $$ = mm_strdup("with no data");
    4732             : }
    4733             : | 
    4734             :  { 
    4735           2 :  $$=EMPTY; }
    4736             : ;
    4737             : 
    4738             : 
    4739             :  CreateMatViewStmt:
    4740             :  CREATE OptNoLog MATERIALIZED VIEW create_mv_target AS SelectStmt opt_with_data
    4741             :  { 
    4742           0 :  $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("materialized view"),$5,mm_strdup("as"),$7,$8);
    4743             : }
    4744             : |  CREATE OptNoLog MATERIALIZED VIEW IF_P NOT EXISTS create_mv_target AS SelectStmt opt_with_data
    4745             :  { 
    4746           0 :  $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("materialized view if not exists"),$8,mm_strdup("as"),$10,$11);
    4747             : }
    4748             : ;
    4749             : 
    4750             : 
    4751             :  create_mv_target:
    4752             :  qualified_name opt_column_list table_access_method_clause opt_reloptions OptTableSpace
    4753             :  { 
    4754           0 :  $$ = cat_str(5,$1,$2,$3,$4,$5);
    4755             : }
    4756             : ;
    4757             : 
    4758             : 
    4759             :  OptNoLog:
    4760             :  UNLOGGED
    4761             :  { 
    4762           0 :  $$ = mm_strdup("unlogged");
    4763             : }
    4764             : | 
    4765             :  { 
    4766           0 :  $$=EMPTY; }
    4767             : ;
    4768             : 
    4769             : 
    4770             :  RefreshMatViewStmt:
    4771             :  REFRESH MATERIALIZED VIEW opt_concurrently qualified_name opt_with_data
    4772             :  { 
    4773           0 :  $$ = cat_str(4,mm_strdup("refresh materialized view"),$4,$5,$6);
    4774             : }
    4775             : ;
    4776             : 
    4777             : 
    4778             :  CreateSeqStmt:
    4779             :  CREATE OptTemp SEQUENCE qualified_name OptSeqOptList
    4780             :  { 
    4781           0 :  $$ = cat_str(5,mm_strdup("create"),$2,mm_strdup("sequence"),$4,$5);
    4782             : }
    4783             : |  CREATE OptTemp SEQUENCE IF_P NOT EXISTS qualified_name OptSeqOptList
    4784             :  { 
    4785           0 :  $$ = cat_str(5,mm_strdup("create"),$2,mm_strdup("sequence if not exists"),$7,$8);
    4786             : }
    4787             : ;
    4788             : 
    4789             : 
    4790             :  AlterSeqStmt:
    4791             :  ALTER SEQUENCE qualified_name SeqOptList
    4792             :  { 
    4793           0 :  $$ = cat_str(3,mm_strdup("alter sequence"),$3,$4);
    4794             : }
    4795             : |  ALTER SEQUENCE IF_P EXISTS qualified_name SeqOptList
    4796             :  { 
    4797           0 :  $$ = cat_str(3,mm_strdup("alter sequence if exists"),$5,$6);
    4798             : }
    4799             : ;
    4800             : 
    4801             : 
    4802             :  OptSeqOptList:
    4803             :  SeqOptList
    4804             :  { 
    4805           0 :  $$ = $1;
    4806             : }
    4807             : | 
    4808             :  { 
    4809           0 :  $$=EMPTY; }
    4810             : ;
    4811             : 
    4812             : 
    4813             :  OptParenthesizedSeqOptList:
    4814             :  '(' SeqOptList ')'
    4815             :  { 
    4816           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    4817             : }
    4818             : | 
    4819             :  { 
    4820           0 :  $$=EMPTY; }
    4821             : ;
    4822             : 
    4823             : 
    4824             :  SeqOptList:
    4825             :  SeqOptElem
    4826             :  { 
    4827           0 :  $$ = $1;
    4828             : }
    4829             : |  SeqOptList SeqOptElem
    4830             :  { 
    4831           0 :  $$ = cat_str(2,$1,$2);
    4832             : }
    4833             : ;
    4834             : 
    4835             : 
    4836             :  SeqOptElem:
    4837             :  AS SimpleTypename
    4838             :  { 
    4839           0 :  $$ = cat_str(2,mm_strdup("as"),$2);
    4840             : }
    4841             : |  CACHE NumericOnly
    4842             :  { 
    4843           0 :  $$ = cat_str(2,mm_strdup("cache"),$2);
    4844             : }
    4845             : |  CYCLE
    4846             :  { 
    4847           0 :  $$ = mm_strdup("cycle");
    4848             : }
    4849             : |  NO CYCLE
    4850             :  { 
    4851           0 :  $$ = mm_strdup("no cycle");
    4852             : }
    4853             : |  INCREMENT opt_by NumericOnly
    4854             :  { 
    4855           0 :  $$ = cat_str(3,mm_strdup("increment"),$2,$3);
    4856             : }
    4857             : |  MAXVALUE NumericOnly
    4858             :  { 
    4859           0 :  $$ = cat_str(2,mm_strdup("maxvalue"),$2);
    4860             : }
    4861             : |  MINVALUE NumericOnly
    4862             :  { 
    4863           0 :  $$ = cat_str(2,mm_strdup("minvalue"),$2);
    4864             : }
    4865             : |  NO MAXVALUE
    4866             :  { 
    4867           0 :  $$ = mm_strdup("no maxvalue");
    4868             : }
    4869             : |  NO MINVALUE
    4870             :  { 
    4871           0 :  $$ = mm_strdup("no minvalue");
    4872             : }
    4873             : |  OWNED BY any_name
    4874             :  { 
    4875           0 :  $$ = cat_str(2,mm_strdup("owned by"),$3);
    4876             : }
    4877             : |  SEQUENCE NAME_P any_name
    4878             :  { 
    4879           0 :  $$ = cat_str(2,mm_strdup("sequence name"),$3);
    4880             : }
    4881             : |  START opt_with NumericOnly
    4882             :  { 
    4883           0 :  $$ = cat_str(3,mm_strdup("start"),$2,$3);
    4884             : }
    4885             : |  RESTART
    4886             :  { 
    4887           0 :  $$ = mm_strdup("restart");
    4888             : }
    4889             : |  RESTART opt_with NumericOnly
    4890             :  { 
    4891           0 :  $$ = cat_str(3,mm_strdup("restart"),$2,$3);
    4892             : }
    4893             : ;
    4894             : 
    4895             : 
    4896             :  opt_by:
    4897             :  BY
    4898             :  { 
    4899           0 :  $$ = mm_strdup("by");
    4900             : }
    4901             : | 
    4902             :  { 
    4903           0 :  $$=EMPTY; }
    4904             : ;
    4905             : 
    4906             : 
    4907             :  NumericOnly:
    4908             :  ecpg_fconst
    4909             :  { 
    4910           0 :  $$ = $1;
    4911             : }
    4912             : |  '+' ecpg_fconst
    4913             :  { 
    4914           0 :  $$ = cat_str(2,mm_strdup("+"),$2);
    4915             : }
    4916             : |  '-' ecpg_fconst
    4917             :  { 
    4918           0 :  $$ = cat_str(2,mm_strdup("-"),$2);
    4919             : }
    4920             : |  SignedIconst
    4921             :  { 
    4922           6 :  $$ = $1;
    4923             : }
    4924             : ;
    4925             : 
    4926             : 
    4927             :  NumericOnly_list:
    4928             :  NumericOnly
    4929             :  { 
    4930           0 :  $$ = $1;
    4931             : }
    4932             : |  NumericOnly_list ',' NumericOnly
    4933             :  { 
    4934           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    4935             : }
    4936             : ;
    4937             : 
    4938             : 
    4939             :  CreatePLangStmt:
    4940             :  CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE name
    4941             :  { 
    4942           0 :  $$ = cat_str(6,mm_strdup("create"),$2,$3,$4,mm_strdup("language"),$6);
    4943             : }
    4944             : |  CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE name HANDLER handler_name opt_inline_handler opt_validator
    4945             :  { 
    4946           0 :  $$ = cat_str(10,mm_strdup("create"),$2,$3,$4,mm_strdup("language"),$6,mm_strdup("handler"),$8,$9,$10);
    4947             : }
    4948             : ;
    4949             : 
    4950             : 
    4951             :  opt_trusted:
    4952             :  TRUSTED
    4953             :  { 
    4954           0 :  $$ = mm_strdup("trusted");
    4955             : }
    4956             : | 
    4957             :  { 
    4958           0 :  $$=EMPTY; }
    4959             : ;
    4960             : 
    4961             : 
    4962             :  handler_name:
    4963             :  name
    4964             :  { 
    4965           0 :  $$ = $1;
    4966             : }
    4967             : |  name attrs
    4968             :  { 
    4969           0 :  $$ = cat_str(2,$1,$2);
    4970             : }
    4971             : ;
    4972             : 
    4973             : 
    4974             :  opt_inline_handler:
    4975             :  INLINE_P handler_name
    4976             :  { 
    4977           0 :  $$ = cat_str(2,mm_strdup("inline"),$2);
    4978             : }
    4979             : | 
    4980             :  { 
    4981           0 :  $$=EMPTY; }
    4982             : ;
    4983             : 
    4984             : 
    4985             :  validator_clause:
    4986             :  VALIDATOR handler_name
    4987             :  { 
    4988           0 :  $$ = cat_str(2,mm_strdup("validator"),$2);
    4989             : }
    4990             : |  NO VALIDATOR
    4991             :  { 
    4992           0 :  $$ = mm_strdup("no validator");
    4993             : }
    4994             : ;
    4995             : 
    4996             : 
    4997             :  opt_validator:
    4998             :  validator_clause
    4999             :  { 
    5000           0 :  $$ = $1;
    5001             : }
    5002             : | 
    5003             :  { 
    5004           0 :  $$=EMPTY; }
    5005             : ;
    5006             : 
    5007             : 
    5008             :  opt_procedural:
    5009             :  PROCEDURAL
    5010             :  { 
    5011           0 :  $$ = mm_strdup("procedural");
    5012             : }
    5013             : | 
    5014             :  { 
    5015           0 :  $$=EMPTY; }
    5016             : ;
    5017             : 
    5018             : 
    5019             :  CreateTableSpaceStmt:
    5020             :  CREATE TABLESPACE name OptTableSpaceOwner LOCATION ecpg_sconst opt_reloptions
    5021             :  { 
    5022           0 :  $$ = cat_str(6,mm_strdup("create tablespace"),$3,$4,mm_strdup("location"),$6,$7);
    5023             : }
    5024             : ;
    5025             : 
    5026             : 
    5027             :  OptTableSpaceOwner:
    5028             :  OWNER RoleSpec
    5029             :  { 
    5030           0 :  $$ = cat_str(2,mm_strdup("owner"),$2);
    5031             : }
    5032             : | 
    5033             :  { 
    5034           0 :  $$=EMPTY; }
    5035             : ;
    5036             : 
    5037             : 
    5038             :  DropTableSpaceStmt:
    5039             :  DROP TABLESPACE name
    5040             :  { 
    5041           0 :  $$ = cat_str(2,mm_strdup("drop tablespace"),$3);
    5042             : }
    5043             : |  DROP TABLESPACE IF_P EXISTS name
    5044             :  { 
    5045           0 :  $$ = cat_str(2,mm_strdup("drop tablespace if exists"),$5);
    5046             : }
    5047             : ;
    5048             : 
    5049             : 
    5050             :  CreateExtensionStmt:
    5051             :  CREATE EXTENSION name opt_with create_extension_opt_list
    5052             :  { 
    5053           0 :  $$ = cat_str(4,mm_strdup("create extension"),$3,$4,$5);
    5054             : }
    5055             : |  CREATE EXTENSION IF_P NOT EXISTS name opt_with create_extension_opt_list
    5056             :  { 
    5057           0 :  $$ = cat_str(4,mm_strdup("create extension if not exists"),$6,$7,$8);
    5058             : }
    5059             : ;
    5060             : 
    5061             : 
    5062             :  create_extension_opt_list:
    5063             :  create_extension_opt_list create_extension_opt_item
    5064             :  { 
    5065           0 :  $$ = cat_str(2,$1,$2);
    5066             : }
    5067             : | 
    5068             :  { 
    5069           0 :  $$=EMPTY; }
    5070             : ;
    5071             : 
    5072             : 
    5073             :  create_extension_opt_item:
    5074             :  SCHEMA name
    5075             :  { 
    5076           0 :  $$ = cat_str(2,mm_strdup("schema"),$2);
    5077             : }
    5078             : |  VERSION_P NonReservedWord_or_Sconst
    5079             :  { 
    5080           0 :  $$ = cat_str(2,mm_strdup("version"),$2);
    5081             : }
    5082             : |  FROM NonReservedWord_or_Sconst
    5083             :  { 
    5084           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
    5085           0 :  $$ = cat_str(2,mm_strdup("from"),$2);
    5086             : }
    5087             : |  CASCADE
    5088             :  { 
    5089           0 :  $$ = mm_strdup("cascade");
    5090             : }
    5091             : ;
    5092             : 
    5093             : 
    5094             :  AlterExtensionStmt:
    5095             :  ALTER EXTENSION name UPDATE alter_extension_opt_list
    5096             :  { 
    5097           0 :  $$ = cat_str(4,mm_strdup("alter extension"),$3,mm_strdup("update"),$5);
    5098             : }
    5099             : ;
    5100             : 
    5101             : 
    5102             :  alter_extension_opt_list:
    5103             :  alter_extension_opt_list alter_extension_opt_item
    5104             :  { 
    5105           0 :  $$ = cat_str(2,$1,$2);
    5106             : }
    5107             : | 
    5108             :  { 
    5109           0 :  $$=EMPTY; }
    5110             : ;
    5111             : 
    5112             : 
    5113             :  alter_extension_opt_item:
    5114             :  TO NonReservedWord_or_Sconst
    5115             :  { 
    5116           0 :  $$ = cat_str(2,mm_strdup("to"),$2);
    5117             : }
    5118             : ;
    5119             : 
    5120             : 
    5121             :  AlterExtensionContentsStmt:
    5122             :  ALTER EXTENSION name add_drop object_type_name name
    5123             :  { 
    5124           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,$5,$6);
    5125             : }
    5126             : |  ALTER EXTENSION name add_drop object_type_any_name any_name
    5127             :  { 
    5128           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,$5,$6);
    5129             : }
    5130             : |  ALTER EXTENSION name add_drop AGGREGATE aggregate_with_argtypes
    5131             :  { 
    5132           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("aggregate"),$6);
    5133             : }
    5134             : |  ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')'
    5135             :  { 
    5136           0 :  $$ = cat_str(8,mm_strdup("alter extension"),$3,$4,mm_strdup("cast ("),$7,mm_strdup("as"),$9,mm_strdup(")"));
    5137             : }
    5138             : |  ALTER EXTENSION name add_drop DOMAIN_P Typename
    5139             :  { 
    5140           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("domain"),$6);
    5141             : }
    5142             : |  ALTER EXTENSION name add_drop FUNCTION function_with_argtypes
    5143             :  { 
    5144           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("function"),$6);
    5145             : }
    5146             : |  ALTER EXTENSION name add_drop OPERATOR operator_with_argtypes
    5147             :  { 
    5148           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("operator"),$6);
    5149             : }
    5150             : |  ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING name
    5151             :  { 
    5152           0 :  $$ = cat_str(7,mm_strdup("alter extension"),$3,$4,mm_strdup("operator class"),$7,mm_strdup("using"),$9);
    5153             : }
    5154             : |  ALTER EXTENSION name add_drop OPERATOR FAMILY any_name USING name
    5155             :  { 
    5156           0 :  $$ = cat_str(7,mm_strdup("alter extension"),$3,$4,mm_strdup("operator family"),$7,mm_strdup("using"),$9);
    5157             : }
    5158             : |  ALTER EXTENSION name add_drop PROCEDURE function_with_argtypes
    5159             :  { 
    5160           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("procedure"),$6);
    5161             : }
    5162             : |  ALTER EXTENSION name add_drop ROUTINE function_with_argtypes
    5163             :  { 
    5164           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("routine"),$6);
    5165             : }
    5166             : |  ALTER EXTENSION name add_drop TRANSFORM FOR Typename LANGUAGE name
    5167             :  { 
    5168           0 :  $$ = cat_str(7,mm_strdup("alter extension"),$3,$4,mm_strdup("transform for"),$7,mm_strdup("language"),$9);
    5169             : }
    5170             : |  ALTER EXTENSION name add_drop TYPE_P Typename
    5171             :  { 
    5172           0 :  $$ = cat_str(5,mm_strdup("alter extension"),$3,$4,mm_strdup("type"),$6);
    5173             : }
    5174             : ;
    5175             : 
    5176             : 
    5177             :  CreateFdwStmt:
    5178             :  CREATE FOREIGN DATA_P WRAPPER name opt_fdw_options create_generic_options
    5179             :  { 
    5180           0 :  $$ = cat_str(4,mm_strdup("create foreign data wrapper"),$5,$6,$7);
    5181             : }
    5182             : ;
    5183             : 
    5184             : 
    5185             :  fdw_option:
    5186             :  HANDLER handler_name
    5187             :  { 
    5188           0 :  $$ = cat_str(2,mm_strdup("handler"),$2);
    5189             : }
    5190             : |  NO HANDLER
    5191             :  { 
    5192           0 :  $$ = mm_strdup("no handler");
    5193             : }
    5194             : |  VALIDATOR handler_name
    5195             :  { 
    5196           0 :  $$ = cat_str(2,mm_strdup("validator"),$2);
    5197             : }
    5198             : |  NO VALIDATOR
    5199             :  { 
    5200           0 :  $$ = mm_strdup("no validator");
    5201             : }
    5202             : ;
    5203             : 
    5204             : 
    5205             :  fdw_options:
    5206             :  fdw_option
    5207             :  { 
    5208           0 :  $$ = $1;
    5209             : }
    5210             : |  fdw_options fdw_option
    5211             :  { 
    5212           0 :  $$ = cat_str(2,$1,$2);
    5213             : }
    5214             : ;
    5215             : 
    5216             : 
    5217             :  opt_fdw_options:
    5218             :  fdw_options
    5219             :  { 
    5220           0 :  $$ = $1;
    5221             : }
    5222             : | 
    5223             :  { 
    5224           0 :  $$=EMPTY; }
    5225             : ;
    5226             : 
    5227             : 
    5228             :  AlterFdwStmt:
    5229             :  ALTER FOREIGN DATA_P WRAPPER name opt_fdw_options alter_generic_options
    5230             :  { 
    5231           0 :  $$ = cat_str(4,mm_strdup("alter foreign data wrapper"),$5,$6,$7);
    5232             : }
    5233             : |  ALTER FOREIGN DATA_P WRAPPER name fdw_options
    5234             :  { 
    5235           0 :  $$ = cat_str(3,mm_strdup("alter foreign data wrapper"),$5,$6);
    5236             : }
    5237             : ;
    5238             : 
    5239             : 
    5240             :  create_generic_options:
    5241             :  OPTIONS '(' generic_option_list ')'
    5242             :  { 
    5243           0 :  $$ = cat_str(3,mm_strdup("options ("),$3,mm_strdup(")"));
    5244             : }
    5245             : | 
    5246             :  { 
    5247         308 :  $$=EMPTY; }
    5248             : ;
    5249             : 
    5250             : 
    5251             :  generic_option_list:
    5252             :  generic_option_elem
    5253             :  { 
    5254           0 :  $$ = $1;
    5255             : }
    5256             : |  generic_option_list ',' generic_option_elem
    5257             :  { 
    5258           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    5259             : }
    5260             : ;
    5261             : 
    5262             : 
    5263             :  alter_generic_options:
    5264             :  OPTIONS '(' alter_generic_option_list ')'
    5265             :  { 
    5266           0 :  $$ = cat_str(3,mm_strdup("options ("),$3,mm_strdup(")"));
    5267             : }
    5268             : ;
    5269             : 
    5270             : 
    5271             :  alter_generic_option_list:
    5272             :  alter_generic_option_elem
    5273             :  { 
    5274           0 :  $$ = $1;
    5275             : }
    5276             : |  alter_generic_option_list ',' alter_generic_option_elem
    5277             :  { 
    5278           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    5279             : }
    5280             : ;
    5281             : 
    5282             : 
    5283             :  alter_generic_option_elem:
    5284             :  generic_option_elem
    5285             :  { 
    5286           0 :  $$ = $1;
    5287             : }
    5288             : |  SET generic_option_elem
    5289             :  { 
    5290           0 :  $$ = cat_str(2,mm_strdup("set"),$2);
    5291             : }
    5292             : |  ADD_P generic_option_elem
    5293             :  { 
    5294           0 :  $$ = cat_str(2,mm_strdup("add"),$2);
    5295             : }
    5296             : |  DROP generic_option_name
    5297             :  { 
    5298           0 :  $$ = cat_str(2,mm_strdup("drop"),$2);
    5299             : }
    5300             : ;
    5301             : 
    5302             : 
    5303             :  generic_option_elem:
    5304             :  generic_option_name generic_option_arg
    5305             :  { 
    5306           0 :  $$ = cat_str(2,$1,$2);
    5307             : }
    5308             : ;
    5309             : 
    5310             : 
    5311             :  generic_option_name:
    5312             :  ColLabel
    5313             :  { 
    5314           0 :  $$ = $1;
    5315             : }
    5316             : ;
    5317             : 
    5318             : 
    5319             :  generic_option_arg:
    5320             :  ecpg_sconst
    5321             :  { 
    5322           0 :  $$ = $1;
    5323             : }
    5324             : ;
    5325             : 
    5326             : 
    5327             :  CreateForeignServerStmt:
    5328             :  CREATE SERVER name opt_type opt_foreign_server_version FOREIGN DATA_P WRAPPER name create_generic_options
    5329             :  { 
    5330           0 :  $$ = cat_str(7,mm_strdup("create server"),$3,$4,$5,mm_strdup("foreign data wrapper"),$9,$10);
    5331             : }
    5332             : |  CREATE SERVER IF_P NOT EXISTS name opt_type opt_foreign_server_version FOREIGN DATA_P WRAPPER name create_generic_options
    5333             :  { 
    5334           0 :  $$ = cat_str(7,mm_strdup("create server if not exists"),$6,$7,$8,mm_strdup("foreign data wrapper"),$12,$13);
    5335             : }
    5336             : ;
    5337             : 
    5338             : 
    5339             :  opt_type:
    5340             :  TYPE_P ecpg_sconst
    5341             :  { 
    5342           0 :  $$ = cat_str(2,mm_strdup("type"),$2);
    5343             : }
    5344             : | 
    5345             :  { 
    5346           0 :  $$=EMPTY; }
    5347             : ;
    5348             : 
    5349             : 
    5350             :  foreign_server_version:
    5351             :  VERSION_P ecpg_sconst
    5352             :  { 
    5353           0 :  $$ = cat_str(2,mm_strdup("version"),$2);
    5354             : }
    5355             : |  VERSION_P NULL_P
    5356             :  { 
    5357           0 :  $$ = mm_strdup("version null");
    5358             : }
    5359             : ;
    5360             : 
    5361             : 
    5362             :  opt_foreign_server_version:
    5363             :  foreign_server_version
    5364             :  { 
    5365           0 :  $$ = $1;
    5366             : }
    5367             : | 
    5368             :  { 
    5369           0 :  $$=EMPTY; }
    5370             : ;
    5371             : 
    5372             : 
    5373             :  AlterForeignServerStmt:
    5374             :  ALTER SERVER name foreign_server_version alter_generic_options
    5375             :  { 
    5376           0 :  $$ = cat_str(4,mm_strdup("alter server"),$3,$4,$5);
    5377             : }
    5378             : |  ALTER SERVER name foreign_server_version
    5379             :  { 
    5380           0 :  $$ = cat_str(3,mm_strdup("alter server"),$3,$4);
    5381             : }
    5382             : |  ALTER SERVER name alter_generic_options
    5383             :  { 
    5384           0 :  $$ = cat_str(3,mm_strdup("alter server"),$3,$4);
    5385             : }
    5386             : ;
    5387             : 
    5388             : 
    5389             :  CreateForeignTableStmt:
    5390             :  CREATE FOREIGN TABLE qualified_name '(' OptTableElementList ')' OptInherit SERVER name create_generic_options
    5391             :  { 
    5392           0 :  $$ = cat_str(9,mm_strdup("create foreign table"),$4,mm_strdup("("),$6,mm_strdup(")"),$8,mm_strdup("server"),$10,$11);
    5393             : }
    5394             : |  CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name '(' OptTableElementList ')' OptInherit SERVER name create_generic_options
    5395             :  { 
    5396           0 :  $$ = cat_str(9,mm_strdup("create foreign table if not exists"),$7,mm_strdup("("),$9,mm_strdup(")"),$11,mm_strdup("server"),$13,$14);
    5397             : }
    5398             : |  CREATE FOREIGN TABLE qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec SERVER name create_generic_options
    5399             :  { 
    5400           0 :  $$ = cat_str(9,mm_strdup("create foreign table"),$4,mm_strdup("partition of"),$7,$8,$9,mm_strdup("server"),$11,$12);
    5401             : }
    5402             : |  CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec SERVER name create_generic_options
    5403             :  { 
    5404           0 :  $$ = cat_str(9,mm_strdup("create foreign table if not exists"),$7,mm_strdup("partition of"),$10,$11,$12,mm_strdup("server"),$14,$15);
    5405             : }
    5406             : ;
    5407             : 
    5408             : 
    5409             :  ImportForeignSchemaStmt:
    5410             :  IMPORT_P FOREIGN SCHEMA name import_qualification FROM SERVER name INTO name create_generic_options
    5411             :  { 
    5412           0 :  $$ = cat_str(8,mm_strdup("import foreign schema"),$4,$5,mm_strdup("from server"),$8,mm_strdup("into"),$10,$11);
    5413             : }
    5414             : ;
    5415             : 
    5416             : 
    5417             :  import_qualification_type:
    5418             :  LIMIT TO
    5419             :  { 
    5420           0 :  $$ = mm_strdup("limit to");
    5421             : }
    5422             : |  EXCEPT
    5423             :  { 
    5424           0 :  $$ = mm_strdup("except");
    5425             : }
    5426             : ;
    5427             : 
    5428             : 
    5429             :  import_qualification:
    5430             :  import_qualification_type '(' relation_expr_list ')'
    5431             :  { 
    5432           0 :  $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
    5433             : }
    5434             : | 
    5435             :  { 
    5436           0 :  $$=EMPTY; }
    5437             : ;
    5438             : 
    5439             : 
    5440             :  CreateUserMappingStmt:
    5441             :  CREATE USER MAPPING FOR auth_ident SERVER name create_generic_options
    5442             :  { 
    5443           0 :  $$ = cat_str(5,mm_strdup("create user mapping for"),$5,mm_strdup("server"),$7,$8);
    5444             : }
    5445             : |  CREATE USER MAPPING IF_P NOT EXISTS FOR auth_ident SERVER name create_generic_options
    5446             :  { 
    5447           0 :  $$ = cat_str(5,mm_strdup("create user mapping if not exists for"),$8,mm_strdup("server"),$10,$11);
    5448             : }
    5449             : ;
    5450             : 
    5451             : 
    5452             :  auth_ident:
    5453             :  RoleSpec
    5454             :  { 
    5455           0 :  $$ = $1;
    5456             : }
    5457             : |  USER
    5458             :  { 
    5459           0 :  $$ = mm_strdup("user");
    5460             : }
    5461             : ;
    5462             : 
    5463             : 
    5464             :  DropUserMappingStmt:
    5465             :  DROP USER MAPPING FOR auth_ident SERVER name
    5466             :  { 
    5467           0 :  $$ = cat_str(4,mm_strdup("drop user mapping for"),$5,mm_strdup("server"),$7);
    5468             : }
    5469             : |  DROP USER MAPPING IF_P EXISTS FOR auth_ident SERVER name
    5470             :  { 
    5471           0 :  $$ = cat_str(4,mm_strdup("drop user mapping if exists for"),$7,mm_strdup("server"),$9);
    5472             : }
    5473             : ;
    5474             : 
    5475             : 
    5476             :  AlterUserMappingStmt:
    5477             :  ALTER USER MAPPING FOR auth_ident SERVER name alter_generic_options
    5478             :  { 
    5479           0 :  $$ = cat_str(5,mm_strdup("alter user mapping for"),$5,mm_strdup("server"),$7,$8);
    5480             : }
    5481             : ;
    5482             : 
    5483             : 
    5484             :  CreatePolicyStmt:
    5485             :  CREATE POLICY name ON qualified_name RowSecurityDefaultPermissive RowSecurityDefaultForCmd RowSecurityDefaultToRole RowSecurityOptionalExpr RowSecurityOptionalWithCheck
    5486             :  { 
    5487           0 :  $$ = cat_str(9,mm_strdup("create policy"),$3,mm_strdup("on"),$5,$6,$7,$8,$9,$10);
    5488             : }
    5489             : ;
    5490             : 
    5491             : 
    5492             :  AlterPolicyStmt:
    5493             :  ALTER POLICY name ON qualified_name RowSecurityOptionalToRole RowSecurityOptionalExpr RowSecurityOptionalWithCheck
    5494             :  { 
    5495           0 :  $$ = cat_str(7,mm_strdup("alter policy"),$3,mm_strdup("on"),$5,$6,$7,$8);
    5496             : }
    5497             : ;
    5498             : 
    5499             : 
    5500             :  RowSecurityOptionalExpr:
    5501             :  USING '(' a_expr ')'
    5502             :  { 
    5503           0 :  $$ = cat_str(3,mm_strdup("using ("),$3,mm_strdup(")"));
    5504             : }
    5505             : | 
    5506             :  { 
    5507           0 :  $$=EMPTY; }
    5508             : ;
    5509             : 
    5510             : 
    5511             :  RowSecurityOptionalWithCheck:
    5512             :  WITH CHECK '(' a_expr ')'
    5513             :  { 
    5514           0 :  $$ = cat_str(3,mm_strdup("with check ("),$4,mm_strdup(")"));
    5515             : }
    5516             : | 
    5517             :  { 
    5518           0 :  $$=EMPTY; }
    5519             : ;
    5520             : 
    5521             : 
    5522             :  RowSecurityDefaultToRole:
    5523             :  TO role_list
    5524             :  { 
    5525           0 :  $$ = cat_str(2,mm_strdup("to"),$2);
    5526             : }
    5527             : | 
    5528             :  { 
    5529           0 :  $$=EMPTY; }
    5530             : ;
    5531             : 
    5532             : 
    5533             :  RowSecurityOptionalToRole:
    5534             :  TO role_list
    5535             :  { 
    5536           0 :  $$ = cat_str(2,mm_strdup("to"),$2);
    5537             : }
    5538             : | 
    5539             :  { 
    5540           0 :  $$=EMPTY; }
    5541             : ;
    5542             : 
    5543             : 
    5544             :  RowSecurityDefaultPermissive:
    5545             :  AS ecpg_ident
    5546             :  { 
    5547           0 :  $$ = cat_str(2,mm_strdup("as"),$2);
    5548             : }
    5549             : | 
    5550             :  { 
    5551           0 :  $$=EMPTY; }
    5552             : ;
    5553             : 
    5554             : 
    5555             :  RowSecurityDefaultForCmd:
    5556             :  FOR row_security_cmd
    5557             :  { 
    5558           0 :  $$ = cat_str(2,mm_strdup("for"),$2);
    5559             : }
    5560             : | 
    5561             :  { 
    5562           0 :  $$=EMPTY; }
    5563             : ;
    5564             : 
    5565             : 
    5566             :  row_security_cmd:
    5567             :  ALL
    5568             :  { 
    5569           0 :  $$ = mm_strdup("all");
    5570             : }
    5571             : |  SELECT
    5572             :  { 
    5573           0 :  $$ = mm_strdup("select");
    5574             : }
    5575             : |  INSERT
    5576             :  { 
    5577           0 :  $$ = mm_strdup("insert");
    5578             : }
    5579             : |  UPDATE
    5580             :  { 
    5581           0 :  $$ = mm_strdup("update");
    5582             : }
    5583             : |  DELETE_P
    5584             :  { 
    5585           0 :  $$ = mm_strdup("delete");
    5586             : }
    5587             : ;
    5588             : 
    5589             : 
    5590             :  CreateAmStmt:
    5591             :  CREATE ACCESS METHOD name TYPE_P am_type HANDLER handler_name
    5592             :  { 
    5593           0 :  $$ = cat_str(6,mm_strdup("create access method"),$4,mm_strdup("type"),$6,mm_strdup("handler"),$8);
    5594             : }
    5595             : ;
    5596             : 
    5597             : 
    5598             :  am_type:
    5599             :  INDEX
    5600             :  { 
    5601           0 :  $$ = mm_strdup("index");
    5602             : }
    5603             : |  TABLE
    5604             :  { 
    5605           0 :  $$ = mm_strdup("table");
    5606             : }
    5607             : ;
    5608             : 
    5609             : 
    5610             :  CreateTrigStmt:
    5611             :  CREATE opt_or_replace TRIGGER name TriggerActionTime TriggerEvents ON qualified_name TriggerReferencing TriggerForSpec TriggerWhen EXECUTE FUNCTION_or_PROCEDURE func_name '(' TriggerFuncArgs ')'
    5612             :  { 
    5613           2 :  $$ = 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(")"));
    5614             : }
    5615             : |  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 ')'
    5616             :  { 
    5617           0 :  $$ = 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(")"));
    5618             : }
    5619             : ;
    5620             : 
    5621             : 
    5622             :  TriggerActionTime:
    5623             :  BEFORE
    5624             :  { 
    5625           2 :  $$ = mm_strdup("before");
    5626             : }
    5627             : |  AFTER
    5628             :  { 
    5629           0 :  $$ = mm_strdup("after");
    5630             : }
    5631             : |  INSTEAD OF
    5632             :  { 
    5633           0 :  $$ = mm_strdup("instead of");
    5634             : }
    5635             : ;
    5636             : 
    5637             : 
    5638             :  TriggerEvents:
    5639             :  TriggerOneEvent
    5640             :  { 
    5641           2 :  $$ = $1;
    5642             : }
    5643             : |  TriggerEvents OR TriggerOneEvent
    5644             :  { 
    5645           0 :  $$ = cat_str(3,$1,mm_strdup("or"),$3);
    5646             : }
    5647             : ;
    5648             : 
    5649             : 
    5650             :  TriggerOneEvent:
    5651             :  INSERT
    5652             :  { 
    5653           2 :  $$ = mm_strdup("insert");
    5654             : }
    5655             : |  DELETE_P
    5656             :  { 
    5657           0 :  $$ = mm_strdup("delete");
    5658             : }
    5659             : |  UPDATE
    5660             :  { 
    5661           0 :  $$ = mm_strdup("update");
    5662             : }
    5663             : |  UPDATE OF columnList
    5664             :  { 
    5665           0 :  $$ = cat_str(2,mm_strdup("update of"),$3);
    5666             : }
    5667             : |  TRUNCATE
    5668             :  { 
    5669           0 :  $$ = mm_strdup("truncate");
    5670             : }
    5671             : ;
    5672             : 
    5673             : 
    5674             :  TriggerReferencing:
    5675             :  REFERENCING TriggerTransitions
    5676             :  { 
    5677           0 :  $$ = cat_str(2,mm_strdup("referencing"),$2);
    5678             : }
    5679             : | 
    5680             :  { 
    5681           2 :  $$=EMPTY; }
    5682             : ;
    5683             : 
    5684             : 
    5685             :  TriggerTransitions:
    5686             :  TriggerTransition
    5687             :  { 
    5688           0 :  $$ = $1;
    5689             : }
    5690             : |  TriggerTransitions TriggerTransition
    5691             :  { 
    5692           0 :  $$ = cat_str(2,$1,$2);
    5693             : }
    5694             : ;
    5695             : 
    5696             : 
    5697             :  TriggerTransition:
    5698             :  TransitionOldOrNew TransitionRowOrTable opt_as TransitionRelName
    5699             :  { 
    5700           0 :  $$ = cat_str(4,$1,$2,$3,$4);
    5701             : }
    5702             : ;
    5703             : 
    5704             : 
    5705             :  TransitionOldOrNew:
    5706             :  NEW
    5707             :  { 
    5708           0 :  $$ = mm_strdup("new");
    5709             : }
    5710             : |  OLD
    5711             :  { 
    5712           0 :  $$ = mm_strdup("old");
    5713             : }
    5714             : ;
    5715             : 
    5716             : 
    5717             :  TransitionRowOrTable:
    5718             :  TABLE
    5719             :  { 
    5720           0 :  $$ = mm_strdup("table");
    5721             : }
    5722             : |  ROW
    5723             :  { 
    5724           0 :  $$ = mm_strdup("row");
    5725             : }
    5726             : ;
    5727             : 
    5728             : 
    5729             :  TransitionRelName:
    5730             :  ColId
    5731             :  { 
    5732           0 :  $$ = $1;
    5733             : }
    5734             : ;
    5735             : 
    5736             : 
    5737             :  TriggerForSpec:
    5738             :  FOR TriggerForOptEach TriggerForType
    5739             :  { 
    5740           2 :  $$ = cat_str(3,mm_strdup("for"),$2,$3);
    5741             : }
    5742             : | 
    5743             :  { 
    5744           0 :  $$=EMPTY; }
    5745             : ;
    5746             : 
    5747             : 
    5748             :  TriggerForOptEach:
    5749             :  EACH
    5750             :  { 
    5751           2 :  $$ = mm_strdup("each");
    5752             : }
    5753             : | 
    5754             :  { 
    5755           0 :  $$=EMPTY; }
    5756             : ;
    5757             : 
    5758             : 
    5759             :  TriggerForType:
    5760             :  ROW
    5761             :  { 
    5762           2 :  $$ = mm_strdup("row");
    5763             : }
    5764             : |  STATEMENT
    5765             :  { 
    5766           0 :  $$ = mm_strdup("statement");
    5767             : }
    5768             : ;
    5769             : 
    5770             : 
    5771             :  TriggerWhen:
    5772             :  WHEN '(' a_expr ')'
    5773             :  { 
    5774           0 :  $$ = cat_str(3,mm_strdup("when ("),$3,mm_strdup(")"));
    5775             : }
    5776             : | 
    5777             :  { 
    5778           2 :  $$=EMPTY; }
    5779             : ;
    5780             : 
    5781             : 
    5782             :  FUNCTION_or_PROCEDURE:
    5783             :  FUNCTION
    5784             :  { 
    5785           0 :  $$ = mm_strdup("function");
    5786             : }
    5787             : |  PROCEDURE
    5788             :  { 
    5789           2 :  $$ = mm_strdup("procedure");
    5790             : }
    5791             : ;
    5792             : 
    5793             : 
    5794             :  TriggerFuncArgs:
    5795             :  TriggerFuncArg
    5796             :  { 
    5797           0 :  $$ = $1;
    5798             : }
    5799             : |  TriggerFuncArgs ',' TriggerFuncArg
    5800             :  { 
    5801           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    5802             : }
    5803             : | 
    5804             :  { 
    5805           2 :  $$=EMPTY; }
    5806             : ;
    5807             : 
    5808             : 
    5809             :  TriggerFuncArg:
    5810             :  Iconst
    5811             :  { 
    5812           0 :  $$ = $1;
    5813             : }
    5814             : |  ecpg_fconst
    5815             :  { 
    5816           0 :  $$ = $1;
    5817             : }
    5818             : |  ecpg_sconst
    5819             :  { 
    5820           0 :  $$ = $1;
    5821             : }
    5822             : |  ColLabel
    5823             :  { 
    5824           0 :  $$ = $1;
    5825             : }
    5826             : ;
    5827             : 
    5828             : 
    5829             :  OptConstrFromTable:
    5830             :  FROM qualified_name
    5831             :  { 
    5832           0 :  $$ = cat_str(2,mm_strdup("from"),$2);
    5833             : }
    5834             : | 
    5835             :  { 
    5836           0 :  $$=EMPTY; }
    5837             : ;
    5838             : 
    5839             : 
    5840             :  ConstraintAttributeSpec:
    5841             : 
    5842             :  { 
    5843           4 :  $$=EMPTY; }
    5844             : |  ConstraintAttributeSpec ConstraintAttributeElem
    5845             :  { 
    5846           0 :  $$ = cat_str(2,$1,$2);
    5847             : }
    5848             : ;
    5849             : 
    5850             : 
    5851             :  ConstraintAttributeElem:
    5852             :  NOT DEFERRABLE
    5853             :  { 
    5854           0 :  $$ = mm_strdup("not deferrable");
    5855             : }
    5856             : |  DEFERRABLE
    5857             :  { 
    5858           0 :  $$ = mm_strdup("deferrable");
    5859             : }
    5860             : |  INITIALLY IMMEDIATE
    5861             :  { 
    5862           0 :  $$ = mm_strdup("initially immediate");
    5863             : }
    5864             : |  INITIALLY DEFERRED
    5865             :  { 
    5866           0 :  $$ = mm_strdup("initially deferred");
    5867             : }
    5868             : |  NOT VALID
    5869             :  { 
    5870           0 :  $$ = mm_strdup("not valid");
    5871             : }
    5872             : |  NO INHERIT
    5873             :  { 
    5874           0 :  $$ = mm_strdup("no inherit");
    5875             : }
    5876             : ;
    5877             : 
    5878             : 
    5879             :  CreateEventTrigStmt:
    5880             :  CREATE EVENT TRIGGER name ON ColLabel EXECUTE FUNCTION_or_PROCEDURE func_name '(' ')'
    5881             :  { 
    5882           0 :  $$ = cat_str(8,mm_strdup("create event trigger"),$4,mm_strdup("on"),$6,mm_strdup("execute"),$8,$9,mm_strdup("( )"));
    5883             : }
    5884             : |  CREATE EVENT TRIGGER name ON ColLabel WHEN event_trigger_when_list EXECUTE FUNCTION_or_PROCEDURE func_name '(' ')'
    5885             :  { 
    5886           0 :  $$ = cat_str(10,mm_strdup("create event trigger"),$4,mm_strdup("on"),$6,mm_strdup("when"),$8,mm_strdup("execute"),$10,$11,mm_strdup("( )"));
    5887             : }
    5888             : ;
    5889             : 
    5890             : 
    5891             :  event_trigger_when_list:
    5892             :  event_trigger_when_item
    5893             :  { 
    5894           0 :  $$ = $1;
    5895             : }
    5896             : |  event_trigger_when_list AND event_trigger_when_item
    5897             :  { 
    5898           0 :  $$ = cat_str(3,$1,mm_strdup("and"),$3);
    5899             : }
    5900             : ;
    5901             : 
    5902             : 
    5903             :  event_trigger_when_item:
    5904             :  ColId IN_P '(' event_trigger_value_list ')'
    5905             :  { 
    5906           0 :  $$ = cat_str(4,$1,mm_strdup("in ("),$4,mm_strdup(")"));
    5907             : }
    5908             : ;
    5909             : 
    5910             : 
    5911             :  event_trigger_value_list:
    5912             :  SCONST
    5913             :  { 
    5914           0 :  $$ = mm_strdup("sconst");
    5915             : }
    5916             : |  event_trigger_value_list ',' SCONST
    5917             :  { 
    5918           0 :  $$ = cat_str(2,$1,mm_strdup(", sconst"));
    5919             : }
    5920             : ;
    5921             : 
    5922             : 
    5923             :  AlterEventTrigStmt:
    5924             :  ALTER EVENT TRIGGER name enable_trigger
    5925             :  { 
    5926           0 :  $$ = cat_str(3,mm_strdup("alter event trigger"),$4,$5);
    5927             : }
    5928             : ;
    5929             : 
    5930             : 
    5931             :  enable_trigger:
    5932             :  ENABLE_P
    5933             :  { 
    5934           0 :  $$ = mm_strdup("enable");
    5935             : }
    5936             : |  ENABLE_P REPLICA
    5937             :  { 
    5938           0 :  $$ = mm_strdup("enable replica");
    5939             : }
    5940             : |  ENABLE_P ALWAYS
    5941             :  { 
    5942           0 :  $$ = mm_strdup("enable always");
    5943             : }
    5944             : |  DISABLE_P
    5945             :  { 
    5946           0 :  $$ = mm_strdup("disable");
    5947             : }
    5948             : ;
    5949             : 
    5950             : 
    5951             :  CreateAssertionStmt:
    5952             :  CREATE ASSERTION any_name CHECK '(' a_expr ')' ConstraintAttributeSpec
    5953             :  { 
    5954           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
    5955           0 :  $$ = cat_str(6,mm_strdup("create assertion"),$3,mm_strdup("check ("),$6,mm_strdup(")"),$8);
    5956             : }
    5957             : ;
    5958             : 
    5959             : 
    5960             :  DefineStmt:
    5961             :  CREATE opt_or_replace AGGREGATE func_name aggr_args definition
    5962             :  { 
    5963           0 :  $$ = cat_str(6,mm_strdup("create"),$2,mm_strdup("aggregate"),$4,$5,$6);
    5964             : }
    5965             : |  CREATE opt_or_replace AGGREGATE func_name old_aggr_definition
    5966             :  { 
    5967           0 :  $$ = cat_str(5,mm_strdup("create"),$2,mm_strdup("aggregate"),$4,$5);
    5968             : }
    5969             : |  CREATE OPERATOR any_operator definition
    5970             :  { 
    5971           0 :  $$ = cat_str(3,mm_strdup("create operator"),$3,$4);
    5972             : }
    5973             : |  CREATE TYPE_P any_name definition
    5974             :  { 
    5975           0 :  $$ = cat_str(3,mm_strdup("create type"),$3,$4);
    5976             : }
    5977             : |  CREATE TYPE_P any_name
    5978             :  { 
    5979           0 :  $$ = cat_str(2,mm_strdup("create type"),$3);
    5980             : }
    5981             : |  CREATE TYPE_P any_name AS '(' OptTableFuncElementList ')'
    5982             :  { 
    5983           0 :  $$ = cat_str(5,mm_strdup("create type"),$3,mm_strdup("as ("),$6,mm_strdup(")"));
    5984             : }
    5985             : |  CREATE TYPE_P any_name AS ENUM_P '(' opt_enum_val_list ')'
    5986             :  { 
    5987           0 :  $$ = cat_str(5,mm_strdup("create type"),$3,mm_strdup("as enum ("),$7,mm_strdup(")"));
    5988             : }
    5989             : |  CREATE TYPE_P any_name AS RANGE definition
    5990             :  { 
    5991           0 :  $$ = cat_str(4,mm_strdup("create type"),$3,mm_strdup("as range"),$6);
    5992             : }
    5993             : |  CREATE TEXT_P SEARCH PARSER any_name definition
    5994             :  { 
    5995           0 :  $$ = cat_str(3,mm_strdup("create text search parser"),$5,$6);
    5996             : }
    5997             : |  CREATE TEXT_P SEARCH DICTIONARY any_name definition
    5998             :  { 
    5999           0 :  $$ = cat_str(3,mm_strdup("create text search dictionary"),$5,$6);
    6000             : }
    6001             : |  CREATE TEXT_P SEARCH TEMPLATE any_name definition
    6002             :  { 
    6003           0 :  $$ = cat_str(3,mm_strdup("create text search template"),$5,$6);
    6004             : }
    6005             : |  CREATE TEXT_P SEARCH CONFIGURATION any_name definition
    6006             :  { 
    6007           0 :  $$ = cat_str(3,mm_strdup("create text search configuration"),$5,$6);
    6008             : }
    6009             : |  CREATE COLLATION any_name definition
    6010             :  { 
    6011           0 :  $$ = cat_str(3,mm_strdup("create collation"),$3,$4);
    6012             : }
    6013             : |  CREATE COLLATION IF_P NOT EXISTS any_name definition
    6014             :  { 
    6015           0 :  $$ = cat_str(3,mm_strdup("create collation if not exists"),$6,$7);
    6016             : }
    6017             : |  CREATE COLLATION any_name FROM any_name
    6018             :  { 
    6019           0 :  $$ = cat_str(4,mm_strdup("create collation"),$3,mm_strdup("from"),$5);
    6020             : }
    6021             : |  CREATE COLLATION IF_P NOT EXISTS any_name FROM any_name
    6022             :  { 
    6023           0 :  $$ = cat_str(4,mm_strdup("create collation if not exists"),$6,mm_strdup("from"),$8);
    6024             : }
    6025             : ;
    6026             : 
    6027             : 
    6028             :  definition:
    6029             :  '(' def_list ')'
    6030             :  { 
    6031           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    6032             : }
    6033             : ;
    6034             : 
    6035             : 
    6036             :  def_list:
    6037             :  def_elem
    6038             :  { 
    6039           0 :  $$ = $1;
    6040             : }
    6041             : |  def_list ',' def_elem
    6042             :  { 
    6043           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    6044             : }
    6045             : ;
    6046             : 
    6047             : 
    6048             :  def_elem:
    6049             :  ColLabel '=' def_arg
    6050             :  { 
    6051           0 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
    6052             : }
    6053             : |  ColLabel
    6054             :  { 
    6055           0 :  $$ = $1;
    6056             : }
    6057             : ;
    6058             : 
    6059             : 
    6060             :  def_arg:
    6061             :  func_type
    6062             :  { 
    6063           0 :  $$ = $1;
    6064             : }
    6065             : |  reserved_keyword
    6066             :  { 
    6067           0 :  $$ = $1;
    6068             : }
    6069             : |  qual_all_Op
    6070             :  { 
    6071           0 :  $$ = $1;
    6072             : }
    6073             : |  NumericOnly
    6074             :  { 
    6075           0 :  $$ = $1;
    6076             : }
    6077             : |  ecpg_sconst
    6078             :  { 
    6079           0 :  $$ = $1;
    6080             : }
    6081             : |  NONE
    6082             :  { 
    6083           0 :  $$ = mm_strdup("none");
    6084             : }
    6085             : ;
    6086             : 
    6087             : 
    6088             :  old_aggr_definition:
    6089             :  '(' old_aggr_list ')'
    6090             :  { 
    6091           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    6092             : }
    6093             : ;
    6094             : 
    6095             : 
    6096             :  old_aggr_list:
    6097             :  old_aggr_elem
    6098             :  { 
    6099           0 :  $$ = $1;
    6100             : }
    6101             : |  old_aggr_list ',' old_aggr_elem
    6102             :  { 
    6103           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    6104             : }
    6105             : ;
    6106             : 
    6107             : 
    6108             :  old_aggr_elem:
    6109             :  ecpg_ident '=' def_arg
    6110             :  { 
    6111           0 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
    6112             : }
    6113             : ;
    6114             : 
    6115             : 
    6116             :  opt_enum_val_list:
    6117             :  enum_val_list
    6118             :  { 
    6119           0 :  $$ = $1;
    6120             : }
    6121             : | 
    6122             :  { 
    6123           0 :  $$=EMPTY; }
    6124             : ;
    6125             : 
    6126             : 
    6127             :  enum_val_list:
    6128             :  ecpg_sconst
    6129             :  { 
    6130           0 :  $$ = $1;
    6131             : }
    6132             : |  enum_val_list ',' ecpg_sconst
    6133             :  { 
    6134           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    6135             : }
    6136             : ;
    6137             : 
    6138             : 
    6139             :  AlterEnumStmt:
    6140             :  ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst
    6141             :  { 
    6142           0 :  $$ = cat_str(5,mm_strdup("alter type"),$3,mm_strdup("add value"),$6,$7);
    6143             : }
    6144             : |  ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst BEFORE ecpg_sconst
    6145             :  { 
    6146           0 :  $$ = cat_str(7,mm_strdup("alter type"),$3,mm_strdup("add value"),$6,$7,mm_strdup("before"),$9);
    6147             : }
    6148             : |  ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst AFTER ecpg_sconst
    6149             :  { 
    6150           0 :  $$ = cat_str(7,mm_strdup("alter type"),$3,mm_strdup("add value"),$6,$7,mm_strdup("after"),$9);
    6151             : }
    6152             : |  ALTER TYPE_P any_name RENAME VALUE_P ecpg_sconst TO ecpg_sconst
    6153             :  { 
    6154           0 :  $$ = cat_str(6,mm_strdup("alter type"),$3,mm_strdup("rename value"),$6,mm_strdup("to"),$8);
    6155             : }
    6156             : |  ALTER TYPE_P any_name DROP VALUE_P ecpg_sconst
    6157             :  { 
    6158           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
    6159           0 :  $$ = cat_str(4,mm_strdup("alter type"),$3,mm_strdup("drop value"),$6);
    6160             : }
    6161             : ;
    6162             : 
    6163             : 
    6164             :  opt_if_not_exists:
    6165             :  IF_P NOT EXISTS
    6166             :  { 
    6167           0 :  $$ = mm_strdup("if not exists");
    6168             : }
    6169             : | 
    6170             :  { 
    6171           0 :  $$=EMPTY; }
    6172             : ;
    6173             : 
    6174             : 
    6175             :  CreateOpClassStmt:
    6176             :  CREATE OPERATOR CLASS any_name opt_default FOR TYPE_P Typename USING name opt_opfamily AS opclass_item_list
    6177             :  { 
    6178           0 :  $$ = cat_str(10,mm_strdup("create operator class"),$4,$5,mm_strdup("for type"),$8,mm_strdup("using"),$10,$11,mm_strdup("as"),$13);
    6179             : }
    6180             : ;
    6181             : 
    6182             : 
    6183             :  opclass_item_list:
    6184             :  opclass_item
    6185             :  { 
    6186           0 :  $$ = $1;
    6187             : }
    6188             : |  opclass_item_list ',' opclass_item
    6189             :  { 
    6190           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    6191             : }
    6192             : ;
    6193             : 
    6194             : 
    6195             :  opclass_item:
    6196             :  OPERATOR Iconst any_operator opclass_purpose opt_recheck
    6197             :  { 
    6198           0 :  $$ = cat_str(5,mm_strdup("operator"),$2,$3,$4,$5);
    6199             : }
    6200             : |  OPERATOR Iconst operator_with_argtypes opclass_purpose opt_recheck
    6201             :  { 
    6202           0 :  $$ = cat_str(5,mm_strdup("operator"),$2,$3,$4,$5);
    6203             : }
    6204             : |  FUNCTION Iconst function_with_argtypes
    6205             :  { 
    6206           0 :  $$ = cat_str(3,mm_strdup("function"),$2,$3);
    6207             : }
    6208             : |  FUNCTION Iconst '(' type_list ')' function_with_argtypes
    6209             :  { 
    6210           0 :  $$ = cat_str(6,mm_strdup("function"),$2,mm_strdup("("),$4,mm_strdup(")"),$6);
    6211             : }
    6212             : |  STORAGE Typename
    6213             :  { 
    6214           0 :  $$ = cat_str(2,mm_strdup("storage"),$2);
    6215             : }
    6216             : ;
    6217             : 
    6218             : 
    6219             :  opt_default:
    6220             :  DEFAULT
    6221             :  { 
    6222           0 :  $$ = mm_strdup("default");
    6223             : }
    6224             : | 
    6225             :  { 
    6226           0 :  $$=EMPTY; }
    6227             : ;
    6228             : 
    6229             : 
    6230             :  opt_opfamily:
    6231             :  FAMILY any_name
    6232             :  { 
    6233           0 :  $$ = cat_str(2,mm_strdup("family"),$2);
    6234             : }
    6235             : | 
    6236             :  { 
    6237           0 :  $$=EMPTY; }
    6238             : ;
    6239             : 
    6240             : 
    6241             :  opclass_purpose:
    6242             :  FOR SEARCH
    6243             :  { 
    6244           0 :  $$ = mm_strdup("for search");
    6245             : }
    6246             : |  FOR ORDER BY any_name
    6247             :  { 
    6248           0 :  $$ = cat_str(2,mm_strdup("for order by"),$4);
    6249             : }
    6250             : | 
    6251             :  { 
    6252           0 :  $$=EMPTY; }
    6253             : ;
    6254             : 
    6255             : 
    6256             :  opt_recheck:
    6257             :  RECHECK
    6258             :  { 
    6259           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
    6260           0 :  $$ = mm_strdup("recheck");
    6261             : }
    6262             : | 
    6263             :  { 
    6264           0 :  $$=EMPTY; }
    6265             : ;
    6266             : 
    6267             : 
    6268             :  CreateOpFamilyStmt:
    6269             :  CREATE OPERATOR FAMILY any_name USING name
    6270             :  { 
    6271           0 :  $$ = cat_str(4,mm_strdup("create operator family"),$4,mm_strdup("using"),$6);
    6272             : }
    6273             : ;
    6274             : 
    6275             : 
    6276             :  AlterOpFamilyStmt:
    6277             :  ALTER OPERATOR FAMILY any_name USING name ADD_P opclass_item_list
    6278             :  { 
    6279           0 :  $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("add"),$8);
    6280             : }
    6281             : |  ALTER OPERATOR FAMILY any_name USING name DROP opclass_drop_list
    6282             :  { 
    6283           0 :  $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("drop"),$8);
    6284             : }
    6285             : ;
    6286             : 
    6287             : 
    6288             :  opclass_drop_list:
    6289             :  opclass_drop
    6290             :  { 
    6291           0 :  $$ = $1;
    6292             : }
    6293             : |  opclass_drop_list ',' opclass_drop
    6294             :  { 
    6295           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    6296             : }
    6297             : ;
    6298             : 
    6299             : 
    6300             :  opclass_drop:
    6301             :  OPERATOR Iconst '(' type_list ')'
    6302             :  { 
    6303           0 :  $$ = cat_str(5,mm_strdup("operator"),$2,mm_strdup("("),$4,mm_strdup(")"));
    6304             : }
    6305             : |  FUNCTION Iconst '(' type_list ')'
    6306             :  { 
    6307           0 :  $$ = cat_str(5,mm_strdup("function"),$2,mm_strdup("("),$4,mm_strdup(")"));
    6308             : }
    6309             : ;
    6310             : 
    6311             : 
    6312             :  DropOpClassStmt:
    6313             :  DROP OPERATOR CLASS any_name USING name opt_drop_behavior
    6314             :  { 
    6315           0 :  $$ = cat_str(5,mm_strdup("drop operator class"),$4,mm_strdup("using"),$6,$7);
    6316             : }
    6317             : |  DROP OPERATOR CLASS IF_P EXISTS any_name USING name opt_drop_behavior
    6318             :  { 
    6319           0 :  $$ = cat_str(5,mm_strdup("drop operator class if exists"),$6,mm_strdup("using"),$8,$9);
    6320             : }
    6321             : ;
    6322             : 
    6323             : 
    6324             :  DropOpFamilyStmt:
    6325             :  DROP OPERATOR FAMILY any_name USING name opt_drop_behavior
    6326             :  { 
    6327           0 :  $$ = cat_str(5,mm_strdup("drop operator family"),$4,mm_strdup("using"),$6,$7);
    6328             : }
    6329             : |  DROP OPERATOR FAMILY IF_P EXISTS any_name USING name opt_drop_behavior
    6330             :  { 
    6331           0 :  $$ = cat_str(5,mm_strdup("drop operator family if exists"),$6,mm_strdup("using"),$8,$9);
    6332             : }
    6333             : ;
    6334             : 
    6335             : 
    6336             :  DropOwnedStmt:
    6337             :  DROP OWNED BY role_list opt_drop_behavior
    6338             :  { 
    6339           0 :  $$ = cat_str(3,mm_strdup("drop owned by"),$4,$5);
    6340             : }
    6341             : ;
    6342             : 
    6343             : 
    6344             :  ReassignOwnedStmt:
    6345             :  REASSIGN OWNED BY role_list TO RoleSpec
    6346             :  { 
    6347           0 :  $$ = cat_str(4,mm_strdup("reassign owned by"),$4,mm_strdup("to"),$6);
    6348             : }
    6349             : ;
    6350             : 
    6351             : 
    6352             :  DropStmt:
    6353             :  DROP object_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
    6354             :  { 
    6355           6 :  $$ = cat_str(5,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,$6);
    6356             : }
    6357             : |  DROP object_type_any_name any_name_list opt_drop_behavior
    6358             :  { 
    6359          68 :  $$ = cat_str(4,mm_strdup("drop"),$2,$3,$4);
    6360             : }
    6361             : |  DROP drop_type_name IF_P EXISTS name_list opt_drop_behavior
    6362             :  { 
    6363           0 :  $$ = cat_str(5,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,$6);
    6364             : }
    6365             : |  DROP drop_type_name name_list opt_drop_behavior
    6366             :  { 
    6367           0 :  $$ = cat_str(4,mm_strdup("drop"),$2,$3,$4);
    6368             : }
    6369             : |  DROP object_type_name_on_any_name name ON any_name opt_drop_behavior
    6370             :  { 
    6371           2 :  $$ = cat_str(6,mm_strdup("drop"),$2,$3,mm_strdup("on"),$5,$6);
    6372             : }
    6373             : |  DROP object_type_name_on_any_name IF_P EXISTS name ON any_name opt_drop_behavior
    6374             :  { 
    6375           0 :  $$ = cat_str(7,mm_strdup("drop"),$2,mm_strdup("if exists"),$5,mm_strdup("on"),$7,$8);
    6376             : }
    6377             : |  DROP TYPE_P type_name_list opt_drop_behavior
    6378             :  { 
    6379           0 :  $$ = cat_str(3,mm_strdup("drop type"),$3,$4);
    6380             : }
    6381             : |  DROP TYPE_P IF_P EXISTS type_name_list opt_drop_behavior
    6382             :  { 
    6383           0 :  $$ = cat_str(3,mm_strdup("drop type if exists"),$5,$6);
    6384             : }
    6385             : |  DROP DOMAIN_P type_name_list opt_drop_behavior
    6386             :  { 
    6387           0 :  $$ = cat_str(3,mm_strdup("drop domain"),$3,$4);
    6388             : }
    6389             : |  DROP DOMAIN_P IF_P EXISTS type_name_list opt_drop_behavior
    6390             :  { 
    6391           0 :  $$ = cat_str(3,mm_strdup("drop domain if exists"),$5,$6);
    6392             : }
    6393             : |  DROP INDEX CONCURRENTLY any_name_list opt_drop_behavior
    6394             :  { 
    6395           0 :  $$ = cat_str(3,mm_strdup("drop index concurrently"),$4,$5);
    6396             : }
    6397             : |  DROP INDEX CONCURRENTLY IF_P EXISTS any_name_list opt_drop_behavior
    6398             :  { 
    6399           0 :  $$ = cat_str(3,mm_strdup("drop index concurrently if exists"),$6,$7);
    6400             : }
    6401             : ;
    6402             : 
    6403             : 
    6404             :  object_type_any_name:
    6405             :  TABLE
    6406             :  { 
    6407          74 :  $$ = mm_strdup("table");
    6408             : }
    6409             : |  SEQUENCE
    6410             :  { 
    6411           0 :  $$ = mm_strdup("sequence");
    6412             : }
    6413             : |  VIEW
    6414             :  { 
    6415           0 :  $$ = mm_strdup("view");
    6416             : }
    6417             : |  MATERIALIZED VIEW
    6418             :  { 
    6419           0 :  $$ = mm_strdup("materialized view");
    6420             : }
    6421             : |  INDEX
    6422             :  { 
    6423           0 :  $$ = mm_strdup("index");
    6424             : }
    6425             : |  FOREIGN TABLE
    6426             :  { 
    6427           0 :  $$ = mm_strdup("foreign table");
    6428             : }
    6429             : |  COLLATION
    6430             :  { 
    6431           0 :  $$ = mm_strdup("collation");
    6432             : }
    6433             : |  CONVERSION_P
    6434             :  { 
    6435           0 :  $$ = mm_strdup("conversion");
    6436             : }
    6437             : |  STATISTICS
    6438             :  { 
    6439           0 :  $$ = mm_strdup("statistics");
    6440             : }
    6441             : |  TEXT_P SEARCH PARSER
    6442             :  { 
    6443           0 :  $$ = mm_strdup("text search parser");
    6444             : }
    6445             : |  TEXT_P SEARCH DICTIONARY
    6446             :  { 
    6447           0 :  $$ = mm_strdup("text search dictionary");
    6448             : }
    6449             : |  TEXT_P SEARCH TEMPLATE
    6450             :  { 
    6451           0 :  $$ = mm_strdup("text search template");
    6452             : }
    6453             : |  TEXT_P SEARCH CONFIGURATION
    6454             :  { 
    6455           0 :  $$ = mm_strdup("text search configuration");
    6456             : }
    6457             : ;
    6458             : 
    6459             : 
    6460             :  object_type_name:
    6461             :  drop_type_name
    6462             :  { 
    6463           0 :  $$ = $1;
    6464             : }
    6465             : |  DATABASE
    6466             :  { 
    6467           0 :  $$ = mm_strdup("database");
    6468             : }
    6469             : |  ROLE
    6470             :  { 
    6471           0 :  $$ = mm_strdup("role");
    6472             : }
    6473             : |  SUBSCRIPTION
    6474             :  { 
    6475           0 :  $$ = mm_strdup("subscription");
    6476             : }
    6477             : |  TABLESPACE
    6478             :  { 
    6479           0 :  $$ = mm_strdup("tablespace");
    6480             : }
    6481             : ;
    6482             : 
    6483             : 
    6484             :  drop_type_name:
    6485             :  ACCESS METHOD
    6486             :  { 
    6487           0 :  $$ = mm_strdup("access method");
    6488             : }
    6489             : |  EVENT TRIGGER
    6490             :  { 
    6491           0 :  $$ = mm_strdup("event trigger");
    6492             : }
    6493             : |  EXTENSION
    6494             :  { 
    6495           0 :  $$ = mm_strdup("extension");
    6496             : }
    6497             : |  FOREIGN DATA_P WRAPPER
    6498             :  { 
    6499           0 :  $$ = mm_strdup("foreign data wrapper");
    6500             : }
    6501             : |  opt_procedural LANGUAGE
    6502             :  { 
    6503           0 :  $$ = cat_str(2,$1,mm_strdup("language"));
    6504             : }
    6505             : |  PUBLICATION
    6506             :  { 
    6507           0 :  $$ = mm_strdup("publication");
    6508             : }
    6509             : |  SCHEMA
    6510             :  { 
    6511           0 :  $$ = mm_strdup("schema");
    6512             : }
    6513             : |  SERVER
    6514             :  { 
    6515           0 :  $$ = mm_strdup("server");
    6516             : }
    6517             : ;
    6518             : 
    6519             : 
    6520             :  object_type_name_on_any_name:
    6521             :  POLICY
    6522             :  { 
    6523           0 :  $$ = mm_strdup("policy");
    6524             : }
    6525             : |  RULE
    6526             :  { 
    6527           0 :  $$ = mm_strdup("rule");
    6528             : }
    6529             : |  TRIGGER
    6530             :  { 
    6531           2 :  $$ = mm_strdup("trigger");
    6532             : }
    6533             : ;
    6534             : 
    6535             : 
    6536             :  any_name_list:
    6537             :  any_name
    6538             :  { 
    6539          74 :  $$ = $1;
    6540             : }
    6541             : |  any_name_list ',' any_name
    6542             :  { 
    6543           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    6544             : }
    6545             : ;
    6546             : 
    6547             : 
    6548             :  any_name:
    6549             :  ColId
    6550             :  { 
    6551          78 :  $$ = $1;
    6552             : }
    6553             : |  ColId attrs
    6554             :  { 
    6555           0 :  $$ = cat_str(2,$1,$2);
    6556             : }
    6557             : ;
    6558             : 
    6559             : 
    6560             :  attrs:
    6561             :  '.' attr_name
    6562             :  { 
    6563           0 :  $$ = cat_str(2,mm_strdup("."),$2);
    6564             : }
    6565             : |  attrs '.' attr_name
    6566             :  { 
    6567           0 :  $$ = cat_str(3,$1,mm_strdup("."),$3);
    6568             : }
    6569             : ;
    6570             : 
    6571             : 
    6572             :  type_name_list:
    6573             :  Typename
    6574             :  { 
    6575           0 :  $$ = $1;
    6576             : }
    6577             : |  type_name_list ',' Typename
    6578             :  { 
    6579           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    6580             : }
    6581             : ;
    6582             : 
    6583             : 
    6584             :  TruncateStmt:
    6585             :  TRUNCATE opt_table relation_expr_list opt_restart_seqs opt_drop_behavior
    6586             :  { 
    6587          44 :  $$ = cat_str(5,mm_strdup("truncate"),$2,$3,$4,$5);
    6588             : }
    6589             : ;
    6590             : 
    6591             : 
    6592             :  opt_restart_seqs:
    6593             :  CONTINUE_P IDENTITY_P
    6594             :  { 
    6595           0 :  $$ = mm_strdup("continue identity");
    6596             : }
    6597             : |  RESTART IDENTITY_P
    6598             :  { 
    6599           0 :  $$ = mm_strdup("restart identity");
    6600             : }
    6601             : | 
    6602             :  { 
    6603          44 :  $$=EMPTY; }
    6604             : ;
    6605             : 
    6606             : 
    6607             :  CommentStmt:
    6608             :  COMMENT ON object_type_any_name any_name IS comment_text
    6609             :  { 
    6610           0 :  $$ = cat_str(5,mm_strdup("comment on"),$3,$4,mm_strdup("is"),$6);
    6611             : }
    6612             : |  COMMENT ON COLUMN any_name IS comment_text
    6613             :  { 
    6614           0 :  $$ = cat_str(4,mm_strdup("comment on column"),$4,mm_strdup("is"),$6);
    6615             : }
    6616             : |  COMMENT ON object_type_name name IS comment_text
    6617             :  { 
    6618           0 :  $$ = cat_str(5,mm_strdup("comment on"),$3,$4,mm_strdup("is"),$6);
    6619             : }
    6620             : |  COMMENT ON TYPE_P Typename IS comment_text
    6621             :  { 
    6622           0 :  $$ = cat_str(4,mm_strdup("comment on type"),$4,mm_strdup("is"),$6);
    6623             : }
    6624             : |  COMMENT ON DOMAIN_P Typename IS comment_text
    6625             :  { 
    6626           0 :  $$ = cat_str(4,mm_strdup("comment on domain"),$4,mm_strdup("is"),$6);
    6627             : }
    6628             : |  COMMENT ON AGGREGATE aggregate_with_argtypes IS comment_text
    6629             :  { 
    6630           0 :  $$ = cat_str(4,mm_strdup("comment on aggregate"),$4,mm_strdup("is"),$6);
    6631             : }
    6632             : |  COMMENT ON FUNCTION function_with_argtypes IS comment_text
    6633             :  { 
    6634           0 :  $$ = cat_str(4,mm_strdup("comment on function"),$4,mm_strdup("is"),$6);
    6635             : }
    6636             : |  COMMENT ON OPERATOR operator_with_argtypes IS comment_text
    6637             :  { 
    6638           0 :  $$ = cat_str(4,mm_strdup("comment on operator"),$4,mm_strdup("is"),$6);
    6639             : }
    6640             : |  COMMENT ON CONSTRAINT name ON any_name IS comment_text
    6641             :  { 
    6642           0 :  $$ = cat_str(6,mm_strdup("comment on constraint"),$4,mm_strdup("on"),$6,mm_strdup("is"),$8);
    6643             : }
    6644             : |  COMMENT ON CONSTRAINT name ON DOMAIN_P any_name IS comment_text
    6645             :  { 
    6646           0 :  $$ = cat_str(6,mm_strdup("comment on constraint"),$4,mm_strdup("on domain"),$7,mm_strdup("is"),$9);
    6647             : }
    6648             : |  COMMENT ON object_type_name_on_any_name name ON any_name IS comment_text
    6649             :  { 
    6650           0 :  $$ = cat_str(7,mm_strdup("comment on"),$3,$4,mm_strdup("on"),$6,mm_strdup("is"),$8);
    6651             : }
    6652             : |  COMMENT ON PROCEDURE function_with_argtypes IS comment_text
    6653             :  { 
    6654           0 :  $$ = cat_str(4,mm_strdup("comment on procedure"),$4,mm_strdup("is"),$6);
    6655             : }
    6656             : |  COMMENT ON ROUTINE function_with_argtypes IS comment_text
    6657             :  { 
    6658           0 :  $$ = cat_str(4,mm_strdup("comment on routine"),$4,mm_strdup("is"),$6);
    6659             : }
    6660             : |  COMMENT ON TRANSFORM FOR Typename LANGUAGE name IS comment_text
    6661             :  { 
    6662           0 :  $$ = cat_str(6,mm_strdup("comment on transform for"),$5,mm_strdup("language"),$7,mm_strdup("is"),$9);
    6663             : }
    6664             : |  COMMENT ON OPERATOR CLASS any_name USING name IS comment_text
    6665             :  { 
    6666           0 :  $$ = cat_str(6,mm_strdup("comment on operator class"),$5,mm_strdup("using"),$7,mm_strdup("is"),$9);
    6667             : }
    6668             : |  COMMENT ON OPERATOR FAMILY any_name USING name IS comment_text
    6669             :  { 
    6670           0 :  $$ = cat_str(6,mm_strdup("comment on operator family"),$5,mm_strdup("using"),$7,mm_strdup("is"),$9);
    6671             : }
    6672             : |  COMMENT ON LARGE_P OBJECT_P NumericOnly IS comment_text
    6673             :  { 
    6674           0 :  $$ = cat_str(4,mm_strdup("comment on large object"),$5,mm_strdup("is"),$7);
    6675             : }
    6676             : |  COMMENT ON CAST '(' Typename AS Typename ')' IS comment_text
    6677             :  { 
    6678           0 :  $$ = cat_str(6,mm_strdup("comment on cast ("),$5,mm_strdup("as"),$7,mm_strdup(") is"),$10);
    6679             : }
    6680             : ;
    6681             : 
    6682             : 
    6683             :  comment_text:
    6684             :  ecpg_sconst
    6685             :  { 
    6686           0 :  $$ = $1;
    6687             : }
    6688             : |  NULL_P
    6689             :  { 
    6690           0 :  $$ = mm_strdup("null");
    6691             : }
    6692             : ;
    6693             : 
    6694             : 
    6695             :  SecLabelStmt:
    6696             :  SECURITY LABEL opt_provider ON object_type_any_name any_name IS security_label
    6697             :  { 
    6698           0 :  $$ = cat_str(7,mm_strdup("security label"),$3,mm_strdup("on"),$5,$6,mm_strdup("is"),$8);
    6699             : }
    6700             : |  SECURITY LABEL opt_provider ON COLUMN any_name IS security_label
    6701             :  { 
    6702           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on column"),$6,mm_strdup("is"),$8);
    6703             : }
    6704             : |  SECURITY LABEL opt_provider ON object_type_name name IS security_label
    6705             :  { 
    6706           0 :  $$ = cat_str(7,mm_strdup("security label"),$3,mm_strdup("on"),$5,$6,mm_strdup("is"),$8);
    6707             : }
    6708             : |  SECURITY LABEL opt_provider ON TYPE_P Typename IS security_label
    6709             :  { 
    6710           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on type"),$6,mm_strdup("is"),$8);
    6711             : }
    6712             : |  SECURITY LABEL opt_provider ON DOMAIN_P Typename IS security_label
    6713             :  { 
    6714           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on domain"),$6,mm_strdup("is"),$8);
    6715             : }
    6716             : |  SECURITY LABEL opt_provider ON AGGREGATE aggregate_with_argtypes IS security_label
    6717             :  { 
    6718           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on aggregate"),$6,mm_strdup("is"),$8);
    6719             : }
    6720             : |  SECURITY LABEL opt_provider ON FUNCTION function_with_argtypes IS security_label
    6721             :  { 
    6722           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on function"),$6,mm_strdup("is"),$8);
    6723             : }
    6724             : |  SECURITY LABEL opt_provider ON LARGE_P OBJECT_P NumericOnly IS security_label
    6725             :  { 
    6726           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on large object"),$7,mm_strdup("is"),$9);
    6727             : }
    6728             : |  SECURITY LABEL opt_provider ON PROCEDURE function_with_argtypes IS security_label
    6729             :  { 
    6730           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on procedure"),$6,mm_strdup("is"),$8);
    6731             : }
    6732             : |  SECURITY LABEL opt_provider ON ROUTINE function_with_argtypes IS security_label
    6733             :  { 
    6734           0 :  $$ = cat_str(6,mm_strdup("security label"),$3,mm_strdup("on routine"),$6,mm_strdup("is"),$8);
    6735             : }
    6736             : ;
    6737             : 
    6738             : 
    6739             :  opt_provider:
    6740             :  FOR NonReservedWord_or_Sconst
    6741             :  { 
    6742           0 :  $$ = cat_str(2,mm_strdup("for"),$2);
    6743             : }
    6744             : | 
    6745             :  { 
    6746           0 :  $$=EMPTY; }
    6747             : ;
    6748             : 
    6749             : 
    6750             :  security_label:
    6751             :  ecpg_sconst
    6752             :  { 
    6753           0 :  $$ = $1;
    6754             : }
    6755             : |  NULL_P
    6756             :  { 
    6757           0 :  $$ = mm_strdup("null");
    6758             : }
    6759             : ;
    6760             : 
    6761             : 
    6762             :  FetchStmt:
    6763             :  FETCH fetch_args
    6764             :  { 
    6765          14 :  $$ = cat_str(2,mm_strdup("fetch"),$2);
    6766             : }
    6767             : |  MOVE fetch_args
    6768             :  { 
    6769          10 :  $$ = cat_str(2,mm_strdup("move"),$2);
    6770             : }
    6771             :     | FETCH fetch_args ecpg_fetch_into
    6772             :     {
    6773          96 :         $$ = cat2_str(mm_strdup("fetch"), $2);
    6774             :     }
    6775             :     | FETCH FORWARD cursor_name opt_ecpg_fetch_into
    6776             :     {
    6777           4 :         char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
    6778           4 :         struct cursor *ptr = add_additional_variables($3, false);
    6779           4 :         if (ptr -> connection)
    6780           2 :             connection = mm_strdup(ptr -> connection);
    6781             : 
    6782           4 :         $$ = cat_str(2, mm_strdup("fetch forward"), cursor_marker);
    6783             :     }
    6784             :     | FETCH FORWARD from_in cursor_name opt_ecpg_fetch_into
    6785             :     {
    6786           2 :         char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
    6787           2 :         struct cursor *ptr = add_additional_variables($4, false);
    6788           2 :             if (ptr -> connection)
    6789           2 :                 connection = mm_strdup(ptr -> connection);
    6790             : 
    6791           2 :         $$ = cat_str(2, mm_strdup("fetch forward from"), cursor_marker);
    6792             :     }
    6793             :     | FETCH BACKWARD cursor_name opt_ecpg_fetch_into
    6794             :     {
    6795           0 :         char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
    6796           0 :         struct cursor *ptr = add_additional_variables($3, false);
    6797           0 :         if (ptr -> connection)
    6798           0 :             connection = mm_strdup(ptr -> connection);
    6799             : 
    6800           0 :         $$ = cat_str(2, mm_strdup("fetch backward"), cursor_marker);
    6801             :     }
    6802             :     | FETCH BACKWARD from_in cursor_name opt_ecpg_fetch_into
    6803             :     {
    6804           0 :         char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
    6805           0 :         struct cursor *ptr = add_additional_variables($4, false);
    6806           0 :         if (ptr -> connection)
    6807           0 :             connection = mm_strdup(ptr -> connection);
    6808             : 
    6809           0 :         $$ = cat_str(2, mm_strdup("fetch backward from"), cursor_marker);
    6810             :     }
    6811             :     | MOVE FORWARD cursor_name
    6812             :     {
    6813           0 :         char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
    6814           0 :         struct cursor *ptr = add_additional_variables($3, false);
    6815           0 :         if (ptr -> connection)
    6816           0 :             connection = mm_strdup(ptr -> connection);
    6817             : 
    6818           0 :         $$ = cat_str(2, mm_strdup("move forward"), cursor_marker);
    6819             :     }
    6820             :     | MOVE FORWARD from_in cursor_name
    6821             :     {
    6822           0 :         char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
    6823           0 :         struct cursor *ptr = add_additional_variables($4, false);
    6824           0 :         if (ptr -> connection)
    6825           0 :             connection = mm_strdup(ptr -> connection);
    6826             : 
    6827           0 :         $$ = cat_str(2, mm_strdup("move forward from"), cursor_marker);
    6828             :     }
    6829             :     | MOVE BACKWARD cursor_name
    6830             :     {
    6831           0 :         char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
    6832           0 :         struct cursor *ptr = add_additional_variables($3, false);
    6833           0 :         if (ptr -> connection)
    6834           0 :             connection = mm_strdup(ptr -> connection);
    6835             : 
    6836           0 :         $$ = cat_str(2, mm_strdup("move backward"), cursor_marker);
    6837             :     }
    6838             :     | MOVE BACKWARD from_in cursor_name
    6839             :     {
    6840           0 :         char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
    6841           0 :         struct cursor *ptr = add_additional_variables($4, false);
    6842           0 :         if (ptr -> connection)
    6843           0 :             connection = mm_strdup(ptr -> connection);
    6844             : 
    6845           0 :         $$ = cat_str(2, mm_strdup("move backward from"), cursor_marker);
    6846             :     }
    6847             : ;
    6848             : 
    6849             : 
    6850             :  fetch_args:
    6851             :  cursor_name
    6852             :  { 
    6853          32 :         struct cursor *ptr = add_additional_variables($1, false);
    6854          32 :         if (ptr -> connection)
    6855          12 :             connection = mm_strdup(ptr -> connection);
    6856             : 
    6857          32 :         if ($1[0] == ':')
    6858             :         {
    6859           6 :             free($1);
    6860           6 :             $1 = mm_strdup("$0");
    6861             :         }
    6862             : 
    6863          32 :  $$ = $1;
    6864             : }
    6865             : |  from_in cursor_name
    6866             :  { 
    6867          22 :         struct cursor *ptr = add_additional_variables($2, false);
    6868          22 :         if (ptr -> connection)
    6869           6 :             connection = mm_strdup(ptr -> connection);
    6870             : 
    6871          22 :         if ($2[0] == ':')
    6872             :         {
    6873           6 :             free($2);
    6874           6 :             $2 = mm_strdup("$0");
    6875             :         }
    6876             : 
    6877          22 :  $$ = cat_str(2,$1,$2);
    6878             : }
    6879             : |  NEXT opt_from_in cursor_name
    6880             :  { 
    6881           6 :         struct cursor *ptr = add_additional_variables($3, false);
    6882           6 :         if (ptr -> connection)
    6883           0 :             connection = mm_strdup(ptr -> connection);
    6884             : 
    6885           6 :         if ($3[0] == ':')
    6886             :         {
    6887           0 :             free($3);
    6888           0 :             $3 = mm_strdup("$0");
    6889             :         }
    6890             : 
    6891           6 :  $$ = cat_str(3,mm_strdup("next"),$2,$3);
    6892             : }
    6893             : |  PRIOR opt_from_in cursor_name
    6894             :  { 
    6895           0 :         struct cursor *ptr = add_additional_variables($3, false);
    6896           0 :         if (ptr -> connection)
    6897           0 :             connection = mm_strdup(ptr -> connection);
    6898             : 
    6899           0 :         if ($3[0] == ':')
    6900             :         {
    6901           0 :             free($3);
    6902           0 :             $3 = mm_strdup("$0");
    6903             :         }
    6904             : 
    6905           0 :  $$ = cat_str(3,mm_strdup("prior"),$2,$3);
    6906             : }
    6907             : |  FIRST_P opt_from_in cursor_name
    6908             :  { 
    6909           0 :         struct cursor *ptr = add_additional_variables($3, false);
    6910           0 :         if (ptr -> connection)
    6911           0 :             connection = mm_strdup(ptr -> connection);
    6912             : 
    6913           0 :         if ($3[0] == ':')
    6914             :         {
    6915           0 :             free($3);
    6916           0 :             $3 = mm_strdup("$0");
    6917             :         }
    6918             : 
    6919           0 :  $$ = cat_str(3,mm_strdup("first"),$2,$3);
    6920             : }
    6921             : |  LAST_P opt_from_in cursor_name
    6922             :  { 
    6923           0 :         struct cursor *ptr = add_additional_variables($3, false);
    6924           0 :         if (ptr -> connection)
    6925           0 :             connection = mm_strdup(ptr -> connection);
    6926             : 
    6927           0 :         if ($3[0] == ':')
    6928             :         {
    6929           0 :             free($3);
    6930           0 :             $3 = mm_strdup("$0");
    6931             :         }
    6932             : 
    6933           0 :  $$ = cat_str(3,mm_strdup("last"),$2,$3);
    6934             : }
    6935             : |  ABSOLUTE_P SignedIconst opt_from_in cursor_name
    6936             :  { 
    6937           8 :         struct cursor *ptr = add_additional_variables($4, false);
    6938           8 :         if (ptr -> connection)
    6939           8 :             connection = mm_strdup(ptr -> connection);
    6940             : 
    6941           8 :         if ($4[0] == ':')
    6942             :         {
    6943           8 :             free($4);
    6944           8 :             $4 = mm_strdup("$0");
    6945             :         }
    6946           8 :         if ($2[0] == '$')
    6947             :         {
    6948           0 :             free($2);
    6949           0 :             $2 = mm_strdup("$0");
    6950             :         }
    6951             : 
    6952           8 :  $$ = cat_str(4,mm_strdup("absolute"),$2,$3,$4);
    6953             : }
    6954             : |  RELATIVE_P SignedIconst opt_from_in cursor_name
    6955             :  { 
    6956           0 :         struct cursor *ptr = add_additional_variables($4, false);
    6957           0 :         if (ptr -> connection)
    6958           0 :             connection = mm_strdup(ptr -> connection);
    6959             : 
    6960           0 :         if ($4[0] == ':')
    6961             :         {
    6962           0 :             free($4);
    6963           0 :             $4 = mm_strdup("$0");
    6964             :         }
    6965           0 :         if ($2[0] == '$')
    6966             :         {
    6967           0 :             free($2);
    6968           0 :             $2 = mm_strdup("$0");
    6969             :         }
    6970             : 
    6971           0 :  $$ = cat_str(4,mm_strdup("relative"),$2,$3,$4);
    6972             : }
    6973             : |  SignedIconst opt_from_in cursor_name
    6974             :  { 
    6975          48 :         struct cursor *ptr = add_additional_variables($3, false);
    6976          48 :         if (ptr -> connection)
    6977          32 :             connection = mm_strdup(ptr -> connection);
    6978             : 
    6979          48 :         if ($3[0] == ':')
    6980             :         {
    6981          32 :             free($3);
    6982          32 :             $3 = mm_strdup("$0");
    6983             :         }
    6984          48 :         if ($1[0] == '$')
    6985             :         {
    6986          18 :             free($1);
    6987          18 :             $1 = mm_strdup("$0");
    6988             :         }
    6989             : 
    6990          48 :  $$ = cat_str(3,$1,$2,$3);
    6991             : }
    6992             : |  ALL opt_from_in cursor_name
    6993             :  { 
    6994           2 :         struct cursor *ptr = add_additional_variables($3, false);
    6995           2 :         if (ptr -> connection)
    6996           0 :             connection = mm_strdup(ptr -> connection);
    6997             : 
    6998           2 :         if ($3[0] == ':')
    6999             :         {
    7000           0 :             free($3);
    7001           0 :             $3 = mm_strdup("$0");
    7002             :         }
    7003             : 
    7004           2 :  $$ = cat_str(3,mm_strdup("all"),$2,$3);
    7005             : }
    7006             : |  FORWARD SignedIconst opt_from_in cursor_name
    7007             :  { 
    7008           0 :         struct cursor *ptr = add_additional_variables($4, false);
    7009           0 :         if (ptr -> connection)
    7010           0 :             connection = mm_strdup(ptr -> connection);
    7011             : 
    7012           0 :         if ($4[0] == ':')
    7013             :         {
    7014           0 :             free($4);
    7015           0 :             $4 = mm_strdup("$0");
    7016             :         }
    7017           0 :         if ($2[0] == '$')
    7018             :         {
    7019           0 :             free($2);
    7020           0 :             $2 = mm_strdup("$0");
    7021             :         }
    7022             : 
    7023           0 :  $$ = cat_str(4,mm_strdup("forward"),$2,$3,$4);
    7024             : }
    7025             : |  FORWARD ALL opt_from_in cursor_name
    7026             :  { 
    7027           0 :         struct cursor *ptr = add_additional_variables($4, false);
    7028           0 :         if (ptr -> connection)
    7029           0 :             connection = mm_strdup(ptr -> connection);
    7030             : 
    7031           0 :         if ($4[0] == ':')
    7032             :         {
    7033           0 :             free($4);
    7034           0 :             $4 = mm_strdup("$0");
    7035             :         }
    7036             : 
    7037           0 :  $$ = cat_str(3,mm_strdup("forward all"),$3,$4);
    7038             : }
    7039             : |  BACKWARD SignedIconst opt_from_in cursor_name
    7040             :  { 
    7041           2 :         struct cursor *ptr = add_additional_variables($4, false);
    7042           2 :         if (ptr -> connection)
    7043           0 :             connection = mm_strdup(ptr -> connection);
    7044             : 
    7045           2 :         if ($4[0] == ':')
    7046             :         {
    7047           0 :             free($4);
    7048           0 :             $4 = mm_strdup("$0");
    7049             :         }
    7050           2 :         if ($2[0] == '$')
    7051             :         {
    7052           0 :             free($2);
    7053           0 :             $2 = mm_strdup("$0");
    7054             :         }
    7055             : 
    7056           2 :  $$ = cat_str(4,mm_strdup("backward"),$2,$3,$4);
    7057             : }
    7058             : |  BACKWARD ALL opt_from_in cursor_name
    7059             :  { 
    7060           0 :         struct cursor *ptr = add_additional_variables($4, false);
    7061           0 :         if (ptr -> connection)
    7062           0 :             connection = mm_strdup(ptr -> connection);
    7063             : 
    7064           0 :         if ($4[0] == ':')
    7065             :         {
    7066           0 :             free($4);
    7067           0 :             $4 = mm_strdup("$0");
    7068             :         }
    7069             : 
    7070           0 :  $$ = cat_str(3,mm_strdup("backward all"),$3,$4);
    7071             : }
    7072             : ;
    7073             : 
    7074             : 
    7075             :  from_in:
    7076             :  FROM
    7077             :  { 
    7078          46 :  $$ = mm_strdup("from");
    7079             : }
    7080             : |  IN_P
    7081             :  { 
    7082          22 :  $$ = mm_strdup("in");
    7083             : }
    7084             : ;
    7085             : 
    7086             : 
    7087             :  opt_from_in:
    7088             :  from_in
    7089             :  { 
    7090          44 :  $$ = $1;
    7091             : }
    7092             : | 
    7093             :  { 
    7094          22 :  $$=EMPTY; }
    7095             : ;
    7096             : 
    7097             : 
    7098             :  GrantStmt:
    7099             :  GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_option opt_granted_by
    7100             :  { 
    7101           0 :  $$ = cat_str(8,mm_strdup("grant"),$2,mm_strdup("on"),$4,mm_strdup("to"),$6,$7,$8);
    7102             : }
    7103             : ;
    7104             : 
    7105             : 
    7106             :  RevokeStmt:
    7107             :  REVOKE privileges ON privilege_target FROM grantee_list opt_granted_by opt_drop_behavior
    7108             :  { 
    7109           0 :  $$ = cat_str(8,mm_strdup("revoke"),$2,mm_strdup("on"),$4,mm_strdup("from"),$6,$7,$8);
    7110             : }
    7111             : |  REVOKE GRANT OPTION FOR privileges ON privilege_target FROM grantee_list opt_granted_by opt_drop_behavior
    7112             :  { 
    7113           0 :  $$ = cat_str(8,mm_strdup("revoke grant option for"),$5,mm_strdup("on"),$7,mm_strdup("from"),$9,$10,$11);
    7114             : }
    7115             : ;
    7116             : 
    7117             : 
    7118             :  privileges:
    7119             :  privilege_list
    7120             :  { 
    7121           0 :  $$ = $1;
    7122             : }
    7123             : |  ALL
    7124             :  { 
    7125           0 :  $$ = mm_strdup("all");
    7126             : }
    7127             : |  ALL PRIVILEGES
    7128             :  { 
    7129           0 :  $$ = mm_strdup("all privileges");
    7130             : }
    7131             : |  ALL '(' columnList ')'
    7132             :  { 
    7133           0 :  $$ = cat_str(3,mm_strdup("all ("),$3,mm_strdup(")"));
    7134             : }
    7135             : |  ALL PRIVILEGES '(' columnList ')'
    7136             :  { 
    7137           0 :  $$ = cat_str(3,mm_strdup("all privileges ("),$4,mm_strdup(")"));
    7138             : }
    7139             : ;
    7140             : 
    7141             : 
    7142             :  privilege_list:
    7143             :  privilege
    7144             :  { 
    7145           0 :  $$ = $1;
    7146             : }
    7147             : |  privilege_list ',' privilege
    7148             :  { 
    7149           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7150             : }
    7151             : ;
    7152             : 
    7153             : 
    7154             :  privilege:
    7155             :  SELECT opt_column_list
    7156             :  { 
    7157           0 :  $$ = cat_str(2,mm_strdup("select"),$2);
    7158             : }
    7159             : |  REFERENCES opt_column_list
    7160             :  { 
    7161           0 :  $$ = cat_str(2,mm_strdup("references"),$2);
    7162             : }
    7163             : |  CREATE opt_column_list
    7164             :  { 
    7165           0 :  $$ = cat_str(2,mm_strdup("create"),$2);
    7166             : }
    7167             : |  ALTER SYSTEM_P
    7168             :  { 
    7169           0 :  $$ = mm_strdup("alter system");
    7170             : }
    7171             : |  ColId opt_column_list
    7172             :  { 
    7173           0 :  $$ = cat_str(2,$1,$2);
    7174             : }
    7175             : ;
    7176             : 
    7177             : 
    7178             :  parameter_name_list:
    7179             :  parameter_name
    7180             :  { 
    7181           0 :  $$ = $1;
    7182             : }
    7183             : |  parameter_name_list ',' parameter_name
    7184             :  { 
    7185           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7186             : }
    7187             : ;
    7188             : 
    7189             : 
    7190             :  parameter_name:
    7191             :  ColId
    7192             :  { 
    7193           0 :  $$ = $1;
    7194             : }
    7195             : |  parameter_name '.' ColId
    7196             :  { 
    7197           0 :  $$ = cat_str(3,$1,mm_strdup("."),$3);
    7198             : }
    7199             : ;
    7200             : 
    7201             : 
    7202             :  privilege_target:
    7203             :  qualified_name_list
    7204             :  { 
    7205           0 :  $$ = $1;
    7206             : }
    7207             : |  TABLE qualified_name_list
    7208             :  { 
    7209           0 :  $$ = cat_str(2,mm_strdup("table"),$2);
    7210             : }
    7211             : |  SEQUENCE qualified_name_list
    7212             :  { 
    7213           0 :  $$ = cat_str(2,mm_strdup("sequence"),$2);
    7214             : }
    7215             : |  FOREIGN DATA_P WRAPPER name_list
    7216             :  { 
    7217           0 :  $$ = cat_str(2,mm_strdup("foreign data wrapper"),$4);
    7218             : }
    7219             : |  FOREIGN SERVER name_list
    7220             :  { 
    7221           0 :  $$ = cat_str(2,mm_strdup("foreign server"),$3);
    7222             : }
    7223             : |  FUNCTION function_with_argtypes_list
    7224             :  { 
    7225           0 :  $$ = cat_str(2,mm_strdup("function"),$2);
    7226             : }
    7227             : |  PROCEDURE function_with_argtypes_list
    7228             :  { 
    7229           0 :  $$ = cat_str(2,mm_strdup("procedure"),$2);
    7230             : }
    7231             : |  ROUTINE function_with_argtypes_list
    7232             :  { 
    7233           0 :  $$ = cat_str(2,mm_strdup("routine"),$2);
    7234             : }
    7235             : |  DATABASE name_list
    7236             :  { 
    7237           0 :  $$ = cat_str(2,mm_strdup("database"),$2);
    7238             : }
    7239             : |  DOMAIN_P any_name_list
    7240             :  { 
    7241           0 :  $$ = cat_str(2,mm_strdup("domain"),$2);
    7242             : }
    7243             : |  LANGUAGE name_list
    7244             :  { 
    7245           0 :  $$ = cat_str(2,mm_strdup("language"),$2);
    7246             : }
    7247             : |  LARGE_P OBJECT_P NumericOnly_list
    7248             :  { 
    7249           0 :  $$ = cat_str(2,mm_strdup("large object"),$3);
    7250             : }
    7251             : |  PARAMETER parameter_name_list
    7252             :  { 
    7253           0 :  $$ = cat_str(2,mm_strdup("parameter"),$2);
    7254             : }
    7255             : |  SCHEMA name_list
    7256             :  { 
    7257           0 :  $$ = cat_str(2,mm_strdup("schema"),$2);
    7258             : }
    7259             : |  TABLESPACE name_list
    7260             :  { 
    7261           0 :  $$ = cat_str(2,mm_strdup("tablespace"),$2);
    7262             : }
    7263             : |  TYPE_P any_name_list
    7264             :  { 
    7265           0 :  $$ = cat_str(2,mm_strdup("type"),$2);
    7266             : }
    7267             : |  ALL TABLES IN_P SCHEMA name_list
    7268             :  { 
    7269           0 :  $$ = cat_str(2,mm_strdup("all tables in schema"),$5);
    7270             : }
    7271             : |  ALL SEQUENCES IN_P SCHEMA name_list
    7272             :  { 
    7273           0 :  $$ = cat_str(2,mm_strdup("all sequences in schema"),$5);
    7274             : }
    7275             : |  ALL FUNCTIONS IN_P SCHEMA name_list
    7276             :  { 
    7277           0 :  $$ = cat_str(2,mm_strdup("all functions in schema"),$5);
    7278             : }
    7279             : |  ALL PROCEDURES IN_P SCHEMA name_list
    7280             :  { 
    7281           0 :  $$ = cat_str(2,mm_strdup("all procedures in schema"),$5);
    7282             : }
    7283             : |  ALL ROUTINES IN_P SCHEMA name_list
    7284             :  { 
    7285           0 :  $$ = cat_str(2,mm_strdup("all routines in schema"),$5);
    7286             : }
    7287             : ;
    7288             : 
    7289             : 
    7290             :  grantee_list:
    7291             :  grantee
    7292             :  { 
    7293           0 :  $$ = $1;
    7294             : }
    7295             : |  grantee_list ',' grantee
    7296             :  { 
    7297           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7298             : }
    7299             : ;
    7300             : 
    7301             : 
    7302             :  grantee:
    7303             :  RoleSpec
    7304             :  { 
    7305           0 :  $$ = $1;
    7306             : }
    7307             : |  GROUP_P RoleSpec
    7308             :  { 
    7309           0 :  $$ = cat_str(2,mm_strdup("group"),$2);
    7310             : }
    7311             : ;
    7312             : 
    7313             : 
    7314             :  opt_grant_grant_option:
    7315             :  WITH GRANT OPTION
    7316             :  { 
    7317           0 :  $$ = mm_strdup("with grant option");
    7318             : }
    7319             : | 
    7320             :  { 
    7321           0 :  $$=EMPTY; }
    7322             : ;
    7323             : 
    7324             : 
    7325             :  GrantRoleStmt:
    7326             :  GRANT privilege_list TO role_list opt_granted_by
    7327             :  { 
    7328           0 :  $$ = cat_str(5,mm_strdup("grant"),$2,mm_strdup("to"),$4,$5);
    7329             : }
    7330             : |  GRANT privilege_list TO role_list WITH grant_role_opt_list opt_granted_by
    7331             :  { 
    7332           0 :  $$ = cat_str(7,mm_strdup("grant"),$2,mm_strdup("to"),$4,mm_strdup("with"),$6,$7);
    7333             : }
    7334             : ;
    7335             : 
    7336             : 
    7337             :  RevokeRoleStmt:
    7338             :  REVOKE privilege_list FROM role_list opt_granted_by opt_drop_behavior
    7339             :  { 
    7340           0 :  $$ = cat_str(6,mm_strdup("revoke"),$2,mm_strdup("from"),$4,$5,$6);
    7341             : }
    7342             : |  REVOKE ColId OPTION FOR privilege_list FROM role_list opt_granted_by opt_drop_behavior
    7343             :  { 
    7344           0 :  $$ = cat_str(8,mm_strdup("revoke"),$2,mm_strdup("option for"),$5,mm_strdup("from"),$7,$8,$9);
    7345             : }
    7346             : ;
    7347             : 
    7348             : 
    7349             :  grant_role_opt_list:
    7350             :  grant_role_opt_list ',' grant_role_opt
    7351             :  { 
    7352           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7353             : }
    7354             : |  grant_role_opt
    7355             :  { 
    7356           0 :  $$ = $1;
    7357             : }
    7358             : ;
    7359             : 
    7360             : 
    7361             :  grant_role_opt:
    7362             :  ColLabel grant_role_opt_value
    7363             :  { 
    7364           0 :  $$ = cat_str(2,$1,$2);
    7365             : }
    7366             : ;
    7367             : 
    7368             : 
    7369             :  grant_role_opt_value:
    7370             :  OPTION
    7371             :  { 
    7372           0 :  $$ = mm_strdup("option");
    7373             : }
    7374             : |  TRUE_P
    7375             :  { 
    7376           0 :  $$ = mm_strdup("true");
    7377             : }
    7378             : |  FALSE_P
    7379             :  { 
    7380           0 :  $$ = mm_strdup("false");
    7381             : }
    7382             : ;
    7383             : 
    7384             : 
    7385             :  opt_granted_by:
    7386             :  GRANTED BY RoleSpec
    7387             :  { 
    7388           0 :  $$ = cat_str(2,mm_strdup("granted by"),$3);
    7389             : }
    7390             : | 
    7391             :  { 
    7392           0 :  $$=EMPTY; }
    7393             : ;
    7394             : 
    7395             : 
    7396             :  AlterDefaultPrivilegesStmt:
    7397             :  ALTER DEFAULT PRIVILEGES DefACLOptionList DefACLAction
    7398             :  { 
    7399           0 :  $$ = cat_str(3,mm_strdup("alter default privileges"),$4,$5);
    7400             : }
    7401             : ;
    7402             : 
    7403             : 
    7404             :  DefACLOptionList:
    7405             :  DefACLOptionList DefACLOption
    7406             :  { 
    7407           0 :  $$ = cat_str(2,$1,$2);
    7408             : }
    7409             : | 
    7410             :  { 
    7411           0 :  $$=EMPTY; }
    7412             : ;
    7413             : 
    7414             : 
    7415             :  DefACLOption:
    7416             :  IN_P SCHEMA name_list
    7417             :  { 
    7418           0 :  $$ = cat_str(2,mm_strdup("in schema"),$3);
    7419             : }
    7420             : |  FOR ROLE role_list
    7421             :  { 
    7422           0 :  $$ = cat_str(2,mm_strdup("for role"),$3);
    7423             : }
    7424             : |  FOR USER role_list
    7425             :  { 
    7426           0 :  $$ = cat_str(2,mm_strdup("for user"),$3);
    7427             : }
    7428             : ;
    7429             : 
    7430             : 
    7431             :  DefACLAction:
    7432             :  GRANT privileges ON defacl_privilege_target TO grantee_list opt_grant_grant_option
    7433             :  { 
    7434           0 :  $$ = cat_str(7,mm_strdup("grant"),$2,mm_strdup("on"),$4,mm_strdup("to"),$6,$7);
    7435             : }
    7436             : |  REVOKE privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior
    7437             :  { 
    7438           0 :  $$ = cat_str(7,mm_strdup("revoke"),$2,mm_strdup("on"),$4,mm_strdup("from"),$6,$7);
    7439             : }
    7440             : |  REVOKE GRANT OPTION FOR privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior
    7441             :  { 
    7442           0 :  $$ = cat_str(7,mm_strdup("revoke grant option for"),$5,mm_strdup("on"),$7,mm_strdup("from"),$9,$10);
    7443             : }
    7444             : ;
    7445             : 
    7446             : 
    7447             :  defacl_privilege_target:
    7448             :  TABLES
    7449             :  { 
    7450           0 :  $$ = mm_strdup("tables");
    7451             : }
    7452             : |  FUNCTIONS
    7453             :  { 
    7454           0 :  $$ = mm_strdup("functions");
    7455             : }
    7456             : |  ROUTINES
    7457             :  { 
    7458           0 :  $$ = mm_strdup("routines");
    7459             : }
    7460             : |  SEQUENCES
    7461             :  { 
    7462           0 :  $$ = mm_strdup("sequences");
    7463             : }
    7464             : |  TYPES_P
    7465             :  { 
    7466           0 :  $$ = mm_strdup("types");
    7467             : }
    7468             : |  SCHEMAS
    7469             :  { 
    7470           0 :  $$ = mm_strdup("schemas");
    7471             : }
    7472             : ;
    7473             : 
    7474             : 
    7475             :  IndexStmt:
    7476             :  CREATE opt_unique INDEX opt_concurrently opt_single_name ON relation_expr access_method_clause '(' index_params ')' opt_include opt_unique_null_treatment opt_reloptions OptTableSpace where_clause
    7477             :  { 
    7478           0 :  $$ = cat_str(16,mm_strdup("create"),$2,mm_strdup("index"),$4,$5,mm_strdup("on"),$7,$8,mm_strdup("("),$10,mm_strdup(")"),$12,$13,$14,$15,$16);
    7479             : }
    7480             : |  CREATE opt_unique INDEX opt_concurrently IF_P NOT EXISTS name ON relation_expr access_method_clause '(' index_params ')' opt_include opt_unique_null_treatment opt_reloptions OptTableSpace where_clause
    7481             :  { 
    7482           0 :  $$ = cat_str(17,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,$19);
    7483             : }
    7484             : ;
    7485             : 
    7486             : 
    7487             :  opt_unique:
    7488             :  UNIQUE
    7489             :  { 
    7490           0 :  $$ = mm_strdup("unique");
    7491             : }
    7492             : | 
    7493             :  { 
    7494           0 :  $$=EMPTY; }
    7495             : ;
    7496             : 
    7497             : 
    7498             :  access_method_clause:
    7499             :  USING name
    7500             :  { 
    7501           0 :  $$ = cat_str(2,mm_strdup("using"),$2);
    7502             : }
    7503             : | 
    7504             :  { 
    7505           0 :  $$=EMPTY; }
    7506             : ;
    7507             : 
    7508             : 
    7509             :  index_params:
    7510             :  index_elem
    7511             :  { 
    7512           0 :  $$ = $1;
    7513             : }
    7514             : |  index_params ',' index_elem
    7515             :  { 
    7516           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7517             : }
    7518             : ;
    7519             : 
    7520             : 
    7521             :  index_elem_options:
    7522             :  opt_collate opt_qualified_name opt_asc_desc opt_nulls_order
    7523             :  { 
    7524           0 :  $$ = cat_str(4,$1,$2,$3,$4);
    7525             : }
    7526             : |  opt_collate any_name reloptions opt_asc_desc opt_nulls_order
    7527             :  { 
    7528           0 :  $$ = cat_str(5,$1,$2,$3,$4,$5);
    7529             : }
    7530             : ;
    7531             : 
    7532             : 
    7533             :  index_elem:
    7534             :  ColId index_elem_options
    7535             :  { 
    7536           0 :  $$ = cat_str(2,$1,$2);
    7537             : }
    7538             : |  func_expr_windowless index_elem_options
    7539             :  { 
    7540           0 :  $$ = cat_str(2,$1,$2);
    7541             : }
    7542             : |  '(' a_expr ')' index_elem_options
    7543             :  { 
    7544           0 :  $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
    7545             : }
    7546             : ;
    7547             : 
    7548             : 
    7549             :  opt_include:
    7550             :  INCLUDE '(' index_including_params ')'
    7551             :  { 
    7552           0 :  $$ = cat_str(3,mm_strdup("include ("),$3,mm_strdup(")"));
    7553             : }
    7554             : | 
    7555             :  { 
    7556           0 :  $$=EMPTY; }
    7557             : ;
    7558             : 
    7559             : 
    7560             :  index_including_params:
    7561             :  index_elem
    7562             :  { 
    7563           0 :  $$ = $1;
    7564             : }
    7565             : |  index_including_params ',' index_elem
    7566             :  { 
    7567           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7568             : }
    7569             : ;
    7570             : 
    7571             : 
    7572             :  opt_collate:
    7573             :  COLLATE any_name
    7574             :  { 
    7575           0 :  $$ = cat_str(2,mm_strdup("collate"),$2);
    7576             : }
    7577             : | 
    7578             :  { 
    7579           0 :  $$=EMPTY; }
    7580             : ;
    7581             : 
    7582             : 
    7583             :  opt_asc_desc:
    7584             :  ASC
    7585             :  { 
    7586           2 :  $$ = mm_strdup("asc");
    7587             : }
    7588             : |  DESC
    7589             :  { 
    7590           0 :  $$ = mm_strdup("desc");
    7591             : }
    7592             : | 
    7593             :  { 
    7594          10 :  $$=EMPTY; }
    7595             : ;
    7596             : 
    7597             : 
    7598             :  opt_nulls_order:
    7599             :  NULLS_LA FIRST_P
    7600             :  { 
    7601           0 :  $$ = mm_strdup("nulls first");
    7602             : }
    7603             : |  NULLS_LA LAST_P
    7604             :  { 
    7605           4 :  $$ = mm_strdup("nulls last");
    7606             : }
    7607             : | 
    7608             :  { 
    7609           8 :  $$=EMPTY; }
    7610             : ;
    7611             : 
    7612             : 
    7613             :  CreateFunctionStmt:
    7614             :  CREATE opt_or_replace FUNCTION func_name func_args_with_defaults RETURNS func_return opt_createfunc_opt_list opt_routine_body
    7615             :  { 
    7616           2 :  $$ = cat_str(9,mm_strdup("create"),$2,mm_strdup("function"),$4,$5,mm_strdup("returns"),$7,$8,$9);
    7617             : }
    7618             : |  CREATE opt_or_replace FUNCTION func_name func_args_with_defaults RETURNS TABLE '(' table_func_column_list ')' opt_createfunc_opt_list opt_routine_body
    7619             :  { 
    7620           0 :  $$ = cat_str(10,mm_strdup("create"),$2,mm_strdup("function"),$4,$5,mm_strdup("returns table ("),$9,mm_strdup(")"),$11,$12);
    7621             : }
    7622             : |  CREATE opt_or_replace FUNCTION func_name func_args_with_defaults opt_createfunc_opt_list opt_routine_body
    7623             :  { 
    7624           0 :  $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("function"),$4,$5,$6,$7);
    7625             : }
    7626             : |  CREATE opt_or_replace PROCEDURE func_name func_args_with_defaults opt_createfunc_opt_list opt_routine_body
    7627             :  { 
    7628           0 :  $$ = cat_str(7,mm_strdup("create"),$2,mm_strdup("procedure"),$4,$5,$6,$7);
    7629             : }
    7630             : ;
    7631             : 
    7632             : 
    7633             :  opt_or_replace:
    7634             :  OR REPLACE
    7635             :  { 
    7636           0 :  $$ = mm_strdup("or replace");
    7637             : }
    7638             : | 
    7639             :  { 
    7640           4 :  $$=EMPTY; }
    7641             : ;
    7642             : 
    7643             : 
    7644             :  func_args:
    7645             :  '(' func_args_list ')'
    7646             :  { 
    7647           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    7648             : }
    7649             : |  '(' ')'
    7650             :  { 
    7651           2 :  $$ = mm_strdup("( )");
    7652             : }
    7653             : ;
    7654             : 
    7655             : 
    7656             :  func_args_list:
    7657             :  func_arg
    7658             :  { 
    7659           0 :  $$ = $1;
    7660             : }
    7661             : |  func_args_list ',' func_arg
    7662             :  { 
    7663           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7664             : }
    7665             : ;
    7666             : 
    7667             : 
    7668             :  function_with_argtypes_list:
    7669             :  function_with_argtypes
    7670             :  { 
    7671           2 :  $$ = $1;
    7672             : }
    7673             : |  function_with_argtypes_list ',' function_with_argtypes
    7674             :  { 
    7675           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7676             : }
    7677             : ;
    7678             : 
    7679             : 
    7680             :  function_with_argtypes:
    7681             :  func_name func_args
    7682             :  { 
    7683           2 :  $$ = cat_str(2,$1,$2);
    7684             : }
    7685             : |  type_func_name_keyword
    7686             :  { 
    7687           0 :  $$ = $1;
    7688             : }
    7689             : |  ColId
    7690             :  { 
    7691           0 :  $$ = $1;
    7692             : }
    7693             : |  ColId indirection
    7694             :  { 
    7695           0 :  $$ = cat_str(2,$1,$2);
    7696             : }
    7697             : ;
    7698             : 
    7699             : 
    7700             :  func_args_with_defaults:
    7701             :  '(' func_args_with_defaults_list ')'
    7702             :  { 
    7703           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    7704             : }
    7705             : |  '(' ')'
    7706             :  { 
    7707           2 :  $$ = mm_strdup("( )");
    7708             : }
    7709             : ;
    7710             : 
    7711             : 
    7712             :  func_args_with_defaults_list:
    7713             :  func_arg_with_default
    7714             :  { 
    7715           0 :  $$ = $1;
    7716             : }
    7717             : |  func_args_with_defaults_list ',' func_arg_with_default
    7718             :  { 
    7719           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7720             : }
    7721             : ;
    7722             : 
    7723             : 
    7724             :  func_arg:
    7725             :  arg_class param_name func_type
    7726             :  { 
    7727           0 :  $$ = cat_str(3,$1,$2,$3);
    7728             : }
    7729             : |  param_name arg_class func_type
    7730             :  { 
    7731           0 :  $$ = cat_str(3,$1,$2,$3);
    7732             : }
    7733             : |  param_name func_type
    7734             :  { 
    7735           0 :  $$ = cat_str(2,$1,$2);
    7736             : }
    7737             : |  arg_class func_type
    7738             :  { 
    7739           0 :  $$ = cat_str(2,$1,$2);
    7740             : }
    7741             : |  func_type
    7742             :  { 
    7743           0 :  $$ = $1;
    7744             : }
    7745             : ;
    7746             : 
    7747             : 
    7748             :  arg_class:
    7749             :  IN_P
    7750             :  { 
    7751           0 :  $$ = mm_strdup("in");
    7752             : }
    7753             : |  OUT_P
    7754             :  { 
    7755           0 :  $$ = mm_strdup("out");
    7756             : }
    7757             : |  INOUT
    7758             :  { 
    7759           0 :  $$ = mm_strdup("inout");
    7760             : }
    7761             : |  IN_P OUT_P
    7762             :  { 
    7763           0 :  $$ = mm_strdup("in out");
    7764             : }
    7765             : |  VARIADIC
    7766             :  { 
    7767           0 :  $$ = mm_strdup("variadic");
    7768             : }
    7769             : ;
    7770             : 
    7771             : 
    7772             :  param_name:
    7773             :  type_function_name
    7774             :  { 
    7775           0 :  $$ = $1;
    7776             : }
    7777             : ;
    7778             : 
    7779             : 
    7780             :  func_return:
    7781             :  func_type
    7782             :  { 
    7783           2 :  $$ = $1;
    7784             : }
    7785             : ;
    7786             : 
    7787             : 
    7788             :  func_type:
    7789             :  Typename
    7790             :  { 
    7791           2 :  $$ = $1;
    7792             : }
    7793             : |  type_function_name attrs '%' TYPE_P
    7794             :  { 
    7795           0 :  $$ = cat_str(3,$1,$2,mm_strdup("% type"));
    7796             : }
    7797             : |  SETOF type_function_name attrs '%' TYPE_P
    7798             :  { 
    7799           0 :  $$ = cat_str(4,mm_strdup("setof"),$2,$3,mm_strdup("% type"));
    7800             : }
    7801             : ;
    7802             : 
    7803             : 
    7804             :  func_arg_with_default:
    7805             :  func_arg
    7806             :  { 
    7807           0 :  $$ = $1;
    7808             : }
    7809             : |  func_arg DEFAULT a_expr
    7810             :  { 
    7811           0 :  $$ = cat_str(3,$1,mm_strdup("default"),$3);
    7812             : }
    7813             : |  func_arg '=' a_expr
    7814             :  { 
    7815           0 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
    7816             : }
    7817             : ;
    7818             : 
    7819             : 
    7820             :  aggr_arg:
    7821             :  func_arg
    7822             :  { 
    7823           0 :  $$ = $1;
    7824             : }
    7825             : ;
    7826             : 
    7827             : 
    7828             :  aggr_args:
    7829             :  '(' '*' ')'
    7830             :  { 
    7831           0 :  $$ = mm_strdup("( * )");
    7832             : }
    7833             : |  '(' aggr_args_list ')'
    7834             :  { 
    7835           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    7836             : }
    7837             : |  '(' ORDER BY aggr_args_list ')'
    7838             :  { 
    7839           0 :  $$ = cat_str(3,mm_strdup("( order by"),$4,mm_strdup(")"));
    7840             : }
    7841             : |  '(' aggr_args_list ORDER BY aggr_args_list ')'
    7842             :  { 
    7843           0 :  $$ = cat_str(5,mm_strdup("("),$2,mm_strdup("order by"),$5,mm_strdup(")"));
    7844             : }
    7845             : ;
    7846             : 
    7847             : 
    7848             :  aggr_args_list:
    7849             :  aggr_arg
    7850             :  { 
    7851           0 :  $$ = $1;
    7852             : }
    7853             : |  aggr_args_list ',' aggr_arg
    7854             :  { 
    7855           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7856             : }
    7857             : ;
    7858             : 
    7859             : 
    7860             :  aggregate_with_argtypes:
    7861             :  func_name aggr_args
    7862             :  { 
    7863           0 :  $$ = cat_str(2,$1,$2);
    7864             : }
    7865             : ;
    7866             : 
    7867             : 
    7868             :  aggregate_with_argtypes_list:
    7869             :  aggregate_with_argtypes
    7870             :  { 
    7871           0 :  $$ = $1;
    7872             : }
    7873             : |  aggregate_with_argtypes_list ',' aggregate_with_argtypes
    7874             :  { 
    7875           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    7876             : }
    7877             : ;
    7878             : 
    7879             : 
    7880             :  opt_createfunc_opt_list:
    7881             :  createfunc_opt_list
    7882             :  { 
    7883           2 :  $$ = $1;
    7884             : }
    7885             : | 
    7886             :  { 
    7887           0 :  $$=EMPTY; }
    7888             : ;
    7889             : 
    7890             : 
    7891             :  createfunc_opt_list:
    7892             :  createfunc_opt_item
    7893             :  { 
    7894           2 :  $$ = $1;
    7895             : }
    7896             : |  createfunc_opt_list createfunc_opt_item
    7897             :  { 
    7898           2 :  $$ = cat_str(2,$1,$2);
    7899             : }
    7900             : ;
    7901             : 
    7902             : 
    7903             :  common_func_opt_item:
    7904             :  CALLED ON NULL_P INPUT_P
    7905             :  { 
    7906           0 :  $$ = mm_strdup("called on null input");
    7907             : }
    7908             : |  RETURNS NULL_P ON NULL_P INPUT_P
    7909             :  { 
    7910           0 :  $$ = mm_strdup("returns null on null input");
    7911             : }
    7912             : |  STRICT_P
    7913             :  { 
    7914           0 :  $$ = mm_strdup("strict");
    7915             : }
    7916             : |  IMMUTABLE
    7917             :  { 
    7918           0 :  $$ = mm_strdup("immutable");
    7919             : }
    7920             : |  STABLE
    7921             :  { 
    7922           0 :  $$ = mm_strdup("stable");
    7923             : }
    7924             : |  VOLATILE
    7925             :  { 
    7926           0 :  $$ = mm_strdup("volatile");
    7927             : }
    7928             : |  EXTERNAL SECURITY DEFINER
    7929             :  { 
    7930           0 :  $$ = mm_strdup("external security definer");
    7931             : }
    7932             : |  EXTERNAL SECURITY INVOKER
    7933             :  { 
    7934           0 :  $$ = mm_strdup("external security invoker");
    7935             : }
    7936             : |  SECURITY DEFINER
    7937             :  { 
    7938           0 :  $$ = mm_strdup("security definer");
    7939             : }
    7940             : |  SECURITY INVOKER
    7941             :  { 
    7942           0 :  $$ = mm_strdup("security invoker");
    7943             : }
    7944             : |  LEAKPROOF
    7945             :  { 
    7946           0 :  $$ = mm_strdup("leakproof");
    7947             : }
    7948             : |  NOT LEAKPROOF
    7949             :  { 
    7950           0 :  $$ = mm_strdup("not leakproof");
    7951             : }
    7952             : |  COST NumericOnly
    7953             :  { 
    7954           0 :  $$ = cat_str(2,mm_strdup("cost"),$2);
    7955             : }
    7956             : |  ROWS NumericOnly
    7957             :  { 
    7958           0 :  $$ = cat_str(2,mm_strdup("rows"),$2);
    7959             : }
    7960             : |  SUPPORT any_name
    7961             :  { 
    7962           0 :  $$ = cat_str(2,mm_strdup("support"),$2);
    7963             : }
    7964             : |  FunctionSetResetClause
    7965             :  { 
    7966           0 :  $$ = $1;
    7967             : }
    7968             : |  PARALLEL ColId
    7969             :  { 
    7970           0 :  $$ = cat_str(2,mm_strdup("parallel"),$2);
    7971             : }
    7972             : ;
    7973             : 
    7974             : 
    7975             :  createfunc_opt_item:
    7976             :  AS func_as
    7977             :  { 
    7978           2 :  $$ = cat_str(2,mm_strdup("as"),$2);
    7979             : }
    7980             : |  LANGUAGE NonReservedWord_or_Sconst
    7981             :  { 
    7982           2 :  $$ = cat_str(2,mm_strdup("language"),$2);
    7983             : }
    7984             : |  TRANSFORM transform_type_list
    7985             :  { 
    7986           0 :  $$ = cat_str(2,mm_strdup("transform"),$2);
    7987             : }
    7988             : |  WINDOW
    7989             :  { 
    7990           0 :  $$ = mm_strdup("window");
    7991             : }
    7992             : |  common_func_opt_item
    7993             :  { 
    7994           0 :  $$ = $1;
    7995             : }
    7996             : ;
    7997             : 
    7998             : 
    7999             :  func_as:
    8000             :  ecpg_sconst
    8001             :  { 
    8002           2 :  $$ = $1;
    8003             : }
    8004             : |  ecpg_sconst ',' ecpg_sconst
    8005             :  { 
    8006           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    8007             : }
    8008             : ;
    8009             : 
    8010             : 
    8011             :  ReturnStmt:
    8012             :  RETURN a_expr
    8013             :  { 
    8014           0 :  $$ = cat_str(2,mm_strdup("return"),$2);
    8015             : }
    8016             : ;
    8017             : 
    8018             : 
    8019             :  opt_routine_body:
    8020             :  ReturnStmt
    8021             :  { 
    8022           0 :  $$ = $1;
    8023             : }
    8024             : |  BEGIN_P ATOMIC routine_body_stmt_list END_P
    8025             :  { 
    8026           0 :  $$ = cat_str(3,mm_strdup("begin atomic"),$3,mm_strdup("end"));
    8027             : }
    8028             : | 
    8029             :  { 
    8030           2 :  $$=EMPTY; }
    8031             : ;
    8032             : 
    8033             : 
    8034             :  routine_body_stmt_list:
    8035             :  routine_body_stmt_list routine_body_stmt ';'
    8036             :  { 
    8037           0 :  $$ = cat_str(3,$1,$2,mm_strdup(";"));
    8038             : }
    8039             : | 
    8040             :  { 
    8041           0 :  $$=EMPTY; }
    8042             : ;
    8043             : 
    8044             : 
    8045             :  routine_body_stmt:
    8046             :  stmt
    8047             :  { 
    8048           0 :  $$ = $1;
    8049             : }
    8050             : |  ReturnStmt
    8051             :  { 
    8052           0 :  $$ = $1;
    8053             : }
    8054             : ;
    8055             : 
    8056             : 
    8057             :  transform_type_list:
    8058             :  FOR TYPE_P Typename
    8059             :  { 
    8060           0 :  $$ = cat_str(2,mm_strdup("for type"),$3);
    8061             : }
    8062             : |  transform_type_list ',' FOR TYPE_P Typename
    8063             :  { 
    8064           0 :  $$ = cat_str(3,$1,mm_strdup(", for type"),$5);
    8065             : }
    8066             : ;
    8067             : 
    8068             : 
    8069             :  opt_definition:
    8070             :  WITH definition
    8071             :  { 
    8072           0 :  $$ = cat_str(2,mm_strdup("with"),$2);
    8073             : }
    8074             : | 
    8075             :  { 
    8076          20 :  $$=EMPTY; }
    8077             : ;
    8078             : 
    8079             : 
    8080             :  table_func_column:
    8081             :  param_name func_type
    8082             :  { 
    8083           0 :  $$ = cat_str(2,$1,$2);
    8084             : }
    8085             : ;
    8086             : 
    8087             : 
    8088             :  table_func_column_list:
    8089             :  table_func_column
    8090             :  { 
    8091           0 :  $$ = $1;
    8092             : }
    8093             : |  table_func_column_list ',' table_func_column
    8094             :  { 
    8095           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    8096             : }
    8097             : ;
    8098             : 
    8099             : 
    8100             :  AlterFunctionStmt:
    8101             :  ALTER FUNCTION function_with_argtypes alterfunc_opt_list opt_restrict
    8102             :  { 
    8103           0 :  $$ = cat_str(4,mm_strdup("alter function"),$3,$4,$5);
    8104             : }
    8105             : |  ALTER PROCEDURE function_with_argtypes alterfunc_opt_list opt_restrict
    8106             :  { 
    8107           0 :  $$ = cat_str(4,mm_strdup("alter procedure"),$3,$4,$5);
    8108             : }
    8109             : |  ALTER ROUTINE function_with_argtypes alterfunc_opt_list opt_restrict
    8110             :  { 
    8111           0 :  $$ = cat_str(4,mm_strdup("alter routine"),$3,$4,$5);
    8112             : }
    8113             : ;
    8114             : 
    8115             : 
    8116             :  alterfunc_opt_list:
    8117             :  common_func_opt_item
    8118             :  { 
    8119           0 :  $$ = $1;
    8120             : }
    8121             : |  alterfunc_opt_list common_func_opt_item
    8122             :  { 
    8123           0 :  $$ = cat_str(2,$1,$2);
    8124             : }
    8125             : ;
    8126             : 
    8127             : 
    8128             :  opt_restrict:
    8129             :  RESTRICT
    8130             :  { 
    8131           0 :  $$ = mm_strdup("restrict");
    8132             : }
    8133             : | 
    8134             :  { 
    8135           0 :  $$=EMPTY; }
    8136             : ;
    8137             : 
    8138             : 
    8139             :  RemoveFuncStmt:
    8140             :  DROP FUNCTION function_with_argtypes_list opt_drop_behavior
    8141             :  { 
    8142           2 :  $$ = cat_str(3,mm_strdup("drop function"),$3,$4);
    8143             : }
    8144             : |  DROP FUNCTION IF_P EXISTS function_with_argtypes_list opt_drop_behavior
    8145             :  { 
    8146           0 :  $$ = cat_str(3,mm_strdup("drop function if exists"),$5,$6);
    8147             : }
    8148             : |  DROP PROCEDURE function_with_argtypes_list opt_drop_behavior
    8149             :  { 
    8150           0 :  $$ = cat_str(3,mm_strdup("drop procedure"),$3,$4);
    8151             : }
    8152             : |  DROP PROCEDURE IF_P EXISTS function_with_argtypes_list opt_drop_behavior
    8153             :  { 
    8154           0 :  $$ = cat_str(3,mm_strdup("drop procedure if exists"),$5,$6);
    8155             : }
    8156             : |  DROP ROUTINE function_with_argtypes_list opt_drop_behavior
    8157             :  { 
    8158           0 :  $$ = cat_str(3,mm_strdup("drop routine"),$3,$4);
    8159             : }
    8160             : |  DROP ROUTINE IF_P EXISTS function_with_argtypes_list opt_drop_behavior
    8161             :  { 
    8162           0 :  $$ = cat_str(3,mm_strdup("drop routine if exists"),$5,$6);
    8163             : }
    8164             : ;
    8165             : 
    8166             : 
    8167             :  RemoveAggrStmt:
    8168             :  DROP AGGREGATE aggregate_with_argtypes_list opt_drop_behavior
    8169             :  { 
    8170           0 :  $$ = cat_str(3,mm_strdup("drop aggregate"),$3,$4);
    8171             : }
    8172             : |  DROP AGGREGATE IF_P EXISTS aggregate_with_argtypes_list opt_drop_behavior
    8173             :  { 
    8174           0 :  $$ = cat_str(3,mm_strdup("drop aggregate if exists"),$5,$6);
    8175             : }
    8176             : ;
    8177             : 
    8178             : 
    8179             :  RemoveOperStmt:
    8180             :  DROP OPERATOR operator_with_argtypes_list opt_drop_behavior
    8181             :  { 
    8182           0 :  $$ = cat_str(3,mm_strdup("drop operator"),$3,$4);
    8183             : }
    8184             : |  DROP OPERATOR IF_P EXISTS operator_with_argtypes_list opt_drop_behavior
    8185             :  { 
    8186           0 :  $$ = cat_str(3,mm_strdup("drop operator if exists"),$5,$6);
    8187             : }
    8188             : ;
    8189             : 
    8190             : 
    8191             :  oper_argtypes:
    8192             :  '(' Typename ')'
    8193             :  { 
    8194           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    8195             : }
    8196             : |  '(' Typename ',' Typename ')'
    8197             :  { 
    8198           0 :  $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(","),$4,mm_strdup(")"));
    8199             : }
    8200             : |  '(' NONE ',' Typename ')'
    8201             :  { 
    8202           0 :  $$ = cat_str(3,mm_strdup("( none ,"),$4,mm_strdup(")"));
    8203             : }
    8204             : |  '(' Typename ',' NONE ')'
    8205             :  { 
    8206           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(", none )"));
    8207             : }
    8208             : ;
    8209             : 
    8210             : 
    8211             :  any_operator:
    8212             :  all_Op
    8213             :  { 
    8214           0 :  $$ = $1;
    8215             : }
    8216             : |  ColId '.' any_operator
    8217             :  { 
    8218           0 :  $$ = cat_str(3,$1,mm_strdup("."),$3);
    8219             : }
    8220             : ;
    8221             : 
    8222             : 
    8223             :  operator_with_argtypes_list:
    8224             :  operator_with_argtypes
    8225             :  { 
    8226           0 :  $$ = $1;
    8227             : }
    8228             : |  operator_with_argtypes_list ',' operator_with_argtypes
    8229             :  { 
    8230           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    8231             : }
    8232             : ;
    8233             : 
    8234             : 
    8235             :  operator_with_argtypes:
    8236             :  any_operator oper_argtypes
    8237             :  { 
    8238           0 :  $$ = cat_str(2,$1,$2);
    8239             : }
    8240             : ;
    8241             : 
    8242             : 
    8243             :  DoStmt:
    8244             :  DO dostmt_opt_list
    8245             :  { 
    8246           0 :  $$ = cat_str(2,mm_strdup("do"),$2);
    8247             : }
    8248             : ;
    8249             : 
    8250             : 
    8251             :  dostmt_opt_list:
    8252             :  dostmt_opt_item
    8253             :  { 
    8254           0 :  $$ = $1;
    8255             : }
    8256             : |  dostmt_opt_list dostmt_opt_item
    8257             :  { 
    8258           0 :  $$ = cat_str(2,$1,$2);
    8259             : }
    8260             : ;
    8261             : 
    8262             : 
    8263             :  dostmt_opt_item:
    8264             :  ecpg_sconst
    8265             :  { 
    8266           0 :  $$ = $1;
    8267             : }
    8268             : |  LANGUAGE NonReservedWord_or_Sconst
    8269             :  { 
    8270           0 :  $$ = cat_str(2,mm_strdup("language"),$2);
    8271             : }
    8272             : ;
    8273             : 
    8274             : 
    8275             :  CreateCastStmt:
    8276             :  CREATE CAST '(' Typename AS Typename ')' WITH FUNCTION function_with_argtypes cast_context
    8277             :  { 
    8278           0 :  $$ = cat_str(7,mm_strdup("create cast ("),$4,mm_strdup("as"),$6,mm_strdup(") with function"),$10,$11);
    8279             : }
    8280             : |  CREATE CAST '(' Typename AS Typename ')' WITHOUT FUNCTION cast_context
    8281             :  { 
    8282           0 :  $$ = cat_str(6,mm_strdup("create cast ("),$4,mm_strdup("as"),$6,mm_strdup(") without function"),$10);
    8283             : }
    8284             : |  CREATE CAST '(' Typename AS Typename ')' WITH INOUT cast_context
    8285             :  { 
    8286           0 :  $$ = cat_str(6,mm_strdup("create cast ("),$4,mm_strdup("as"),$6,mm_strdup(") with inout"),$10);
    8287             : }
    8288             : ;
    8289             : 
    8290             : 
    8291             :  cast_context:
    8292             :  AS IMPLICIT_P
    8293             :  { 
    8294           0 :  $$ = mm_strdup("as implicit");
    8295             : }
    8296             : |  AS ASSIGNMENT
    8297             :  { 
    8298           0 :  $$ = mm_strdup("as assignment");
    8299             : }
    8300             : | 
    8301             :  { 
    8302           0 :  $$=EMPTY; }
    8303             : ;
    8304             : 
    8305             : 
    8306             :  DropCastStmt:
    8307             :  DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_behavior
    8308             :  { 
    8309           0 :  $$ = cat_str(8,mm_strdup("drop cast"),$3,mm_strdup("("),$5,mm_strdup("as"),$7,mm_strdup(")"),$9);
    8310             : }
    8311             : ;
    8312             : 
    8313             : 
    8314             :  opt_if_exists:
    8315             :  IF_P EXISTS
    8316             :  { 
    8317           0 :  $$ = mm_strdup("if exists");
    8318             : }
    8319             : | 
    8320             :  { 
    8321           0 :  $$=EMPTY; }
    8322             : ;
    8323             : 
    8324             : 
    8325             :  CreateTransformStmt:
    8326             :  CREATE opt_or_replace TRANSFORM FOR Typename LANGUAGE name '(' transform_element_list ')'
    8327             :  { 
    8328           0 :  $$ = cat_str(9,mm_strdup("create"),$2,mm_strdup("transform for"),$5,mm_strdup("language"),$7,mm_strdup("("),$9,mm_strdup(")"));
    8329             : }
    8330             : ;
    8331             : 
    8332             : 
    8333             :  transform_element_list:
    8334             :  FROM SQL_P WITH FUNCTION function_with_argtypes ',' TO SQL_P WITH FUNCTION function_with_argtypes
    8335             :  { 
    8336           0 :  $$ = cat_str(4,mm_strdup("from sql with function"),$5,mm_strdup(", to sql with function"),$11);
    8337             : }
    8338             : |  TO SQL_P WITH FUNCTION function_with_argtypes ',' FROM SQL_P WITH FUNCTION function_with_argtypes
    8339             :  { 
    8340           0 :  $$ = cat_str(4,mm_strdup("to sql with function"),$5,mm_strdup(", from sql with function"),$11);
    8341             : }
    8342             : |  FROM SQL_P WITH FUNCTION function_with_argtypes
    8343             :  { 
    8344           0 :  $$ = cat_str(2,mm_strdup("from sql with function"),$5);
    8345             : }
    8346             : |  TO SQL_P WITH FUNCTION function_with_argtypes
    8347             :  { 
    8348           0 :  $$ = cat_str(2,mm_strdup("to sql with function"),$5);
    8349             : }
    8350             : ;
    8351             : 
    8352             : 
    8353             :  DropTransformStmt:
    8354             :  DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_drop_behavior
    8355             :  { 
    8356           0 :  $$ = cat_str(7,mm_strdup("drop transform"),$3,mm_strdup("for"),$5,mm_strdup("language"),$7,$8);
    8357             : }
    8358             : ;
    8359             : 
    8360             : 
    8361             :  ReindexStmt:
    8362             :  REINDEX opt_reindex_option_list reindex_target_relation opt_concurrently qualified_name
    8363             :  { 
    8364           0 :  $$ = cat_str(5,mm_strdup("reindex"),$2,$3,$4,$5);
    8365             : }
    8366             : |  REINDEX opt_reindex_option_list SCHEMA opt_concurrently name
    8367             :  { 
    8368           0 :  $$ = cat_str(5,mm_strdup("reindex"),$2,mm_strdup("schema"),$4,$5);
    8369             : }
    8370             : |  REINDEX opt_reindex_option_list reindex_target_all opt_concurrently opt_single_name
    8371             :  { 
    8372           0 :  $$ = cat_str(5,mm_strdup("reindex"),$2,$3,$4,$5);
    8373             : }
    8374             : ;
    8375             : 
    8376             : 
    8377             :  reindex_target_relation:
    8378             :  INDEX
    8379             :  { 
    8380           0 :  $$ = mm_strdup("index");
    8381             : }
    8382             : |  TABLE
    8383             :  { 
    8384           0 :  $$ = mm_strdup("table");
    8385             : }
    8386             : ;
    8387             : 
    8388             : 
    8389             :  reindex_target_all:
    8390             :  SYSTEM_P
    8391             :  { 
    8392           0 :  $$ = mm_strdup("system");
    8393             : }
    8394             : |  DATABASE
    8395             :  { 
    8396           0 :  $$ = mm_strdup("database");
    8397             : }
    8398             : ;
    8399             : 
    8400             : 
    8401             :  opt_reindex_option_list:
    8402             :  '(' utility_option_list ')'
    8403             :  { 
    8404           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    8405             : }
    8406             : | 
    8407             :  { 
    8408           0 :  $$=EMPTY; }
    8409             : ;
    8410             : 
    8411             : 
    8412             :  AlterTblSpcStmt:
    8413             :  ALTER TABLESPACE name SET reloptions
    8414             :  { 
    8415           0 :  $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("set"),$5);
    8416             : }
    8417             : |  ALTER TABLESPACE name RESET reloptions
    8418             :  { 
    8419           0 :  $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("reset"),$5);
    8420             : }
    8421             : ;
    8422             : 
    8423             : 
    8424             :  RenameStmt:
    8425             :  ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
    8426             :  { 
    8427           0 :  $$ = cat_str(4,mm_strdup("alter aggregate"),$3,mm_strdup("rename to"),$6);
    8428             : }
    8429             : |  ALTER COLLATION any_name RENAME TO name
    8430             :  { 
    8431           0 :  $$ = cat_str(4,mm_strdup("alter collation"),$3,mm_strdup("rename to"),$6);
    8432             : }
    8433             : |  ALTER CONVERSION_P any_name RENAME TO name
    8434             :  { 
    8435           0 :  $$ = cat_str(4,mm_strdup("alter conversion"),$3,mm_strdup("rename to"),$6);
    8436             : }
    8437             : |  ALTER DATABASE name RENAME TO name
    8438             :  { 
    8439           0 :  $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("rename to"),$6);
    8440             : }
    8441             : |  ALTER DOMAIN_P any_name RENAME TO name
    8442             :  { 
    8443           0 :  $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("rename to"),$6);
    8444             : }
    8445             : |  ALTER DOMAIN_P any_name RENAME CONSTRAINT name TO name
    8446             :  { 
    8447           0 :  $$ = cat_str(6,mm_strdup("alter domain"),$3,mm_strdup("rename constraint"),$6,mm_strdup("to"),$8);
    8448             : }
    8449             : |  ALTER FOREIGN DATA_P WRAPPER name RENAME TO name
    8450             :  { 
    8451           0 :  $$ = cat_str(4,mm_strdup("alter foreign data wrapper"),$5,mm_strdup("rename to"),$8);
    8452             : }
    8453             : |  ALTER FUNCTION function_with_argtypes RENAME TO name
    8454             :  { 
    8455           0 :  $$ = cat_str(4,mm_strdup("alter function"),$3,mm_strdup("rename to"),$6);
    8456             : }
    8457             : |  ALTER GROUP_P RoleId RENAME TO RoleId
    8458             :  { 
    8459           0 :  $$ = cat_str(4,mm_strdup("alter group"),$3,mm_strdup("rename to"),$6);
    8460             : }
    8461             : |  ALTER opt_procedural LANGUAGE name RENAME TO name
    8462             :  { 
    8463           0 :  $$ = cat_str(6,mm_strdup("alter"),$2,mm_strdup("language"),$4,mm_strdup("rename to"),$7);
    8464             : }
    8465             : |  ALTER OPERATOR CLASS any_name USING name RENAME TO name
    8466             :  { 
    8467           0 :  $$ = cat_str(6,mm_strdup("alter operator class"),$4,mm_strdup("using"),$6,mm_strdup("rename to"),$9);
    8468             : }
    8469             : |  ALTER OPERATOR FAMILY any_name USING name RENAME TO name
    8470             :  { 
    8471           0 :  $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("rename to"),$9);
    8472             : }
    8473             : |  ALTER POLICY name ON qualified_name RENAME TO name
    8474             :  { 
    8475           0 :  $$ = cat_str(6,mm_strdup("alter policy"),$3,mm_strdup("on"),$5,mm_strdup("rename to"),$8);
    8476             : }
    8477             : |  ALTER POLICY IF_P EXISTS name ON qualified_name RENAME TO name
    8478             :  { 
    8479           0 :  $$ = cat_str(6,mm_strdup("alter policy if exists"),$5,mm_strdup("on"),$7,mm_strdup("rename to"),$10);
    8480             : }
    8481             : |  ALTER PROCEDURE function_with_argtypes RENAME TO name
    8482             :  { 
    8483           0 :  $$ = cat_str(4,mm_strdup("alter procedure"),$3,mm_strdup("rename to"),$6);
    8484             : }
    8485             : |  ALTER PUBLICATION name RENAME TO name
    8486             :  { 
    8487           0 :  $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("rename to"),$6);
    8488             : }
    8489             : |  ALTER ROUTINE function_with_argtypes RENAME TO name
    8490             :  { 
    8491           0 :  $$ = cat_str(4,mm_strdup("alter routine"),$3,mm_strdup("rename to"),$6);
    8492             : }
    8493             : |  ALTER SCHEMA name RENAME TO name
    8494             :  { 
    8495           0 :  $$ = cat_str(4,mm_strdup("alter schema"),$3,mm_strdup("rename to"),$6);
    8496             : }
    8497             : |  ALTER SERVER name RENAME TO name
    8498             :  { 
    8499           0 :  $$ = cat_str(4,mm_strdup("alter server"),$3,mm_strdup("rename to"),$6);
    8500             : }
    8501             : |  ALTER SUBSCRIPTION name RENAME TO name
    8502             :  { 
    8503           0 :  $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("rename to"),$6);
    8504             : }
    8505             : |  ALTER TABLE relation_expr RENAME TO name
    8506             :  { 
    8507           0 :  $$ = cat_str(4,mm_strdup("alter table"),$3,mm_strdup("rename to"),$6);
    8508             : }
    8509             : |  ALTER TABLE IF_P EXISTS relation_expr RENAME TO name
    8510             :  { 
    8511           0 :  $$ = cat_str(4,mm_strdup("alter table if exists"),$5,mm_strdup("rename to"),$8);
    8512             : }
    8513             : |  ALTER SEQUENCE qualified_name RENAME TO name
    8514             :  { 
    8515           0 :  $$ = cat_str(4,mm_strdup("alter sequence"),$3,mm_strdup("rename to"),$6);
    8516             : }
    8517             : |  ALTER SEQUENCE IF_P EXISTS qualified_name RENAME TO name
    8518             :  { 
    8519           0 :  $$ = cat_str(4,mm_strdup("alter sequence if exists"),$5,mm_strdup("rename to"),$8);
    8520             : }
    8521             : |  ALTER VIEW qualified_name RENAME TO name
    8522             :  { 
    8523           0 :  $$ = cat_str(4,mm_strdup("alter view"),$3,mm_strdup("rename to"),$6);
    8524             : }
    8525             : |  ALTER VIEW IF_P EXISTS qualified_name RENAME TO name
    8526             :  { 
    8527           0 :  $$ = cat_str(4,mm_strdup("alter view if exists"),$5,mm_strdup("rename to"),$8);
    8528             : }
    8529             : |  ALTER MATERIALIZED VIEW qualified_name RENAME TO name
    8530             :  { 
    8531           0 :  $$ = cat_str(4,mm_strdup("alter materialized view"),$4,mm_strdup("rename to"),$7);
    8532             : }
    8533             : |  ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME TO name
    8534             :  { 
    8535           0 :  $$ = cat_str(4,mm_strdup("alter materialized view if exists"),$6,mm_strdup("rename to"),$9);
    8536             : }
    8537             : |  ALTER INDEX qualified_name RENAME TO name
    8538             :  { 
    8539           0 :  $$ = cat_str(4,mm_strdup("alter index"),$3,mm_strdup("rename to"),$6);
    8540             : }
    8541             : |  ALTER INDEX IF_P EXISTS qualified_name RENAME TO name
    8542             :  { 
    8543           0 :  $$ = cat_str(4,mm_strdup("alter index if exists"),$5,mm_strdup("rename to"),$8);
    8544             : }
    8545             : |  ALTER FOREIGN TABLE relation_expr RENAME TO name
    8546             :  { 
    8547           0 :  $$ = cat_str(4,mm_strdup("alter foreign table"),$4,mm_strdup("rename to"),$7);
    8548             : }
    8549             : |  ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME TO name
    8550             :  { 
    8551           0 :  $$ = cat_str(4,mm_strdup("alter foreign table if exists"),$6,mm_strdup("rename to"),$9);
    8552             : }
    8553             : |  ALTER TABLE relation_expr RENAME opt_column name TO name
    8554             :  { 
    8555           0 :  $$ = cat_str(7,mm_strdup("alter table"),$3,mm_strdup("rename"),$5,$6,mm_strdup("to"),$8);
    8556             : }
    8557             : |  ALTER TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name
    8558             :  { 
    8559           0 :  $$ = cat_str(7,mm_strdup("alter table if exists"),$5,mm_strdup("rename"),$7,$8,mm_strdup("to"),$10);
    8560             : }
    8561             : |  ALTER VIEW qualified_name RENAME opt_column name TO name
    8562             :  { 
    8563           0 :  $$ = cat_str(7,mm_strdup("alter view"),$3,mm_strdup("rename"),$5,$6,mm_strdup("to"),$8);
    8564             : }
    8565             : |  ALTER VIEW IF_P EXISTS qualified_name RENAME opt_column name TO name
    8566             :  { 
    8567           0 :  $$ = cat_str(7,mm_strdup("alter view if exists"),$5,mm_strdup("rename"),$7,$8,mm_strdup("to"),$10);
    8568             : }
    8569             : |  ALTER MATERIALIZED VIEW qualified_name RENAME opt_column name TO name
    8570             :  { 
    8571           0 :  $$ = cat_str(7,mm_strdup("alter materialized view"),$4,mm_strdup("rename"),$6,$7,mm_strdup("to"),$9);
    8572             : }
    8573             : |  ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME opt_column name TO name
    8574             :  { 
    8575           0 :  $$ = cat_str(7,mm_strdup("alter materialized view if exists"),$6,mm_strdup("rename"),$8,$9,mm_strdup("to"),$11);
    8576             : }
    8577             : |  ALTER TABLE relation_expr RENAME CONSTRAINT name TO name
    8578             :  { 
    8579           0 :  $$ = cat_str(6,mm_strdup("alter table"),$3,mm_strdup("rename constraint"),$6,mm_strdup("to"),$8);
    8580             : }
    8581             : |  ALTER TABLE IF_P EXISTS relation_expr RENAME CONSTRAINT name TO name
    8582             :  { 
    8583           0 :  $$ = cat_str(6,mm_strdup("alter table if exists"),$5,mm_strdup("rename constraint"),$8,mm_strdup("to"),$10);
    8584             : }
    8585             : |  ALTER FOREIGN TABLE relation_expr RENAME opt_column name TO name
    8586             :  { 
    8587           0 :  $$ = cat_str(7,mm_strdup("alter foreign table"),$4,mm_strdup("rename"),$6,$7,mm_strdup("to"),$9);
    8588             : }
    8589             : |  ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name
    8590             :  { 
    8591           0 :  $$ = cat_str(7,mm_strdup("alter foreign table if exists"),$6,mm_strdup("rename"),$8,$9,mm_strdup("to"),$11);
    8592             : }
    8593             : |  ALTER RULE name ON qualified_name RENAME TO name
    8594             :  { 
    8595           0 :  $$ = cat_str(6,mm_strdup("alter rule"),$3,mm_strdup("on"),$5,mm_strdup("rename to"),$8);
    8596             : }
    8597             : |  ALTER TRIGGER name ON qualified_name RENAME TO name
    8598             :  { 
    8599           0 :  $$ = cat_str(6,mm_strdup("alter trigger"),$3,mm_strdup("on"),$5,mm_strdup("rename to"),$8);
    8600             : }
    8601             : |  ALTER EVENT TRIGGER name RENAME TO name
    8602             :  { 
    8603           0 :  $$ = cat_str(4,mm_strdup("alter event trigger"),$4,mm_strdup("rename to"),$7);
    8604             : }
    8605             : |  ALTER ROLE RoleId RENAME TO RoleId
    8606             :  { 
    8607           0 :  $$ = cat_str(4,mm_strdup("alter role"),$3,mm_strdup("rename to"),$6);
    8608             : }
    8609             : |  ALTER USER RoleId RENAME TO RoleId
    8610             :  { 
    8611           0 :  $$ = cat_str(4,mm_strdup("alter user"),$3,mm_strdup("rename to"),$6);
    8612             : }
    8613             : |  ALTER TABLESPACE name RENAME TO name
    8614             :  { 
    8615           0 :  $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("rename to"),$6);
    8616             : }
    8617             : |  ALTER STATISTICS any_name RENAME TO name
    8618             :  { 
    8619           0 :  $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("rename to"),$6);
    8620             : }
    8621             : |  ALTER TEXT_P SEARCH PARSER any_name RENAME TO name
    8622             :  { 
    8623           0 :  $$ = cat_str(4,mm_strdup("alter text search parser"),$5,mm_strdup("rename to"),$8);
    8624             : }
    8625             : |  ALTER TEXT_P SEARCH DICTIONARY any_name RENAME TO name
    8626             :  { 
    8627           0 :  $$ = cat_str(4,mm_strdup("alter text search dictionary"),$5,mm_strdup("rename to"),$8);
    8628             : }
    8629             : |  ALTER TEXT_P SEARCH TEMPLATE any_name RENAME TO name
    8630             :  { 
    8631           0 :  $$ = cat_str(4,mm_strdup("alter text search template"),$5,mm_strdup("rename to"),$8);
    8632             : }
    8633             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name RENAME TO name
    8634             :  { 
    8635           0 :  $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("rename to"),$8);
    8636             : }
    8637             : |  ALTER TYPE_P any_name RENAME TO name
    8638             :  { 
    8639           0 :  $$ = cat_str(4,mm_strdup("alter type"),$3,mm_strdup("rename to"),$6);
    8640             : }
    8641             : |  ALTER TYPE_P any_name RENAME ATTRIBUTE name TO name opt_drop_behavior
    8642             :  { 
    8643           0 :  $$ = cat_str(7,mm_strdup("alter type"),$3,mm_strdup("rename attribute"),$6,mm_strdup("to"),$8,$9);
    8644             : }
    8645             : ;
    8646             : 
    8647             : 
    8648             :  opt_column:
    8649             :  COLUMN
    8650             :  { 
    8651           2 :  $$ = mm_strdup("column");
    8652             : }
    8653             : | 
    8654             :  { 
    8655           2 :  $$=EMPTY; }
    8656             : ;
    8657             : 
    8658             : 
    8659             :  opt_set_data:
    8660             :  SET DATA_P
    8661             :  { 
    8662           2 :  $$ = mm_strdup("set data");
    8663             : }
    8664             : | 
    8665             :  { 
    8666           2 :  $$=EMPTY; }
    8667             : ;
    8668             : 
    8669             : 
    8670             :  AlterObjectDependsStmt:
    8671             :  ALTER FUNCTION function_with_argtypes opt_no DEPENDS ON EXTENSION name
    8672             :  { 
    8673           0 :  $$ = cat_str(5,mm_strdup("alter function"),$3,$4,mm_strdup("depends on extension"),$8);
    8674             : }
    8675             : |  ALTER PROCEDURE function_with_argtypes opt_no DEPENDS ON EXTENSION name
    8676             :  { 
    8677           0 :  $$ = cat_str(5,mm_strdup("alter procedure"),$3,$4,mm_strdup("depends on extension"),$8);
    8678             : }
    8679             : |  ALTER ROUTINE function_with_argtypes opt_no DEPENDS ON EXTENSION name
    8680             :  { 
    8681           0 :  $$ = cat_str(5,mm_strdup("alter routine"),$3,$4,mm_strdup("depends on extension"),$8);
    8682             : }
    8683             : |  ALTER TRIGGER name ON qualified_name opt_no DEPENDS ON EXTENSION name
    8684             :  { 
    8685           0 :  $$ = cat_str(7,mm_strdup("alter trigger"),$3,mm_strdup("on"),$5,$6,mm_strdup("depends on extension"),$10);
    8686             : }
    8687             : |  ALTER MATERIALIZED VIEW qualified_name opt_no DEPENDS ON EXTENSION name
    8688             :  { 
    8689           0 :  $$ = cat_str(5,mm_strdup("alter materialized view"),$4,$5,mm_strdup("depends on extension"),$9);
    8690             : }
    8691             : |  ALTER INDEX qualified_name opt_no DEPENDS ON EXTENSION name
    8692             :  { 
    8693           0 :  $$ = cat_str(5,mm_strdup("alter index"),$3,$4,mm_strdup("depends on extension"),$8);
    8694             : }
    8695             : ;
    8696             : 
    8697             : 
    8698             :  opt_no:
    8699             :  NO
    8700             :  { 
    8701           0 :  $$ = mm_strdup("no");
    8702             : }
    8703             : | 
    8704             :  { 
    8705           0 :  $$=EMPTY; }
    8706             : ;
    8707             : 
    8708             : 
    8709             :  AlterObjectSchemaStmt:
    8710             :  ALTER AGGREGATE aggregate_with_argtypes SET SCHEMA name
    8711             :  { 
    8712           0 :  $$ = cat_str(4,mm_strdup("alter aggregate"),$3,mm_strdup("set schema"),$6);
    8713             : }
    8714             : |  ALTER COLLATION any_name SET SCHEMA name
    8715             :  { 
    8716           0 :  $$ = cat_str(4,mm_strdup("alter collation"),$3,mm_strdup("set schema"),$6);
    8717             : }
    8718             : |  ALTER CONVERSION_P any_name SET SCHEMA name
    8719             :  { 
    8720           0 :  $$ = cat_str(4,mm_strdup("alter conversion"),$3,mm_strdup("set schema"),$6);
    8721             : }
    8722             : |  ALTER DOMAIN_P any_name SET SCHEMA name
    8723             :  { 
    8724           0 :  $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("set schema"),$6);
    8725             : }
    8726             : |  ALTER EXTENSION name SET SCHEMA name
    8727             :  { 
    8728           0 :  $$ = cat_str(4,mm_strdup("alter extension"),$3,mm_strdup("set schema"),$6);
    8729             : }
    8730             : |  ALTER FUNCTION function_with_argtypes SET SCHEMA name
    8731             :  { 
    8732           0 :  $$ = cat_str(4,mm_strdup("alter function"),$3,mm_strdup("set schema"),$6);
    8733             : }
    8734             : |  ALTER OPERATOR operator_with_argtypes SET SCHEMA name
    8735             :  { 
    8736           0 :  $$ = cat_str(4,mm_strdup("alter operator"),$3,mm_strdup("set schema"),$6);
    8737             : }
    8738             : |  ALTER OPERATOR CLASS any_name USING name SET SCHEMA name
    8739             :  { 
    8740           0 :  $$ = cat_str(6,mm_strdup("alter operator class"),$4,mm_strdup("using"),$6,mm_strdup("set schema"),$9);
    8741             : }
    8742             : |  ALTER OPERATOR FAMILY any_name USING name SET SCHEMA name
    8743             :  { 
    8744           0 :  $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("set schema"),$9);
    8745             : }
    8746             : |  ALTER PROCEDURE function_with_argtypes SET SCHEMA name
    8747             :  { 
    8748           0 :  $$ = cat_str(4,mm_strdup("alter procedure"),$3,mm_strdup("set schema"),$6);
    8749             : }
    8750             : |  ALTER ROUTINE function_with_argtypes SET SCHEMA name
    8751             :  { 
    8752           0 :  $$ = cat_str(4,mm_strdup("alter routine"),$3,mm_strdup("set schema"),$6);
    8753             : }
    8754             : |  ALTER TABLE relation_expr SET SCHEMA name
    8755             :  { 
    8756           0 :  $$ = cat_str(4,mm_strdup("alter table"),$3,mm_strdup("set schema"),$6);
    8757             : }
    8758             : |  ALTER TABLE IF_P EXISTS relation_expr SET SCHEMA name
    8759             :  { 
    8760           0 :  $$ = cat_str(4,mm_strdup("alter table if exists"),$5,mm_strdup("set schema"),$8);
    8761             : }
    8762             : |  ALTER STATISTICS any_name SET SCHEMA name
    8763             :  { 
    8764           0 :  $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("set schema"),$6);
    8765             : }
    8766             : |  ALTER TEXT_P SEARCH PARSER any_name SET SCHEMA name
    8767             :  { 
    8768           0 :  $$ = cat_str(4,mm_strdup("alter text search parser"),$5,mm_strdup("set schema"),$8);
    8769             : }
    8770             : |  ALTER TEXT_P SEARCH DICTIONARY any_name SET SCHEMA name
    8771             :  { 
    8772           0 :  $$ = cat_str(4,mm_strdup("alter text search dictionary"),$5,mm_strdup("set schema"),$8);
    8773             : }
    8774             : |  ALTER TEXT_P SEARCH TEMPLATE any_name SET SCHEMA name
    8775             :  { 
    8776           0 :  $$ = cat_str(4,mm_strdup("alter text search template"),$5,mm_strdup("set schema"),$8);
    8777             : }
    8778             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name SET SCHEMA name
    8779             :  { 
    8780           0 :  $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("set schema"),$8);
    8781             : }
    8782             : |  ALTER SEQUENCE qualified_name SET SCHEMA name
    8783             :  { 
    8784           0 :  $$ = cat_str(4,mm_strdup("alter sequence"),$3,mm_strdup("set schema"),$6);
    8785             : }
    8786             : |  ALTER SEQUENCE IF_P EXISTS qualified_name SET SCHEMA name
    8787             :  { 
    8788           0 :  $$ = cat_str(4,mm_strdup("alter sequence if exists"),$5,mm_strdup("set schema"),$8);
    8789             : }
    8790             : |  ALTER VIEW qualified_name SET SCHEMA name
    8791             :  { 
    8792           0 :  $$ = cat_str(4,mm_strdup("alter view"),$3,mm_strdup("set schema"),$6);
    8793             : }
    8794             : |  ALTER VIEW IF_P EXISTS qualified_name SET SCHEMA name
    8795             :  { 
    8796           0 :  $$ = cat_str(4,mm_strdup("alter view if exists"),$5,mm_strdup("set schema"),$8);
    8797             : }
    8798             : |  ALTER MATERIALIZED VIEW qualified_name SET SCHEMA name
    8799             :  { 
    8800           0 :  $$ = cat_str(4,mm_strdup("alter materialized view"),$4,mm_strdup("set schema"),$7);
    8801             : }
    8802             : |  ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name SET SCHEMA name
    8803             :  { 
    8804           0 :  $$ = cat_str(4,mm_strdup("alter materialized view if exists"),$6,mm_strdup("set schema"),$9);
    8805             : }
    8806             : |  ALTER FOREIGN TABLE relation_expr SET SCHEMA name
    8807             :  { 
    8808           0 :  $$ = cat_str(4,mm_strdup("alter foreign table"),$4,mm_strdup("set schema"),$7);
    8809             : }
    8810             : |  ALTER FOREIGN TABLE IF_P EXISTS relation_expr SET SCHEMA name
    8811             :  { 
    8812           0 :  $$ = cat_str(4,mm_strdup("alter foreign table if exists"),$6,mm_strdup("set schema"),$9);
    8813             : }
    8814             : |  ALTER TYPE_P any_name SET SCHEMA name
    8815             :  { 
    8816           0 :  $$ = cat_str(4,mm_strdup("alter type"),$3,mm_strdup("set schema"),$6);
    8817             : }
    8818             : ;
    8819             : 
    8820             : 
    8821             :  AlterOperatorStmt:
    8822             :  ALTER OPERATOR operator_with_argtypes SET '(' operator_def_list ')'
    8823             :  { 
    8824           0 :  $$ = cat_str(5,mm_strdup("alter operator"),$3,mm_strdup("set ("),$6,mm_strdup(")"));
    8825             : }
    8826             : ;
    8827             : 
    8828             : 
    8829             :  operator_def_list:
    8830             :  operator_def_elem
    8831             :  { 
    8832           0 :  $$ = $1;
    8833             : }
    8834             : |  operator_def_list ',' operator_def_elem
    8835             :  { 
    8836           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    8837             : }
    8838             : ;
    8839             : 
    8840             : 
    8841             :  operator_def_elem:
    8842             :  ColLabel '=' NONE
    8843             :  { 
    8844           0 :  $$ = cat_str(2,$1,mm_strdup("= none"));
    8845             : }
    8846             : |  ColLabel '=' operator_def_arg
    8847             :  { 
    8848           0 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
    8849             : }
    8850             : |  ColLabel
    8851             :  { 
    8852           0 :  $$ = $1;
    8853             : }
    8854             : ;
    8855             : 
    8856             : 
    8857             :  operator_def_arg:
    8858             :  func_type
    8859             :  { 
    8860           0 :  $$ = $1;
    8861             : }
    8862             : |  reserved_keyword
    8863             :  { 
    8864           0 :  $$ = $1;
    8865             : }
    8866             : |  qual_all_Op
    8867             :  { 
    8868           0 :  $$ = $1;
    8869             : }
    8870             : |  NumericOnly
    8871             :  { 
    8872           0 :  $$ = $1;
    8873             : }
    8874             : |  ecpg_sconst
    8875             :  { 
    8876           0 :  $$ = $1;
    8877             : }
    8878             : ;
    8879             : 
    8880             : 
    8881             :  AlterTypeStmt:
    8882             :  ALTER TYPE_P any_name SET '(' operator_def_list ')'
    8883             :  { 
    8884           0 :  $$ = cat_str(5,mm_strdup("alter type"),$3,mm_strdup("set ("),$6,mm_strdup(")"));
    8885             : }
    8886             : ;
    8887             : 
    8888             : 
    8889             :  AlterOwnerStmt:
    8890             :  ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
    8891             :  { 
    8892           0 :  $$ = cat_str(4,mm_strdup("alter aggregate"),$3,mm_strdup("owner to"),$6);
    8893             : }
    8894             : |  ALTER COLLATION any_name OWNER TO RoleSpec
    8895             :  { 
    8896           0 :  $$ = cat_str(4,mm_strdup("alter collation"),$3,mm_strdup("owner to"),$6);
    8897             : }
    8898             : |  ALTER CONVERSION_P any_name OWNER TO RoleSpec
    8899             :  { 
    8900           0 :  $$ = cat_str(4,mm_strdup("alter conversion"),$3,mm_strdup("owner to"),$6);
    8901             : }
    8902             : |  ALTER DATABASE name OWNER TO RoleSpec
    8903             :  { 
    8904           0 :  $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("owner to"),$6);
    8905             : }
    8906             : |  ALTER DOMAIN_P any_name OWNER TO RoleSpec
    8907             :  { 
    8908           0 :  $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("owner to"),$6);
    8909             : }
    8910             : |  ALTER FUNCTION function_with_argtypes OWNER TO RoleSpec
    8911             :  { 
    8912           0 :  $$ = cat_str(4,mm_strdup("alter function"),$3,mm_strdup("owner to"),$6);
    8913             : }
    8914             : |  ALTER opt_procedural LANGUAGE name OWNER TO RoleSpec
    8915             :  { 
    8916           0 :  $$ = cat_str(6,mm_strdup("alter"),$2,mm_strdup("language"),$4,mm_strdup("owner to"),$7);
    8917             : }
    8918             : |  ALTER LARGE_P OBJECT_P NumericOnly OWNER TO RoleSpec
    8919             :  { 
    8920           0 :  $$ = cat_str(4,mm_strdup("alter large object"),$4,mm_strdup("owner to"),$7);
    8921             : }
    8922             : |  ALTER OPERATOR operator_with_argtypes OWNER TO RoleSpec
    8923             :  { 
    8924           0 :  $$ = cat_str(4,mm_strdup("alter operator"),$3,mm_strdup("owner to"),$6);
    8925             : }
    8926             : |  ALTER OPERATOR CLASS any_name USING name OWNER TO RoleSpec
    8927             :  { 
    8928           0 :  $$ = cat_str(6,mm_strdup("alter operator class"),$4,mm_strdup("using"),$6,mm_strdup("owner to"),$9);
    8929             : }
    8930             : |  ALTER OPERATOR FAMILY any_name USING name OWNER TO RoleSpec
    8931             :  { 
    8932           0 :  $$ = cat_str(6,mm_strdup("alter operator family"),$4,mm_strdup("using"),$6,mm_strdup("owner to"),$9);
    8933             : }
    8934             : |  ALTER PROCEDURE function_with_argtypes OWNER TO RoleSpec
    8935             :  { 
    8936           0 :  $$ = cat_str(4,mm_strdup("alter procedure"),$3,mm_strdup("owner to"),$6);
    8937             : }
    8938             : |  ALTER ROUTINE function_with_argtypes OWNER TO RoleSpec
    8939             :  { 
    8940           0 :  $$ = cat_str(4,mm_strdup("alter routine"),$3,mm_strdup("owner to"),$6);
    8941             : }
    8942             : |  ALTER SCHEMA name OWNER TO RoleSpec
    8943             :  { 
    8944           0 :  $$ = cat_str(4,mm_strdup("alter schema"),$3,mm_strdup("owner to"),$6);
    8945             : }
    8946             : |  ALTER TYPE_P any_name OWNER TO RoleSpec
    8947             :  { 
    8948           0 :  $$ = cat_str(4,mm_strdup("alter type"),$3,mm_strdup("owner to"),$6);
    8949             : }
    8950             : |  ALTER TABLESPACE name OWNER TO RoleSpec
    8951             :  { 
    8952           0 :  $$ = cat_str(4,mm_strdup("alter tablespace"),$3,mm_strdup("owner to"),$6);
    8953             : }
    8954             : |  ALTER STATISTICS any_name OWNER TO RoleSpec
    8955             :  { 
    8956           0 :  $$ = cat_str(4,mm_strdup("alter statistics"),$3,mm_strdup("owner to"),$6);
    8957             : }
    8958             : |  ALTER TEXT_P SEARCH DICTIONARY any_name OWNER TO RoleSpec
    8959             :  { 
    8960           0 :  $$ = cat_str(4,mm_strdup("alter text search dictionary"),$5,mm_strdup("owner to"),$8);
    8961             : }
    8962             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name OWNER TO RoleSpec
    8963             :  { 
    8964           0 :  $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("owner to"),$8);
    8965             : }
    8966             : |  ALTER FOREIGN DATA_P WRAPPER name OWNER TO RoleSpec
    8967             :  { 
    8968           0 :  $$ = cat_str(4,mm_strdup("alter foreign data wrapper"),$5,mm_strdup("owner to"),$8);
    8969             : }
    8970             : |  ALTER SERVER name OWNER TO RoleSpec
    8971             :  { 
    8972           0 :  $$ = cat_str(4,mm_strdup("alter server"),$3,mm_strdup("owner to"),$6);
    8973             : }
    8974             : |  ALTER EVENT TRIGGER name OWNER TO RoleSpec
    8975             :  { 
    8976           0 :  $$ = cat_str(4,mm_strdup("alter event trigger"),$4,mm_strdup("owner to"),$7);
    8977             : }
    8978             : |  ALTER PUBLICATION name OWNER TO RoleSpec
    8979             :  { 
    8980           0 :  $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("owner to"),$6);
    8981             : }
    8982             : |  ALTER SUBSCRIPTION name OWNER TO RoleSpec
    8983             :  { 
    8984           0 :  $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("owner to"),$6);
    8985             : }
    8986             : ;
    8987             : 
    8988             : 
    8989             :  CreatePublicationStmt:
    8990             :  CREATE PUBLICATION name opt_definition
    8991             :  { 
    8992           0 :  $$ = cat_str(3,mm_strdup("create publication"),$3,$4);
    8993             : }
    8994             : |  CREATE PUBLICATION name FOR ALL TABLES opt_definition
    8995             :  { 
    8996           0 :  $$ = cat_str(4,mm_strdup("create publication"),$3,mm_strdup("for all tables"),$7);
    8997             : }
    8998             : |  CREATE PUBLICATION name FOR pub_obj_list opt_definition
    8999             :  { 
    9000           0 :  $$ = cat_str(5,mm_strdup("create publication"),$3,mm_strdup("for"),$5,$6);
    9001             : }
    9002             : ;
    9003             : 
    9004             : 
    9005             :  PublicationObjSpec:
    9006             :  TABLE relation_expr opt_column_list OptWhereClause
    9007             :  { 
    9008           0 :  $$ = cat_str(4,mm_strdup("table"),$2,$3,$4);
    9009             : }
    9010             : |  TABLES IN_P SCHEMA ColId
    9011             :  { 
    9012           0 :  $$ = cat_str(2,mm_strdup("tables in schema"),$4);
    9013             : }
    9014             : |  TABLES IN_P SCHEMA CURRENT_SCHEMA
    9015             :  { 
    9016           0 :  $$ = mm_strdup("tables in schema current_schema");
    9017             : }
    9018             : |  ColId opt_column_list OptWhereClause
    9019             :  { 
    9020           0 :  $$ = cat_str(3,$1,$2,$3);
    9021             : }
    9022             : |  ColId indirection opt_column_list OptWhereClause
    9023             :  { 
    9024           0 :  $$ = cat_str(4,$1,$2,$3,$4);
    9025             : }
    9026             : |  extended_relation_expr opt_column_list OptWhereClause
    9027             :  { 
    9028           0 :  $$ = cat_str(3,$1,$2,$3);
    9029             : }
    9030             : |  CURRENT_SCHEMA
    9031             :  { 
    9032           0 :  $$ = mm_strdup("current_schema");
    9033             : }
    9034             : ;
    9035             : 
    9036             : 
    9037             :  pub_obj_list:
    9038             :  PublicationObjSpec
    9039             :  { 
    9040           0 :  $$ = $1;
    9041             : }
    9042             : |  pub_obj_list ',' PublicationObjSpec
    9043             :  { 
    9044           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    9045             : }
    9046             : ;
    9047             : 
    9048             : 
    9049             :  AlterPublicationStmt:
    9050             :  ALTER PUBLICATION name SET definition
    9051             :  { 
    9052           0 :  $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("set"),$5);
    9053             : }
    9054             : |  ALTER PUBLICATION name ADD_P pub_obj_list
    9055             :  { 
    9056           0 :  $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("add"),$5);
    9057             : }
    9058             : |  ALTER PUBLICATION name SET pub_obj_list
    9059             :  { 
    9060           0 :  $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("set"),$5);
    9061             : }
    9062             : |  ALTER PUBLICATION name DROP pub_obj_list
    9063             :  { 
    9064           0 :  $$ = cat_str(4,mm_strdup("alter publication"),$3,mm_strdup("drop"),$5);
    9065             : }
    9066             : ;
    9067             : 
    9068             : 
    9069             :  CreateSubscriptionStmt:
    9070             :  CREATE SUBSCRIPTION name CONNECTION ecpg_sconst PUBLICATION name_list opt_definition
    9071             :  { 
    9072           0 :  $$ = cat_str(7,mm_strdup("create subscription"),$3,mm_strdup("connection"),$5,mm_strdup("publication"),$7,$8);
    9073             : }
    9074             : ;
    9075             : 
    9076             : 
    9077             :  AlterSubscriptionStmt:
    9078             :  ALTER SUBSCRIPTION name SET definition
    9079             :  { 
    9080           0 :  $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("set"),$5);
    9081             : }
    9082             : |  ALTER SUBSCRIPTION name CONNECTION ecpg_sconst
    9083             :  { 
    9084           0 :  $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("connection"),$5);
    9085             : }
    9086             : |  ALTER SUBSCRIPTION name REFRESH PUBLICATION opt_definition
    9087             :  { 
    9088           0 :  $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("refresh publication"),$6);
    9089             : }
    9090             : |  ALTER SUBSCRIPTION name ADD_P PUBLICATION name_list opt_definition
    9091             :  { 
    9092           0 :  $$ = cat_str(5,mm_strdup("alter subscription"),$3,mm_strdup("add publication"),$6,$7);
    9093             : }
    9094             : |  ALTER SUBSCRIPTION name DROP PUBLICATION name_list opt_definition
    9095             :  { 
    9096           0 :  $$ = cat_str(5,mm_strdup("alter subscription"),$3,mm_strdup("drop publication"),$6,$7);
    9097             : }
    9098             : |  ALTER SUBSCRIPTION name SET PUBLICATION name_list opt_definition
    9099             :  { 
    9100           0 :  $$ = cat_str(5,mm_strdup("alter subscription"),$3,mm_strdup("set publication"),$6,$7);
    9101             : }
    9102             : |  ALTER SUBSCRIPTION name ENABLE_P
    9103             :  { 
    9104           0 :  $$ = cat_str(3,mm_strdup("alter subscription"),$3,mm_strdup("enable"));
    9105             : }
    9106             : |  ALTER SUBSCRIPTION name DISABLE_P
    9107             :  { 
    9108           0 :  $$ = cat_str(3,mm_strdup("alter subscription"),$3,mm_strdup("disable"));
    9109             : }
    9110             : |  ALTER SUBSCRIPTION name SKIP definition
    9111             :  { 
    9112           0 :  $$ = cat_str(4,mm_strdup("alter subscription"),$3,mm_strdup("skip"),$5);
    9113             : }
    9114             : ;
    9115             : 
    9116             : 
    9117             :  DropSubscriptionStmt:
    9118             :  DROP SUBSCRIPTION name opt_drop_behavior
    9119             :  { 
    9120           0 :  $$ = cat_str(3,mm_strdup("drop subscription"),$3,$4);
    9121             : }
    9122             : |  DROP SUBSCRIPTION IF_P EXISTS name opt_drop_behavior
    9123             :  { 
    9124           0 :  $$ = cat_str(3,mm_strdup("drop subscription if exists"),$5,$6);
    9125             : }
    9126             : ;
    9127             : 
    9128             : 
    9129             :  RuleStmt:
    9130             :  CREATE opt_or_replace RULE name AS ON event TO qualified_name where_clause DO opt_instead RuleActionList
    9131             :  { 
    9132           0 :  $$ = 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);
    9133             : }
    9134             : ;
    9135             : 
    9136             : 
    9137             :  RuleActionList:
    9138             :  NOTHING
    9139             :  { 
    9140           0 :  $$ = mm_strdup("nothing");
    9141             : }
    9142             : |  RuleActionStmt
    9143             :  { 
    9144           0 :  $$ = $1;
    9145             : }
    9146             : |  '(' RuleActionMulti ')'
    9147             :  { 
    9148           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    9149             : }
    9150             : ;
    9151             : 
    9152             : 
    9153             :  RuleActionMulti:
    9154             :  RuleActionMulti ';' RuleActionStmtOrEmpty
    9155             :  { 
    9156           0 :  $$ = cat_str(3,$1,mm_strdup(";"),$3);
    9157             : }
    9158             : |  RuleActionStmtOrEmpty
    9159             :  { 
    9160           0 :  $$ = $1;
    9161             : }
    9162             : ;
    9163             : 
    9164             : 
    9165             :  RuleActionStmt:
    9166             :  SelectStmt
    9167             :  { 
    9168           0 :  $$ = $1;
    9169             : }
    9170             : |  InsertStmt
    9171             :  { 
    9172           0 :  $$ = $1;
    9173             : }
    9174             : |  UpdateStmt
    9175             :  { 
    9176           0 :  $$ = $1;
    9177             : }
    9178             : |  DeleteStmt
    9179             :  { 
    9180           0 :  $$ = $1;
    9181             : }
    9182             : |  NotifyStmt
    9183             :  { 
    9184           0 :  $$ = $1;
    9185             : }
    9186             : ;
    9187             : 
    9188             : 
    9189             :  RuleActionStmtOrEmpty:
    9190             :  RuleActionStmt
    9191             :  { 
    9192           0 :  $$ = $1;
    9193             : }
    9194             : | 
    9195             :  { 
    9196           0 :  $$=EMPTY; }
    9197             : ;
    9198             : 
    9199             : 
    9200             :  event:
    9201             :  SELECT
    9202             :  { 
    9203           0 :  $$ = mm_strdup("select");
    9204             : }
    9205             : |  UPDATE
    9206             :  { 
    9207           0 :  $$ = mm_strdup("update");
    9208             : }
    9209             : |  DELETE_P
    9210             :  { 
    9211           0 :  $$ = mm_strdup("delete");
    9212             : }
    9213             : |  INSERT
    9214             :  { 
    9215           0 :  $$ = mm_strdup("insert");
    9216             : }
    9217             : ;
    9218             : 
    9219             : 
    9220             :  opt_instead:
    9221             :  INSTEAD
    9222             :  { 
    9223           0 :  $$ = mm_strdup("instead");
    9224             : }
    9225             : |  ALSO
    9226             :  { 
    9227           0 :  $$ = mm_strdup("also");
    9228             : }
    9229             : | 
    9230             :  { 
    9231           0 :  $$=EMPTY; }
    9232             : ;
    9233             : 
    9234             : 
    9235             :  NotifyStmt:
    9236             :  NOTIFY ColId notify_payload
    9237             :  { 
    9238           0 :  $$ = cat_str(3,mm_strdup("notify"),$2,$3);
    9239             : }
    9240             : ;
    9241             : 
    9242             : 
    9243             :  notify_payload:
    9244             :  ',' ecpg_sconst
    9245             :  { 
    9246           0 :  $$ = cat_str(2,mm_strdup(","),$2);
    9247             : }
    9248             : | 
    9249             :  { 
    9250           0 :  $$=EMPTY; }
    9251             : ;
    9252             : 
    9253             : 
    9254             :  ListenStmt:
    9255             :  LISTEN ColId
    9256             :  { 
    9257           0 :  $$ = cat_str(2,mm_strdup("listen"),$2);
    9258             : }
    9259             : ;
    9260             : 
    9261             : 
    9262             :  UnlistenStmt:
    9263             :  UNLISTEN ColId
    9264             :  { 
    9265           0 :  $$ = cat_str(2,mm_strdup("unlisten"),$2);
    9266             : }
    9267             : |  UNLISTEN '*'
    9268             :  { 
    9269           0 :  $$ = mm_strdup("unlisten *");
    9270             : }
    9271             : ;
    9272             : 
    9273             : 
    9274             :  TransactionStmt:
    9275             :  ABORT_P opt_transaction opt_transaction_chain
    9276             :  { 
    9277           0 :  $$ = cat_str(3,mm_strdup("abort"),$2,$3);
    9278             : }
    9279             : |  START TRANSACTION transaction_mode_list_or_empty
    9280             :  { 
    9281           0 :  $$ = cat_str(2,mm_strdup("start transaction"),$3);
    9282             : }
    9283             : |  COMMIT opt_transaction opt_transaction_chain
    9284             :  { 
    9285         122 :  $$ = cat_str(3,mm_strdup("commit"),$2,$3);
    9286             : }
    9287             : |  ROLLBACK opt_transaction opt_transaction_chain
    9288             :  { 
    9289          32 :  $$ = cat_str(3,mm_strdup("rollback"),$2,$3);
    9290             : }
    9291             : |  SAVEPOINT ColId
    9292             :  { 
    9293           0 :  $$ = cat_str(2,mm_strdup("savepoint"),$2);
    9294             : }
    9295             : |  RELEASE SAVEPOINT ColId
    9296             :  { 
    9297           0 :  $$ = cat_str(2,mm_strdup("release savepoint"),$3);
    9298             : }
    9299             : |  RELEASE ColId
    9300             :  { 
    9301           0 :  $$ = cat_str(2,mm_strdup("release"),$2);
    9302             : }
    9303             : |  ROLLBACK opt_transaction TO SAVEPOINT ColId
    9304             :  { 
    9305           0 :  $$ = cat_str(4,mm_strdup("rollback"),$2,mm_strdup("to savepoint"),$5);
    9306             : }
    9307             : |  ROLLBACK opt_transaction TO ColId
    9308             :  { 
    9309           0 :  $$ = cat_str(4,mm_strdup("rollback"),$2,mm_strdup("to"),$4);
    9310             : }
    9311             : |  PREPARE TRANSACTION ecpg_sconst
    9312             :  { 
    9313           2 :  $$ = cat_str(2,mm_strdup("prepare transaction"),$3);
    9314             : }
    9315             : |  COMMIT PREPARED ecpg_sconst
    9316             :  { 
    9317           2 :  $$ = cat_str(2,mm_strdup("commit prepared"),$3);
    9318             : }
    9319             : |  ROLLBACK PREPARED ecpg_sconst
    9320             :  { 
    9321           0 :  $$ = cat_str(2,mm_strdup("rollback prepared"),$3);
    9322             : }
    9323             : ;
    9324             : 
    9325             : 
    9326             :  TransactionStmtLegacy:
    9327             :  BEGIN_P opt_transaction transaction_mode_list_or_empty
    9328             :  { 
    9329          16 :  $$ = cat_str(3,mm_strdup("begin"),$2,$3);
    9330             : }
    9331             : |  END_P opt_transaction opt_transaction_chain
    9332             :  { 
    9333           0 :  $$ = cat_str(3,mm_strdup("end"),$2,$3);
    9334             : }
    9335             : ;
    9336             : 
    9337             : 
    9338             :  opt_transaction:
    9339             :  WORK
    9340             :  { 
    9341          24 :  $$ = mm_strdup("work");
    9342             : }
    9343             : |  TRANSACTION
    9344             :  { 
    9345           0 :  $$ = mm_strdup("transaction");
    9346             : }
    9347             : | 
    9348             :  { 
    9349         146 :  $$=EMPTY; }
    9350             : ;
    9351             : 
    9352             : 
    9353             :  transaction_mode_item:
    9354             :  ISOLATION LEVEL iso_level
    9355             :  { 
    9356           2 :  $$ = cat_str(2,mm_strdup("isolation level"),$3);
    9357             : }
    9358             : |  READ ONLY
    9359             :  { 
    9360           0 :  $$ = mm_strdup("read only");
    9361             : }
    9362             : |  READ WRITE
    9363             :  { 
    9364           0 :  $$ = mm_strdup("read write");
    9365             : }
    9366             : |  DEFERRABLE
    9367             :  { 
    9368           0 :  $$ = mm_strdup("deferrable");
    9369             : }
    9370             : |  NOT DEFERRABLE
    9371             :  { 
    9372           0 :  $$ = mm_strdup("not deferrable");
    9373             : }
    9374             : ;
    9375             : 
    9376             : 
    9377             :  transaction_mode_list:
    9378             :  transaction_mode_item
    9379             :  { 
    9380           2 :  $$ = $1;
    9381             : }
    9382             : |  transaction_mode_list ',' transaction_mode_item
    9383             :  { 
    9384           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    9385             : }
    9386             : |  transaction_mode_list transaction_mode_item
    9387             :  { 
    9388           0 :  $$ = cat_str(2,$1,$2);
    9389             : }
    9390             : ;
    9391             : 
    9392             : 
    9393             :  transaction_mode_list_or_empty:
    9394             :  transaction_mode_list
    9395             :  { 
    9396           0 :  $$ = $1;
    9397             : }
    9398             : | 
    9399             :  { 
    9400          16 :  $$=EMPTY; }
    9401             : ;
    9402             : 
    9403             : 
    9404             :  opt_transaction_chain:
    9405             :  AND CHAIN
    9406             :  { 
    9407           0 :  $$ = mm_strdup("and chain");
    9408             : }
    9409             : |  AND NO CHAIN
    9410             :  { 
    9411           0 :  $$ = mm_strdup("and no chain");
    9412             : }
    9413             : | 
    9414             :  { 
    9415         154 :  $$=EMPTY; }
    9416             : ;
    9417             : 
    9418             : 
    9419             :  ViewStmt:
    9420             :  CREATE OptTemp VIEW qualified_name opt_column_list opt_reloptions AS SelectStmt opt_check_option
    9421             :  { 
    9422           0 :  $$ = cat_str(9,mm_strdup("create"),$2,mm_strdup("view"),$4,$5,$6,mm_strdup("as"),$8,$9);
    9423             : }
    9424             : |  CREATE OR REPLACE OptTemp VIEW qualified_name opt_column_list opt_reloptions AS SelectStmt opt_check_option
    9425             :  { 
    9426           0 :  $$ = cat_str(9,mm_strdup("create or replace"),$4,mm_strdup("view"),$6,$7,$8,mm_strdup("as"),$10,$11);
    9427             : }
    9428             : |  CREATE OptTemp RECURSIVE VIEW qualified_name '(' columnList ')' opt_reloptions AS SelectStmt opt_check_option
    9429             :  { 
    9430           0 :  $$ = cat_str(11,mm_strdup("create"),$2,mm_strdup("recursive view"),$5,mm_strdup("("),$7,mm_strdup(")"),$9,mm_strdup("as"),$11,$12);
    9431             : }
    9432             : |  CREATE OR REPLACE OptTemp RECURSIVE VIEW qualified_name '(' columnList ')' opt_reloptions AS SelectStmt opt_check_option
    9433             :  { 
    9434           0 :  $$ = 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);
    9435             : }
    9436             : ;
    9437             : 
    9438             : 
    9439             :  opt_check_option:
    9440             :  WITH CHECK OPTION
    9441             :  { 
    9442           0 :  $$ = mm_strdup("with check option");
    9443             : }
    9444             : |  WITH CASCADED CHECK OPTION
    9445             :  { 
    9446           0 :  $$ = mm_strdup("with cascaded check option");
    9447             : }
    9448             : |  WITH LOCAL CHECK OPTION
    9449             :  { 
    9450           0 :  $$ = mm_strdup("with local check option");
    9451             : }
    9452             : | 
    9453             :  { 
    9454           0 :  $$=EMPTY; }
    9455             : ;
    9456             : 
    9457             : 
    9458             :  LoadStmt:
    9459             :  LOAD file_name
    9460             :  { 
    9461           0 :  $$ = cat_str(2,mm_strdup("load"),$2);
    9462             : }
    9463             : ;
    9464             : 
    9465             : 
    9466             :  CreatedbStmt:
    9467             :  CREATE DATABASE name opt_with createdb_opt_list
    9468             :  { 
    9469           0 :  $$ = cat_str(4,mm_strdup("create database"),$3,$4,$5);
    9470             : }
    9471             : ;
    9472             : 
    9473             : 
    9474             :  createdb_opt_list:
    9475             :  createdb_opt_items
    9476             :  { 
    9477           0 :  $$ = $1;
    9478             : }
    9479             : | 
    9480             :  { 
    9481           0 :  $$=EMPTY; }
    9482             : ;
    9483             : 
    9484             : 
    9485             :  createdb_opt_items:
    9486             :  createdb_opt_item
    9487             :  { 
    9488           0 :  $$ = $1;
    9489             : }
    9490             : |  createdb_opt_items createdb_opt_item
    9491             :  { 
    9492           0 :  $$ = cat_str(2,$1,$2);
    9493             : }
    9494             : ;
    9495             : 
    9496             : 
    9497             :  createdb_opt_item:
    9498             :  createdb_opt_name opt_equal NumericOnly
    9499             :  { 
    9500           0 :  $$ = cat_str(3,$1,$2,$3);
    9501             : }
    9502             : |  createdb_opt_name opt_equal opt_boolean_or_string
    9503             :  { 
    9504           0 :  $$ = cat_str(3,$1,$2,$3);
    9505             : }
    9506             : |  createdb_opt_name opt_equal DEFAULT
    9507             :  { 
    9508           0 :  $$ = cat_str(3,$1,$2,mm_strdup("default"));
    9509             : }
    9510             : ;
    9511             : 
    9512             : 
    9513             :  createdb_opt_name:
    9514             :  ecpg_ident
    9515             :  { 
    9516           0 :  $$ = $1;
    9517             : }
    9518             : |  CONNECTION LIMIT
    9519             :  { 
    9520           0 :  $$ = mm_strdup("connection limit");
    9521             : }
    9522             : |  ENCODING
    9523             :  { 
    9524           0 :  $$ = mm_strdup("encoding");
    9525             : }
    9526             : |  LOCATION
    9527             :  { 
    9528           0 :  $$ = mm_strdup("location");
    9529             : }
    9530             : |  OWNER
    9531             :  { 
    9532           0 :  $$ = mm_strdup("owner");
    9533             : }
    9534             : |  TABLESPACE
    9535             :  { 
    9536           0 :  $$ = mm_strdup("tablespace");
    9537             : }
    9538             : |  TEMPLATE
    9539             :  { 
    9540           0 :  $$ = mm_strdup("template");
    9541             : }
    9542             : ;
    9543             : 
    9544             : 
    9545             :  opt_equal:
    9546             :  '='
    9547             :  { 
    9548           0 :  $$ = mm_strdup("=");
    9549             : }
    9550             : | 
    9551             :  { 
    9552           0 :  $$=EMPTY; }
    9553             : ;
    9554             : 
    9555             : 
    9556             :  AlterDatabaseStmt:
    9557             :  ALTER DATABASE name WITH createdb_opt_list
    9558             :  { 
    9559           0 :  $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("with"),$5);
    9560             : }
    9561             : |  ALTER DATABASE name createdb_opt_list
    9562             :  { 
    9563           0 :  $$ = cat_str(3,mm_strdup("alter database"),$3,$4);
    9564             : }
    9565             : |  ALTER DATABASE name SET TABLESPACE name
    9566             :  { 
    9567           0 :  $$ = cat_str(4,mm_strdup("alter database"),$3,mm_strdup("set tablespace"),$6);
    9568             : }
    9569             : |  ALTER DATABASE name REFRESH COLLATION VERSION_P
    9570             :  { 
    9571           0 :  $$ = cat_str(3,mm_strdup("alter database"),$3,mm_strdup("refresh collation version"));
    9572             : }
    9573             : ;
    9574             : 
    9575             : 
    9576             :  AlterDatabaseSetStmt:
    9577             :  ALTER DATABASE name SetResetClause
    9578             :  { 
    9579           0 :  $$ = cat_str(3,mm_strdup("alter database"),$3,$4);
    9580             : }
    9581             : ;
    9582             : 
    9583             : 
    9584             :  DropdbStmt:
    9585             :  DROP DATABASE name
    9586             :  { 
    9587           0 :  $$ = cat_str(2,mm_strdup("drop database"),$3);
    9588             : }
    9589             : |  DROP DATABASE IF_P EXISTS name
    9590             :  { 
    9591           0 :  $$ = cat_str(2,mm_strdup("drop database if exists"),$5);
    9592             : }
    9593             : |  DROP DATABASE name opt_with '(' drop_option_list ')'
    9594             :  { 
    9595           0 :  $$ = cat_str(6,mm_strdup("drop database"),$3,$4,mm_strdup("("),$6,mm_strdup(")"));
    9596             : }
    9597             : |  DROP DATABASE IF_P EXISTS name opt_with '(' drop_option_list ')'
    9598             :  { 
    9599           0 :  $$ = cat_str(6,mm_strdup("drop database if exists"),$5,$6,mm_strdup("("),$8,mm_strdup(")"));
    9600             : }
    9601             : ;
    9602             : 
    9603             : 
    9604             :  drop_option_list:
    9605             :  drop_option
    9606             :  { 
    9607           0 :  $$ = $1;
    9608             : }
    9609             : |  drop_option_list ',' drop_option
    9610             :  { 
    9611           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    9612             : }
    9613             : ;
    9614             : 
    9615             : 
    9616             :  drop_option:
    9617             :  FORCE
    9618             :  { 
    9619           0 :  $$ = mm_strdup("force");
    9620             : }
    9621             : ;
    9622             : 
    9623             : 
    9624             :  AlterCollationStmt:
    9625             :  ALTER COLLATION any_name REFRESH VERSION_P
    9626             :  { 
    9627           0 :  $$ = cat_str(3,mm_strdup("alter collation"),$3,mm_strdup("refresh version"));
    9628             : }
    9629             : ;
    9630             : 
    9631             : 
    9632             :  AlterSystemStmt:
    9633             :  ALTER SYSTEM_P SET generic_set
    9634             :  { 
    9635           0 :  $$ = cat_str(2,mm_strdup("alter system set"),$4);
    9636             : }
    9637             : |  ALTER SYSTEM_P RESET generic_reset
    9638             :  { 
    9639           0 :  $$ = cat_str(2,mm_strdup("alter system reset"),$4);
    9640             : }
    9641             : ;
    9642             : 
    9643             : 
    9644             :  CreateDomainStmt:
    9645             :  CREATE DOMAIN_P any_name opt_as Typename ColQualList
    9646             :  { 
    9647           0 :  $$ = cat_str(5,mm_strdup("create domain"),$3,$4,$5,$6);
    9648             : }
    9649             : ;
    9650             : 
    9651             : 
    9652             :  AlterDomainStmt:
    9653             :  ALTER DOMAIN_P any_name alter_column_default
    9654             :  { 
    9655           0 :  $$ = cat_str(3,mm_strdup("alter domain"),$3,$4);
    9656             : }
    9657             : |  ALTER DOMAIN_P any_name DROP NOT NULL_P
    9658             :  { 
    9659           0 :  $$ = cat_str(3,mm_strdup("alter domain"),$3,mm_strdup("drop not null"));
    9660             : }
    9661             : |  ALTER DOMAIN_P any_name SET NOT NULL_P
    9662             :  { 
    9663           0 :  $$ = cat_str(3,mm_strdup("alter domain"),$3,mm_strdup("set not null"));
    9664             : }
    9665             : |  ALTER DOMAIN_P any_name ADD_P DomainConstraint
    9666             :  { 
    9667           0 :  $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("add"),$5);
    9668             : }
    9669             : |  ALTER DOMAIN_P any_name DROP CONSTRAINT name opt_drop_behavior
    9670             :  { 
    9671           0 :  $$ = cat_str(5,mm_strdup("alter domain"),$3,mm_strdup("drop constraint"),$6,$7);
    9672             : }
    9673             : |  ALTER DOMAIN_P any_name DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
    9674             :  { 
    9675           0 :  $$ = cat_str(5,mm_strdup("alter domain"),$3,mm_strdup("drop constraint if exists"),$8,$9);
    9676             : }
    9677             : |  ALTER DOMAIN_P any_name VALIDATE CONSTRAINT name
    9678             :  { 
    9679           0 :  $$ = cat_str(4,mm_strdup("alter domain"),$3,mm_strdup("validate constraint"),$6);
    9680             : }
    9681             : ;
    9682             : 
    9683             : 
    9684             :  opt_as:
    9685             :  AS
    9686             :  { 
    9687           0 :  $$ = mm_strdup("as");
    9688             : }
    9689             : | 
    9690             :  { 
    9691           2 :  $$=EMPTY; }
    9692             : ;
    9693             : 
    9694             : 
    9695             :  AlterTSDictionaryStmt:
    9696             :  ALTER TEXT_P SEARCH DICTIONARY any_name definition
    9697             :  { 
    9698           0 :  $$ = cat_str(3,mm_strdup("alter text search dictionary"),$5,$6);
    9699             : }
    9700             : ;
    9701             : 
    9702             : 
    9703             :  AlterTSConfigurationStmt:
    9704             :  ALTER TEXT_P SEARCH CONFIGURATION any_name ADD_P MAPPING FOR name_list any_with any_name_list
    9705             :  { 
    9706           0 :  $$ = cat_str(6,mm_strdup("alter text search configuration"),$5,mm_strdup("add mapping for"),$9,$10,$11);
    9707             : }
    9708             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list any_with any_name_list
    9709             :  { 
    9710           0 :  $$ = cat_str(6,mm_strdup("alter text search configuration"),$5,mm_strdup("alter mapping for"),$9,$10,$11);
    9711             : }
    9712             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING REPLACE any_name any_with any_name
    9713             :  { 
    9714           0 :  $$ = cat_str(6,mm_strdup("alter text search configuration"),$5,mm_strdup("alter mapping replace"),$9,$10,$11);
    9715             : }
    9716             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list REPLACE any_name any_with any_name
    9717             :  { 
    9718           0 :  $$ = cat_str(8,mm_strdup("alter text search configuration"),$5,mm_strdup("alter mapping for"),$9,mm_strdup("replace"),$11,$12,$13);
    9719             : }
    9720             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING FOR name_list
    9721             :  { 
    9722           0 :  $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("drop mapping for"),$9);
    9723             : }
    9724             : |  ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING IF_P EXISTS FOR name_list
    9725             :  { 
    9726           0 :  $$ = cat_str(4,mm_strdup("alter text search configuration"),$5,mm_strdup("drop mapping if exists for"),$11);
    9727             : }
    9728             : ;
    9729             : 
    9730             : 
    9731             :  any_with:
    9732             :  WITH
    9733             :  { 
    9734           0 :  $$ = mm_strdup("with");
    9735             : }
    9736             : |  WITH_LA
    9737             :  { 
    9738           0 :  $$ = mm_strdup("with");
    9739             : }
    9740             : ;
    9741             : 
    9742             : 
    9743             :  CreateConversionStmt:
    9744             :  CREATE opt_default CONVERSION_P any_name FOR ecpg_sconst TO ecpg_sconst FROM any_name
    9745             :  { 
    9746           0 :  $$ = cat_str(10,mm_strdup("create"),$2,mm_strdup("conversion"),$4,mm_strdup("for"),$6,mm_strdup("to"),$8,mm_strdup("from"),$10);
    9747             : }
    9748             : ;
    9749             : 
    9750             : 
    9751             :  ClusterStmt:
    9752             :  CLUSTER '(' utility_option_list ')' qualified_name cluster_index_specification
    9753             :  { 
    9754           0 :  $$ = cat_str(5,mm_strdup("cluster ("),$3,mm_strdup(")"),$5,$6);
    9755             : }
    9756             : |  CLUSTER '(' utility_option_list ')'
    9757             :  { 
    9758           0 :  $$ = cat_str(3,mm_strdup("cluster ("),$3,mm_strdup(")"));
    9759             : }
    9760             : |  CLUSTER opt_verbose qualified_name cluster_index_specification
    9761             :  { 
    9762           0 :  $$ = cat_str(4,mm_strdup("cluster"),$2,$3,$4);
    9763             : }
    9764             : |  CLUSTER opt_verbose
    9765             :  { 
    9766           0 :  $$ = cat_str(2,mm_strdup("cluster"),$2);
    9767             : }
    9768             : |  CLUSTER opt_verbose name ON qualified_name
    9769             :  { 
    9770           0 :  $$ = cat_str(5,mm_strdup("cluster"),$2,$3,mm_strdup("on"),$5);
    9771             : }
    9772             : ;
    9773             : 
    9774             : 
    9775             :  cluster_index_specification:
    9776             :  USING name
    9777             :  { 
    9778           0 :  $$ = cat_str(2,mm_strdup("using"),$2);
    9779             : }
    9780             : | 
    9781             :  { 
    9782           0 :  $$=EMPTY; }
    9783             : ;
    9784             : 
    9785             : 
    9786             :  VacuumStmt:
    9787             :  VACUUM opt_full opt_freeze opt_verbose opt_analyze opt_vacuum_relation_list
    9788             :  { 
    9789           0 :  $$ = cat_str(6,mm_strdup("vacuum"),$2,$3,$4,$5,$6);
    9790             : }
    9791             : |  VACUUM '(' utility_option_list ')' opt_vacuum_relation_list
    9792             :  { 
    9793           0 :  $$ = cat_str(4,mm_strdup("vacuum ("),$3,mm_strdup(")"),$5);
    9794             : }
    9795             : ;
    9796             : 
    9797             : 
    9798             :  AnalyzeStmt:
    9799             :  analyze_keyword opt_verbose opt_vacuum_relation_list
    9800             :  { 
    9801           0 :  $$ = cat_str(3,$1,$2,$3);
    9802             : }
    9803             : |  analyze_keyword '(' utility_option_list ')' opt_vacuum_relation_list
    9804             :  { 
    9805           0 :  $$ = cat_str(5,$1,mm_strdup("("),$3,mm_strdup(")"),$5);
    9806             : }
    9807             : ;
    9808             : 
    9809             : 
    9810             :  utility_option_list:
    9811             :  utility_option_elem
    9812             :  { 
    9813           0 :  $$ = $1;
    9814             : }
    9815             : |  utility_option_list ',' utility_option_elem
    9816             :  { 
    9817           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    9818             : }
    9819             : ;
    9820             : 
    9821             : 
    9822             :  analyze_keyword:
    9823             :  ANALYZE
    9824             :  { 
    9825           0 :  $$ = mm_strdup("analyze");
    9826             : }
    9827             : |  ANALYSE
    9828             :  { 
    9829           0 :  $$ = mm_strdup("analyse");
    9830             : }
    9831             : ;
    9832             : 
    9833             : 
    9834             :  utility_option_elem:
    9835             :  utility_option_name utility_option_arg
    9836             :  { 
    9837           0 :  $$ = cat_str(2,$1,$2);
    9838             : }
    9839             : ;
    9840             : 
    9841             : 
    9842             :  utility_option_name:
    9843             :  NonReservedWord
    9844             :  { 
    9845           0 :  $$ = $1;
    9846             : }
    9847             : |  analyze_keyword
    9848             :  { 
    9849           0 :  $$ = $1;
    9850             : }
    9851             : |  FORMAT_LA
    9852             :  { 
    9853           0 :  $$ = mm_strdup("format");
    9854             : }
    9855             : ;
    9856             : 
    9857             : 
    9858             :  utility_option_arg:
    9859             :  opt_boolean_or_string
    9860             :  { 
    9861           0 :  $$ = $1;
    9862             : }
    9863             : |  NumericOnly
    9864             :  { 
    9865           0 :  $$ = $1;
    9866             : }
    9867             : | 
    9868             :  { 
    9869           0 :  $$=EMPTY; }
    9870             : ;
    9871             : 
    9872             : 
    9873             :  opt_analyze:
    9874             :  analyze_keyword
    9875             :  { 
    9876           0 :  $$ = $1;
    9877             : }
    9878             : | 
    9879             :  { 
    9880           0 :  $$=EMPTY; }
    9881             : ;
    9882             : 
    9883             : 
    9884             :  opt_verbose:
    9885             :  VERBOSE
    9886             :  { 
    9887           0 :  $$ = mm_strdup("verbose");
    9888             : }
    9889             : | 
    9890             :  { 
    9891           0 :  $$=EMPTY; }
    9892             : ;
    9893             : 
    9894             : 
    9895             :  opt_full:
    9896             :  FULL
    9897             :  { 
    9898           0 :  $$ = mm_strdup("full");
    9899             : }
    9900             : | 
    9901             :  { 
    9902           0 :  $$=EMPTY; }
    9903             : ;
    9904             : 
    9905             : 
    9906             :  opt_freeze:
    9907             :  FREEZE
    9908             :  { 
    9909           0 :  $$ = mm_strdup("freeze");
    9910             : }
    9911             : | 
    9912             :  { 
    9913           0 :  $$=EMPTY; }
    9914             : ;
    9915             : 
    9916             : 
    9917             :  opt_name_list:
    9918             :  '(' name_list ')'
    9919             :  { 
    9920           2 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
    9921             : }
    9922             : | 
    9923             :  { 
    9924           0 :  $$=EMPTY; }
    9925             : ;
    9926             : 
    9927             : 
    9928             :  vacuum_relation:
    9929             :  qualified_name opt_name_list
    9930             :  { 
    9931           0 :  $$ = cat_str(2,$1,$2);
    9932             : }
    9933             : ;
    9934             : 
    9935             : 
    9936             :  vacuum_relation_list:
    9937             :  vacuum_relation
    9938             :  { 
    9939           0 :  $$ = $1;
    9940             : }
    9941             : |  vacuum_relation_list ',' vacuum_relation
    9942             :  { 
    9943           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
    9944             : }
    9945             : ;
    9946             : 
    9947             : 
    9948             :  opt_vacuum_relation_list:
    9949             :  vacuum_relation_list
    9950             :  { 
    9951           0 :  $$ = $1;
    9952             : }
    9953             : | 
    9954             :  { 
    9955           0 :  $$=EMPTY; }
    9956             : ;
    9957             : 
    9958             : 
    9959             :  ExplainStmt:
    9960             :  EXPLAIN ExplainableStmt
    9961             :  { 
    9962           0 :  $$ = cat_str(2,mm_strdup("explain"),$2);
    9963             : }
    9964             : |  EXPLAIN analyze_keyword opt_verbose ExplainableStmt
    9965             :  { 
    9966           0 :  $$ = cat_str(4,mm_strdup("explain"),$2,$3,$4);
    9967             : }
    9968             : |  EXPLAIN VERBOSE ExplainableStmt
    9969             :  { 
    9970           0 :  $$ = cat_str(2,mm_strdup("explain verbose"),$3);
    9971             : }
    9972             : |  EXPLAIN '(' utility_option_list ')' ExplainableStmt
    9973             :  { 
    9974           0 :  $$ = cat_str(4,mm_strdup("explain ("),$3,mm_strdup(")"),$5);
    9975             : }
    9976             : ;
    9977             : 
    9978             : 
    9979             :  ExplainableStmt:
    9980             :  SelectStmt
    9981             :  { 
    9982           0 :  $$ = $1;
    9983             : }
    9984             : |  InsertStmt
    9985             :  { 
    9986           0 :  $$ = $1;
    9987             : }
    9988             : |  UpdateStmt
    9989             :  { 
    9990           0 :  $$ = $1;
    9991             : }
    9992             : |  DeleteStmt
    9993             :  { 
    9994           0 :  $$ = $1;
    9995             : }
    9996             : |  MergeStmt
    9997             :  { 
    9998           0 :  $$ = $1;
    9999             : }
   10000             : |  DeclareCursorStmt
   10001             :  { 
   10002           0 :  $$ = $1;
   10003             : }
   10004             : |  CreateAsStmt
   10005             :  { 
   10006           0 :  $$ = $1;
   10007             : }
   10008             : |  CreateMatViewStmt
   10009             :  { 
   10010           0 :  $$ = $1;
   10011             : }
   10012             : |  RefreshMatViewStmt
   10013             :  { 
   10014           0 :  $$ = $1;
   10015             : }
   10016             : |  ExecuteStmt
   10017             :     {
   10018           0 :         $$ = $1.name;
   10019             :     }
   10020             : ;
   10021             : 
   10022             : 
   10023             :  PrepareStmt:
   10024             : PREPARE prepared_name prep_type_clause AS PreparableStmt
   10025             :     {
   10026          12 :         $$.name = $2;
   10027          12 :         $$.type = $3;
   10028          12 :         $$.stmt = $5;
   10029             :     }
   10030             :     | PREPARE prepared_name FROM execstring
   10031             :     {
   10032          94 :         $$.name = $2;
   10033          94 :         $$.type = NULL;
   10034          94 :         $$.stmt = $4;
   10035             :     }
   10036             : ;
   10037             : 
   10038             : 
   10039             :  prep_type_clause:
   10040             :  '(' type_list ')'
   10041             :  { 
   10042          10 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   10043             : }
   10044             : | 
   10045             :  { 
   10046           2 :  $$=EMPTY; }
   10047             : ;
   10048             : 
   10049             : 
   10050             :  PreparableStmt:
   10051             :  SelectStmt
   10052             :  { 
   10053           2 :  $$ = $1;
   10054             : }
   10055             : |  InsertStmt
   10056             :  { 
   10057          12 :  $$ = $1;
   10058             : }
   10059             : |  UpdateStmt
   10060             :  { 
   10061           0 :  $$ = $1;
   10062             : }
   10063             : |  DeleteStmt
   10064             :  { 
   10065           0 :  $$ = $1;
   10066             : }
   10067             : |  MergeStmt
   10068             :  { 
   10069           0 :  $$ = $1;
   10070             : }
   10071             : ;
   10072             : 
   10073             : 
   10074             :  ExecuteStmt:
   10075             : EXECUTE prepared_name execute_param_clause execute_rest
   10076             :     {
   10077          66 :         $$.name = $2;
   10078          66 :         $$.type = $3;
   10079             :     }
   10080             : | CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause opt_with_data execute_rest
   10081             :     {
   10082           0 :         $$.name = cat_str(8,mm_strdup("create"),$2,mm_strdup("table"),$4,mm_strdup("as execute"),$7,$8,$9);
   10083             :     }
   10084             : | CREATE OptTemp TABLE IF_P NOT EXISTS create_as_target AS EXECUTE prepared_name execute_param_clause opt_with_data execute_rest
   10085             :     {
   10086           0 :         $$.name = cat_str(8,mm_strdup("create"),$2,mm_strdup("table if not exists"),$7,mm_strdup("as execute"),$10,$11,$12);
   10087             :     }
   10088             : ;
   10089             : 
   10090             : 
   10091             :  execute_param_clause:
   10092             :  '(' expr_list ')'
   10093             :  { 
   10094          18 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   10095             : }
   10096             : | 
   10097             :  { 
   10098          48 :  $$=EMPTY; }
   10099             : ;
   10100             : 
   10101             : 
   10102             :  InsertStmt:
   10103             :  opt_with_clause INSERT INTO insert_target insert_rest opt_on_conflict returning_clause
   10104             :  { 
   10105         236 :  $$ = cat_str(6,$1,mm_strdup("insert into"),$4,$5,$6,$7);
   10106             : }
   10107             : ;
   10108             : 
   10109             : 
   10110             :  insert_target:
   10111             :  qualified_name
   10112             :  { 
   10113         236 :  $$ = $1;
   10114             : }
   10115             : |  qualified_name AS ColId
   10116             :  { 
   10117           0 :  $$ = cat_str(3,$1,mm_strdup("as"),$3);
   10118             : }
   10119             : ;
   10120             : 
   10121             : 
   10122             :  insert_rest:
   10123             :  SelectStmt
   10124             :  { 
   10125         132 :  $$ = $1;
   10126             : }
   10127             : |  OVERRIDING override_kind VALUE_P SelectStmt
   10128             :  { 
   10129           0 :  $$ = cat_str(4,mm_strdup("overriding"),$2,mm_strdup("value"),$4);
   10130             : }
   10131             : |  '(' insert_column_list ')' SelectStmt
   10132             :  { 
   10133         104 :  $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
   10134             : }
   10135             : |  '(' insert_column_list ')' OVERRIDING override_kind VALUE_P SelectStmt
   10136             :  { 
   10137           0 :  $$ = cat_str(6,mm_strdup("("),$2,mm_strdup(") overriding"),$5,mm_strdup("value"),$7);
   10138             : }
   10139             : |  DEFAULT VALUES
   10140             :  { 
   10141           0 :  $$ = mm_strdup("default values");
   10142             : }
   10143             : ;
   10144             : 
   10145             : 
   10146             :  override_kind:
   10147             :  USER
   10148             :  { 
   10149           0 :  $$ = mm_strdup("user");
   10150             : }
   10151             : |  SYSTEM_P
   10152             :  { 
   10153           0 :  $$ = mm_strdup("system");
   10154             : }
   10155             : ;
   10156             : 
   10157             : 
   10158             :  insert_column_list:
   10159             :  insert_column_item
   10160             :  { 
   10161         104 :  $$ = $1;
   10162             : }
   10163             : |  insert_column_list ',' insert_column_item
   10164             :  { 
   10165         242 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   10166             : }
   10167             : ;
   10168             : 
   10169             : 
   10170             :  insert_column_item:
   10171             :  ColId opt_indirection
   10172             :  { 
   10173         346 :  $$ = cat_str(2,$1,$2);
   10174             : }
   10175             : ;
   10176             : 
   10177             : 
   10178             :  opt_on_conflict:
   10179             :  ON CONFLICT opt_conf_expr DO UPDATE SET set_clause_list where_clause
   10180             :  { 
   10181           0 :  $$ = cat_str(5,mm_strdup("on conflict"),$3,mm_strdup("do update set"),$7,$8);
   10182             : }
   10183             : |  ON CONFLICT opt_conf_expr DO NOTHING
   10184             :  { 
   10185           0 :  $$ = cat_str(3,mm_strdup("on conflict"),$3,mm_strdup("do nothing"));
   10186             : }
   10187             : | 
   10188             :  { 
   10189         236 :  $$=EMPTY; }
   10190             : ;
   10191             : 
   10192             : 
   10193             :  opt_conf_expr:
   10194             :  '(' index_params ')' where_clause
   10195             :  { 
   10196           0 :  $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
   10197             : }
   10198             : |  ON CONSTRAINT name
   10199             :  { 
   10200           0 :  $$ = cat_str(2,mm_strdup("on constraint"),$3);
   10201             : }
   10202             : | 
   10203             :  { 
   10204           0 :  $$=EMPTY; }
   10205             : ;
   10206             : 
   10207             : 
   10208             :  returning_clause:
   10209             : RETURNING target_list opt_ecpg_into
   10210             :  { 
   10211           4 :  $$ = cat_str(2,mm_strdup("returning"),$2);
   10212             : }
   10213             : | 
   10214             :  { 
   10215         246 :  $$=EMPTY; }
   10216             : ;
   10217             : 
   10218             : 
   10219             :  DeleteStmt:
   10220             :  opt_with_clause DELETE_P FROM relation_expr_opt_alias using_clause where_or_current_clause returning_clause
   10221             :  { 
   10222           4 :  $$ = cat_str(6,$1,mm_strdup("delete from"),$4,$5,$6,$7);
   10223             : }
   10224             : ;
   10225             : 
   10226             : 
   10227             :  using_clause:
   10228             :  USING from_list
   10229             :  { 
   10230           0 :  $$ = cat_str(2,mm_strdup("using"),$2);
   10231             : }
   10232             : | 
   10233             :  { 
   10234           4 :  $$=EMPTY; }
   10235             : ;
   10236             : 
   10237             : 
   10238             :  LockStmt:
   10239             :  LOCK_P opt_table relation_expr_list opt_lock opt_nowait
   10240             :  { 
   10241           0 :  $$ = cat_str(5,mm_strdup("lock"),$2,$3,$4,$5);
   10242             : }
   10243             : ;
   10244             : 
   10245             : 
   10246             :  opt_lock:
   10247             :  IN_P lock_type MODE
   10248             :  { 
   10249           0 :  $$ = cat_str(3,mm_strdup("in"),$2,mm_strdup("mode"));
   10250             : }
   10251             : | 
   10252             :  { 
   10253           0 :  $$=EMPTY; }
   10254             : ;
   10255             : 
   10256             : 
   10257             :  lock_type:
   10258             :  ACCESS SHARE
   10259             :  { 
   10260           0 :  $$ = mm_strdup("access share");
   10261             : }
   10262             : |  ROW SHARE
   10263             :  { 
   10264           0 :  $$ = mm_strdup("row share");
   10265             : }
   10266             : |  ROW EXCLUSIVE
   10267             :  { 
   10268           0 :  $$ = mm_strdup("row exclusive");
   10269             : }
   10270             : |  SHARE UPDATE EXCLUSIVE
   10271             :  { 
   10272           0 :  $$ = mm_strdup("share update exclusive");
   10273             : }
   10274             : |  SHARE
   10275             :  { 
   10276           0 :  $$ = mm_strdup("share");
   10277             : }
   10278             : |  SHARE ROW EXCLUSIVE
   10279             :  { 
   10280           0 :  $$ = mm_strdup("share row exclusive");
   10281             : }
   10282             : |  EXCLUSIVE
   10283             :  { 
   10284           0 :  $$ = mm_strdup("exclusive");
   10285             : }
   10286             : |  ACCESS EXCLUSIVE
   10287             :  { 
   10288           0 :  $$ = mm_strdup("access exclusive");
   10289             : }
   10290             : ;
   10291             : 
   10292             : 
   10293             :  opt_nowait:
   10294             :  NOWAIT
   10295             :  { 
   10296           0 :  $$ = mm_strdup("nowait");
   10297             : }
   10298             : | 
   10299             :  { 
   10300           0 :  $$=EMPTY; }
   10301             : ;
   10302             : 
   10303             : 
   10304             :  opt_nowait_or_skip:
   10305             :  NOWAIT
   10306             :  { 
   10307           0 :  $$ = mm_strdup("nowait");
   10308             : }
   10309             : |  SKIP LOCKED
   10310             :  { 
   10311           0 :  $$ = mm_strdup("skip locked");
   10312             : }
   10313             : | 
   10314             :  { 
   10315           0 :  $$=EMPTY; }
   10316             : ;
   10317             : 
   10318             : 
   10319             :  UpdateStmt:
   10320             :  opt_with_clause UPDATE relation_expr_opt_alias SET set_clause_list from_clause where_or_current_clause returning_clause
   10321             :  { 
   10322          10 :  $$ = cat_str(8,$1,mm_strdup("update"),$3,mm_strdup("set"),$5,$6,$7,$8);
   10323             : }
   10324             : ;
   10325             : 
   10326             : 
   10327             :  set_clause_list:
   10328             :  set_clause
   10329             :  { 
   10330          10 :  $$ = $1;
   10331             : }
   10332             : |  set_clause_list ',' set_clause
   10333             :  { 
   10334           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   10335             : }
   10336             : ;
   10337             : 
   10338             : 
   10339             :  set_clause:
   10340             :  set_target '=' a_expr
   10341             :  { 
   10342           8 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
   10343             : }
   10344             : |  '(' set_target_list ')' '=' a_expr
   10345             :  { 
   10346           2 :  $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(") ="),$5);
   10347             : }
   10348             : ;
   10349             : 
   10350             : 
   10351             :  set_target:
   10352             :  ColId opt_indirection
   10353             :  { 
   10354          12 :  $$ = cat_str(2,$1,$2);
   10355             : }
   10356             : ;
   10357             : 
   10358             : 
   10359             :  set_target_list:
   10360             :  set_target
   10361             :  { 
   10362           2 :  $$ = $1;
   10363             : }
   10364             : |  set_target_list ',' set_target
   10365             :  { 
   10366           2 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   10367             : }
   10368             : ;
   10369             : 
   10370             : 
   10371             :  MergeStmt:
   10372             :  opt_with_clause MERGE INTO relation_expr_opt_alias USING table_ref ON a_expr merge_when_list returning_clause
   10373             :  { 
   10374           0 :  $$ = cat_str(9,$1,mm_strdup("merge into"),$4,mm_strdup("using"),$6,mm_strdup("on"),$8,$9,$10);
   10375             : }
   10376             : ;
   10377             : 
   10378             : 
   10379             :  merge_when_list:
   10380             :  merge_when_clause
   10381             :  { 
   10382           0 :  $$ = $1;
   10383             : }
   10384             : |  merge_when_list merge_when_clause
   10385             :  { 
   10386           0 :  $$ = cat_str(2,$1,$2);
   10387             : }
   10388             : ;
   10389             : 
   10390             : 
   10391             :  merge_when_clause:
   10392             :  merge_when_tgt_matched opt_merge_when_condition THEN merge_update
   10393             :  { 
   10394           0 :  $$ = cat_str(4,$1,$2,mm_strdup("then"),$4);
   10395             : }
   10396             : |  merge_when_tgt_matched opt_merge_when_condition THEN merge_delete
   10397             :  { 
   10398           0 :  $$ = cat_str(4,$1,$2,mm_strdup("then"),$4);
   10399             : }
   10400             : |  merge_when_tgt_not_matched opt_merge_when_condition THEN merge_insert
   10401             :  { 
   10402           0 :  $$ = cat_str(4,$1,$2,mm_strdup("then"),$4);
   10403             : }
   10404             : |  merge_when_tgt_matched opt_merge_when_condition THEN DO NOTHING
   10405             :  { 
   10406           0 :  $$ = cat_str(3,$1,$2,mm_strdup("then do nothing"));
   10407             : }
   10408             : |  merge_when_tgt_not_matched opt_merge_when_condition THEN DO NOTHING
   10409             :  { 
   10410           0 :  $$ = cat_str(3,$1,$2,mm_strdup("then do nothing"));
   10411             : }
   10412             : ;
   10413             : 
   10414             : 
   10415             :  merge_when_tgt_matched:
   10416             :  WHEN MATCHED
   10417             :  { 
   10418           0 :  $$ = mm_strdup("when matched");
   10419             : }
   10420             : |  WHEN NOT MATCHED BY SOURCE
   10421             :  { 
   10422           0 :  $$ = mm_strdup("when not matched by source");
   10423             : }
   10424             : ;
   10425             : 
   10426             : 
   10427             :  merge_when_tgt_not_matched:
   10428             :  WHEN NOT MATCHED
   10429             :  { 
   10430           0 :  $$ = mm_strdup("when not matched");
   10431             : }
   10432             : |  WHEN NOT MATCHED BY TARGET
   10433             :  { 
   10434           0 :  $$ = mm_strdup("when not matched by target");
   10435             : }
   10436             : ;
   10437             : 
   10438             : 
   10439             :  opt_merge_when_condition:
   10440             :  AND a_expr
   10441             :  { 
   10442           0 :  $$ = cat_str(2,mm_strdup("and"),$2);
   10443             : }
   10444             : | 
   10445             :  { 
   10446           0 :  $$=EMPTY; }
   10447             : ;
   10448             : 
   10449             : 
   10450             :  merge_update:
   10451             :  UPDATE SET set_clause_list
   10452             :  { 
   10453           0 :  $$ = cat_str(2,mm_strdup("update set"),$3);
   10454             : }
   10455             : ;
   10456             : 
   10457             : 
   10458             :  merge_delete:
   10459             :  DELETE_P
   10460             :  { 
   10461           0 :  $$ = mm_strdup("delete");
   10462             : }
   10463             : ;
   10464             : 
   10465             : 
   10466             :  merge_insert:
   10467             :  INSERT merge_values_clause
   10468             :  { 
   10469           0 :  $$ = cat_str(2,mm_strdup("insert"),$2);
   10470             : }
   10471             : |  INSERT OVERRIDING override_kind VALUE_P merge_values_clause
   10472             :  { 
   10473           0 :  $$ = cat_str(4,mm_strdup("insert overriding"),$3,mm_strdup("value"),$5);
   10474             : }
   10475             : |  INSERT '(' insert_column_list ')' merge_values_clause
   10476             :  { 
   10477           0 :  $$ = cat_str(4,mm_strdup("insert ("),$3,mm_strdup(")"),$5);
   10478             : }
   10479             : |  INSERT '(' insert_column_list ')' OVERRIDING override_kind VALUE_P merge_values_clause
   10480             :  { 
   10481           0 :  $$ = cat_str(6,mm_strdup("insert ("),$3,mm_strdup(") overriding"),$6,mm_strdup("value"),$8);
   10482             : }
   10483             : |  INSERT DEFAULT VALUES
   10484             :  { 
   10485           0 :  $$ = mm_strdup("insert default values");
   10486             : }
   10487             : ;
   10488             : 
   10489             : 
   10490             :  merge_values_clause:
   10491             :  VALUES '(' expr_list ')'
   10492             :  { 
   10493           0 :  $$ = cat_str(3,mm_strdup("values ("),$3,mm_strdup(")"));
   10494             : }
   10495             : ;
   10496             : 
   10497             : 
   10498             :  DeclareCursorStmt:
   10499             :  DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt
   10500             :     {
   10501             :         struct cursor *ptr, *this;
   10502          34 :         char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : mm_strdup($2);
   10503             :         char *comment, *c1, *c2;
   10504          34 :         int (* strcmp_fn)(const char *, const char *) = (($2[0] == ':' || $2[0] == '"') ? strcmp : pg_strcasecmp);
   10505             : 
   10506          34 :                 if (INFORMIX_MODE && pg_strcasecmp($2, "database") == 0)
   10507           0 :                         mmfatal(PARSE_ERROR, "\"database\" cannot be used as cursor name in INFORMIX mode");
   10508             : 
   10509          46 :         for (ptr = cur; ptr != NULL; ptr = ptr->next)
   10510             :         {
   10511          12 :             if (strcmp_fn($2, ptr->name) == 0)
   10512             :             {
   10513           0 :                 if ($2[0] == ':')
   10514           0 :                     mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
   10515             :                 else
   10516           0 :                     mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
   10517             :             }
   10518             :         }
   10519             : 
   10520          34 :         this = (struct cursor *) mm_alloc(sizeof(struct cursor));
   10521             : 
   10522          34 :         this->next = cur;
   10523          34 :         this->name = $2;
   10524          34 :         this->function = (current_function ? mm_strdup(current_function) : NULL);
   10525          34 :         this->connection = connection ? mm_strdup(connection) : NULL;
   10526          34 :         this->opened = false;
   10527          34 :         this->command =  cat_str(7, mm_strdup("declare"), cursor_marker, $3, mm_strdup("cursor"), $5, mm_strdup("for"), $7);
   10528          34 :         this->argsinsert = argsinsert;
   10529          34 :         this->argsinsert_oos = NULL;
   10530          34 :         this->argsresult = argsresult;
   10531          34 :         this->argsresult_oos = NULL;
   10532          34 :         argsinsert = argsresult = NULL;
   10533          34 :         cur = this;
   10534             : 
   10535          34 :         c1 = mm_strdup(this->command);
   10536          34 :         if ((c2 = strstr(c1, "*/")) != NULL)
   10537             :         {
   10538             :             /* We put this text into a comment, so we better remove [*][/]. */
   10539           0 :             c2[0] = '.';
   10540           0 :             c2[1] = '.';
   10541             :         }
   10542          34 :         comment = cat_str(3, mm_strdup("/*"), c1, mm_strdup("*/"));
   10543             : 
   10544          34 :         $$ = cat2_str(adjust_outofscope_cursor_vars(this), comment);
   10545             :     }
   10546             : ;
   10547             : 
   10548             : 
   10549             :  cursor_name:
   10550             :  name
   10551             :  { 
   10552         268 :  $$ = $1;
   10553             : }
   10554             :     | char_civar
   10555             :         {
   10556          86 :             char *curname = mm_alloc(strlen($1) + 2);
   10557          86 :             sprintf(curname, ":%s", $1);
   10558          86 :             free($1);
   10559          86 :             $1 = curname;
   10560          86 :             $$ = $1;
   10561             :         }
   10562             : ;
   10563             : 
   10564             : 
   10565             :  cursor_options:
   10566             : 
   10567             :  { 
   10568          74 :  $$=EMPTY; }
   10569             : |  cursor_options NO SCROLL
   10570             :  { 
   10571           0 :  $$ = cat_str(2,$1,mm_strdup("no scroll"));
   10572             : }
   10573             : |  cursor_options SCROLL
   10574             :  { 
   10575           0 :  $$ = cat_str(2,$1,mm_strdup("scroll"));
   10576             : }
   10577             : |  cursor_options BINARY
   10578             :  { 
   10579           4 :  $$ = cat_str(2,$1,mm_strdup("binary"));
   10580             : }
   10581             : |  cursor_options ASENSITIVE
   10582             :  { 
   10583           0 :  $$ = cat_str(2,$1,mm_strdup("asensitive"));
   10584             : }
   10585             : |  cursor_options INSENSITIVE
   10586             :  { 
   10587           0 :  $$ = cat_str(2,$1,mm_strdup("insensitive"));
   10588             : }
   10589             : ;
   10590             : 
   10591             : 
   10592             :  opt_hold:
   10593             : 
   10594             :     {
   10595          74 :         if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit)
   10596           0 :             $$ = mm_strdup("with hold");
   10597             :         else
   10598          74 :             $$ = EMPTY;
   10599             :     }
   10600             : |  WITH HOLD
   10601             :  { 
   10602           0 :  $$ = mm_strdup("with hold");
   10603             : }
   10604             : |  WITHOUT HOLD
   10605             :  { 
   10606           0 :  $$ = mm_strdup("without hold");
   10607             : }
   10608             : ;
   10609             : 
   10610             : 
   10611             :  SelectStmt:
   10612             :  select_no_parens %prec UMINUS
   10613             :  { 
   10614         476 :  $$ = $1;
   10615             : }
   10616             : |  select_with_parens %prec UMINUS
   10617             :  { 
   10618           2 :  $$ = $1;
   10619             : }
   10620             : ;
   10621             : 
   10622             : 
   10623             :  select_with_parens:
   10624             :  '(' select_no_parens ')'
   10625             :  { 
   10626           6 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   10627             : }
   10628             : |  '(' select_with_parens ')'
   10629             :  { 
   10630           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   10631             : }
   10632             : ;
   10633             : 
   10634             : 
   10635             :  select_no_parens:
   10636             :  simple_select
   10637             :  { 
   10638         444 :  $$ = $1;
   10639             : }
   10640             : |  select_clause sort_clause
   10641             :  { 
   10642          10 :  $$ = cat_str(2,$1,$2);
   10643             : }
   10644             : |  select_clause opt_sort_clause for_locking_clause opt_select_limit
   10645             :  { 
   10646           0 :  $$ = cat_str(4,$1,$2,$3,$4);
   10647             : }
   10648             : |  select_clause opt_sort_clause select_limit opt_for_locking_clause
   10649             :  { 
   10650          26 :  $$ = cat_str(4,$1,$2,$3,$4);
   10651             : }
   10652             : |  with_clause select_clause
   10653             :  { 
   10654           2 :  $$ = cat_str(2,$1,$2);
   10655             : }
   10656             : |  with_clause select_clause sort_clause
   10657             :  { 
   10658           0 :  $$ = cat_str(3,$1,$2,$3);
   10659             : }
   10660             : |  with_clause select_clause opt_sort_clause for_locking_clause opt_select_limit
   10661             :  { 
   10662           0 :  $$ = cat_str(5,$1,$2,$3,$4,$5);
   10663             : }
   10664             : |  with_clause select_clause opt_sort_clause select_limit opt_for_locking_clause
   10665             :  { 
   10666           0 :  $$ = cat_str(5,$1,$2,$3,$4,$5);
   10667             : }
   10668             : ;
   10669             : 
   10670             : 
   10671             :  select_clause:
   10672             :  simple_select
   10673             :  { 
   10674          38 :  $$ = $1;
   10675             : }
   10676             : |  select_with_parens
   10677             :  { 
   10678           0 :  $$ = $1;
   10679             : }
   10680             : ;
   10681             : 
   10682             : 
   10683             :  simple_select:
   10684             :  SELECT opt_all_clause opt_target_list into_clause from_clause where_clause group_clause having_clause window_clause
   10685             :  { 
   10686         248 :  $$ = cat_str(9,mm_strdup("select"),$2,$3,$4,$5,$6,$7,$8,$9);
   10687             : }
   10688             : |  SELECT distinct_clause target_list into_clause from_clause where_clause group_clause having_clause window_clause
   10689             :  { 
   10690           0 :  $$ = cat_str(9,mm_strdup("select"),$2,$3,$4,$5,$6,$7,$8,$9);
   10691             : }
   10692             : |  values_clause
   10693             :  { 
   10694         234 :  $$ = $1;
   10695             : }
   10696             : |  TABLE relation_expr
   10697             :  { 
   10698           0 :  $$ = cat_str(2,mm_strdup("table"),$2);
   10699             : }
   10700             : |  select_clause UNION set_quantifier select_clause
   10701             :  { 
   10702           0 :  $$ = cat_str(4,$1,mm_strdup("union"),$3,$4);
   10703             : }
   10704             : |  select_clause INTERSECT set_quantifier select_clause
   10705             :  { 
   10706           0 :  $$ = cat_str(4,$1,mm_strdup("intersect"),$3,$4);
   10707             : }
   10708             : |  select_clause EXCEPT set_quantifier select_clause
   10709             :  { 
   10710           0 :  $$ = cat_str(4,$1,mm_strdup("except"),$3,$4);
   10711             : }
   10712             : ;
   10713             : 
   10714             : 
   10715             :  with_clause:
   10716             :  WITH cte_list
   10717             :  { 
   10718           2 :  $$ = cat_str(2,mm_strdup("with"),$2);
   10719             : }
   10720             : |  WITH_LA cte_list
   10721             :  { 
   10722           0 :  $$ = cat_str(2,mm_strdup("with"),$2);
   10723             : }
   10724             : |  WITH RECURSIVE cte_list
   10725             :  { 
   10726           0 :  $$ = cat_str(2,mm_strdup("with recursive"),$3);
   10727             : }
   10728             : ;
   10729             : 
   10730             : 
   10731             :  cte_list:
   10732             :  common_table_expr
   10733             :  { 
   10734           2 :  $$ = $1;
   10735             : }
   10736             : |  cte_list ',' common_table_expr
   10737             :  { 
   10738           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   10739             : }
   10740             : ;
   10741             : 
   10742             : 
   10743             :  common_table_expr:
   10744             :  name opt_name_list AS opt_materialized '(' PreparableStmt ')' opt_search_clause opt_cycle_clause
   10745             :  { 
   10746           2 :  $$ = cat_str(9,$1,$2,mm_strdup("as"),$4,mm_strdup("("),$6,mm_strdup(")"),$8,$9);
   10747             : }
   10748             : ;
   10749             : 
   10750             : 
   10751             :  opt_materialized:
   10752             :  MATERIALIZED
   10753             :  { 
   10754           0 :  $$ = mm_strdup("materialized");
   10755             : }
   10756             : |  NOT MATERIALIZED
   10757             :  { 
   10758           0 :  $$ = mm_strdup("not materialized");
   10759             : }
   10760             : | 
   10761             :  { 
   10762           2 :  $$=EMPTY; }
   10763             : ;
   10764             : 
   10765             : 
   10766             :  opt_search_clause:
   10767             :  SEARCH DEPTH FIRST_P BY columnList SET ColId
   10768             :  { 
   10769           0 :  $$ = cat_str(4,mm_strdup("search depth first by"),$5,mm_strdup("set"),$7);
   10770             : }
   10771             : |  SEARCH BREADTH FIRST_P BY columnList SET ColId
   10772             :  { 
   10773           0 :  $$ = cat_str(4,mm_strdup("search breadth first by"),$5,mm_strdup("set"),$7);
   10774             : }
   10775             : | 
   10776             :  { 
   10777           2 :  $$=EMPTY; }
   10778             : ;
   10779             : 
   10780             : 
   10781             :  opt_cycle_clause:
   10782             :  CYCLE columnList SET ColId TO AexprConst DEFAULT AexprConst USING ColId
   10783             :  { 
   10784           0 :  $$ = cat_str(10,mm_strdup("cycle"),$2,mm_strdup("set"),$4,mm_strdup("to"),$6,mm_strdup("default"),$8,mm_strdup("using"),$10);
   10785             : }
   10786             : |  CYCLE columnList SET ColId USING ColId
   10787             :  { 
   10788           0 :  $$ = cat_str(6,mm_strdup("cycle"),$2,mm_strdup("set"),$4,mm_strdup("using"),$6);
   10789             : }
   10790             : | 
   10791             :  { 
   10792           2 :  $$=EMPTY; }
   10793             : ;
   10794             : 
   10795             : 
   10796             :  opt_with_clause:
   10797             :  with_clause
   10798             :  { 
   10799           0 :  $$ = $1;
   10800             : }
   10801             : | 
   10802             :  { 
   10803         250 :  $$=EMPTY; }
   10804             : ;
   10805             : 
   10806             : 
   10807             :  into_clause:
   10808             :  INTO OptTempTableName
   10809             :                     {
   10810           2 :                         FoundInto = 1;
   10811           2 :                         $$= cat2_str(mm_strdup("into"), $2);
   10812             :                     }
   10813         182 :     | ecpg_into { $$ = EMPTY; }
   10814             : | 
   10815             :  { 
   10816          64 :  $$=EMPTY; }
   10817             : ;
   10818             : 
   10819             : 
   10820             :  OptTempTableName:
   10821             :  TEMPORARY opt_table qualified_name
   10822             :  { 
   10823           0 :  $$ = cat_str(3,mm_strdup("temporary"),$2,$3);
   10824             : }
   10825             : |  TEMP opt_table qualified_name
   10826             :  { 
   10827           0 :  $$ = cat_str(3,mm_strdup("temp"),$2,$3);
   10828             : }
   10829             : |  LOCAL TEMPORARY opt_table qualified_name
   10830             :  { 
   10831           0 :  $$ = cat_str(3,mm_strdup("local temporary"),$3,$4);
   10832             : }
   10833             : |  LOCAL TEMP opt_table qualified_name
   10834             :  { 
   10835           0 :  $$ = cat_str(3,mm_strdup("local temp"),$3,$4);
   10836             : }
   10837             : |  GLOBAL TEMPORARY opt_table qualified_name
   10838             :  { 
   10839           0 :  $$ = cat_str(3,mm_strdup("global temporary"),$3,$4);
   10840             : }
   10841             : |  GLOBAL TEMP opt_table qualified_name
   10842             :  { 
   10843           0 :  $$ = cat_str(3,mm_strdup("global temp"),$3,$4);
   10844             : }
   10845             : |  UNLOGGED opt_table qualified_name
   10846             :  { 
   10847           0 :  $$ = cat_str(3,mm_strdup("unlogged"),$2,$3);
   10848             : }
   10849             : |  TABLE qualified_name
   10850             :  { 
   10851           0 :  $$ = cat_str(2,mm_strdup("table"),$2);
   10852             : }
   10853             : |  qualified_name
   10854             :  { 
   10855           2 :  $$ = $1;
   10856             : }
   10857             : ;
   10858             : 
   10859             : 
   10860             :  opt_table:
   10861             :  TABLE
   10862             :  { 
   10863           0 :  $$ = mm_strdup("table");
   10864             : }
   10865             : | 
   10866             :  { 
   10867          44 :  $$=EMPTY; }
   10868             : ;
   10869             : 
   10870             : 
   10871             :  set_quantifier:
   10872             :  ALL
   10873             :  { 
   10874           0 :  $$ = mm_strdup("all");
   10875             : }
   10876             : |  DISTINCT
   10877             :  { 
   10878           0 :  $$ = mm_strdup("distinct");
   10879             : }
   10880             : | 
   10881             :  { 
   10882           0 :  $$=EMPTY; }
   10883             : ;
   10884             : 
   10885             : 
   10886             :  distinct_clause:
   10887             :  DISTINCT
   10888             :  { 
   10889           0 :  $$ = mm_strdup("distinct");
   10890             : }
   10891             : |  DISTINCT ON '(' expr_list ')'
   10892             :  { 
   10893           0 :  $$ = cat_str(3,mm_strdup("distinct on ("),$4,mm_strdup(")"));
   10894             : }
   10895             : ;
   10896             : 
   10897             : 
   10898             :  opt_all_clause:
   10899             :  ALL
   10900             :  { 
   10901           0 :  $$ = mm_strdup("all");
   10902             : }
   10903             : | 
   10904             :  { 
   10905         248 :  $$=EMPTY; }
   10906             : ;
   10907             : 
   10908             : 
   10909             :  opt_sort_clause:
   10910             :  sort_clause
   10911             :  { 
   10912           2 :  $$ = $1;
   10913             : }
   10914             : | 
   10915             :  { 
   10916          30 :  $$=EMPTY; }
   10917             : ;
   10918             : 
   10919             : 
   10920             :  sort_clause:
   10921             :  ORDER BY sortby_list
   10922             :  { 
   10923          12 :  $$ = cat_str(2,mm_strdup("order by"),$3);
   10924             : }
   10925             : ;
   10926             : 
   10927             : 
   10928             :  sortby_list:
   10929             :  sortby
   10930             :  { 
   10931          12 :  $$ = $1;
   10932             : }
   10933             : |  sortby_list ',' sortby
   10934             :  { 
   10935           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   10936             : }
   10937             : ;
   10938             : 
   10939             : 
   10940             :  sortby:
   10941             :  a_expr USING qual_all_Op opt_nulls_order
   10942             :  { 
   10943           0 :  $$ = cat_str(4,$1,mm_strdup("using"),$3,$4);
   10944             : }
   10945             : |  a_expr opt_asc_desc opt_nulls_order
   10946             :  { 
   10947          12 :  $$ = cat_str(3,$1,$2,$3);
   10948             : }
   10949             : ;
   10950             : 
   10951             : 
   10952             :  select_limit:
   10953             :  limit_clause offset_clause
   10954             :  { 
   10955           0 :  $$ = cat_str(2,$1,$2);
   10956             : }
   10957             : |  offset_clause limit_clause
   10958             :  { 
   10959           0 :  $$ = cat_str(2,$1,$2);
   10960             : }
   10961             : |  limit_clause
   10962             :  { 
   10963          26 :  $$ = $1;
   10964             : }
   10965             : |  offset_clause
   10966             :  { 
   10967           0 :  $$ = $1;
   10968             : }
   10969             : ;
   10970             : 
   10971             : 
   10972             :  opt_select_limit:
   10973             :  select_limit
   10974             :  { 
   10975           0 :  $$ = $1;
   10976             : }
   10977             : | 
   10978             :  { 
   10979           0 :  $$=EMPTY; }
   10980             : ;
   10981             : 
   10982             : 
   10983             :  limit_clause:
   10984             :  LIMIT select_limit_value
   10985             :  { 
   10986          26 :  $$ = cat_str(2,mm_strdup("limit"),$2);
   10987             : }
   10988             : |  LIMIT select_limit_value ',' select_offset_value
   10989             :     {
   10990           0 :         mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
   10991           0 :         $$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4);
   10992             :     }
   10993             : |  FETCH first_or_next select_fetch_first_value row_or_rows ONLY
   10994             :  { 
   10995           0 :  $$ = cat_str(5,mm_strdup("fetch"),$2,$3,$4,mm_strdup("only"));
   10996             : }
   10997             : |  FETCH first_or_next select_fetch_first_value row_or_rows WITH TIES
   10998             :  { 
   10999           0 :  $$ = cat_str(5,mm_strdup("fetch"),$2,$3,$4,mm_strdup("with ties"));
   11000             : }
   11001             : |  FETCH first_or_next row_or_rows ONLY
   11002             :  { 
   11003           0 :  $$ = cat_str(4,mm_strdup("fetch"),$2,$3,mm_strdup("only"));
   11004             : }
   11005             : |  FETCH first_or_next row_or_rows WITH TIES
   11006             :  { 
   11007           0 :  $$ = cat_str(4,mm_strdup("fetch"),$2,$3,mm_strdup("with ties"));
   11008             : }
   11009             : ;
   11010             : 
   11011             : 
   11012             :  offset_clause:
   11013             :  OFFSET select_offset_value
   11014             :  { 
   11015           0 :  $$ = cat_str(2,mm_strdup("offset"),$2);
   11016             : }
   11017             : |  OFFSET select_fetch_first_value row_or_rows
   11018             :  { 
   11019           0 :  $$ = cat_str(3,mm_strdup("offset"),$2,$3);
   11020             : }
   11021             : ;
   11022             : 
   11023             : 
   11024             :  select_limit_value:
   11025             :  a_expr
   11026             :  { 
   11027          26 :  $$ = $1;
   11028             : }
   11029             : |  ALL
   11030             :  { 
   11031           0 :  $$ = mm_strdup("all");
   11032             : }
   11033             : ;
   11034             : 
   11035             : 
   11036             :  select_offset_value:
   11037             :  a_expr
   11038             :  { 
   11039           0 :  $$ = $1;
   11040             : }
   11041             : ;
   11042             : 
   11043             : 
   11044             :  select_fetch_first_value:
   11045             :  c_expr
   11046             :  { 
   11047           0 :  $$ = $1;
   11048             : }
   11049             : |  '+' I_or_F_const
   11050             :  { 
   11051           0 :  $$ = cat_str(2,mm_strdup("+"),$2);
   11052             : }
   11053             : |  '-' I_or_F_const
   11054             :  { 
   11055           0 :  $$ = cat_str(2,mm_strdup("-"),$2);
   11056             : }
   11057             : ;
   11058             : 
   11059             : 
   11060             :  I_or_F_const:
   11061             :  Iconst
   11062             :  { 
   11063           0 :  $$ = $1;
   11064             : }
   11065             : |  ecpg_fconst
   11066             :  { 
   11067           0 :  $$ = $1;
   11068             : }
   11069             : ;
   11070             : 
   11071             : 
   11072             :  row_or_rows:
   11073             :  ROW
   11074             :  { 
   11075           0 :  $$ = mm_strdup("row");
   11076             : }
   11077             : |  ROWS
   11078             :  { 
   11079           0 :  $$ = mm_strdup("rows");
   11080             : }
   11081             : ;
   11082             : 
   11083             : 
   11084             :  first_or_next:
   11085             :  FIRST_P
   11086             :  { 
   11087           0 :  $$ = mm_strdup("first");
   11088             : }
   11089             : |  NEXT
   11090             :  { 
   11091           0 :  $$ = mm_strdup("next");
   11092             : }
   11093             : ;
   11094             : 
   11095             : 
   11096             :  group_clause:
   11097             :  GROUP_P BY set_quantifier group_by_list
   11098             :  { 
   11099           0 :  $$ = cat_str(3,mm_strdup("group by"),$3,$4);
   11100             : }
   11101             : | 
   11102             :  { 
   11103         248 :  $$=EMPTY; }
   11104             : ;
   11105             : 
   11106             : 
   11107             :  group_by_list:
   11108             :  group_by_item
   11109             :  { 
   11110           0 :  $$ = $1;
   11111             : }
   11112             : |  group_by_list ',' group_by_item
   11113             :  { 
   11114           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11115             : }
   11116             : ;
   11117             : 
   11118             : 
   11119             :  group_by_item:
   11120             :  a_expr
   11121             :  { 
   11122           0 :  $$ = $1;
   11123             : }
   11124             : |  empty_grouping_set
   11125             :  { 
   11126           0 :  $$ = $1;
   11127             : }
   11128             : |  cube_clause
   11129             :  { 
   11130           0 :  $$ = $1;
   11131             : }
   11132             : |  rollup_clause
   11133             :  { 
   11134           0 :  $$ = $1;
   11135             : }
   11136             : |  grouping_sets_clause
   11137             :  { 
   11138           0 :  $$ = $1;
   11139             : }
   11140             : ;
   11141             : 
   11142             : 
   11143             :  empty_grouping_set:
   11144             :  '(' ')'
   11145             :  { 
   11146           0 :  $$ = mm_strdup("( )");
   11147             : }
   11148             : ;
   11149             : 
   11150             : 
   11151             :  rollup_clause:
   11152             :  ROLLUP '(' expr_list ')'
   11153             :  { 
   11154           0 :  $$ = cat_str(3,mm_strdup("rollup ("),$3,mm_strdup(")"));
   11155             : }
   11156             : ;
   11157             : 
   11158             : 
   11159             :  cube_clause:
   11160             :  CUBE '(' expr_list ')'
   11161             :  { 
   11162           0 :  $$ = cat_str(3,mm_strdup("cube ("),$3,mm_strdup(")"));
   11163             : }
   11164             : ;
   11165             : 
   11166             : 
   11167             :  grouping_sets_clause:
   11168             :  GROUPING SETS '(' group_by_list ')'
   11169             :  { 
   11170           0 :  $$ = cat_str(3,mm_strdup("grouping sets ("),$4,mm_strdup(")"));
   11171             : }
   11172             : ;
   11173             : 
   11174             : 
   11175             :  having_clause:
   11176             :  HAVING a_expr
   11177             :  { 
   11178           0 :  $$ = cat_str(2,mm_strdup("having"),$2);
   11179             : }
   11180             : | 
   11181             :  { 
   11182         248 :  $$=EMPTY; }
   11183             : ;
   11184             : 
   11185             : 
   11186             :  for_locking_clause:
   11187             :  for_locking_items
   11188             :  { 
   11189           0 :  $$ = $1;
   11190             : }
   11191             : |  FOR READ ONLY
   11192             :  { 
   11193           0 :  $$ = mm_strdup("for read only");
   11194             : }
   11195             : ;
   11196             : 
   11197             : 
   11198             :  opt_for_locking_clause:
   11199             :  for_locking_clause
   11200             :  { 
   11201           0 :  $$ = $1;
   11202             : }
   11203             : | 
   11204             :  { 
   11205          26 :  $$=EMPTY; }
   11206             : ;
   11207             : 
   11208             : 
   11209             :  for_locking_items:
   11210             :  for_locking_item
   11211             :  { 
   11212           0 :  $$ = $1;
   11213             : }
   11214             : |  for_locking_items for_locking_item
   11215             :  { 
   11216           0 :  $$ = cat_str(2,$1,$2);
   11217             : }
   11218             : ;
   11219             : 
   11220             : 
   11221             :  for_locking_item:
   11222             :  for_locking_strength locked_rels_list opt_nowait_or_skip
   11223             :  { 
   11224           0 :  $$ = cat_str(3,$1,$2,$3);
   11225             : }
   11226             : ;
   11227             : 
   11228             : 
   11229             :  for_locking_strength:
   11230             :  FOR UPDATE
   11231             :  { 
   11232           0 :  $$ = mm_strdup("for update");
   11233             : }
   11234             : |  FOR NO KEY UPDATE
   11235             :  { 
   11236           0 :  $$ = mm_strdup("for no key update");
   11237             : }
   11238             : |  FOR SHARE
   11239             :  { 
   11240           0 :  $$ = mm_strdup("for share");
   11241             : }
   11242             : |  FOR KEY SHARE
   11243             :  { 
   11244           0 :  $$ = mm_strdup("for key share");
   11245             : }
   11246             : ;
   11247             : 
   11248             : 
   11249             :  locked_rels_list:
   11250             :  OF qualified_name_list
   11251             :  { 
   11252           0 :  $$ = cat_str(2,mm_strdup("of"),$2);
   11253             : }
   11254             : | 
   11255             :  { 
   11256           0 :  $$=EMPTY; }
   11257             : ;
   11258             : 
   11259             : 
   11260             :  values_clause:
   11261             :  VALUES '(' expr_list ')'
   11262             :  { 
   11263         234 :  $$ = cat_str(3,mm_strdup("values ("),$3,mm_strdup(")"));
   11264             : }
   11265             : |  values_clause ',' '(' expr_list ')'
   11266             :  { 
   11267          16 :  $$ = cat_str(4,$1,mm_strdup(", ("),$4,mm_strdup(")"));
   11268             : }
   11269             : ;
   11270             : 
   11271             : 
   11272             :  from_clause:
   11273             :  FROM from_list
   11274             :  { 
   11275         154 :  $$ = cat_str(2,mm_strdup("from"),$2);
   11276             : }
   11277             : | 
   11278             :  { 
   11279         104 :  $$=EMPTY; }
   11280             : ;
   11281             : 
   11282             : 
   11283             :  from_list:
   11284             :  table_ref
   11285             :  { 
   11286         154 :  $$ = $1;
   11287             : }
   11288             : |  from_list ',' table_ref
   11289             :  { 
   11290           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11291             : }
   11292             : ;
   11293             : 
   11294             : 
   11295             :  table_ref:
   11296             :  relation_expr opt_alias_clause
   11297             :  { 
   11298         148 :  $$ = cat_str(2,$1,$2);
   11299             : }
   11300             : |  relation_expr opt_alias_clause tablesample_clause
   11301             :  { 
   11302           0 :  $$ = cat_str(3,$1,$2,$3);
   11303             : }
   11304             : |  func_table func_alias_clause
   11305             :  { 
   11306           2 :  $$ = cat_str(2,$1,$2);
   11307             : }
   11308             : |  LATERAL_P func_table func_alias_clause
   11309             :  { 
   11310           0 :  $$ = cat_str(3,mm_strdup("lateral"),$2,$3);
   11311             : }
   11312             : |  xmltable opt_alias_clause
   11313             :  { 
   11314           0 :  $$ = cat_str(2,$1,$2);
   11315             : }
   11316             : |  LATERAL_P xmltable opt_alias_clause
   11317             :  { 
   11318           0 :  $$ = cat_str(3,mm_strdup("lateral"),$2,$3);
   11319             : }
   11320             : |  select_with_parens opt_alias_clause
   11321             :  { 
   11322           0 :  $$ = cat_str(2,$1,$2);
   11323             : }
   11324             : |  LATERAL_P select_with_parens opt_alias_clause
   11325             :  { 
   11326           0 :  $$ = cat_str(3,mm_strdup("lateral"),$2,$3);
   11327             : }
   11328             : |  joined_table
   11329             :  { 
   11330           0 :  $$ = $1;
   11331             : }
   11332             : |  '(' joined_table ')' alias_clause
   11333             :  { 
   11334           0 :  $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
   11335             : }
   11336             : |  json_table opt_alias_clause
   11337             :  { 
   11338           4 :  $$ = cat_str(2,$1,$2);
   11339             : }
   11340             : |  LATERAL_P json_table opt_alias_clause
   11341             :  { 
   11342           0 :  $$ = cat_str(3,mm_strdup("lateral"),$2,$3);
   11343             : }
   11344             : ;
   11345             : 
   11346             : 
   11347             :  joined_table:
   11348             :  '(' joined_table ')'
   11349             :  { 
   11350           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   11351             : }
   11352             : |  table_ref CROSS JOIN table_ref
   11353             :  { 
   11354           0 :  $$ = cat_str(3,$1,mm_strdup("cross join"),$4);
   11355             : }
   11356             : |  table_ref join_type JOIN table_ref join_qual
   11357             :  { 
   11358           0 :  $$ = cat_str(5,$1,$2,mm_strdup("join"),$4,$5);
   11359             : }
   11360             : |  table_ref JOIN table_ref join_qual
   11361             :  { 
   11362           0 :  $$ = cat_str(4,$1,mm_strdup("join"),$3,$4);
   11363             : }
   11364             : |  table_ref NATURAL join_type JOIN table_ref
   11365             :  { 
   11366           0 :  $$ = cat_str(5,$1,mm_strdup("natural"),$3,mm_strdup("join"),$5);
   11367             : }
   11368             : |  table_ref NATURAL JOIN table_ref
   11369             :  { 
   11370           0 :  $$ = cat_str(3,$1,mm_strdup("natural join"),$4);
   11371             : }
   11372             : ;
   11373             : 
   11374             : 
   11375             :  alias_clause:
   11376             :  AS ColId '(' name_list ')'
   11377             :  { 
   11378           2 :  $$ = cat_str(5,mm_strdup("as"),$2,mm_strdup("("),$4,mm_strdup(")"));
   11379             : }
   11380             : |  AS ColId
   11381             :  { 
   11382           0 :  $$ = cat_str(2,mm_strdup("as"),$2);
   11383             : }
   11384             : |  ColId '(' name_list ')'
   11385             :  { 
   11386           4 :  $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
   11387             : }
   11388             : |  ColId
   11389             :  { 
   11390           0 :  $$ = $1;
   11391             : }
   11392             : ;
   11393             : 
   11394             : 
   11395             :  opt_alias_clause:
   11396             :  alias_clause
   11397             :  { 
   11398           4 :  $$ = $1;
   11399             : }
   11400             : | 
   11401             :  { 
   11402         148 :  $$=EMPTY; }
   11403             : ;
   11404             : 
   11405             : 
   11406             :  opt_alias_clause_for_join_using:
   11407             :  AS ColId
   11408             :  { 
   11409           0 :  $$ = cat_str(2,mm_strdup("as"),$2);
   11410             : }
   11411             : | 
   11412             :  { 
   11413           0 :  $$=EMPTY; }
   11414             : ;
   11415             : 
   11416             : 
   11417             :  func_alias_clause:
   11418             :  alias_clause
   11419             :  { 
   11420           2 :  $$ = $1;
   11421             : }
   11422             : |  AS '(' TableFuncElementList ')'
   11423             :  { 
   11424           0 :  $$ = cat_str(3,mm_strdup("as ("),$3,mm_strdup(")"));
   11425             : }
   11426             : |  AS ColId '(' TableFuncElementList ')'
   11427             :  { 
   11428           0 :  $$ = cat_str(5,mm_strdup("as"),$2,mm_strdup("("),$4,mm_strdup(")"));
   11429             : }
   11430             : |  ColId '(' TableFuncElementList ')'
   11431             :  { 
   11432           0 :  $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
   11433             : }
   11434             : | 
   11435             :  { 
   11436           0 :  $$=EMPTY; }
   11437             : ;
   11438             : 
   11439             : 
   11440             :  join_type:
   11441             :  FULL opt_outer
   11442             :  { 
   11443           0 :  $$ = cat_str(2,mm_strdup("full"),$2);
   11444             : }
   11445             : |  LEFT opt_outer
   11446             :  { 
   11447           0 :  $$ = cat_str(2,mm_strdup("left"),$2);
   11448             : }
   11449             : |  RIGHT opt_outer
   11450             :  { 
   11451           0 :  $$ = cat_str(2,mm_strdup("right"),$2);
   11452             : }
   11453             : |  INNER_P
   11454             :  { 
   11455           0 :  $$ = mm_strdup("inner");
   11456             : }
   11457             : ;
   11458             : 
   11459             : 
   11460             :  opt_outer:
   11461             :  OUTER_P
   11462             :  { 
   11463           0 :  $$ = mm_strdup("outer");
   11464             : }
   11465             : | 
   11466             :  { 
   11467           0 :  $$=EMPTY; }
   11468             : ;
   11469             : 
   11470             : 
   11471             :  join_qual:
   11472             :  USING '(' name_list ')' opt_alias_clause_for_join_using
   11473             :  { 
   11474           0 :  $$ = cat_str(4,mm_strdup("using ("),$3,mm_strdup(")"),$5);
   11475             : }
   11476             : |  ON a_expr
   11477             :  { 
   11478           0 :  $$ = cat_str(2,mm_strdup("on"),$2);
   11479             : }
   11480             : ;
   11481             : 
   11482             : 
   11483             :  relation_expr:
   11484             :  qualified_name
   11485             :  { 
   11486         210 :  $$ = $1;
   11487             : }
   11488             : |  extended_relation_expr
   11489             :  { 
   11490           0 :  $$ = $1;
   11491             : }
   11492             : ;
   11493             : 
   11494             : 
   11495             :  extended_relation_expr:
   11496             :  qualified_name '*'
   11497             :  { 
   11498           0 :  $$ = cat_str(2,$1,mm_strdup("*"));
   11499             : }
   11500             : |  ONLY qualified_name
   11501             :  { 
   11502           0 :  $$ = cat_str(2,mm_strdup("only"),$2);
   11503             : }
   11504             : |  ONLY '(' qualified_name ')'
   11505             :  { 
   11506           0 :  $$ = cat_str(3,mm_strdup("only ("),$3,mm_strdup(")"));
   11507             : }
   11508             : ;
   11509             : 
   11510             : 
   11511             :  relation_expr_list:
   11512             :  relation_expr
   11513             :  { 
   11514          44 :  $$ = $1;
   11515             : }
   11516             : |  relation_expr_list ',' relation_expr
   11517             :  { 
   11518           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11519             : }
   11520             : ;
   11521             : 
   11522             : 
   11523             :  relation_expr_opt_alias:
   11524             :  relation_expr %prec UMINUS
   11525             :  { 
   11526          14 :  $$ = $1;
   11527             : }
   11528             : |  relation_expr ColId
   11529             :  { 
   11530           0 :  $$ = cat_str(2,$1,$2);
   11531             : }
   11532             : |  relation_expr AS ColId
   11533             :  { 
   11534           0 :  $$ = cat_str(3,$1,mm_strdup("as"),$3);
   11535             : }
   11536             : ;
   11537             : 
   11538             : 
   11539             :  tablesample_clause:
   11540             :  TABLESAMPLE func_name '(' expr_list ')' opt_repeatable_clause
   11541             :  { 
   11542           0 :  $$ = cat_str(6,mm_strdup("tablesample"),$2,mm_strdup("("),$4,mm_strdup(")"),$6);
   11543             : }
   11544             : ;
   11545             : 
   11546             : 
   11547             :  opt_repeatable_clause:
   11548             :  REPEATABLE '(' a_expr ')'
   11549             :  { 
   11550           0 :  $$ = cat_str(3,mm_strdup("repeatable ("),$3,mm_strdup(")"));
   11551             : }
   11552             : | 
   11553             :  { 
   11554           0 :  $$=EMPTY; }
   11555             : ;
   11556             : 
   11557             : 
   11558             :  func_table:
   11559             :  func_expr_windowless opt_ordinality
   11560             :  { 
   11561           2 :  $$ = cat_str(2,$1,$2);
   11562             : }
   11563             : |  ROWS FROM '(' rowsfrom_list ')' opt_ordinality
   11564             :  { 
   11565           0 :  $$ = cat_str(4,mm_strdup("rows from ("),$4,mm_strdup(")"),$6);
   11566             : }
   11567             : ;
   11568             : 
   11569             : 
   11570             :  rowsfrom_item:
   11571             :  func_expr_windowless opt_col_def_list
   11572             :  { 
   11573           0 :  $$ = cat_str(2,$1,$2);
   11574             : }
   11575             : ;
   11576             : 
   11577             : 
   11578             :  rowsfrom_list:
   11579             :  rowsfrom_item
   11580             :  { 
   11581           0 :  $$ = $1;
   11582             : }
   11583             : |  rowsfrom_list ',' rowsfrom_item
   11584             :  { 
   11585           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11586             : }
   11587             : ;
   11588             : 
   11589             : 
   11590             :  opt_col_def_list:
   11591             :  AS '(' TableFuncElementList ')'
   11592             :  { 
   11593           0 :  $$ = cat_str(3,mm_strdup("as ("),$3,mm_strdup(")"));
   11594             : }
   11595             : | 
   11596             :  { 
   11597           0 :  $$=EMPTY; }
   11598             : ;
   11599             : 
   11600             : 
   11601             :  opt_ordinality:
   11602             :  WITH_LA ORDINALITY
   11603             :  { 
   11604           2 :  $$ = mm_strdup("with ordinality");
   11605             : }
   11606             : | 
   11607             :  { 
   11608           0 :  $$=EMPTY; }
   11609             : ;
   11610             : 
   11611             : 
   11612             :  where_clause:
   11613             :  WHERE a_expr
   11614             :  { 
   11615          54 :  $$ = cat_str(2,mm_strdup("where"),$2);
   11616             : }
   11617             : | 
   11618             :  { 
   11619         196 :  $$=EMPTY; }
   11620             : ;
   11621             : 
   11622             : 
   11623             :  where_or_current_clause:
   11624             :  WHERE a_expr
   11625             :  { 
   11626          12 :  $$ = cat_str(2,mm_strdup("where"),$2);
   11627             : }
   11628             : |  WHERE CURRENT_P OF cursor_name
   11629             :     {
   11630           0 :         char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
   11631           0 :         $$ = cat_str(2,mm_strdup("where current of"), cursor_marker);
   11632             :     }
   11633             : | 
   11634             :  { 
   11635           2 :  $$=EMPTY; }
   11636             : ;
   11637             : 
   11638             : 
   11639             :  OptTableFuncElementList:
   11640             :  TableFuncElementList
   11641             :  { 
   11642           0 :  $$ = $1;
   11643             : }
   11644             : | 
   11645             :  { 
   11646           0 :  $$=EMPTY; }
   11647             : ;
   11648             : 
   11649             : 
   11650             :  TableFuncElementList:
   11651             :  TableFuncElement
   11652             :  { 
   11653           0 :  $$ = $1;
   11654             : }
   11655             : |  TableFuncElementList ',' TableFuncElement
   11656             :  { 
   11657           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11658             : }
   11659             : ;
   11660             : 
   11661             : 
   11662             :  TableFuncElement:
   11663             :  ColId Typename opt_collate_clause
   11664             :  { 
   11665           0 :  $$ = cat_str(3,$1,$2,$3);
   11666             : }
   11667             : ;
   11668             : 
   11669             : 
   11670             :  xmltable:
   11671             :  XMLTABLE '(' c_expr xmlexists_argument COLUMNS xmltable_column_list ')'
   11672             :  { 
   11673           0 :  $$ = cat_str(6,mm_strdup("xmltable ("),$3,$4,mm_strdup("columns"),$6,mm_strdup(")"));
   11674             : }
   11675             : |  XMLTABLE '(' XMLNAMESPACES '(' xml_namespace_list ')' ',' c_expr xmlexists_argument COLUMNS xmltable_column_list ')'
   11676             :  { 
   11677           0 :  $$ = cat_str(8,mm_strdup("xmltable ( xmlnamespaces ("),$5,mm_strdup(") ,"),$8,$9,mm_strdup("columns"),$11,mm_strdup(")"));
   11678             : }
   11679             : ;
   11680             : 
   11681             : 
   11682             :  xmltable_column_list:
   11683             :  xmltable_column_el
   11684             :  { 
   11685           0 :  $$ = $1;
   11686             : }
   11687             : |  xmltable_column_list ',' xmltable_column_el
   11688             :  { 
   11689           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11690             : }
   11691             : ;
   11692             : 
   11693             : 
   11694             :  xmltable_column_el:
   11695             :  ColId Typename
   11696             :  { 
   11697           0 :  $$ = cat_str(2,$1,$2);
   11698             : }
   11699             : |  ColId Typename xmltable_column_option_list
   11700             :  { 
   11701           0 :  $$ = cat_str(3,$1,$2,$3);
   11702             : }
   11703             : |  ColId FOR ORDINALITY
   11704             :  { 
   11705           0 :  $$ = cat_str(2,$1,mm_strdup("for ordinality"));
   11706             : }
   11707             : ;
   11708             : 
   11709             : 
   11710             :  xmltable_column_option_list:
   11711             :  xmltable_column_option_el
   11712             :  { 
   11713           0 :  $$ = $1;
   11714             : }
   11715             : |  xmltable_column_option_list xmltable_column_option_el
   11716             :  { 
   11717           0 :  $$ = cat_str(2,$1,$2);
   11718             : }
   11719             : ;
   11720             : 
   11721             : 
   11722             :  xmltable_column_option_el:
   11723             :  ecpg_ident b_expr
   11724             :  { 
   11725           0 :  $$ = cat_str(2,$1,$2);
   11726             : }
   11727             : |  DEFAULT b_expr
   11728             :  { 
   11729           0 :  $$ = cat_str(2,mm_strdup("default"),$2);
   11730             : }
   11731             : |  NOT NULL_P
   11732             :  { 
   11733           0 :  $$ = mm_strdup("not null");
   11734             : }
   11735             : |  NULL_P
   11736             :  { 
   11737           0 :  $$ = mm_strdup("null");
   11738             : }
   11739             : |  PATH b_expr
   11740             :  { 
   11741           0 :  $$ = cat_str(2,mm_strdup("path"),$2);
   11742             : }
   11743             : ;
   11744             : 
   11745             : 
   11746             :  xml_namespace_list:
   11747             :  xml_namespace_el
   11748             :  { 
   11749           0 :  $$ = $1;
   11750             : }
   11751             : |  xml_namespace_list ',' xml_namespace_el
   11752             :  { 
   11753           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11754             : }
   11755             : ;
   11756             : 
   11757             : 
   11758             :  xml_namespace_el:
   11759             :  b_expr AS ColLabel
   11760             :  { 
   11761           0 :  $$ = cat_str(3,$1,mm_strdup("as"),$3);
   11762             : }
   11763             : |  DEFAULT b_expr
   11764             :  { 
   11765           0 :  $$ = cat_str(2,mm_strdup("default"),$2);
   11766             : }
   11767             : ;
   11768             : 
   11769             : 
   11770             :  json_table:
   11771             :  JSON_TABLE '(' json_value_expr ',' a_expr json_table_path_name_opt json_passing_clause_opt COLUMNS '(' json_table_column_definition_list ')' json_on_error_clause_opt ')'
   11772             :  { 
   11773           4 :  $$ = cat_str(11,mm_strdup("json_table ("),$3,mm_strdup(","),$5,$6,$7,mm_strdup("columns ("),$10,mm_strdup(")"),$12,mm_strdup(")"));
   11774             : }
   11775             : ;
   11776             : 
   11777             : 
   11778             :  json_table_path_name_opt:
   11779             :  AS name
   11780             :  { 
   11781           4 :  $$ = cat_str(2,mm_strdup("as"),$2);
   11782             : }
   11783             : | 
   11784             :  { 
   11785           0 :  $$=EMPTY; }
   11786             : ;
   11787             : 
   11788             : 
   11789             :  json_table_column_definition_list:
   11790             :  json_table_column_definition
   11791             :  { 
   11792           8 :  $$ = $1;
   11793             : }
   11794             : |  json_table_column_definition_list ',' json_table_column_definition
   11795             :  { 
   11796           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   11797             : }
   11798             : ;
   11799             : 
   11800             : 
   11801             :  json_table_column_definition:
   11802             :  ColId FOR ORDINALITY
   11803             :  { 
   11804           0 :  $$ = cat_str(2,$1,mm_strdup("for ordinality"));
   11805             : }
   11806             : |  ColId Typename json_table_column_path_clause_opt json_wrapper_behavior json_quotes_clause_opt json_behavior_clause_opt
   11807             :  { 
   11808           4 :  $$ = cat_str(6,$1,$2,$3,$4,$5,$6);
   11809             : }
   11810             : |  ColId Typename json_format_clause json_table_column_path_clause_opt json_wrapper_behavior json_quotes_clause_opt json_behavior_clause_opt
   11811             :  { 
   11812           0 :  $$ = cat_str(7,$1,$2,$3,$4,$5,$6,$7);
   11813             : }
   11814             : |  ColId Typename EXISTS json_table_column_path_clause_opt json_behavior_clause_opt
   11815             :  { 
   11816           0 :  $$ = cat_str(5,$1,$2,mm_strdup("exists"),$4,$5);
   11817             : }
   11818             : |  NESTED path_opt ecpg_sconst COLUMNS '(' json_table_column_definition_list ')'
   11819             :  { 
   11820           0 :  $$ = cat_str(6,mm_strdup("nested"),$2,$3,mm_strdup("columns ("),$6,mm_strdup(")"));
   11821             : }
   11822             : |  NESTED path_opt ecpg_sconst AS name COLUMNS '(' json_table_column_definition_list ')'
   11823             :  { 
   11824           4 :  $$ = cat_str(8,mm_strdup("nested"),$2,$3,mm_strdup("as"),$5,mm_strdup("columns ("),$8,mm_strdup(")"));
   11825             : }
   11826             : ;
   11827             : 
   11828             : 
   11829             :  path_opt:
   11830             :  PATH
   11831             :  { 
   11832           2 :  $$ = mm_strdup("path");
   11833             : }
   11834             : | 
   11835             :  { 
   11836           2 :  $$=EMPTY; }
   11837             : ;
   11838             : 
   11839             : 
   11840             :  json_table_column_path_clause_opt:
   11841             :  PATH ecpg_sconst
   11842             :  { 
   11843           0 :  $$ = cat_str(2,mm_strdup("path"),$2);
   11844             : }
   11845             : | 
   11846             :  { 
   11847           4 :  $$=EMPTY; }
   11848             : ;
   11849             : 
   11850             : 
   11851             :  Typename:
   11852             :  SimpleTypename opt_array_bounds
   11853         378 :     {   $$ = cat2_str($1, $2.str); }
   11854             : |  SETOF SimpleTypename opt_array_bounds
   11855           0 :     {   $$ = cat_str(3, mm_strdup("setof"), $2, $3.str); }
   11856             : |  SimpleTypename ARRAY '[' Iconst ']'
   11857             :  { 
   11858           0 :  $$ = cat_str(4,$1,mm_strdup("array ["),$4,mm_strdup("]"));
   11859             : }
   11860             : |  SETOF SimpleTypename ARRAY '[' Iconst ']'
   11861             :  { 
   11862           0 :  $$ = cat_str(5,mm_strdup("setof"),$2,mm_strdup("array ["),$5,mm_strdup("]"));
   11863             : }
   11864             : |  SimpleTypename ARRAY
   11865             :  { 
   11866           0 :  $$ = cat_str(2,$1,mm_strdup("array"));
   11867             : }
   11868             : |  SETOF SimpleTypename ARRAY
   11869             :  { 
   11870           0 :  $$ = cat_str(3,mm_strdup("setof"),$2,mm_strdup("array"));
   11871             : }
   11872             : ;
   11873             : 
   11874             : 
   11875             :  opt_array_bounds:
   11876             :  opt_array_bounds '[' ']'
   11877             :     {
   11878           6 :         $$.index1 = $1.index1;
   11879           6 :         $$.index2 = $1.index2;
   11880           6 :         if (strcmp($$.index1, "-1") == 0)
   11881           6 :             $$.index1 = mm_strdup("0");
   11882           0 :         else if (strcmp($1.index2, "-1") == 0)
   11883           0 :             $$.index2 = mm_strdup("0");
   11884           6 :         $$.str = cat_str(2, $1.str, mm_strdup("[]"));
   11885             :     }
   11886             :     | opt_array_bounds '[' Iresult ']'
   11887             :     {
   11888         246 :         $$.index1 = $1.index1;
   11889         246 :         $$.index2 = $1.index2;
   11890         246 :         if (strcmp($1.index1, "-1") == 0)
   11891         222 :             $$.index1 = mm_strdup($3);
   11892          24 :         else if (strcmp($1.index2, "-1") == 0)
   11893          24 :             $$.index2 = mm_strdup($3);
   11894         246 :         $$.str = cat_str(4, $1.str, mm_strdup("["), $3, mm_strdup("]"));
   11895             :     }
   11896             : | 
   11897             :     {
   11898        1126 :         $$.index1 = mm_strdup("-1");
   11899        1126 :         $$.index2 = mm_strdup("-1");
   11900        1126 :         $$.str= EMPTY;
   11901             :     }
   11902             : ;
   11903             : 
   11904             : 
   11905             :  SimpleTypename:
   11906             :  GenericType
   11907             :  { 
   11908         122 :  $$ = $1;
   11909             : }
   11910             : |  Numeric
   11911             :  { 
   11912         170 :  $$ = $1;
   11913             : }
   11914             : |  Bit
   11915             :  { 
   11916           0 :  $$ = $1;
   11917             : }
   11918             : |  Character
   11919             :  { 
   11920          66 :  $$ = $1;
   11921             : }
   11922             : |  ConstDatetime
   11923             :  { 
   11924          16 :  $$ = $1;
   11925             : }
   11926             : |  ConstInterval opt_interval
   11927             :  { 
   11928           2 :  $$ = cat_str(2,$1,$2);
   11929             : }
   11930             : |  ConstInterval '(' Iconst ')'
   11931             :  { 
   11932           0 :  $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
   11933             : }
   11934             : |  JsonType
   11935             :  { 
   11936           2 :  $$ = $1;
   11937             : }
   11938             : ;
   11939             : 
   11940             : 
   11941             :  ConstTypename:
   11942             :  Numeric
   11943             :  { 
   11944           0 :  $$ = $1;
   11945             : }
   11946             : |  ConstBit
   11947             :  { 
   11948           0 :  $$ = $1;
   11949             : }
   11950             : |  ConstCharacter
   11951             :  { 
   11952           0 :  $$ = $1;
   11953             : }
   11954             : |  ConstDatetime
   11955             :  { 
   11956           0 :  $$ = $1;
   11957             : }
   11958             : |  JsonType
   11959             :  { 
   11960           0 :  $$ = $1;
   11961             : }
   11962             : ;
   11963             : 
   11964             : 
   11965             :  GenericType:
   11966             :  type_function_name opt_type_modifiers
   11967             :  { 
   11968         122 :  $$ = cat_str(2,$1,$2);
   11969             : }
   11970             : |  type_function_name attrs opt_type_modifiers
   11971             :  { 
   11972           0 :  $$ = cat_str(3,$1,$2,$3);
   11973             : }
   11974             : ;
   11975             : 
   11976             : 
   11977             :  opt_type_modifiers:
   11978             :  '(' expr_list ')'
   11979             :  { 
   11980           6 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   11981             : }
   11982             : | 
   11983             :  { 
   11984         138 :  $$=EMPTY; }
   11985             : ;
   11986             : 
   11987             : 
   11988             :  Numeric:
   11989             :  INT_P
   11990             :  { 
   11991          92 :  $$ = mm_strdup("int");
   11992             : }
   11993             : |  INTEGER
   11994             :  { 
   11995          26 :  $$ = mm_strdup("integer");
   11996             : }
   11997             : |  SMALLINT
   11998             :  { 
   11999          10 :  $$ = mm_strdup("smallint");
   12000             : }
   12001             : |  BIGINT
   12002             :  { 
   12003           6 :  $$ = mm_strdup("bigint");
   12004             : }
   12005             : |  REAL
   12006             :  { 
   12007           0 :  $$ = mm_strdup("real");
   12008             : }
   12009             : |  FLOAT_P opt_float
   12010             :  { 
   12011           4 :  $$ = cat_str(2,mm_strdup("float"),$2);
   12012             : }
   12013             : |  DOUBLE_P PRECISION
   12014             :  { 
   12015           6 :  $$ = mm_strdup("double precision");
   12016             : }
   12017             : |  DECIMAL_P opt_type_modifiers
   12018             :  { 
   12019           4 :  $$ = cat_str(2,mm_strdup("decimal"),$2);
   12020             : }
   12021             : |  DEC opt_type_modifiers
   12022             :  { 
   12023           0 :  $$ = cat_str(2,mm_strdup("dec"),$2);
   12024             : }
   12025             : |  NUMERIC opt_type_modifiers
   12026             :  { 
   12027          18 :  $$ = cat_str(2,mm_strdup("numeric"),$2);
   12028             : }
   12029             : |  BOOLEAN_P
   12030             :  { 
   12031           4 :  $$ = mm_strdup("boolean");
   12032             : }
   12033             : ;
   12034             : 
   12035             : 
   12036             :  opt_float:
   12037             :  '(' Iconst ')'
   12038             :  { 
   12039           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   12040             : }
   12041             : | 
   12042             :  { 
   12043           4 :  $$=EMPTY; }
   12044             : ;
   12045             : 
   12046             : 
   12047             :  Bit:
   12048             :  BitWithLength
   12049             :  { 
   12050           0 :  $$ = $1;
   12051             : }
   12052             : |  BitWithoutLength
   12053             :  { 
   12054           0 :  $$ = $1;
   12055             : }
   12056             : ;
   12057             : 
   12058             : 
   12059             :  ConstBit:
   12060             :  BitWithLength
   12061             :  { 
   12062           0 :  $$ = $1;
   12063             : }
   12064             : |  BitWithoutLength
   12065             :  { 
   12066           0 :  $$ = $1;
   12067             : }
   12068             : ;
   12069             : 
   12070             : 
   12071             :  BitWithLength:
   12072             :  BIT opt_varying '(' expr_list ')'
   12073             :  { 
   12074           0 :  $$ = cat_str(5,mm_strdup("bit"),$2,mm_strdup("("),$4,mm_strdup(")"));
   12075             : }
   12076             : ;
   12077             : 
   12078             : 
   12079             :  BitWithoutLength:
   12080             :  BIT opt_varying
   12081             :  { 
   12082           0 :  $$ = cat_str(2,mm_strdup("bit"),$2);
   12083             : }
   12084             : ;
   12085             : 
   12086             : 
   12087             :  Character:
   12088             :  CharacterWithLength
   12089             :  { 
   12090          58 :  $$ = $1;
   12091             : }
   12092             : |  CharacterWithoutLength
   12093             :  { 
   12094           8 :  $$ = $1;
   12095             : }
   12096             : ;
   12097             : 
   12098             : 
   12099             :  ConstCharacter:
   12100             :  CharacterWithLength
   12101             :  { 
   12102           0 :  $$ = $1;
   12103             : }
   12104             : |  CharacterWithoutLength
   12105             :  { 
   12106           0 :  $$ = $1;
   12107             : }
   12108             : ;
   12109             : 
   12110             : 
   12111             :  CharacterWithLength:
   12112             :  character '(' Iconst ')'
   12113             :  { 
   12114          58 :  $$ = cat_str(4,$1,mm_strdup("("),$3,mm_strdup(")"));
   12115             : }
   12116             : ;
   12117             : 
   12118             : 
   12119             :  CharacterWithoutLength:
   12120             :  character
   12121             :  { 
   12122           8 :  $$ = $1;
   12123             : }
   12124             : ;
   12125             : 
   12126             : 
   12127             :  character:
   12128             :  CHARACTER opt_varying
   12129             :  { 
   12130           2 :  $$ = cat_str(2,mm_strdup("character"),$2);
   12131             : }
   12132             : |  CHAR_P opt_varying
   12133             :  { 
   12134          42 :  $$ = cat_str(2,mm_strdup("char"),$2);
   12135             : }
   12136             : |  VARCHAR
   12137             :  { 
   12138          22 :  $$ = mm_strdup("varchar");
   12139             : }
   12140             : |  NATIONAL CHARACTER opt_varying
   12141             :  { 
   12142           0 :  $$ = cat_str(2,mm_strdup("national character"),$3);
   12143             : }
   12144             : |  NATIONAL CHAR_P opt_varying
   12145             :  { 
   12146           0 :  $$ = cat_str(2,mm_strdup("national char"),$3);
   12147             : }
   12148             : |  NCHAR opt_varying
   12149             :  { 
   12150           0 :  $$ = cat_str(2,mm_strdup("nchar"),$2);
   12151             : }
   12152             : ;
   12153             : 
   12154             : 
   12155             :  opt_varying:
   12156             :  VARYING
   12157             :  { 
   12158           0 :  $$ = mm_strdup("varying");
   12159             : }
   12160             : | 
   12161             :  { 
   12162          44 :  $$=EMPTY; }
   12163             : ;
   12164             : 
   12165             : 
   12166             :  ConstDatetime:
   12167             :  TIMESTAMP '(' Iconst ')' opt_timezone
   12168             :  { 
   12169           0 :  $$ = cat_str(4,mm_strdup("timestamp ("),$3,mm_strdup(")"),$5);
   12170             : }
   12171             : |  TIMESTAMP opt_timezone
   12172             :  { 
   12173          16 :  $$ = cat_str(2,mm_strdup("timestamp"),$2);
   12174             : }
   12175             : |  TIME '(' Iconst ')' opt_timezone
   12176             :  { 
   12177           0 :  $$ = cat_str(4,mm_strdup("time ("),$3,mm_strdup(")"),$5);
   12178             : }
   12179             : |  TIME opt_timezone
   12180             :  { 
   12181           0 :  $$ = cat_str(2,mm_strdup("time"),$2);
   12182             : }
   12183             : ;
   12184             : 
   12185             : 
   12186             :  ConstInterval:
   12187             :  INTERVAL
   12188             :  { 
   12189           2 :  $$ = mm_strdup("interval");
   12190             : }
   12191             : ;
   12192             : 
   12193             : 
   12194             :  opt_timezone:
   12195             :  WITH_LA TIME ZONE
   12196             :  { 
   12197           0 :  $$ = mm_strdup("with time zone");
   12198             : }
   12199             : |  WITHOUT_LA TIME ZONE
   12200             :  { 
   12201           2 :  $$ = mm_strdup("without time zone");
   12202             : }
   12203             : | 
   12204             :  { 
   12205          14 :  $$=EMPTY; }
   12206             : ;
   12207             : 
   12208             : 
   12209             :  opt_interval:
   12210             :  YEAR_P
   12211             :  { 
   12212           0 :  $$ = mm_strdup("year");
   12213             : }
   12214             : |  MONTH_P
   12215             :  { 
   12216           0 :  $$ = mm_strdup("month");
   12217             : }
   12218             : |  DAY_P
   12219             :  { 
   12220           0 :  $$ = mm_strdup("day");
   12221             : }
   12222             : |  HOUR_P
   12223             :  { 
   12224           0 :  $$ = mm_strdup("hour");
   12225             : }
   12226             : |  MINUTE_P
   12227             :  { 
   12228           0 :  $$ = mm_strdup("minute");
   12229             : }
   12230             : |  interval_second
   12231             :  { 
   12232           0 :  $$ = $1;
   12233             : }
   12234             : |  YEAR_P TO MONTH_P
   12235             :  { 
   12236           0 :  $$ = mm_strdup("year to month");
   12237             : }
   12238             : |  DAY_P TO HOUR_P
   12239             :  { 
   12240           0 :  $$ = mm_strdup("day to hour");
   12241             : }
   12242             : |  DAY_P TO MINUTE_P
   12243             :  { 
   12244           0 :  $$ = mm_strdup("day to minute");
   12245             : }
   12246             : |  DAY_P TO interval_second
   12247             :  { 
   12248           0 :  $$ = cat_str(2,mm_strdup("day to"),$3);
   12249             : }
   12250             : |  HOUR_P TO MINUTE_P
   12251             :  { 
   12252           0 :  $$ = mm_strdup("hour to minute");
   12253             : }
   12254             : |  HOUR_P TO interval_second
   12255             :  { 
   12256           0 :  $$ = cat_str(2,mm_strdup("hour to"),$3);
   12257             : }
   12258             : |  MINUTE_P TO interval_second
   12259             :  { 
   12260           0 :  $$ = cat_str(2,mm_strdup("minute to"),$3);
   12261             : }
   12262             : | 
   12263             :  { 
   12264         100 :  $$=EMPTY; }
   12265             : ;
   12266             : 
   12267             : 
   12268             :  interval_second:
   12269             :  SECOND_P
   12270             :  { 
   12271           0 :  $$ = mm_strdup("second");
   12272             : }
   12273             : |  SECOND_P '(' Iconst ')'
   12274             :  { 
   12275           0 :  $$ = cat_str(3,mm_strdup("second ("),$3,mm_strdup(")"));
   12276             : }
   12277             : ;
   12278             : 
   12279             : 
   12280             :  JsonType:
   12281             :  JSON
   12282             :  { 
   12283           2 :  $$ = mm_strdup("json");
   12284             : }
   12285             : ;
   12286             : 
   12287             : 
   12288             :  a_expr:
   12289             :  c_expr
   12290             :  { 
   12291        1386 :  $$ = $1;
   12292             : }
   12293             : |  a_expr TYPECAST Typename
   12294             :  { 
   12295          22 :  $$ = cat_str(3,$1,mm_strdup("::"),$3);
   12296             : }
   12297             : |  a_expr COLLATE any_name
   12298             :  { 
   12299           2 :  $$ = cat_str(3,$1,mm_strdup("collate"),$3);
   12300             : }
   12301             : |  a_expr AT TIME ZONE a_expr %prec AT
   12302             :  { 
   12303           0 :  $$ = cat_str(3,$1,mm_strdup("at time zone"),$5);
   12304             : }
   12305             : |  a_expr AT LOCAL %prec AT
   12306             :  { 
   12307           0 :  $$ = cat_str(2,$1,mm_strdup("at local"));
   12308             : }
   12309             : |  '+' a_expr %prec UMINUS
   12310             :  { 
   12311           0 :  $$ = cat_str(2,mm_strdup("+"),$2);
   12312             : }
   12313             : |  '-' a_expr %prec UMINUS
   12314             :  { 
   12315           6 :  $$ = cat_str(2,mm_strdup("-"),$2);
   12316             : }
   12317             : |  a_expr '+' a_expr
   12318             :  { 
   12319          12 :  $$ = cat_str(3,$1,mm_strdup("+"),$3);
   12320             : }
   12321             : |  a_expr '-' a_expr
   12322             :  { 
   12323           2 :  $$ = cat_str(3,$1,mm_strdup("-"),$3);
   12324             : }
   12325             : |  a_expr '*' a_expr
   12326             :  { 
   12327           0 :  $$ = cat_str(3,$1,mm_strdup("*"),$3);
   12328             : }
   12329             : |  a_expr '/' a_expr
   12330             :  { 
   12331           0 :  $$ = cat_str(3,$1,mm_strdup("/"),$3);
   12332             : }
   12333             : |  a_expr '%' a_expr
   12334             :  { 
   12335           0 :  $$ = cat_str(3,$1,mm_strdup("%"),$3);
   12336             : }
   12337             : |  a_expr '^' a_expr
   12338             :  { 
   12339           0 :  $$ = cat_str(3,$1,mm_strdup("^"),$3);
   12340             : }
   12341             : |  a_expr '<' a_expr
   12342             :  { 
   12343           0 :  $$ = cat_str(3,$1,mm_strdup("<"),$3);
   12344             : }
   12345             : |  a_expr '>' a_expr
   12346             :  { 
   12347           0 :  $$ = cat_str(3,$1,mm_strdup(">"),$3);
   12348             : }
   12349             : |  a_expr '=' a_expr
   12350             :  { 
   12351          64 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
   12352             : }
   12353             : |  a_expr LESS_EQUALS a_expr
   12354             :  { 
   12355           2 :  $$ = cat_str(3,$1,mm_strdup("<="),$3);
   12356             : }
   12357             : |  a_expr GREATER_EQUALS a_expr
   12358             :  { 
   12359           0 :  $$ = cat_str(3,$1,mm_strdup(">="),$3);
   12360             : }
   12361             : |  a_expr NOT_EQUALS a_expr
   12362             :  { 
   12363           0 :  $$ = cat_str(3,$1,mm_strdup("<>"),$3);
   12364             : }
   12365             : |  a_expr qual_Op a_expr %prec Op
   12366             :  { 
   12367           4 :  $$ = cat_str(3,$1,$2,$3);
   12368             : }
   12369             : |  qual_Op a_expr %prec Op
   12370             :  { 
   12371           0 :  $$ = cat_str(2,$1,$2);
   12372             : }
   12373             : |  a_expr AND a_expr
   12374             :  { 
   12375           0 :  $$ = cat_str(3,$1,mm_strdup("and"),$3);
   12376             : }
   12377             : |  a_expr OR a_expr
   12378             :  { 
   12379           0 :  $$ = cat_str(3,$1,mm_strdup("or"),$3);
   12380             : }
   12381             : |  NOT a_expr
   12382             :  { 
   12383           0 :  $$ = cat_str(2,mm_strdup("not"),$2);
   12384             : }
   12385             : |  NOT_LA a_expr %prec NOT
   12386             :  { 
   12387           0 :  $$ = cat_str(2,mm_strdup("not"),$2);
   12388             : }
   12389             : |  a_expr LIKE a_expr
   12390             :  { 
   12391           0 :  $$ = cat_str(3,$1,mm_strdup("like"),$3);
   12392             : }
   12393             : |  a_expr LIKE a_expr ESCAPE a_expr %prec LIKE
   12394             :  { 
   12395           0 :  $$ = cat_str(5,$1,mm_strdup("like"),$3,mm_strdup("escape"),$5);
   12396             : }
   12397             : |  a_expr NOT_LA LIKE a_expr %prec NOT_LA
   12398             :  { 
   12399           0 :  $$ = cat_str(3,$1,mm_strdup("not like"),$4);
   12400             : }
   12401             : |  a_expr NOT_LA LIKE a_expr ESCAPE a_expr %prec NOT_LA
   12402             :  { 
   12403           0 :  $$ = cat_str(5,$1,mm_strdup("not like"),$4,mm_strdup("escape"),$6);
   12404             : }
   12405             : |  a_expr ILIKE a_expr
   12406             :  { 
   12407           0 :  $$ = cat_str(3,$1,mm_strdup("ilike"),$3);
   12408             : }
   12409             : |  a_expr ILIKE a_expr ESCAPE a_expr %prec ILIKE
   12410             :  { 
   12411           0 :  $$ = cat_str(5,$1,mm_strdup("ilike"),$3,mm_strdup("escape"),$5);
   12412             : }
   12413             : |  a_expr NOT_LA ILIKE a_expr %prec NOT_LA
   12414             :  { 
   12415           0 :  $$ = cat_str(3,$1,mm_strdup("not ilike"),$4);
   12416             : }
   12417             : |  a_expr NOT_LA ILIKE a_expr ESCAPE a_expr %prec NOT_LA
   12418             :  { 
   12419           0 :  $$ = cat_str(5,$1,mm_strdup("not ilike"),$4,mm_strdup("escape"),$6);
   12420             : }
   12421             : |  a_expr SIMILAR TO a_expr %prec SIMILAR
   12422             :  { 
   12423           0 :  $$ = cat_str(3,$1,mm_strdup("similar to"),$4);
   12424             : }
   12425             : |  a_expr SIMILAR TO a_expr ESCAPE a_expr %prec SIMILAR
   12426             :  { 
   12427           0 :  $$ = cat_str(5,$1,mm_strdup("similar to"),$4,mm_strdup("escape"),$6);
   12428             : }
   12429             : |  a_expr NOT_LA SIMILAR TO a_expr %prec NOT_LA
   12430             :  { 
   12431           0 :  $$ = cat_str(3,$1,mm_strdup("not similar to"),$5);
   12432             : }
   12433             : |  a_expr NOT_LA SIMILAR TO a_expr ESCAPE a_expr %prec NOT_LA
   12434             :  { 
   12435           0 :  $$ = cat_str(5,$1,mm_strdup("not similar to"),$5,mm_strdup("escape"),$7);
   12436             : }
   12437             : |  a_expr IS NULL_P %prec IS
   12438             :  { 
   12439           0 :  $$ = cat_str(2,$1,mm_strdup("is null"));
   12440             : }
   12441             : |  a_expr ISNULL
   12442             :  { 
   12443           0 :  $$ = cat_str(2,$1,mm_strdup("isnull"));
   12444             : }
   12445             : |  a_expr IS NOT NULL_P %prec IS
   12446             :  { 
   12447           0 :  $$ = cat_str(2,$1,mm_strdup("is not null"));
   12448             : }
   12449             : |  a_expr NOTNULL
   12450             :  { 
   12451           0 :  $$ = cat_str(2,$1,mm_strdup("notnull"));
   12452             : }
   12453             : |  row OVERLAPS row
   12454             :  { 
   12455           0 :  $$ = cat_str(3,$1,mm_strdup("overlaps"),$3);
   12456             : }
   12457             : |  a_expr IS TRUE_P %prec IS
   12458             :  { 
   12459           0 :  $$ = cat_str(2,$1,mm_strdup("is true"));
   12460             : }
   12461             : |  a_expr IS NOT TRUE_P %prec IS
   12462             :  { 
   12463           0 :  $$ = cat_str(2,$1,mm_strdup("is not true"));
   12464             : }
   12465             : |  a_expr IS FALSE_P %prec IS
   12466             :  { 
   12467           0 :  $$ = cat_str(2,$1,mm_strdup("is false"));
   12468             : }
   12469             : |  a_expr IS NOT FALSE_P %prec IS
   12470             :  { 
   12471           0 :  $$ = cat_str(2,$1,mm_strdup("is not false"));
   12472             : }
   12473             : |  a_expr IS UNKNOWN %prec IS
   12474             :  { 
   12475           0 :  $$ = cat_str(2,$1,mm_strdup("is unknown"));
   12476             : }
   12477             : |  a_expr IS NOT UNKNOWN %prec IS
   12478             :  { 
   12479           0 :  $$ = cat_str(2,$1,mm_strdup("is not unknown"));
   12480             : }
   12481             : |  a_expr IS DISTINCT FROM a_expr %prec IS
   12482             :  { 
   12483           0 :  $$ = cat_str(3,$1,mm_strdup("is distinct from"),$5);
   12484             : }
   12485             : |  a_expr IS NOT DISTINCT FROM a_expr %prec IS
   12486             :  { 
   12487           0 :  $$ = cat_str(3,$1,mm_strdup("is not distinct from"),$6);
   12488             : }
   12489             : |  a_expr BETWEEN opt_asymmetric b_expr AND a_expr %prec BETWEEN
   12490             :  { 
   12491           0 :  $$ = cat_str(6,$1,mm_strdup("between"),$3,$4,mm_strdup("and"),$6);
   12492             : }
   12493             : |  a_expr NOT_LA BETWEEN opt_asymmetric b_expr AND a_expr %prec NOT_LA
   12494             :  { 
   12495           0 :  $$ = cat_str(6,$1,mm_strdup("not between"),$4,$5,mm_strdup("and"),$7);
   12496             : }
   12497             : |  a_expr BETWEEN SYMMETRIC b_expr AND a_expr %prec BETWEEN
   12498             :  { 
   12499           0 :  $$ = cat_str(5,$1,mm_strdup("between symmetric"),$4,mm_strdup("and"),$6);
   12500             : }
   12501             : |  a_expr NOT_LA BETWEEN SYMMETRIC b_expr AND a_expr %prec NOT_LA
   12502             :  { 
   12503           0 :  $$ = cat_str(5,$1,mm_strdup("not between symmetric"),$5,mm_strdup("and"),$7);
   12504             : }
   12505             : |  a_expr IN_P in_expr
   12506             :  { 
   12507           0 :  $$ = cat_str(3,$1,mm_strdup("in"),$3);
   12508             : }
   12509             : |  a_expr NOT_LA IN_P in_expr %prec NOT_LA
   12510             :  { 
   12511           0 :  $$ = cat_str(3,$1,mm_strdup("not in"),$4);
   12512             : }
   12513             : |  a_expr subquery_Op sub_type select_with_parens %prec Op
   12514             :  { 
   12515           0 :  $$ = cat_str(4,$1,$2,$3,$4);
   12516             : }
   12517             : |  a_expr subquery_Op sub_type '(' a_expr ')' %prec Op
   12518             :  { 
   12519           0 :  $$ = cat_str(6,$1,$2,$3,mm_strdup("("),$5,mm_strdup(")"));
   12520             : }
   12521             : |  UNIQUE opt_unique_null_treatment select_with_parens
   12522             :  { 
   12523           0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
   12524           0 :  $$ = cat_str(3,mm_strdup("unique"),$2,$3);
   12525             : }
   12526             : |  a_expr IS DOCUMENT_P %prec IS
   12527             :  { 
   12528           0 :  $$ = cat_str(2,$1,mm_strdup("is document"));
   12529             : }
   12530             : |  a_expr IS NOT DOCUMENT_P %prec IS
   12531             :  { 
   12532           0 :  $$ = cat_str(2,$1,mm_strdup("is not document"));
   12533             : }
   12534             : |  a_expr IS NORMALIZED %prec IS
   12535             :  { 
   12536           0 :  $$ = cat_str(2,$1,mm_strdup("is normalized"));
   12537             : }
   12538             : |  a_expr IS unicode_normal_form NORMALIZED %prec IS
   12539             :  { 
   12540           0 :  $$ = cat_str(4,$1,mm_strdup("is"),$3,mm_strdup("normalized"));
   12541             : }
   12542             : |  a_expr IS NOT NORMALIZED %prec IS
   12543             :  { 
   12544           0 :  $$ = cat_str(2,$1,mm_strdup("is not normalized"));
   12545             : }
   12546             : |  a_expr IS NOT unicode_normal_form NORMALIZED %prec IS
   12547             :  { 
   12548           0 :  $$ = cat_str(4,$1,mm_strdup("is not"),$4,mm_strdup("normalized"));
   12549             : }
   12550             : |  a_expr IS json_predicate_type_constraint json_key_uniqueness_constraint_opt %prec IS
   12551             :  { 
   12552          14 :  $$ = cat_str(4,$1,mm_strdup("is"),$3,$4);
   12553             : }
   12554             : |  a_expr IS NOT json_predicate_type_constraint json_key_uniqueness_constraint_opt %prec IS
   12555             :  { 
   12556           2 :  $$ = cat_str(4,$1,mm_strdup("is not"),$4,$5);
   12557             : }
   12558             : |  DEFAULT
   12559             :  { 
   12560          32 :  $$ = mm_strdup("default");
   12561             : }
   12562             : ;
   12563             : 
   12564             : 
   12565             :  b_expr:
   12566             :  c_expr
   12567             :  { 
   12568           4 :  $$ = $1;
   12569             : }
   12570             : |  b_expr TYPECAST Typename
   12571             :  { 
   12572           0 :  $$ = cat_str(3,$1,mm_strdup("::"),$3);
   12573             : }
   12574             : |  '+' b_expr %prec UMINUS
   12575             :  { 
   12576           0 :  $$ = cat_str(2,mm_strdup("+"),$2);
   12577             : }
   12578             : |  '-' b_expr %prec UMINUS
   12579             :  { 
   12580           0 :  $$ = cat_str(2,mm_strdup("-"),$2);
   12581             : }
   12582             : |  b_expr '+' b_expr
   12583             :  { 
   12584           0 :  $$ = cat_str(3,$1,mm_strdup("+"),$3);
   12585             : }
   12586             : |  b_expr '-' b_expr
   12587             :  { 
   12588           0 :  $$ = cat_str(3,$1,mm_strdup("-"),$3);
   12589             : }
   12590             : |  b_expr '*' b_expr
   12591             :  { 
   12592           0 :  $$ = cat_str(3,$1,mm_strdup("*"),$3);
   12593             : }
   12594             : |  b_expr '/' b_expr
   12595             :  { 
   12596           0 :  $$ = cat_str(3,$1,mm_strdup("/"),$3);
   12597             : }
   12598             : |  b_expr '%' b_expr
   12599             :  { 
   12600           0 :  $$ = cat_str(3,$1,mm_strdup("%"),$3);
   12601             : }
   12602             : |  b_expr '^' b_expr
   12603             :  { 
   12604           0 :  $$ = cat_str(3,$1,mm_strdup("^"),$3);
   12605             : }
   12606             : |  b_expr '<' b_expr
   12607             :  { 
   12608           0 :  $$ = cat_str(3,$1,mm_strdup("<"),$3);
   12609             : }
   12610             : |  b_expr '>' b_expr
   12611             :  { 
   12612           0 :  $$ = cat_str(3,$1,mm_strdup(">"),$3);
   12613             : }
   12614             : |  b_expr '=' b_expr
   12615             :  { 
   12616           0 :  $$ = cat_str(3,$1,mm_strdup("="),$3);
   12617             : }
   12618             : |  b_expr LESS_EQUALS b_expr
   12619             :  { 
   12620           0 :  $$ = cat_str(3,$1,mm_strdup("<="),$3);
   12621             : }
   12622             : |  b_expr GREATER_EQUALS b_expr
   12623             :  { 
   12624           0 :  $$ = cat_str(3,$1,mm_strdup(">="),$3);
   12625             : }
   12626             : |  b_expr NOT_EQUALS b_expr
   12627             :  { 
   12628           0 :  $$ = cat_str(3,$1,mm_strdup("<>"),$3);
   12629             : }
   12630             : |  b_expr qual_Op b_expr %prec Op
   12631             :  { 
   12632           0 :  $$ = cat_str(3,$1,$2,$3);
   12633             : }
   12634             : |  qual_Op b_expr %prec Op
   12635             :  { 
   12636           0 :  $$ = cat_str(2,$1,$2);
   12637             : }
   12638             : |  b_expr IS DISTINCT FROM b_expr %prec IS
   12639             :  { 
   12640           0 :  $$ = cat_str(3,$1,mm_strdup("is distinct from"),$5);
   12641             : }
   12642             : |  b_expr IS NOT DISTINCT FROM b_expr %prec IS
   12643             :  { 
   12644           0 :  $$ = cat_str(3,$1,mm_strdup("is not distinct from"),$6);
   12645             : }
   12646             : |  b_expr IS DOCUMENT_P %prec IS
   12647             :  { 
   12648           0 :  $$ = cat_str(2,$1,mm_strdup("is document"));
   12649             : }
   12650             : |  b_expr IS NOT DOCUMENT_P %prec IS
   12651             :  { 
   12652           0 :  $$ = cat_str(2,$1,mm_strdup("is not document"));
   12653             : }
   12654             : ;
   12655             : 
   12656             : 
   12657             :  c_expr:
   12658             :  columnref
   12659             :  { 
   12660         314 :  $$ = $1;
   12661             : }
   12662             : |  AexprConst
   12663             :  { 
   12664         948 :  $$ = $1;
   12665             : }
   12666             : |  ecpg_param opt_indirection
   12667             :  { 
   12668          22 :  $$ = cat_str(2,$1,$2);
   12669             : }
   12670             : |  '(' a_expr ')' opt_indirection
   12671             :  { 
   12672           0 :  $$ = cat_str(4,mm_strdup("("),$2,mm_strdup(")"),$4);
   12673             : }
   12674             : |  case_expr
   12675             :  { 
   12676           0 :  $$ = $1;
   12677             : }
   12678             : |  func_expr
   12679             :  { 
   12680         100 :  $$ = $1;
   12681             : }
   12682             : |  select_with_parens %prec UMINUS
   12683             :  { 
   12684           4 :  $$ = $1;
   12685             : }
   12686             : |  select_with_parens indirection
   12687             :  { 
   12688           0 :  $$ = cat_str(2,$1,$2);
   12689             : }
   12690             : |  EXISTS select_with_parens
   12691             :  { 
   12692           0 :  $$ = cat_str(2,mm_strdup("exists"),$2);
   12693             : }
   12694             : |  ARRAY select_with_parens
   12695             :  { 
   12696           0 :  $$ = cat_str(2,mm_strdup("array"),$2);
   12697             : }
   12698             : |  ARRAY array_expr
   12699             :  { 
   12700           0 :  $$ = cat_str(2,mm_strdup("array"),$2);
   12701             : }
   12702             : |  explicit_row
   12703             :  { 
   12704           0 :  $$ = $1;
   12705             : }
   12706             : |  implicit_row
   12707             :  { 
   12708           2 :  $$ = $1;
   12709             : }
   12710             : |  GROUPING '(' expr_list ')'
   12711             :  { 
   12712           0 :  $$ = cat_str(3,mm_strdup("grouping ("),$3,mm_strdup(")"));
   12713             : }
   12714             : ;
   12715             : 
   12716             : 
   12717             :  func_application:
   12718             :  func_name '(' ')'
   12719             :  { 
   12720          30 :  $$ = cat_str(2,$1,mm_strdup("( )"));
   12721             : }
   12722             : |  func_name '(' func_arg_list opt_sort_clause ')'
   12723             :  { 
   12724           6 :  $$ = cat_str(5,$1,mm_strdup("("),$3,$4,mm_strdup(")"));
   12725             : }
   12726             : |  func_name '(' VARIADIC func_arg_expr opt_sort_clause ')'
   12727             :  { 
   12728           0 :  $$ = cat_str(5,$1,mm_strdup("( variadic"),$4,$5,mm_strdup(")"));
   12729             : }
   12730             : |  func_name '(' func_arg_list ',' VARIADIC func_arg_expr opt_sort_clause ')'
   12731             :  { 
   12732           0 :  $$ = cat_str(7,$1,mm_strdup("("),$3,mm_strdup(", variadic"),$6,$7,mm_strdup(")"));
   12733             : }
   12734             : |  func_name '(' ALL func_arg_list opt_sort_clause ')'
   12735             :  { 
   12736           0 :  $$ = cat_str(5,$1,mm_strdup("( all"),$4,$5,mm_strdup(")"));
   12737             : }
   12738             : |  func_name '(' DISTINCT func_arg_list opt_sort_clause ')'
   12739             :  { 
   12740           0 :  $$ = cat_str(5,$1,mm_strdup("( distinct"),$4,$5,mm_strdup(")"));
   12741             : }
   12742             : |  func_name '(' '*' ')'
   12743             :  { 
   12744           4 :  $$ = cat_str(2,$1,mm_strdup("( * )"));
   12745             : }
   12746             : ;
   12747             : 
   12748             : 
   12749             :  func_expr:
   12750             :  func_application within_group_clause filter_clause over_clause
   12751             :  { 
   12752          38 :  $$ = cat_str(4,$1,$2,$3,$4);
   12753             : }
   12754             : |  json_aggregate_func filter_clause over_clause
   12755             :  { 
   12756           0 :  $$ = cat_str(3,$1,$2,$3);
   12757             : }
   12758             : |  func_expr_common_subexpr
   12759             :  { 
   12760          62 :  $$ = $1;
   12761             : }
   12762             : ;
   12763             : 
   12764             : 
   12765             :  func_expr_windowless:
   12766             :  func_application
   12767             :  { 
   12768           2 :  $$ = $1;
   12769             : }
   12770             : |  func_expr_common_subexpr
   12771             :  { 
   12772           0 :  $$ = $1;
   12773             : }
   12774             : |  json_aggregate_func
   12775             :  { 
   12776           0 :  $$ = $1;
   12777             : }
   12778             : ;
   12779             : 
   12780             : 
   12781             :  func_expr_common_subexpr:
   12782             :  COLLATION FOR '(' a_expr ')'
   12783             :  { 
   12784           0 :  $$ = cat_str(3,mm_strdup("collation for ("),$4,mm_strdup(")"));
   12785             : }
   12786             : |  CURRENT_DATE
   12787             :  { 
   12788           0 :  $$ = mm_strdup("current_date");
   12789             : }
   12790             : |  CURRENT_TIME
   12791             :  { 
   12792           0 :  $$ = mm_strdup("current_time");
   12793             : }
   12794             : |  CURRENT_TIME '(' Iconst ')'
   12795             :  { 
   12796           0 :  $$ = cat_str(3,mm_strdup("current_time ("),$3,mm_strdup(")"));
   12797             : }
   12798             : |  CURRENT_TIMESTAMP
   12799             :  { 
   12800           0 :  $$ = mm_strdup("current_timestamp");
   12801             : }
   12802             : |  CURRENT_TIMESTAMP '(' Iconst ')'
   12803             :  { 
   12804           0 :  $$ = cat_str(3,mm_strdup("current_timestamp ("),$3,mm_strdup(")"));
   12805             : }
   12806             : |  LOCALTIME
   12807             :  { 
   12808           0 :  $$ = mm_strdup("localtime");
   12809             : }
   12810             : |  LOCALTIME '(' Iconst ')'
   12811             :  { 
   12812           0 :  $$ = cat_str(3,mm_strdup("localtime ("),$3,mm_strdup(")"));
   12813             : }
   12814             : |  LOCALTIMESTAMP
   12815             :  { 
   12816           0 :  $$ = mm_strdup("localtimestamp");
   12817             : }
   12818             : |  LOCALTIMESTAMP '(' Iconst ')'
   12819             :  { 
   12820           0 :  $$ = cat_str(3,mm_strdup("localtimestamp ("),$3,mm_strdup(")"));
   12821             : }
   12822             : |  CURRENT_ROLE
   12823             :  { 
   12824           0 :  $$ = mm_strdup("current_role");
   12825             : }
   12826             : |  CURRENT_USER
   12827             :  { 
   12828           0 :  $$ = mm_strdup("current_user");
   12829             : }
   12830             : |  SESSION_USER
   12831             :  { 
   12832           0 :  $$ = mm_strdup("session_user");
   12833             : }
   12834             : |  SYSTEM_USER
   12835             :  { 
   12836           0 :  $$ = mm_strdup("system_user");
   12837             : }
   12838             : |  USER
   12839             :  { 
   12840           0 :  $$ = mm_strdup("user");
   12841             : }
   12842             : |  CURRENT_CATALOG
   12843             :  { 
   12844           0 :  $$ = mm_strdup("current_catalog");
   12845             : }
   12846             : |  CURRENT_SCHEMA
   12847             :  { 
   12848           0 :  $$ = mm_strdup("current_schema");
   12849             : }
   12850             : |  CAST '(' a_expr AS Typename ')'
   12851             :  { 
   12852           4 :  $$ = cat_str(5,mm_strdup("cast ("),$3,mm_strdup("as"),$5,mm_strdup(")"));
   12853             : }
   12854             : |  EXTRACT '(' extract_list ')'
   12855             :  { 
   12856           0 :  $$ = cat_str(3,mm_strdup("extract ("),$3,mm_strdup(")"));
   12857             : }
   12858             : |  NORMALIZE '(' a_expr ')'
   12859             :  { 
   12860           0 :  $$ = cat_str(3,mm_strdup("normalize ("),$3,mm_strdup(")"));
   12861             : }
   12862             : |  NORMALIZE '(' a_expr ',' unicode_normal_form ')'
   12863             :  { 
   12864           0 :  $$ = cat_str(5,mm_strdup("normalize ("),$3,mm_strdup(","),$5,mm_strdup(")"));
   12865             : }
   12866             : |  OVERLAY '(' overlay_list ')'
   12867             :  { 
   12868           0 :  $$ = cat_str(3,mm_strdup("overlay ("),$3,mm_strdup(")"));
   12869             : }
   12870             : |  OVERLAY '(' func_arg_list_opt ')'
   12871             :  { 
   12872           0 :  $$ = cat_str(3,mm_strdup("overlay ("),$3,mm_strdup(")"));
   12873             : }
   12874             : |  POSITION '(' position_list ')'
   12875             :  { 
   12876           0 :  $$ = cat_str(3,mm_strdup("position ("),$3,mm_strdup(")"));
   12877             : }
   12878             : |  SUBSTRING '(' substr_list ')'
   12879             :  { 
   12880           0 :  $$ = cat_str(3,mm_strdup("substring ("),$3,mm_strdup(")"));
   12881             : }
   12882             : |  SUBSTRING '(' func_arg_list_opt ')'
   12883             :  { 
   12884           0 :  $$ = cat_str(3,mm_strdup("substring ("),$3,mm_strdup(")"));
   12885             : }
   12886             : |  TREAT '(' a_expr AS Typename ')'
   12887             :  { 
   12888           0 :  $$ = cat_str(5,mm_strdup("treat ("),$3,mm_strdup("as"),$5,mm_strdup(")"));
   12889             : }
   12890             : |  TRIM '(' BOTH trim_list ')'
   12891             :  { 
   12892           0 :  $$ = cat_str(3,mm_strdup("trim ( both"),$4,mm_strdup(")"));
   12893             : }
   12894             : |  TRIM '(' LEADING trim_list ')'
   12895             :  { 
   12896           0 :  $$ = cat_str(3,mm_strdup("trim ( leading"),$4,mm_strdup(")"));
   12897             : }
   12898             : |  TRIM '(' TRAILING trim_list ')'
   12899             :  { 
   12900           0 :  $$ = cat_str(3,mm_strdup("trim ( trailing"),$4,mm_strdup(")"));
   12901             : }
   12902             : |  TRIM '(' trim_list ')'
   12903             :  { 
   12904           0 :  $$ = cat_str(3,mm_strdup("trim ("),$3,mm_strdup(")"));
   12905             : }
   12906             : |  NULLIF '(' a_expr ',' a_expr ')'
   12907             :  { 
   12908           2 :  $$ = cat_str(5,mm_strdup("nullif ("),$3,mm_strdup(","),$5,mm_strdup(")"));
   12909             : }
   12910             : |  COALESCE '(' expr_list ')'
   12911             :  { 
   12912           0 :  $$ = cat_str(3,mm_strdup("coalesce ("),$3,mm_strdup(")"));
   12913             : }
   12914             : |  GREATEST '(' expr_list ')'
   12915             :  { 
   12916           0 :  $$ = cat_str(3,mm_strdup("greatest ("),$3,mm_strdup(")"));
   12917             : }
   12918             : |  LEAST '(' expr_list ')'
   12919             :  { 
   12920           0 :  $$ = cat_str(3,mm_strdup("least ("),$3,mm_strdup(")"));
   12921             : }
   12922             : |  XMLCONCAT '(' expr_list ')'
   12923             :  { 
   12924           0 :  $$ = cat_str(3,mm_strdup("xmlconcat ("),$3,mm_strdup(")"));
   12925             : }
   12926             : |  XMLELEMENT '(' NAME_P ColLabel ')'
   12927             :  { 
   12928           0 :  $$ = cat_str(3,mm_strdup("xmlelement ( name"),$4,mm_strdup(")"));
   12929             : }
   12930             : |  XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ')'
   12931             :  { 
   12932           0 :  $$ = cat_str(5,mm_strdup("xmlelement ( name"),$4,mm_strdup(","),$6,mm_strdup(")"));
   12933             : }
   12934             : |  XMLELEMENT '(' NAME_P ColLabel ',' expr_list ')'
   12935             :  { 
   12936           0 :  $$ = cat_str(5,mm_strdup("xmlelement ( name"),$4,mm_strdup(","),$6,mm_strdup(")"));
   12937             : }
   12938             : |  XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ',' expr_list ')'
   12939             :  { 
   12940           0 :  $$ = cat_str(7,mm_strdup("xmlelement ( name"),$4,mm_strdup(","),$6,mm_strdup(","),$8,mm_strdup(")"));
   12941             : }
   12942             : |  XMLEXISTS '(' c_expr xmlexists_argument ')'
   12943             :  { 
   12944           0 :  $$ = cat_str(4,mm_strdup("xmlexists ("),$3,$4,mm_strdup(")"));
   12945             : }
   12946             : |  XMLFOREST '(' xml_attribute_list ')'
   12947             :  { 
   12948           0 :  $$ = cat_str(3,mm_strdup("xmlforest ("),$3,mm_strdup(")"));
   12949             : }
   12950             : |  XMLPARSE '(' document_or_content a_expr xml_whitespace_option ')'
   12951             :  { 
   12952           0 :  $$ = cat_str(5,mm_strdup("xmlparse ("),$3,$4,$5,mm_strdup(")"));
   12953             : }
   12954             : |  XMLPI '(' NAME_P ColLabel ')'
   12955             :  { 
   12956           0 :  $$ = cat_str(3,mm_strdup("xmlpi ( name"),$4,mm_strdup(")"));
   12957             : }
   12958             : |  XMLPI '(' NAME_P ColLabel ',' a_expr ')'
   12959             :  { 
   12960           0 :  $$ = cat_str(5,mm_strdup("xmlpi ( name"),$4,mm_strdup(","),$6,mm_strdup(")"));
   12961             : }
   12962             : |  XMLROOT '(' a_expr ',' xml_root_version opt_xml_root_standalone ')'
   12963             :  { 
   12964           0 :  $$ = cat_str(6,mm_strdup("xmlroot ("),$3,mm_strdup(","),$5,$6,mm_strdup(")"));
   12965             : }
   12966             : |  XMLSERIALIZE '(' document_or_content a_expr AS SimpleTypename xml_indent_option ')'
   12967             :  { 
   12968           0 :  $$ = cat_str(7,mm_strdup("xmlserialize ("),$3,$4,mm_strdup("as"),$6,$7,mm_strdup(")"));
   12969             : }
   12970             : |  JSON_OBJECT '(' func_arg_list ')'
   12971             :  { 
   12972           0 :  $$ = cat_str(3,mm_strdup("json_object ("),$3,mm_strdup(")"));
   12973             : }
   12974             : |  JSON_OBJECT '(' json_name_and_value_list json_object_constructor_null_clause_opt json_key_uniqueness_constraint_opt json_returning_clause_opt ')'
   12975             :  { 
   12976           6 :  $$ = cat_str(6,mm_strdup("json_object ("),$3,$4,$5,$6,mm_strdup(")"));
   12977             : }
   12978             : |  JSON_OBJECT '(' json_returning_clause_opt ')'
   12979             :  { 
   12980           4 :  $$ = cat_str(3,mm_strdup("json_object ("),$3,mm_strdup(")"));
   12981             : }
   12982             : |  JSON_ARRAY '(' json_value_expr_list json_array_constructor_null_clause_opt json_returning_clause_opt ')'
   12983             :  { 
   12984           0 :  $$ = cat_str(5,mm_strdup("json_array ("),$3,$4,$5,mm_strdup(")"));
   12985             : }
   12986             : |  JSON_ARRAY '(' select_no_parens json_format_clause_opt json_returning_clause_opt ')'
   12987             :  { 
   12988           0 :  $$ = cat_str(5,mm_strdup("json_array ("),$3,$4,$5,mm_strdup(")"));
   12989             : }
   12990             : |  JSON_ARRAY '(' json_returning_clause_opt ')'
   12991             :  { 
   12992           4 :  $$ = cat_str(3,mm_strdup("json_array ("),$3,mm_strdup(")"));
   12993             : }
   12994             : |  JSON '(' json_value_expr json_key_uniqueness_constraint_opt ')'
   12995             :  { 
   12996          16 :  $$ = cat_str(4,mm_strdup("json ("),$3,$4,mm_strdup(")"));
   12997             : }
   12998             : |  JSON_SCALAR '(' a_expr ')'
   12999             :  { 
   13000          14 :  $$ = cat_str(3,mm_strdup("json_scalar ("),$3,mm_strdup(")"));
   13001             : }
   13002             : |  JSON_SERIALIZE '(' json_value_expr json_returning_clause_opt ')'
   13003             :  { 
   13004          12 :  $$ = cat_str(4,mm_strdup("json_serialize ("),$3,$4,mm_strdup(")"));
   13005             : }
   13006             : |  MERGE_ACTION '(' ')'
   13007             :  { 
   13008           0 :  $$ = mm_strdup("merge_action ( )");
   13009             : }
   13010             : |  JSON_QUERY '(' json_value_expr ',' a_expr json_passing_clause_opt json_returning_clause_opt json_wrapper_behavior json_quotes_clause_opt json_behavior_clause_opt ')'
   13011             :  { 
   13012           0 :  $$ = cat_str(10,mm_strdup("json_query ("),$3,mm_strdup(","),$5,$6,$7,$8,$9,$10,mm_strdup(")"));
   13013             : }
   13014             : |  JSON_EXISTS '(' json_value_expr ',' a_expr json_passing_clause_opt json_on_error_clause_opt ')'
   13015             :  { 
   13016           0 :  $$ = cat_str(7,mm_strdup("json_exists ("),$3,mm_strdup(","),$5,$6,$7,mm_strdup(")"));
   13017             : }
   13018             : |  JSON_VALUE '(' json_value_expr ',' a_expr json_passing_clause_opt json_returning_clause_opt json_behavior_clause_opt ')'
   13019             :  { 
   13020           0 :  $$ = cat_str(8,mm_strdup("json_value ("),$3,mm_strdup(","),$5,$6,$7,$8,mm_strdup(")"));
   13021             : }
   13022             : ;
   13023             : 
   13024             : 
   13025             :  xml_root_version:
   13026             :  VERSION_P a_expr
   13027             :  { 
   13028           0 :  $$ = cat_str(2,mm_strdup("version"),$2);
   13029             : }
   13030             : |  VERSION_P NO VALUE_P
   13031             :  { 
   13032           0 :  $$ = mm_strdup("version no value");
   13033             : }
   13034             : ;
   13035             : 
   13036             : 
   13037             :  opt_xml_root_standalone:
   13038             :  ',' STANDALONE_P YES_P
   13039             :  { 
   13040           0 :  $$ = mm_strdup(", standalone yes");
   13041             : }
   13042             : |  ',' STANDALONE_P NO
   13043             :  { 
   13044           0 :  $$ = mm_strdup(", standalone no");
   13045             : }
   13046             : |  ',' STANDALONE_P NO VALUE_P
   13047             :  { 
   13048           0 :  $$ = mm_strdup(", standalone no value");
   13049             : }
   13050             : | 
   13051             :  { 
   13052           0 :  $$=EMPTY; }
   13053             : ;
   13054             : 
   13055             : 
   13056             :  xml_attributes:
   13057             :  XMLATTRIBUTES '(' xml_attribute_list ')'
   13058             :  { 
   13059           0 :  $$ = cat_str(3,mm_strdup("xmlattributes ("),$3,mm_strdup(")"));
   13060             : }
   13061             : ;
   13062             : 
   13063             : 
   13064             :  xml_attribute_list:
   13065             :  xml_attribute_el
   13066             :  { 
   13067           0 :  $$ = $1;
   13068             : }
   13069             : |  xml_attribute_list ',' xml_attribute_el
   13070             :  { 
   13071           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   13072             : }
   13073             : ;
   13074             : 
   13075             : 
   13076             :  xml_attribute_el:
   13077             :  a_expr AS ColLabel
   13078             :  { 
   13079           0 :  $$ = cat_str(3,$1,mm_strdup("as"),$3);
   13080             : }
   13081             : |  a_expr
   13082             :  { 
   13083           0 :  $$ = $1;
   13084             : }
   13085             : ;
   13086             : 
   13087             : 
   13088             :  document_or_content:
   13089             :  DOCUMENT_P
   13090             :  { 
   13091           0 :  $$ = mm_strdup("document");
   13092             : }
   13093             : |  CONTENT_P
   13094             :  { 
   13095           0 :  $$ = mm_strdup("content");
   13096             : }
   13097             : ;
   13098             : 
   13099             : 
   13100             :  xml_indent_option:
   13101             :  INDENT
   13102             :  { 
   13103           0 :  $$ = mm_strdup("indent");
   13104             : }
   13105             : |  NO INDENT
   13106             :  { 
   13107           0 :  $$ = mm_strdup("no indent");
   13108             : }
   13109             : | 
   13110             :  { 
   13111           0 :  $$=EMPTY; }
   13112             : ;
   13113             : 
   13114             : 
   13115             :  xml_whitespace_option:
   13116             :  PRESERVE WHITESPACE_P
   13117             :  { 
   13118           0 :  $$ = mm_strdup("preserve whitespace");
   13119             : }
   13120             : |  STRIP_P WHITESPACE_P
   13121             :  { 
   13122           0 :  $$ = mm_strdup("strip whitespace");
   13123             : }
   13124             : | 
   13125             :  { 
   13126           0 :  $$=EMPTY; }
   13127             : ;
   13128             : 
   13129             : 
   13130             :  xmlexists_argument:
   13131             :  PASSING c_expr
   13132             :  { 
   13133           0 :  $$ = cat_str(2,mm_strdup("passing"),$2);
   13134             : }
   13135             : |  PASSING c_expr xml_passing_mech
   13136             :  { 
   13137           0 :  $$ = cat_str(3,mm_strdup("passing"),$2,$3);
   13138             : }
   13139             : |  PASSING xml_passing_mech c_expr
   13140             :  { 
   13141           0 :  $$ = cat_str(3,mm_strdup("passing"),$2,$3);
   13142             : }
   13143             : |  PASSING xml_passing_mech c_expr xml_passing_mech
   13144             :  { 
   13145           0 :  $$ = cat_str(4,mm_strdup("passing"),$2,$3,$4);
   13146             : }
   13147             : ;
   13148             : 
   13149             : 
   13150             :  xml_passing_mech:
   13151             :  BY REF_P
   13152             :  { 
   13153           0 :  $$ = mm_strdup("by ref");
   13154             : }
   13155             : |  BY VALUE_P
   13156             :  { 
   13157           0 :  $$ = mm_strdup("by value");
   13158             : }
   13159             : ;
   13160             : 
   13161             : 
   13162             :  within_group_clause:
   13163             :  WITHIN GROUP_P '(' sort_clause ')'
   13164             :  { 
   13165           0 :  $$ = cat_str(3,mm_strdup("within group ("),$4,mm_strdup(")"));
   13166             : }
   13167             : | 
   13168             :  { 
   13169          38 :  $$=EMPTY; }
   13170             : ;
   13171             : 
   13172             : 
   13173             :  filter_clause:
   13174             :  FILTER '(' WHERE a_expr ')'
   13175             :  { 
   13176           0 :  $$ = cat_str(3,mm_strdup("filter ( where"),$4,mm_strdup(")"));
   13177             : }
   13178             : | 
   13179             :  { 
   13180          38 :  $$=EMPTY; }
   13181             : ;
   13182             : 
   13183             : 
   13184             :  window_clause:
   13185             :  WINDOW window_definition_list
   13186             :  { 
   13187           0 :  $$ = cat_str(2,mm_strdup("window"),$2);
   13188             : }
   13189             : | 
   13190             :  { 
   13191         248 :  $$=EMPTY; }
   13192             : ;
   13193             : 
   13194             : 
   13195             :  window_definition_list:
   13196             :  window_definition
   13197             :  { 
   13198           0 :  $$ = $1;
   13199             : }
   13200             : |  window_definition_list ',' window_definition
   13201             :  { 
   13202           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   13203             : }
   13204             : ;
   13205             : 
   13206             : 
   13207             :  window_definition:
   13208             :  ColId AS window_specification
   13209             :  { 
   13210           0 :  $$ = cat_str(3,$1,mm_strdup("as"),$3);
   13211             : }
   13212             : ;
   13213             : 
   13214             : 
   13215             :  over_clause:
   13216             :  OVER window_specification
   13217             :  { 
   13218           0 :  $$ = cat_str(2,mm_strdup("over"),$2);
   13219             : }
   13220             : |  OVER ColId
   13221             :  { 
   13222           0 :  $$ = cat_str(2,mm_strdup("over"),$2);
   13223             : }
   13224             : | 
   13225             :  { 
   13226          38 :  $$=EMPTY; }
   13227             : ;
   13228             : 
   13229             : 
   13230             :  window_specification:
   13231             :  '(' opt_existing_window_name opt_partition_clause opt_sort_clause opt_frame_clause ')'
   13232             :  { 
   13233           0 :  $$ = cat_str(6,mm_strdup("("),$2,$3,$4,$5,mm_strdup(")"));
   13234             : }
   13235             : ;
   13236             : 
   13237             : 
   13238             :  opt_existing_window_name:
   13239             :  ColId
   13240             :  { 
   13241           0 :  $$ = $1;
   13242             : }
   13243             : |  %prec Op
   13244             :  { 
   13245           0 :  $$=EMPTY; }
   13246             : ;
   13247             : 
   13248             : 
   13249             :  opt_partition_clause:
   13250             :  PARTITION BY expr_list
   13251             :  { 
   13252           0 :  $$ = cat_str(2,mm_strdup("partition by"),$3);
   13253             : }
   13254             : | 
   13255             :  { 
   13256           0 :  $$=EMPTY; }
   13257             : ;
   13258             : 
   13259             : 
   13260             :  opt_frame_clause:
   13261             :  RANGE frame_extent opt_window_exclusion_clause
   13262             :  { 
   13263           0 :  $$ = cat_str(3,mm_strdup("range"),$2,$3);
   13264             : }
   13265             : |  ROWS frame_extent opt_window_exclusion_clause
   13266             :  { 
   13267           0 :  $$ = cat_str(3,mm_strdup("rows"),$2,$3);
   13268             : }
   13269             : |  GROUPS frame_extent opt_window_exclusion_clause
   13270             :  { 
   13271           0 :  $$ = cat_str(3,mm_strdup("groups"),$2,$3);
   13272             : }
   13273             : | 
   13274             :  { 
   13275           0 :  $$=EMPTY; }
   13276             : ;
   13277             : 
   13278             : 
   13279             :  frame_extent:
   13280             :  frame_bound
   13281             :  { 
   13282           0 :  $$ = $1;
   13283             : }
   13284             : |  BETWEEN frame_bound AND frame_bound
   13285             :  { 
   13286           0 :  $$ = cat_str(4,mm_strdup("between"),$2,mm_strdup("and"),$4);
   13287             : }
   13288             : ;
   13289             : 
   13290             : 
   13291             :  frame_bound:
   13292             :  UNBOUNDED PRECEDING
   13293             :  { 
   13294           0 :  $$ = mm_strdup("unbounded preceding");
   13295             : }
   13296             : |  UNBOUNDED FOLLOWING
   13297             :  { 
   13298           0 :  $$ = mm_strdup("unbounded following");
   13299             : }
   13300             : |  CURRENT_P ROW
   13301             :  { 
   13302           0 :  $$ = mm_strdup("current row");
   13303             : }
   13304             : |  a_expr PRECEDING
   13305             :  { 
   13306           0 :  $$ = cat_str(2,$1,mm_strdup("preceding"));
   13307             : }
   13308             : |  a_expr FOLLOWING
   13309             :  { 
   13310           0 :  $$ = cat_str(2,$1,mm_strdup("following"));
   13311             : }
   13312             : ;
   13313             : 
   13314             : 
   13315             :  opt_window_exclusion_clause:
   13316             :  EXCLUDE CURRENT_P ROW
   13317             :  { 
   13318           0 :  $$ = mm_strdup("exclude current row");
   13319             : }
   13320             : |  EXCLUDE GROUP_P
   13321             :  { 
   13322           0 :  $$ = mm_strdup("exclude group");
   13323             : }
   13324             : |  EXCLUDE TIES
   13325             :  { 
   13326           0 :  $$ = mm_strdup("exclude ties");
   13327             : }
   13328             : |  EXCLUDE NO OTHERS
   13329             :  { 
   13330           0 :  $$ = mm_strdup("exclude no others");
   13331             : }
   13332             : | 
   13333             :  { 
   13334           0 :  $$=EMPTY; }
   13335             : ;
   13336             : 
   13337             : 
   13338             :  row:
   13339             :  ROW '(' expr_list ')'
   13340             :  { 
   13341           0 :  $$ = cat_str(3,mm_strdup("row ("),$3,mm_strdup(")"));
   13342             : }
   13343             : |  ROW '(' ')'
   13344             :  { 
   13345           0 :  $$ = mm_strdup("row ( )");
   13346             : }
   13347             : |  '(' expr_list ',' a_expr ')'
   13348             :  { 
   13349           0 :  $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(","),$4,mm_strdup(")"));
   13350             : }
   13351             : ;
   13352             : 
   13353             : 
   13354             :  explicit_row:
   13355             :  ROW '(' expr_list ')'
   13356             :  { 
   13357           0 :  $$ = cat_str(3,mm_strdup("row ("),$3,mm_strdup(")"));
   13358             : }
   13359             : |  ROW '(' ')'
   13360             :  { 
   13361           0 :  $$ = mm_strdup("row ( )");
   13362             : }
   13363             : ;
   13364             : 
   13365             : 
   13366             :  implicit_row:
   13367             :  '(' expr_list ',' a_expr ')'
   13368             :  { 
   13369           2 :  $$ = cat_str(5,mm_strdup("("),$2,mm_strdup(","),$4,mm_strdup(")"));
   13370             : }
   13371             : ;
   13372             : 
   13373             : 
   13374             :  sub_type:
   13375             :  ANY
   13376             :  { 
   13377           0 :  $$ = mm_strdup("any");
   13378             : }
   13379             : |  SOME
   13380             :  { 
   13381           0 :  $$ = mm_strdup("some");
   13382             : }
   13383             : |  ALL
   13384             :  { 
   13385           0 :  $$ = mm_strdup("all");
   13386             : }
   13387             : ;
   13388             : 
   13389             : 
   13390             :  all_Op:
   13391             :  Op
   13392             :  { 
   13393           0 :  $$ = $1;
   13394             : }
   13395             : |  MathOp
   13396             :  { 
   13397           0 :  $$ = $1;
   13398             : }
   13399             : ;
   13400             : 
   13401             : 
   13402             :  MathOp:
   13403             :  '+'
   13404             :  { 
   13405           0 :  $$ = mm_strdup("+");
   13406             : }
   13407             : |  '-'
   13408             :  { 
   13409           0 :  $$ = mm_strdup("-");
   13410             : }
   13411             : |  '*'
   13412             :  { 
   13413           0 :  $$ = mm_strdup("*");
   13414             : }
   13415             : |  '/'
   13416             :  { 
   13417           0 :  $$ = mm_strdup("/");
   13418             : }
   13419             : |  '%'
   13420             :  { 
   13421           0 :  $$ = mm_strdup("%");
   13422             : }
   13423             : |  '^'
   13424             :  { 
   13425           0 :  $$ = mm_strdup("^");
   13426             : }
   13427             : |  '<'
   13428             :  { 
   13429           0 :  $$ = mm_strdup("<");
   13430             : }
   13431             : |  '>'
   13432             :  { 
   13433           0 :  $$ = mm_strdup(">");
   13434             : }
   13435             : |  '='
   13436             :  { 
   13437           0 :  $$ = mm_strdup("=");
   13438             : }
   13439             : |  LESS_EQUALS
   13440             :  { 
   13441           0 :  $$ = mm_strdup("<=");
   13442             : }
   13443             : |  GREATER_EQUALS
   13444             :  { 
   13445           0 :  $$ = mm_strdup(">=");
   13446             : }
   13447             : |  NOT_EQUALS
   13448             :  { 
   13449           0 :  $$ = mm_strdup("<>");
   13450             : }
   13451             : ;
   13452             : 
   13453             : 
   13454             :  qual_Op:
   13455             :  Op
   13456             :  { 
   13457           4 :  $$ = $1;
   13458             : }
   13459             : |  OPERATOR '(' any_operator ')'
   13460             :  { 
   13461           0 :  $$ = cat_str(3,mm_strdup("operator ("),$3,mm_strdup(")"));
   13462             : }
   13463             : ;
   13464             : 
   13465             : 
   13466             :  qual_all_Op:
   13467             :  all_Op
   13468             :  { 
   13469           0 :  $$ = $1;
   13470             : }
   13471             : |  OPERATOR '(' any_operator ')'
   13472             :  { 
   13473           0 :  $$ = cat_str(3,mm_strdup("operator ("),$3,mm_strdup(")"));
   13474             : }
   13475             : ;
   13476             : 
   13477             : 
   13478             :  subquery_Op:
   13479             :  all_Op
   13480             :  { 
   13481           0 :  $$ = $1;
   13482             : }
   13483             : |  OPERATOR '(' any_operator ')'
   13484             :  { 
   13485           0 :  $$ = cat_str(3,mm_strdup("operator ("),$3,mm_strdup(")"));
   13486             : }
   13487             : |  LIKE
   13488             :  { 
   13489           0 :  $$ = mm_strdup("like");
   13490             : }
   13491             : |  NOT_LA LIKE
   13492             :  { 
   13493           0 :  $$ = mm_strdup("not like");
   13494             : }
   13495             : |  ILIKE
   13496             :  { 
   13497           0 :  $$ = mm_strdup("ilike");
   13498             : }
   13499             : |  NOT_LA ILIKE
   13500             :  { 
   13501           0 :  $$ = mm_strdup("not ilike");
   13502             : }
   13503             : ;
   13504             : 
   13505             : 
   13506             :  expr_list:
   13507             :  a_expr
   13508             :  { 
   13509         276 :  $$ = $1;
   13510             : }
   13511             : |  expr_list ',' a_expr
   13512             :  { 
   13513         498 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   13514             : }
   13515             : ;
   13516             : 
   13517             : 
   13518             :  func_arg_list:
   13519             :  func_arg_expr
   13520             :  { 
   13521           6 :  $$ = $1;
   13522             : }
   13523             : |  func_arg_list ',' func_arg_expr
   13524             :  { 
   13525           2 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   13526             : }
   13527             : ;
   13528             : 
   13529             : 
   13530             :  func_arg_expr:
   13531             :  a_expr
   13532             :  { 
   13533           8 :  $$ = $1;
   13534             : }
   13535             : |  param_name COLON_EQUALS a_expr
   13536             :  { 
   13537           0 :  $$ = cat_str(3,$1,mm_strdup(":="),$3);
   13538             : }
   13539             : |  param_name EQUALS_GREATER a_expr
   13540             :  { 
   13541           0 :  $$ = cat_str(3,$1,mm_strdup("=>"),$3);
   13542             : }
   13543             : ;
   13544             : 
   13545             : 
   13546             :  func_arg_list_opt:
   13547             :  func_arg_list
   13548             :  { 
   13549           0 :  $$ = $1;
   13550             : }
   13551             : | 
   13552             :  { 
   13553           0 :  $$=EMPTY; }
   13554             : ;
   13555             : 
   13556             : 
   13557             :  type_list:
   13558             :  Typename
   13559             :  { 
   13560          10 :  $$ = $1;
   13561             : }
   13562             : |  type_list ',' Typename
   13563             :  { 
   13564          10 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   13565             : }
   13566             : ;
   13567             : 
   13568             : 
   13569             :  array_expr:
   13570             :  '[' expr_list ']'
   13571             :  { 
   13572           0 :  $$ = cat_str(3,mm_strdup("["),$2,mm_strdup("]"));
   13573             : }
   13574             : |  '[' array_expr_list ']'
   13575             :  { 
   13576           0 :  $$ = cat_str(3,mm_strdup("["),$2,mm_strdup("]"));
   13577             : }
   13578             : |  '[' ']'
   13579             :  { 
   13580           0 :  $$ = mm_strdup("[ ]");
   13581             : }
   13582             : ;
   13583             : 
   13584             : 
   13585             :  array_expr_list:
   13586             :  array_expr
   13587             :  { 
   13588           0 :  $$ = $1;
   13589             : }
   13590             : |  array_expr_list ',' array_expr
   13591             :  { 
   13592           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   13593             : }
   13594             : ;
   13595             : 
   13596             : 
   13597             :  extract_list:
   13598             :  extract_arg FROM a_expr
   13599             :  { 
   13600           0 :  $$ = cat_str(3,$1,mm_strdup("from"),$3);
   13601             : }
   13602             : ;
   13603             : 
   13604             : 
   13605             :  extract_arg:
   13606             :  ecpg_ident
   13607             :  { 
   13608           0 :  $$ = $1;
   13609             : }
   13610             : |  YEAR_P
   13611             :  { 
   13612           0 :  $$ = mm_strdup("year");
   13613             : }
   13614             : |  MONTH_P
   13615             :  { 
   13616           0 :  $$ = mm_strdup("month");
   13617             : }
   13618             : |  DAY_P
   13619             :  { 
   13620           0 :  $$ = mm_strdup("day");
   13621             : }
   13622             : |  HOUR_P
   13623             :  { 
   13624           0 :  $$ = mm_strdup("hour");
   13625             : }
   13626             : |  MINUTE_P
   13627             :  { 
   13628           0 :  $$ = mm_strdup("minute");
   13629             : }
   13630             : |  SECOND_P
   13631             :  { 
   13632           0 :  $$ = mm_strdup("second");
   13633             : }
   13634             : |  ecpg_sconst
   13635             :  { 
   13636           0 :  $$ = $1;
   13637             : }
   13638             : ;
   13639             : 
   13640             : 
   13641             :  unicode_normal_form:
   13642             :  NFC
   13643             :  { 
   13644           0 :  $$ = mm_strdup("nfc");
   13645             : }
   13646             : |  NFD
   13647             :  { 
   13648           0 :  $$ = mm_strdup("nfd");
   13649             : }
   13650             : |  NFKC
   13651             :  { 
   13652           0 :  $$ = mm_strdup("nfkc");
   13653             : }
   13654             : |  NFKD
   13655             :  { 
   13656           0 :  $$ = mm_strdup("nfkd");
   13657             : }
   13658             : ;
   13659             : 
   13660             : 
   13661             :  overlay_list:
   13662             :  a_expr PLACING a_expr FROM a_expr FOR a_expr
   13663             :  { 
   13664           0 :  $$ = cat_str(7,$1,mm_strdup("placing"),$3,mm_strdup("from"),$5,mm_strdup("for"),$7);
   13665             : }
   13666             : |  a_expr PLACING a_expr FROM a_expr
   13667             :  { 
   13668           0 :  $$ = cat_str(5,$1,mm_strdup("placing"),$3,mm_strdup("from"),$5);
   13669             : }
   13670             : ;
   13671             : 
   13672             : 
   13673             :  position_list:
   13674             :  b_expr IN_P b_expr
   13675             :  { 
   13676           0 :  $$ = cat_str(3,$1,mm_strdup("in"),$3);
   13677             : }
   13678             : ;
   13679             : 
   13680             : 
   13681             :  substr_list:
   13682             :  a_expr FROM a_expr FOR a_expr
   13683             :  { 
   13684           0 :  $$ = cat_str(5,$1,mm_strdup("from"),$3,mm_strdup("for"),$5);
   13685             : }
   13686             : |  a_expr FOR a_expr FROM a_expr
   13687             :  { 
   13688           0 :  $$ = cat_str(5,$1,mm_strdup("for"),$3,mm_strdup("from"),$5);
   13689             : }
   13690             : |  a_expr FROM a_expr
   13691             :  { 
   13692           0 :  $$ = cat_str(3,$1,mm_strdup("from"),$3);
   13693             : }
   13694             : |  a_expr FOR a_expr
   13695             :  { 
   13696           0 :  $$ = cat_str(3,$1,mm_strdup("for"),$3);
   13697             : }
   13698             : |  a_expr SIMILAR a_expr ESCAPE a_expr
   13699             :  { 
   13700           0 :  $$ = cat_str(5,$1,mm_strdup("similar"),$3,mm_strdup("escape"),$5);
   13701             : }
   13702             : ;
   13703             : 
   13704             : 
   13705             :  trim_list:
   13706             :  a_expr FROM expr_list
   13707             :  { 
   13708           0 :  $$ = cat_str(3,$1,mm_strdup("from"),$3);
   13709             : }
   13710             : |  FROM expr_list
   13711             :  { 
   13712           0 :  $$ = cat_str(2,mm_strdup("from"),$2);
   13713             : }
   13714             : |  expr_list
   13715             :  { 
   13716           0 :  $$ = $1;
   13717             : }
   13718             : ;
   13719             : 
   13720             : 
   13721             :  in_expr:
   13722             :  select_with_parens
   13723             :  { 
   13724           0 :  $$ = $1;
   13725             : }
   13726             : |  '(' expr_list ')'
   13727             :  { 
   13728           0 :  $$ = cat_str(3,mm_strdup("("),$2,mm_strdup(")"));
   13729             : }
   13730             : ;
   13731             : 
   13732             : 
   13733             :  case_expr:
   13734             :  CASE case_arg when_clause_list case_default END_P
   13735             :  { 
   13736           0 :  $$ = cat_str(5,mm_strdup("case"),$2,$3,$4,mm_strdup("end"));
   13737             : }
   13738             : ;
   13739             : 
   13740             : 
   13741             :  when_clause_list:
   13742             :  when_clause
   13743             :  { 
   13744           0 :  $$ = $1;
   13745             : }
   13746             : |  when_clause_list when_clause
   13747             :  { 
   13748           0 :  $$ = cat_str(2,$1,$2);
   13749             : }
   13750             : ;
   13751             : 
   13752             : 
   13753             :  when_clause:
   13754             :  WHEN a_expr THEN a_expr
   13755             :  { 
   13756           0 :  $$ = cat_str(4,mm_strdup("when"),$2,mm_strdup("then"),$4);
   13757             : }
   13758             : ;
   13759             : 
   13760             : 
   13761             :  case_default:
   13762             :  ELSE a_expr
   13763             :  { 
   13764           0 :  $$ = cat_str(2,mm_strdup("else"),$2);
   13765             : }
   13766             : | 
   13767             :  { 
   13768           0 :  $$=EMPTY; }
   13769             : ;
   13770             : 
   13771             : 
   13772             :  case_arg:
   13773             :  a_expr
   13774             :  { 
   13775           0 :  $$ = $1;
   13776             : }
   13777             : | 
   13778             :  { 
   13779           0 :  $$=EMPTY; }
   13780             : ;
   13781             : 
   13782             : 
   13783             :  columnref:
   13784             :  ColId
   13785             :  { 
   13786         314 :  $$ = $1;
   13787             : }
   13788             : |  ColId indirection
   13789             :  { 
   13790           0 :  $$ = cat_str(2,$1,$2);
   13791             : }
   13792             : ;
   13793             : 
   13794             : 
   13795             :  indirection_el:
   13796             :  '.' attr_name
   13797             :  { 
   13798           0 :  $$ = cat_str(2,mm_strdup("."),$2);
   13799             : }
   13800             : |  '.' '*'
   13801             :  { 
   13802           0 :  $$ = mm_strdup(". *");
   13803             : }
   13804             : |  '[' a_expr ']'
   13805             :  { 
   13806           0 :  $$ = cat_str(3,mm_strdup("["),$2,mm_strdup("]"));
   13807             : }
   13808             : |  '[' opt_slice_bound ':' opt_slice_bound ']'
   13809             :  { 
   13810           0 :  $$ = cat_str(5,mm_strdup("["),$2,mm_strdup(":"),$4,mm_strdup("]"));
   13811             : }
   13812             : ;
   13813             : 
   13814             : 
   13815             :  opt_slice_bound:
   13816             :  a_expr
   13817             :  { 
   13818           0 :  $$ = $1;
   13819             : }
   13820             : | 
   13821             :  { 
   13822           0 :  $$=EMPTY; }
   13823             : ;
   13824             : 
   13825             : 
   13826             :  indirection:
   13827             :  indirection_el
   13828             :  { 
   13829           0 :  $$ = $1;
   13830             : }
   13831             : |  indirection indirection_el
   13832             :  { 
   13833           0 :  $$ = cat_str(2,$1,$2);
   13834             : }
   13835             : ;
   13836             : 
   13837             : 
   13838             :  opt_indirection:
   13839             : 
   13840             :  { 
   13841         380 :  $$=EMPTY; }
   13842             : |  opt_indirection indirection_el
   13843             :  { 
   13844           0 :  $$ = cat_str(2,$1,$2);
   13845             : }
   13846             : ;
   13847             : 
   13848             : 
   13849             :  opt_asymmetric:
   13850             :  ASYMMETRIC
   13851             :  { 
   13852           0 :  $$ = mm_strdup("asymmetric");
   13853             : }
   13854             : | 
   13855             :  { 
   13856           0 :  $$=EMPTY; }
   13857             : ;
   13858             : 
   13859             : 
   13860             :  json_passing_clause_opt:
   13861             :  PASSING json_arguments
   13862             :  { 
   13863           0 :  $$ = cat_str(2,mm_strdup("passing"),$2);
   13864             : }
   13865             : | 
   13866             :  { 
   13867           4 :  $$=EMPTY; }
   13868             : ;
   13869             : 
   13870             : 
   13871             :  json_arguments:
   13872             :  json_argument
   13873             :  { 
   13874           0 :  $$ = $1;
   13875             : }
   13876             : |  json_arguments ',' json_argument
   13877             :  { 
   13878           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   13879             : }
   13880             : ;
   13881             : 
   13882             : 
   13883             :  json_argument:
   13884             :  json_value_expr AS ColLabel
   13885             :  { 
   13886           0 :  $$ = cat_str(3,$1,mm_strdup("as"),$3);
   13887             : }
   13888             : ;
   13889             : 
   13890             : 
   13891             :  json_wrapper_behavior:
   13892             :  WITHOUT WRAPPER
   13893             :  { 
   13894           0 :  $$ = mm_strdup("without wrapper");
   13895             : }
   13896             : |  WITHOUT ARRAY WRAPPER
   13897             :  { 
   13898           0 :  $$ = mm_strdup("without array wrapper");
   13899             : }
   13900             : |  WITH WRAPPER
   13901             :  { 
   13902           0 :  $$ = mm_strdup("with wrapper");
   13903             : }
   13904             : |  WITH ARRAY WRAPPER
   13905             :  { 
   13906           0 :  $$ = mm_strdup("with array wrapper");
   13907             : }
   13908             : |  WITH CONDITIONAL ARRAY WRAPPER
   13909             :  { 
   13910           0 :  $$ = mm_strdup("with conditional array wrapper");
   13911             : }
   13912             : |  WITH UNCONDITIONAL ARRAY WRAPPER
   13913             :  { 
   13914           0 :  $$ = mm_strdup("with unconditional array wrapper");
   13915             : }
   13916             : |  WITH CONDITIONAL WRAPPER
   13917             :  { 
   13918           0 :  $$ = mm_strdup("with conditional wrapper");
   13919             : }
   13920             : |  WITH UNCONDITIONAL WRAPPER
   13921             :  { 
   13922           0 :  $$ = mm_strdup("with unconditional wrapper");
   13923             : }
   13924             : | 
   13925             :  { 
   13926           4 :  $$=EMPTY; }
   13927             : ;
   13928             : 
   13929             : 
   13930             :  json_behavior:
   13931             :  DEFAULT a_expr
   13932             :  { 
   13933           0 :  $$ = cat_str(2,mm_strdup("default"),$2);
   13934             : }
   13935             : |  json_behavior_type
   13936             :  { 
   13937           0 :  $$ = $1;
   13938             : }
   13939             : ;
   13940             : 
   13941             : 
   13942             :  json_behavior_type:
   13943             :  ERROR_P
   13944             :  { 
   13945           0 :  $$ = mm_strdup("error");
   13946             : }
   13947             : |  NULL_P
   13948             :  { 
   13949           0 :  $$ = mm_strdup("null");
   13950             : }
   13951             : |  TRUE_P
   13952             :  { 
   13953           0 :  $$ = mm_strdup("true");
   13954             : }
   13955             : |  FALSE_P
   13956             :  { 
   13957           0 :  $$ = mm_strdup("false");
   13958             : }
   13959             : |  UNKNOWN
   13960             :  { 
   13961           0 :  $$ = mm_strdup("unknown");
   13962             : }
   13963             : |  EMPTY_P ARRAY
   13964             :  { 
   13965           0 :  $$ = mm_strdup("empty array");
   13966             : }
   13967             : |  EMPTY_P OBJECT_P
   13968             :  { 
   13969           0 :  $$ = mm_strdup("empty object");
   13970             : }
   13971             : |  EMPTY_P
   13972             :  { 
   13973           0 :  $$ = mm_strdup("empty");
   13974             : }
   13975             : ;
   13976             : 
   13977             : 
   13978             :  json_behavior_clause_opt:
   13979             :  json_behavior ON EMPTY_P
   13980             :  { 
   13981           0 :  $$ = cat_str(2,$1,mm_strdup("on empty"));
   13982             : }
   13983             : |  json_behavior ON ERROR_P
   13984             :  { 
   13985           0 :  $$ = cat_str(2,$1,mm_strdup("on error"));
   13986             : }
   13987             : |  json_behavior ON EMPTY_P json_behavior ON ERROR_P
   13988             :  { 
   13989           0 :  $$ = cat_str(4,$1,mm_strdup("on empty"),$4,mm_strdup("on error"));
   13990             : }
   13991             : | 
   13992             :  { 
   13993           4 :  $$=EMPTY; }
   13994             : ;
   13995             : 
   13996             : 
   13997             :  json_on_error_clause_opt:
   13998             :  json_behavior ON ERROR_P
   13999             :  { 
   14000           0 :  $$ = cat_str(2,$1,mm_strdup("on error"));
   14001             : }
   14002             : | 
   14003             :  { 
   14004           4 :  $$=EMPTY; }
   14005             : ;
   14006             : 
   14007             : 
   14008             :  json_value_expr:
   14009             :  a_expr json_format_clause_opt
   14010             :  { 
   14011          46 :  $$ = cat_str(2,$1,$2);
   14012             : }
   14013             : ;
   14014             : 
   14015             : 
   14016             :  json_format_clause:
   14017             :  FORMAT_LA JSON ENCODING name
   14018             :  { 
   14019           2 :  $$ = cat_str(2,mm_strdup("format json encoding"),$4);
   14020             : }
   14021             : |  FORMAT_LA JSON
   14022             :  { 
   14023           8 :  $$ = mm_strdup("format json");
   14024             : }
   14025             : ;
   14026             : 
   14027             : 
   14028             :  json_format_clause_opt:
   14029             :  json_format_clause
   14030             :  { 
   14031          10 :  $$ = $1;
   14032             : }
   14033             : | 
   14034             :  { 
   14035          50 :  $$=EMPTY; }
   14036             : ;
   14037             : 
   14038             : 
   14039             :  json_quotes_clause_opt:
   14040             :  KEEP QUOTES ON SCALAR STRING_P
   14041             :  { 
   14042           0 :  $$ = mm_strdup("keep quotes on scalar string");
   14043             : }
   14044             : |  KEEP QUOTES
   14045             :  { 
   14046           0 :  $$ = mm_strdup("keep quotes");
   14047             : }
   14048             : |  OMIT QUOTES ON SCALAR STRING_P
   14049             :  { 
   14050           0 :  $$ = mm_strdup("omit quotes on scalar string");
   14051             : }
   14052             : |  OMIT QUOTES
   14053             :  { 
   14054           0 :  $$ = mm_strdup("omit quotes");
   14055             : }
   14056             : | 
   14057             :  { 
   14058           4 :  $$=EMPTY; }
   14059             : ;
   14060             : 
   14061             : 
   14062             :  json_returning_clause_opt:
   14063             :  RETURNING Typename json_format_clause_opt
   14064             :  { 
   14065          14 :  $$ = cat_str(3,mm_strdup("returning"),$2,$3);
   14066             : }
   14067             : | 
   14068             :  { 
   14069          12 :  $$=EMPTY; }
   14070             : ;
   14071             : 
   14072             : 
   14073             :  json_predicate_type_constraint:
   14074             :  JSON %prec UNBOUNDED
   14075             :  { 
   14076           8 :  $$ = mm_strdup("json");
   14077             : }
   14078             : |  JSON VALUE_P
   14079             :  { 
   14080           2 :  $$ = mm_strdup("json value");
   14081             : }
   14082             : |  JSON ARRAY
   14083             :  { 
   14084           2 :  $$ = mm_strdup("json array");
   14085             : }
   14086             : |  JSON OBJECT_P
   14087             :  { 
   14088           2 :  $$ = mm_strdup("json object");
   14089             : }
   14090             : |  JSON SCALAR
   14091             :  { 
   14092           2 :  $$ = mm_strdup("json scalar");
   14093             : }
   14094             : ;
   14095             : 
   14096             : 
   14097             :  json_key_uniqueness_constraint_opt:
   14098             :  WITH UNIQUE KEYS
   14099             :  { 
   14100           6 :  $$ = mm_strdup("with unique keys");
   14101             : }
   14102             : |  WITH UNIQUE %prec UNBOUNDED
   14103             :  { 
   14104           2 :  $$ = mm_strdup("with unique");
   14105             : }
   14106             : |  WITHOUT UNIQUE KEYS
   14107             :  { 
   14108           4 :  $$ = mm_strdup("without unique keys");
   14109             : }
   14110             : |  WITHOUT UNIQUE %prec UNBOUNDED
   14111             :  { 
   14112           2 :  $$ = mm_strdup("without unique");
   14113             : }
   14114             : |  %prec UNBOUNDED
   14115             :  { 
   14116          24 :  $$=EMPTY; }
   14117             : ;
   14118             : 
   14119             : 
   14120             :  json_name_and_value_list:
   14121             :  json_name_and_value
   14122             :  { 
   14123           6 :  $$ = $1;
   14124             : }
   14125             : |  json_name_and_value_list ',' json_name_and_value
   14126             :  { 
   14127           8 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   14128             : }
   14129             : ;
   14130             : 
   14131             : 
   14132             :  json_name_and_value:
   14133             :  c_expr VALUE_P json_value_expr
   14134             :  { 
   14135           0 :  $$ = cat_str(3,$1,mm_strdup("value"),$3);
   14136             : }
   14137             : |  a_expr ':' json_value_expr
   14138             :  { 
   14139          14 :  $$ = cat_str(3,$1,mm_strdup(":"),$3);
   14140             : }
   14141             : ;
   14142             : 
   14143             : 
   14144             :  json_object_constructor_null_clause_opt:
   14145             :  NULL_P ON NULL_P
   14146             :  { 
   14147           0 :  $$ = mm_strdup("null on null");
   14148             : }
   14149             : |  ABSENT ON NULL_P
   14150             :  { 
   14151           4 :  $$ = mm_strdup("absent on null");
   14152             : }
   14153             : | 
   14154             :  { 
   14155           2 :  $$=EMPTY; }
   14156             : ;
   14157             : 
   14158             : 
   14159             :  json_array_constructor_null_clause_opt:
   14160             :  NULL_P ON NULL_P
   14161             :  { 
   14162           0 :  $$ = mm_strdup("null on null");
   14163             : }
   14164             : |  ABSENT ON NULL_P
   14165             :  { 
   14166           0 :  $$ = mm_strdup("absent on null");
   14167             : }
   14168             : | 
   14169             :  { 
   14170           0 :  $$=EMPTY; }
   14171             : ;
   14172             : 
   14173             : 
   14174             :  json_value_expr_list:
   14175             :  json_value_expr
   14176             :  { 
   14177           0 :  $$ = $1;
   14178             : }
   14179             : |  json_value_expr_list ',' json_value_expr
   14180             :  { 
   14181           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   14182             : }
   14183             : ;
   14184             : 
   14185             : 
   14186             :  json_aggregate_func:
   14187             :  JSON_OBJECTAGG '(' json_name_and_value json_object_constructor_null_clause_opt json_key_uniqueness_constraint_opt json_returning_clause_opt ')'
   14188             :  { 
   14189           0 :  $$ = cat_str(6,mm_strdup("json_objectagg ("),$3,$4,$5,$6,mm_strdup(")"));
   14190             : }
   14191             : |  JSON_ARRAYAGG '(' json_value_expr json_array_aggregate_order_by_clause_opt json_array_constructor_null_clause_opt json_returning_clause_opt ')'
   14192             :  { 
   14193           0 :  $$ = cat_str(6,mm_strdup("json_arrayagg ("),$3,$4,$5,$6,mm_strdup(")"));
   14194             : }
   14195             : ;
   14196             : 
   14197             : 
   14198             :  json_array_aggregate_order_by_clause_opt:
   14199             :  ORDER BY sortby_list
   14200             :  { 
   14201           0 :  $$ = cat_str(2,mm_strdup("order by"),$3);
   14202             : }
   14203             : | 
   14204             :  { 
   14205           0 :  $$=EMPTY; }
   14206             : ;
   14207             : 
   14208             : 
   14209             :  opt_target_list:
   14210             :  target_list
   14211             :  { 
   14212         248 :  $$ = $1;
   14213             : }
   14214             : | 
   14215             :  { 
   14216           0 :  $$=EMPTY; }
   14217             : ;
   14218             : 
   14219             : 
   14220             :  target_list:
   14221             :  target_el
   14222             :  { 
   14223         252 :  $$ = $1;
   14224             : }
   14225             : |  target_list ',' target_el
   14226             :  { 
   14227         150 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   14228             : }
   14229             : ;
   14230             : 
   14231             : 
   14232             :  target_el:
   14233             :  a_expr AS ColLabel
   14234             :  { 
   14235           6 :  $$ = cat_str(3,$1,mm_strdup("as"),$3);
   14236             : }
   14237             : |  a_expr BareColLabel
   14238             :  { 
   14239          16 :  $$ = cat_str(2,$1,$2);
   14240             : }
   14241             : |  a_expr
   14242             :  { 
   14243         328 :  $$ = $1;
   14244             : }
   14245             : |  '*'
   14246             :  { 
   14247          52 :  $$ = mm_strdup("*");
   14248             : }
   14249             : ;
   14250             : 
   14251             : 
   14252             :  qualified_name_list:
   14253             :  qualified_name
   14254             :  { 
   14255           0 :  $$ = $1;
   14256             : }
   14257             : |  qualified_name_list ',' qualified_name
   14258             :  { 
   14259           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   14260             : }
   14261             : ;
   14262             : 
   14263             : 
   14264             :  qualified_name:
   14265             :  ColId
   14266             :  { 
   14267         556 :  $$ = $1;
   14268             : }
   14269             : |  ColId indirection
   14270             :  { 
   14271           0 :  $$ = cat_str(2,$1,$2);
   14272             : }
   14273             : ;
   14274             : 
   14275             : 
   14276             :  name_list:
   14277             :  name
   14278             :  { 
   14279           8 :  $$ = $1;
   14280             : }
   14281             : |  name_list ',' name
   14282             :  { 
   14283           2 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   14284             : }
   14285             : ;
   14286             : 
   14287             : 
   14288             :  name:
   14289             :  ColId
   14290             :  { 
   14291        1366 :  $$ = $1;
   14292             : }
   14293             : ;
   14294             : 
   14295             : 
   14296             :  attr_name:
   14297             :  ColLabel
   14298             :  { 
   14299           0 :  $$ = $1;
   14300             : }
   14301             : ;
   14302             : 
   14303             : 
   14304             :  file_name:
   14305             :  ecpg_sconst
   14306             :  { 
   14307           0 :  $$ = $1;
   14308             : }
   14309             : ;
   14310             : 
   14311             : 
   14312             :  func_name:
   14313             :  type_function_name
   14314             :  { 
   14315          50 :  $$ = $1;
   14316             : }
   14317             : |  ColId indirection
   14318             :  { 
   14319           0 :  $$ = cat_str(2,$1,$2);
   14320             : }
   14321             : ;
   14322             : 
   14323             : 
   14324             :  AexprConst:
   14325             :  Iconst
   14326             :  { 
   14327         326 :  $$ = $1;
   14328             : }
   14329             : |  ecpg_fconst
   14330             :  { 
   14331          42 :  $$ = $1;
   14332             : }
   14333             : |  ecpg_sconst
   14334             :  { 
   14335         310 :  $$ = $1;
   14336             : }
   14337             : |  ecpg_bconst
   14338             :  { 
   14339           2 :  $$ = $1;
   14340             : }
   14341             : |  ecpg_xconst
   14342             :  { 
   14343           2 :  $$ = $1;
   14344             : }
   14345             : |  func_name ecpg_sconst
   14346             :  { 
   14347           4 :  $$ = cat_str(2,$1,$2);
   14348             : }
   14349             : |  func_name '(' func_arg_list opt_sort_clause ')' ecpg_sconst
   14350             :  { 
   14351           0 :  $$ = cat_str(6,$1,mm_strdup("("),$3,$4,mm_strdup(")"),$6);
   14352             : }
   14353             : |  ConstTypename ecpg_sconst
   14354             :  { 
   14355           0 :  $$ = cat_str(2,$1,$2);
   14356             : }
   14357             : |  ConstInterval ecpg_sconst opt_interval
   14358             :  { 
   14359           0 :  $$ = cat_str(3,$1,$2,$3);
   14360             : }
   14361             : |  ConstInterval '(' Iconst ')' ecpg_sconst
   14362             :  { 
   14363           0 :  $$ = cat_str(5,$1,mm_strdup("("),$3,mm_strdup(")"),$5);
   14364             : }
   14365             : |  TRUE_P
   14366             :  { 
   14367           6 :  $$ = mm_strdup("true");
   14368             : }
   14369             : |  FALSE_P
   14370             :  { 
   14371           4 :  $$ = mm_strdup("false");
   14372             : }
   14373             : |  NULL_P
   14374             :  { 
   14375          64 :  $$ = mm_strdup("null");
   14376             : }
   14377         182 :     | civar         { $$ = $1; }
   14378           6 :     | civarind      { $$ = $1; }
   14379             : ;
   14380             : 
   14381             : 
   14382             :  Iconst:
   14383             :  ICONST
   14384        2374 :     { $$ = make_name(); }
   14385             : ;
   14386             : 
   14387             : 
   14388             :  SignedIconst:
   14389             :  Iconst
   14390             :  { 
   14391          44 :  $$ = $1;
   14392             : }
   14393          20 :     | civar { $$ = $1; }
   14394             : |  '+' Iconst
   14395             :  { 
   14396           0 :  $$ = cat_str(2,mm_strdup("+"),$2);
   14397             : }
   14398             : |  '-' Iconst
   14399             :  { 
   14400           0 :  $$ = cat_str(2,mm_strdup("-"),$2);
   14401             : }
   14402             : ;
   14403             : 
   14404             : 
   14405             :  RoleId:
   14406             :  RoleSpec
   14407             :  { 
   14408          54 :  $$ = $1;
   14409             : }
   14410             : ;
   14411             : 
   14412             : 
   14413             :  RoleSpec:
   14414             :  NonReservedWord
   14415             :  { 
   14416          60 :  $$ = $1;
   14417             : }
   14418             : |  CURRENT_ROLE
   14419             :  { 
   14420           0 :  $$ = mm_strdup("current_role");
   14421             : }
   14422             : |  CURRENT_USER
   14423             :  { 
   14424           0 :  $$ = mm_strdup("current_user");
   14425             : }
   14426             : |  SESSION_USER
   14427             :  { 
   14428           0 :  $$ = mm_strdup("session_user");
   14429             : }
   14430             : ;
   14431             : 
   14432             : 
   14433             :  role_list:
   14434             :  RoleSpec
   14435             :  { 
   14436           0 :  $$ = $1;
   14437             : }
   14438             : |  role_list ',' RoleSpec
   14439             :  { 
   14440           0 :  $$ = cat_str(3,$1,mm_strdup(","),$3);
   14441             : }
   14442             : ;
   14443             : 
   14444             : 
   14445             :  NonReservedWord:
   14446             :  ecpg_ident
   14447             :  { 
   14448          86 :  $$ = $1;
   14449             : }
   14450             : |  unreserved_keyword
   14451             :  { 
   14452           6 :  $$ = $1;
   14453             : }
   14454             : |  col_name_keyword
   14455             :  { 
   14456           0 :  $$ = $1;
   14457             : }
   14458             : |  type_func_name_keyword
   14459             :  { 
   14460           0 :  $$ = $1;
   14461             : }
   14462             : ;
   14463             : 
   14464             : 
   14465             :  BareColLabel:
   14466             :  ecpg_ident
   14467             :  { 
   14468          16 :  $$ = $1;
   14469             : }
   14470             : |  bare_label_keyword
   14471             :  { 
   14472           0 :  $$ = $1;
   14473             : }
   14474             : ;
   14475             : 
   14476             : 
   14477             :  unreserved_keyword:
   14478             :  ABORT_P
   14479             :  { 
   14480           0 :  $$ = mm_strdup("abort");
   14481             : }
   14482             : |  ABSENT
   14483             :  { 
   14484           0 :  $$ = mm_strdup("absent");
   14485             : }
   14486             : |  ABSOLUTE_P
   14487             :  { 
   14488           0 :  $$ = mm_strdup("absolute");
   14489             : }
   14490             : |  ACCESS
   14491             :  { 
   14492           2 :  $$ = mm_strdup("access");
   14493             : }
   14494             : |  ACTION
   14495             :  { 
   14496           0 :  $$ = mm_strdup("action");
   14497             : }
   14498             : |  ADD_P
   14499             :  { 
   14500           0 :  $$ = mm_strdup("add");
   14501             : }
   14502             : |  ADMIN
   14503             :  { 
   14504           0 :  $$ = mm_strdup("admin");
   14505             : }
   14506             : |  AFTER
   14507             :  { 
   14508           0 :  $$ = mm_strdup("after");
   14509             : }
   14510             : |  AGGREGATE
   14511             :  { 
   14512           0 :  $$ = mm_strdup("aggregate");
   14513             : }
   14514             : |  ALSO
   14515             :  { 
   14516           0 :  $$ = mm_strdup("also");
   14517             : }
   14518             : |  ALTER
   14519             :  { 
   14520           0 :  $$ = mm_strdup("alter");
   14521             : }
   14522             : |  ALWAYS
   14523             :  { 
   14524           0 :  $$ = mm_strdup("always");
   14525             : }
   14526             : |  ASENSITIVE
   14527             :  { 
   14528           0 :  $$ = mm_strdup("asensitive");
   14529             : }
   14530             : |  ASSERTION
   14531             :  { 
   14532           0 :  $$ = mm_strdup("assertion");
   14533             : }
   14534             : |  ASSIGNMENT
   14535             :  { 
   14536           0 :  $$ = mm_strdup("assignment");
   14537             : }
   14538             : |  AT
   14539             :  { 
   14540           0 :  $$ = mm_strdup("at");
   14541             : }
   14542             : |  ATOMIC
   14543             :  { 
   14544           0 :  $$ = mm_strdup("atomic");
   14545             : }
   14546             : |  ATTACH
   14547             :  { 
   14548           0 :  $$ = mm_strdup("attach");
   14549             : }
   14550             : |  ATTRIBUTE
   14551             :  { 
   14552           0 :  $$ = mm_strdup("attribute");
   14553             : }
   14554             : |  BACKWARD
   14555             :  { 
   14556           0 :  $$ = mm_strdup("backward");
   14557             : }
   14558             : |  BEFORE
   14559             :  { 
   14560           0 :  $$ = mm_strdup("before");
   14561             : }
   14562             : |  BEGIN_P
   14563             :  { 
   14564           0 :  $$ = mm_strdup("begin");
   14565             : }
   14566             : |  BREADTH
   14567             :  { 
   14568           0 :  $$ = mm_strdup("breadth");
   14569             : }
   14570             : |  BY
   14571             :  { 
   14572           0 :  $$ = mm_strdup("by");
   14573             : }
   14574             : |  CACHE
   14575             :  { 
   14576           0 :  $$ = mm_strdup("cache");
   14577             : }
   14578             : |  CALL
   14579             :  { 
   14580           0 :  $$ = mm_strdup("call");
   14581             : }
   14582             : |  CALLED
   14583             :  { 
   14584           0 :  $$ = mm_strdup("called");
   14585             : }
   14586             : |  CASCADE
   14587             :  { 
   14588           0 :  $$ = mm_strdup("cascade");
   14589             : }
   14590             : |  CASCADED
   14591             :  { 
   14592           0 :  $$ = mm_strdup("cascaded");
   14593             : }
   14594             : |  CATALOG_P
   14595             :  { 
   14596           0 :  $$ = mm_strdup("catalog");
   14597             : }
   14598             : |  CHAIN
   14599             :  { 
   14600           0 :  $$ = mm_strdup("chain");
   14601             : }
   14602             : |  CHARACTERISTICS
   14603             :  { 
   14604           0 :  $$ = mm_strdup("characteristics");
   14605             : }
   14606             : |  CHECKPOINT
   14607             :  { 
   14608           0 :  $$ = mm_strdup("checkpoint");
   14609             : }
   14610             : |  CLASS
   14611             :  { 
   14612           0 :  $$ = mm_strdup("class");
   14613             : }
   14614             : |  CLOSE
   14615             :  { 
   14616           0 :  $$ = mm_strdup("close");
   14617             : }
   14618             : |  CLUSTER
   14619             :  { 
   14620           0 :  $$ = mm_strdup("cluster");
   14621             : }
   14622             : |  COLUMNS
   14623             :  { 
   14624           0 :  $$ = mm_strdup("columns");
   14625             : }
   14626             : |  COMMENT
   14627             :  { 
   14628           2 :  $$ = mm_strdup("comment");
   14629             : }
   14630             : |  COMMENTS
   14631             :  { 
   14632           0 :  $$ = mm_strdup("comments");
   14633             : }
   14634             : |  COMMIT
   14635             :  { 
   14636           0 :  $$ = mm_strdup("commit");
   14637             : }
   14638             : |  COMMITTED
   14639             :  { 
   14640           0 :  $$ = mm_strdup("committed");
   14641             : }
   14642             : |  COMPRESSION
   14643             :  { 
   14644           0 :  $$ = mm_strdup("compression");
   14645             : }
   14646             : |  CONDITIONAL
   14647             :  { 
   14648           0 :  $$ = mm_strdup("conditional");
   14649             : }
   14650             : |  CONFIGURATION
   14651             :  { 
   14652           0 :  $$ = mm_strdup("configuration");
   14653             : }
   14654             : |  CONFLICT
   14655             :  { 
   14656           0 :  $$ = mm_strdup("conflict");
   14657             : }
   14658             : |  CONSTRAINTS
   14659             :  { 
   14660           0 :  $$ = mm_strdup("constraints");
   14661             : }
   14662             : |  CONTENT_P
   14663             :  { 
   14664           0 :  $$ = mm_strdup("content");
   14665             : }
   14666             : |  CONTINUE_P
   14667             :  { 
   14668           0 :  $$ = mm_strdup("continue");
   14669             : }
   14670             : |  CONVERSION_P
   14671             :  { 
   14672           0 :  $$ = mm_strdup("conversion");
   14673             : }
   14674             : |  COPY
   14675             :  { 
   14676           0 :  $$ = mm_strdup("copy");
   14677             : }
   14678             : |  COST
   14679             :  { 
   14680           0 :  $$ = mm_strdup("cost");
   14681             : }
   14682             : |  CSV
   14683             :  { 
   14684           0 :  $$ = mm_strdup("csv");
   14685             : }
   14686             : |  CUBE
   14687             :  { 
   14688           0 :  $$ = mm_strdup("cube");
   14689             : }
   14690             : |  CURSOR
   14691             :  { 
   14692           0 :  $$ = mm_strdup("cursor");
   14693             : }
   14694             : |  CYCLE
   14695             :  { 
   14696           0 :  $$ = mm_strdup("cycle");
   14697             : }
   14698             : |  DATA_P
   14699             :  { 
   14700           0 :  $$ = mm_strdup("data");
   14701             : }
   14702             : |  DATABASE
   14703             :  { 
   14704           4 :  $$ = mm_strdup("database");
   14705             : }
   14706             : |  DEALLOCATE
   14707             :  { 
   14708           0 :  $$ = mm_strdup("deallocate");
   14709             : }
   14710             : |  DECLARE
   14711             :  { 
   14712           0 :  $$ = mm_strdup("declare");
   14713             : }
   14714             : |  DEFAULTS
   14715             :  { 
   14716           0 :  $$ = mm_strdup("defaults");
   14717             : }
   14718             : |  DEFERRED
   14719             :  { 
   14720           0 :  $$ = mm_strdup("deferred");
   14721             : }
   14722             : |  DEFINER
   14723             :  { 
   14724           0 :  $$ = mm_strdup("definer");
   14725             : }
   14726             : |  DELETE_P
   14727             :  { 
   14728           0 :  $$ = mm_strdup("delete");
   14729             : }
   14730             : |  DELIMITER
   14731             :  { 
   14732           0 :  $$ = mm_strdup("delimiter");
   14733             : }
   14734             : |  DELIMITERS
   14735             :  { 
   14736           0 :  $$ = mm_strdup("delimiters");
   14737             : }
   14738             : |  DEPENDS
   14739             :  { 
   14740           0 :  $$ = mm_strdup("depends");
   14741             : }
   14742             : |  DEPTH
   14743             :  { 
   14744           0 :  $$ = mm_strdup("depth");
   14745             : }
   14746             : |  DETACH
   14747             :  { 
   14748           0 :  $$ = mm_strdup("detach");
   14749             : }
   14750             : |  DICTIONARY
   14751             :  { 
   14752           0 :  $$ = mm_strdup("dictionary");
   14753             : }
   14754             : |  DISABLE_P
   14755             :  { 
   14756           0 :  $$ = mm_strdup("disable");
   14757             : }
   14758             : |  DISCARD
   14759             :  { 
   14760           0 :  $$ = mm_strdup("discard");
   14761             : }
   14762             : |  DOCUMENT_P
   14763             :  { 
   14764           0 :  $$ = mm_strdup("document");
   14765             : }
   14766             : |  DOMAIN_P
   14767             :  { 
   14768           0 :  $$ = mm_strdup("domain");
   14769             : }
   14770             : |  DOUBLE_P
   14771             :  { 
   14772           0 :  $$ = mm_strdup("double");
   14773             : }
   14774             : |  DROP
   14775             :  { 
   14776           0 :  $$ = mm_strdup("drop");
   14777             : }
   14778             : |  EACH
   14779             :  { 
   14780           0 :  $$ = mm_strdup("each");
   14781             : }
   14782             : |  EMPTY_P
   14783             :  { 
   14784           0 :  $$ = mm_strdup("empty");
   14785             : }
   14786             : |  ENABLE_P
   14787             :  { 
   14788           0 :  $$ = mm_strdup("enable");
   14789             : }
   14790             : |  ENCODING
   14791             :  { 
   14792           0 :  $$ = mm_strdup("encoding");
   14793             : }
   14794             : |  ENCRYPTED
   14795             :  { 
   14796           0 :  $$ = mm_strdup("encrypted");
   14797             : }
   14798             : |  ENUM_P
   14799             :  { 
   14800           0 :  $$ = mm_strdup("enum");
   14801             : }
   14802             : |  ERROR_P
   14803             :  { 
   14804           4 :  $$ = mm_strdup("error");
   14805             : }
   14806             : |  ESCAPE
   14807             :  { 
   14808           2 :  $$ = mm_strdup("escape");
   14809             : }
   14810             : |  EVENT
   14811             :  { 
   14812           0 :  $$ = mm_strdup("event");
   14813             : }
   14814             : |  EXCLUDE
   14815             :  { 
   14816           0 :  $$ = mm_strdup("exclude");
   14817             : }
   14818             : |  EXCLUDING
   14819             :  { 
   14820           0 :  $$ = mm_strdup("excluding");
   14821             : }
   14822             : |  EXCLUSIVE
   14823             :  { 
   14824           0 :  $$ = mm_strdup("exclusive");
   14825             : }
   14826             : |  EXECUTE
   14827             :  { 
   14828           0 :  $$ = mm_strdup("execute");
   14829             : }
   14830             : |  EXPLAIN
   14831             :  { 
   14832           0 :  $$ = mm_strdup("explain");
   14833             : }
   14834             : |  EXPRESSION
   14835             :  { 
   14836           0 :  $$ = mm_strdup("expression");
   14837             : }
   14838             : |  EXTENSION
   14839             :  { 
   14840           0 :  $$ = mm_strdup("extension");
   14841             : }
   14842             : |  EXTERNAL
   14843             :  { 
   14844           0 :  $$ = mm_strdup("external");
   14845             : }
   14846             : |  FAMILY
   14847             :  { 
   14848          16 :  $$ = mm_strdup("family");
   14849             : }
   14850             : |  FILTER
   14851             :  { 
   14852           0 :  $$ = mm_strdup("filter");
   14853             : }
   14854             : |  FINALIZE
   14855             :  { 
   14856           0 :  $$ = mm_strdup("finalize");
   14857             : }
   14858             : |  FIRST_P
   14859             :  { 
   14860           4 :  $$ = mm_strdup("first");
   14861             : }
   14862             : |  FOLLOWING
   14863             :  { 
   14864           0 :  $$ = mm_strdup("following");
   14865             : }
   14866             : |  FORCE
   14867             :  { 
   14868           0 :  $$ = mm_strdup("force");
   14869             : }
   14870             : |  FORMAT
   14871             :  { 
   14872           0 :  $$ = mm_strdup("format");
   14873             : }
   14874             : |  FORWARD
   14875             :  { 
   14876           0 :  $$ = mm_strdup("forward");
   14877             : }
   14878             : |  FUNCTION
   14879             :  { 
   14880           0 :  $$ = mm_strdup("function");
   14881             : }
   14882             : |  FUNCTIONS
   14883             :  { 
   14884           0 :  $$ = mm_strdup("functions");
   14885             : }
   14886             : |  GENERATED
   14887             :  { 
   14888           0 :  $$ = mm_strdup("generated");
   14889             : }
   14890             : |  GLOBAL
   14891             :  { 
   14892           0 :  $$ = mm_strdup("global");
   14893             : }
   14894             : |  GRANTED
   14895             :  { 
   14896           0 :  $$ = mm_strdup("granted");
   14897             : }
   14898             : |  GROUPS
   14899             :  { 
   14900           0 :  $$ = mm_strdup("groups");
   14901             : }
   14902             : |  HANDLER
   14903             :  { 
   14904           0 :  $$ = mm_strdup("handler");
   14905             : }
   14906             : |  HEADER_P
   14907             :  { 
   14908           0 :  $$ = mm_strdup("header");
   14909             : }
   14910             : |  HOLD
   14911             :  { 
   14912           0 :  $$ = mm_strdup("hold");
   14913             : }
   14914             : |  IDENTITY_P
   14915             :  { 
   14916           0 :  $$ = mm_strdup("identity");
   14917             : }
   14918             : |  IF_P
   14919             :  { 
   14920           0 :  $$ = mm_strdup("if");
   14921             : }
   14922             : |  IMMEDIATE
   14923             :  { 
   14924           0 :  $$ = mm_strdup("immediate");
   14925             : }
   14926             : |  IMMUTABLE
   14927             :  { 
   14928           0 :  $$ = mm_strdup("immutable");
   14929             : }
   14930             : |  IMPLICIT_P
   14931             :  { 
   14932           0 :  $$ = mm_strdup("implicit");
   14933             : }
   14934             : |  IMPORT_P
   14935             :  { 
   14936           0 :  $$ = mm_strdup("import");
   14937             : }
   14938             : |  INCLUDE
   14939             :  { 
   14940           0 :  $$ = mm_strdup("include");
   14941             : }
   14942             : |  INCLUDING
   14943             :  { 
   14944           0 :  $$ = mm_strdup("including");
   14945             : }
   14946             : |  INCREMENT
   14947             :  { 
   14948           0 :  $$ = mm_strdup("increment");
   14949             : }
   14950             : |  INDENT
   14951             :  { 
   14952           0 :  $$ = mm_strdup("indent");
   14953             : }
   14954             : |  INDEX
   14955             :  { 
   14956           8 :  $$ = mm_strdup("index");
   14957             : }
   14958             : |  INDEXES
   14959             :  { 
   14960           0 :  $$ = mm_strdup("indexes");
   14961             : }
   14962             : |  INHERIT
   14963             :  { 
   14964           0 :  $$ = mm_strdup("inherit");
   14965             : }
   14966             : |  INHERITS
   14967             :  { 
   14968           0 :  $$ = mm_strdup("inherits");
   14969             : }
   14970             : |  INLINE_P
   14971             :  { 
   14972           0 :  $$ = mm_strdup("inline");
   14973             : }
   14974             : |  INSENSITIVE
   14975             :  { 
   14976           0 :  $$ = mm_strdup("insensitive");
   14977             : }
   14978             : |  INSERT
   14979             :  { 
   14980           0 :  $$ = mm_strdup("insert");
   14981             : }
   14982             : |  INSTEAD
   14983             :  { 
   14984           0 :  $$ = mm_strdup("instead");
   14985             : }
   14986             : |  INVOKER
   14987             :  { 
   14988           0 :  $$ = mm_strdup("invoker");
   14989             : }
   14990             : |  ISOLATION
   14991             :  { 
   14992           0 :  $$ = mm_strdup("isolation");
   14993             : }
   14994             : |  KEEP
   14995             :  { 
   14996           0 :  $$ = mm_strdup("keep");
   14997             : }
   14998             : |  KEY
   14999             :  { 
   15000           0 :  $$ = mm_strdup("key");
   15001             : }
   15002             : |  KEYS
   15003             :  { 
   15004           0 :  $$ = mm_strdup("keys");
   15005             : }
   15006             : |  LABEL
   15007             :  { 
   15008           0 :  $$ = mm_strdup("label");
   15009             : }
   15010             : |  LANGUAGE
   15011             :  { 
   15012           0 :  $$ = mm_strdup("language");
   15013             : }
   15014             : |  LARGE_P
   15015             :  { 
   15016           0 :  $$ = mm_strdup("large");
   15017             : }
   15018             : |  LAST_P
   15019             :  { 
   15020           0 :  $$ = mm_strdup("last");
   15021             : }
   15022             : |  LEAKPROOF
   15023             :  { 
   15024           0 :  $$ = mm_strdup("leakproof");
   15025             : }
   15026             : |  LEVEL
   15027             :  { 
   15028           0 :  $$ = mm_strdup("level");
   15029             : }
   15030             : |  LISTEN
   15031             :  { 
   15032           0 :  $$ = mm_strdup("listen");
   15033             : }
   15034             : |  LOAD
   15035             :  { 
   15036           0 :  $$ = mm_strdup("load");
   15037             : }
   15038             : |  LOCAL
   15039             :  { 
   15040           0 :  $$ = mm_strdup("local");
   15041             : }
   15042             : |  LOCATION
   15043             :  { 
   15044           0 :  $$ = mm_strdup("location");
   15045             : }
   15046             : |  LOCK_P
   15047             :  { 
   15048           0 :  $$ = mm_strdup("lock");
   15049             : }
   15050             : |  LOCKED
   15051             :  { 
   15052           0 :  $$ = mm_strdup("locked");
   15053             : }
   15054             : |  LOGGED
   15055             :  { 
   15056           0 :  $$ = mm_strdup("logged");
   15057             : }
   15058             : |  MAPPING
   15059             :  { 
   15060           0 :  $$ = mm_strdup("mapping");
   15061             : }
   15062             : |  MATCH
   15063             :  { 
   15064           0 :  $$ = mm_strdup("match");
   15065             : }
   15066             : |  MATCHED
   15067             :  { 
   15068           0 :  $$ = mm_strdup("matched");
   15069             : }
   15070             : |  MATERIALIZED
   15071             :  { 
   15072           0 :  $$ = mm_strdup("materialized");
   15073             : }
   15074             : |  MAXVALUE
   15075             :  { 
   15076           0 :  $$ = mm_strdup("maxvalue");
   15077             : }
   15078             : |  MERGE
   15079             :  { 
   15080           0 :  $$ = mm_strdup("merge");
   15081             : }
   15082             : |  METHOD
   15083             :  { 
   15084           0 :  $$ = mm_strdup("method");
   15085             : }
   15086             : |  MINVALUE
   15087             :  { 
   15088           0 :  $$ = mm_strdup("minvalue");
   15089             : }
   15090             : |  MODE
   15091             :  { 
   15092           0 :  $$ = mm_strdup("mode");
   15093             : }
   15094             : |  MOVE
   15095             :  { 
   15096           0 :  $$ = mm_strdup("move");
   15097             : }
   15098             : |  NAME_P
   15099             :  { 
   15100          44 :  $$ = mm_strdup("name");
   15101             : }
   15102             : |  NAMES
   15103             :  { 
   15104           0 :  $$ = mm_strdup("names");
   15105             : }
   15106             : |  NESTED
   15107             :  { 
   15108           0 :  $$ = mm_strdup("nested");
   15109             : }
   15110             : |  NEW
   15111             :  { 
   15112           0 :  $$ = mm_strdup("new");
   15113             : }
   15114             : |  NEXT
   15115             :  { 
   15116           0 :  $$ = mm_strdup("next");
   15117             : }
   15118             : |  NFC
   15119             :  { 
   15120           0 :  $$ = mm_strdup("nfc");
   15121             : }
   15122             : |  NFD
   15123             :  { 
   15124           0 :  $$ = mm_strdup("nfd");
   15125             : }
   15126             : |  NFKC
   15127             :  { 
   15128           0 :  $$ = mm_strdup("nfkc");
   15129             : }
   15130             : |  NFKD
   15131             :  { 
   15132           0 :  $$ = mm_strdup("nfkd");
   15133             : }
   15134             : |  NO
   15135             :  { 
   15136           0 :  $$ = mm_strdup("no");
   15137             : }
   15138             : |  NORMALIZED
   15139             :  { 
   15140           0 :  $$ = mm_strdup("normalized");
   15141             : }
   15142             : |  NOTHING
   15143             :  { 
   15144           0 :  $$ = mm_strdup("nothing");
   15145             : }
   15146             : |  NOTIFY
   15147             :  { 
   15148           0 :  $$ = mm_strdup("notify");
   15149             : }
   15150             : |  NOWAIT
   15151             :  { 
   15152           0 :  $$ = mm_strdup("nowait");
   15153             : }
   15154             : |  NULLS_P
   15155             :  { 
   15156           0 :  $$ = mm_strdup("nulls");
   15157             : }
   15158             : |  OBJECT_P
   15159             :  { 
   15160           0 :  $$ = mm_strdup("object");
   15161             : }
   15162             : |  OF
   15163             :  { 
   15164           0 :  $$ = mm_strdup("of");
   15165             : }
   15166             : |  OFF
   15167             :  { 
   15168           4 :  $$ = mm_strdup("off");
   15169             : }
   15170             : |  OIDS
   15171             :  { 
   15172           0 :  $$ = mm_strdup("oids");
   15173             : }
   15174             : |  OLD
   15175             :  { 
   15176           0 :  $$ = mm_strdup("old");
   15177             : }
   15178             : |  OMIT
   15179             :  { 
   15180           0 :  $$ = mm_strdup("omit");
   15181             : }
   15182             : |  OPERATOR
   15183             :  { 
   15184           0 :  $$ = mm_strdup("operator");
   15185             : }
   15186             : |  OPTION
   15187             :  { 
   15188           0 :  $$ = mm_strdup("option");
   15189             : }
   15190             : |  OPTIONS
   15191             :  { 
   15192           0 :  $$ = mm_strdup("options");
   15193             : }
   15194             : |  ORDINALITY
   15195             :  { 
   15196           0 :  $$ = mm_strdup("ordinality");
   15197             : }
   15198             : |  OTHERS
   15199             :  { 
   15200           0 :  $$ = mm_strdup("others");
   15201             : }
   15202             : |  OVER
   15203             :  { 
   15204           0 :  $$ = mm_strdup("over");
   15205             : }
   15206             : |  OVERRIDING
   15207             :  { 
   15208           0 :  $$ = mm_strdup("overriding");
   15209             : }
   15210             : |  OWNED
   15211             :  { 
   15212           0 :  $$ = mm_strdup("owned");
   15213             : }
   15214             : |  OWNER
   15215             :  { 
   15216           0 :  $$ = mm_strdup("owner");
   15217             : }
   15218             : |  PARALLEL
   15219             :  { 
   15220           0 :  $$ = mm_strdup("parallel");
   15221             : }
   15222             : |  PARAMETER
   15223             :  { 
   15224           0 :  $$ = mm_strdup("parameter");
   15225             : }
   15226             : |  PARSER
   15227             :  { 
   15228           0 :  $$ = mm_strdup("parser");
   15229             : }
   15230             : |  PARTIAL
   15231             :  { 
   15232           0 :  $$ = mm_strdup("partial");
   15233             : }
   15234             : |  PARTITION
   15235             :  { 
   15236           0 :  $$ = mm_strdup("partition");
   15237             : }
   15238             : |  PARTITIONS
   15239             :  { 
   15240           0 :  $$ = mm_strdup("partitions");
   15241             : }
   15242             : |  PASSING
   15243             :  { 
   15244           0 :  $$ = mm_strdup("passing");
   15245             : }
   15246             : |  PASSWORD
   15247             :  { 
   15248           0 :  $$ = mm_strdup("password");
   15249             : }
   15250             : |  PATH
   15251             :  { 
   15252           0 :  $$ = mm_strdup("path");
   15253             : }
   15254             : |  PERIOD
   15255             :  { 
   15256           0 :  $$ = mm_strdup("period");
   15257             : }
   15258             : |  PLAN
   15259             :  { 
   15260           0 :  $$ = mm_strdup("plan");
   15261             : }
   15262             : |  PLANS
   15263             :  { 
   15264           0 :  $$ = mm_strdup("plans");
   15265             : }
   15266             : |  POLICY
   15267             :  { 
   15268           0 :  $$ = mm_strdup("policy");
   15269             : }
   15270             : |  PRECEDING
   15271             :  { 
   15272           0 :  $$ = mm_strdup("preceding");
   15273             : }
   15274             : |  PREPARE
   15275             :  { 
   15276           0 :  $$ = mm_strdup("prepare");
   15277             : }
   15278             : |  PREPARED
   15279             :  { 
   15280           0 :  $$ = mm_strdup("prepared");
   15281             : }
   15282             : |  PRESERVE
   15283             :  { 
   15284           0 :  $$ = mm_strdup("preserve");
   15285             : }
   15286             : |  PRIOR
   15287             :  { 
   15288           0 :  $$ = mm_strdup("prior");
   15289             : }
   15290             : |  PRIVILEGES
   15291             :  { 
   15292           0 :  $$ = mm_strdup("privileges");
   15293             : }
   15294             : |  PROCEDURAL
   15295             :  { 
   15296           0 :  $$ = mm_strdup("procedural");
   15297             : }
   15298             : |  PROCEDURE
   15299             :  { 
   15300           0 :  $$ = mm_strdup("procedure");
   15301             : }
   15302             : |  PROCEDURES
   15303             :  { 
   15304           0 :  $$ = mm_strdup("procedures");
   15305             : }
   15306             : |  PROGRAM
   15307             :  { 
   15308           0 :  $$ = mm_strdup("program");
   15309             : }
   15310             : |  PUBLICATION
   15311             :  { 
   15312           0 :  $$ = mm_strdup("publication");
   15313             : }
   15314             : |  QUOTE
   15315             :  { 
   15316           0 :  $$ = mm_strdup("quote");
   15317             : }
   15318             : |  QUOTES
   15319             :  { 
   15320           0 :  $$ = mm_strdup("quotes");
   15321             : }
   15322             : |  RANGE
   15323             :  { 
   15324           0 :  $$ = mm_strdup("range");
   15325             : }
   15326             : |  READ
   15327             :  { 
   15328           0 :  $$ = mm_strdup("read");
   15329             : }
   15330             : |  REASSIGN
   15331             :  { 
   15332           0 :  $$ = mm_strdup("reassign");
   15333             : }
   15334             : |  RECHECK
   15335             :  { 
   15336           0 :  $$ = mm_strdup("recheck");
   15337             : }
   15338             : |  RECURSIVE
   15339             :  { 
   15340           0 :  $$ = mm_strdup("recursive");
   15341             : }
   15342             : |  REF_P
   15343             :  { 
   15344           0 :  $$ = mm_strdup("ref");
   15345             : }
   15346             : |  REFERENCING
   15347             :  { 
   15348           0 :  $$ = mm_strdup("referencing");
   15349             : }
   15350             : |  REFRESH
   15351             :  { 
   15352           0 :  $$ = mm_strdup("refresh");
   15353             : }
   15354             : |  REINDEX
   15355             :  { 
   15356           0 :  $$ = mm_strdup("reindex");
   15357             : }
   15358             : |  RELATIVE_P
   15359             :  { 
   15360           0 :  $$ = mm_strdup("relative");
   15361             : }
   15362             : |  RELEASE
   15363             :  { 
   15364           0 :  $$ = mm_strdup("release");
   15365             : }
   15366             : |  RENAME
   15367             :  { 
   15368           0 :  $$ = mm_strdup("rename");
   15369             : }
   15370             : |  REPEATABLE
   15371             :  { 
   15372           0 :  $$ = mm_strdup("repeatable");
   15373             : }
   15374             : |  REPLACE
   15375             :  { 
   15376           0 :  $$ = mm_strdup("replace");
   15377             : }
   15378             : |  REPLICA
   15379             :  { 
   15380           0 :  $$ = mm_strdup("replica");
   15381             : }
   15382             : |  RESET
   15383             :  { 
   15384           0 :  $$ = mm_strdup("reset");
   15385             : }
   15386             : |  RESTART
   15387             :  { 
   15388           0 :  $$ = mm_strdup("restart");
   15389             : }
   15390             : |  RESTRICT
   15391             :  { 
   15392           0 :  $$ = mm_strdup("restrict");
   15393             : }
   15394             : |  RETURN
   15395             :  { 
   15396           0 :  $$ = mm_strdup("return");
   15397             : }
   15398             : |  RETURNS
   15399             :  { 
   15400           0 :  $$ = mm_strdup("returns");
   15401             : }
   15402             : |  REVOKE
   15403             :  { 
   15404           0 :  $$ = mm_strdup("revoke");
   15405             : }
   15406             : |  ROLE
   15407             :  { 
   15408           0 :  $$ = mm_strdup("role");
   15409             : }
   15410             : |  ROLLBACK
   15411             :  { 
   15412           0 :  $$ = mm_strdup("rollback");
   15413             : }
   15414             : |  ROLLUP
   15415             :  { 
   15416           0 :  $$ = mm_strdup("rollup");
   15417             : }
   15418             : |  ROUTINE
   15419             :  { 
   15420           0 :  $$ = mm_strdup("routine");
   15421             : }
   15422             : |  ROUTINES
   15423             :  { 
   15424           0 :  $$ = mm_strdup("routines");
   15425             : }
   15426             : |  ROWS
   15427             :  { 
   15428           0 :  $$ = mm_strdup("rows");
   15429             : }
   15430             : |  RULE
   15431             :  { 
   15432           0 :  $$ = mm_strdup("rule");
   15433             : }
   15434             : |  SAVEPOINT
   15435             :  { 
   15436           0 :  $$ = mm_strdup("savepoint");
   15437             : }
   15438             : |  SCALAR
   15439             :  { 
   15440           0 :  $$ = mm_strdup("scalar");
   15441             : }
   15442             : |  SCHEMA
   15443             :  { 
   15444           0 :  $$ = mm_strdup("schema");
   15445             : }
   15446             : |  SCHEMAS
   15447             :  { 
   15448           0 :  $$ = mm_strdup("schemas");
   15449             : }
   15450             : |  SCROLL
   15451             :  { 
   15452           0 :  $$ = mm_strdup("scroll");
   15453             : }
   15454             : |  SEARCH
   15455             :  { 
   15456           0 :  $$ = mm_strdup("search");
   15457             : }
   15458             : |  SECURITY
   15459             :  { 
   15460           0 :  $$ = mm_strdup("security");
   15461             : }
   15462             : |  SEQUENCE
   15463             :  { 
   15464           0 :  $$ = mm_strdup("sequence");
   15465             : }
   15466             : |  SEQUENCES
   15467             :  { 
   15468           0 :  $$ = mm_strdup("sequences");
   15469             : }
   15470             : |  SERIALIZABLE
   15471             :  { 
   15472           0 :  $$ = mm_strdup("serializable");
   15473             : }
   15474             : |  SERVER
   15475             :  { 
   15476           0 :  $$ = mm_strdup("server");
   15477             : }
   15478             : |  SESSION
   15479             :  { 
   15480           0 :  $$ = mm_strdup("session");
   15481             : }
   15482             : |  SET
   15483             :  { 
   15484           0 :  $$ = mm_strdup("set");
   15485             : }
   15486             : |  SETS
   15487             :  { 
   15488           0 :  $$ = mm_strdup("sets");
   15489             : }
   15490             : |  SHARE
   15491             :  { 
   15492           0 :  $$ = mm_strdup("share");
   15493             : }
   15494             : |  SHOW
   15495             :  { 
   15496           0 :  $$ = mm_strdup("show");
   15497             : }
   15498             : |  SIMPLE
   15499             :  { 
   15500           0 :  $$ = mm_strdup("simple");
   15501             : }
   15502             : |  SKIP
   15503             :  { 
   15504           0 :  $$ = mm_strdup("skip");
   15505             : }
   15506             : |  SNAPSHOT
   15507             :  { 
   15508           0 :  $$ = mm_strdup("snapshot");
   15509             : }
   15510             : |  SOURCE
   15511             :  { 
   15512          16 :  $$ = mm_strdup("source");
   15513             : }
   15514             : |  SPLIT
   15515             :  { 
   15516           0 :  $$ = mm_strdup("split");
   15517             : }
   15518             : |  SQL_P
   15519             :  { 
   15520           0 :  $$ = mm_strdup("sql");
   15521             : }
   15522             : |  STABLE
   15523             :  { 
   15524           0 :  $$ = mm_strdup("stable");
   15525             : }
   15526             : |  STANDALONE_P
   15527             :  { 
   15528           0 :  $$ = mm_strdup("standalone");
   15529             : }
   15530             : |  START
   15531             :  { 
   15532           0 :  $$ = mm_strdup("start");
   15533             : }
   15534             : |  STATEMENT
   15535             :  { 
   15536           0 :  $$ = mm_strdup("statement");
   15537             : }
   15538             : |  STATISTICS
   15539             :  { 
   15540           0 :  $$ = mm_strdup("statistics");
   15541             : }
   15542             : |  STDIN
   15543             :  { 
   15544           0 :  $$ = mm_strdup("stdin");
   15545             : }
   15546             : |  STDOUT
   15547             :  { 
   15548           0 :  $$ = mm_strdup("stdout");
   15549             : }
   15550             : |  STORAGE
   15551             :  { 
   15552           0 :  $$ = mm_strdup("storage");
   15553             : }
   15554             : |  STORED
   15555             :  { 
   15556           0 :  $$ = mm_strdup("stored");
   15557             : }
   15558             : |  STRICT_P
   15559             :  { 
   15560           0 :  $$ = mm_strdup("strict");
   15561             : }
   15562             : |  STRING_P
   15563             :  { 
   15564           2 :  $$ = mm_strdup("string");
   15565             : }
   15566             : |  STRIP_P
   15567             :  { 
   15568           0 :  $$ = mm_strdup("strip");
   15569             : }
   15570             : |  SUBSCRIPTION
   15571             :  { 
   15572           0 :  $$ = mm_strdup("subscription");
   15573             : }
   15574             : |  SUPPORT
   15575             :  { 
   15576           0 :  $$ = mm_strdup("support");
   15577             : }
   15578             : |  SYSID
   15579             :  { 
   15580           0 :  $$ = mm_strdup("sysid");
   15581             : }
   15582             : |  SYSTEM_P
   15583             :  { 
   15584           0 :  $$ = mm_strdup("system");
   15585             : }
   15586             : |  TABLES
   15587             :  { 
   15588           0 :  $$ = mm_strdup("tables");
   15589             : }
   15590             : |  TABLESPACE
   15591             :  { 
   15592           0 :  $$ = mm_strdup("tablespace");
   15593             : }
   15594             : |  TARGET
   15595             :  { 
   15596           0 :  $$ = mm_strdup("target");
   15597             : }
   15598             : |  TEMP
   15599             :  { 
   15600           0 :  $$ = mm_strdup("temp");
   15601             : }
   15602             : |  TEMPLATE
   15603             :  { 
   15604           0 :  $$ = mm_strdup("template");
   15605             : }
   15606             : |  TEMPORARY
   15607             :  { 
   15608           0 :  $$ = mm_strdup("temporary");
   15609             : }
   15610             : |  TEXT_P
   15611             :  { 
   15612          66 :  $$ = mm_strdup("text");
   15613             : }
   15614             : |  TIES
   15615             :  { 
   15616           0 :  $$ = mm_strdup("ties");
   15617             : }
   15618             : |  TRANSACTION
   15619             :  { 
   15620           0 :  $$ = mm_strdup("transaction");
   15621             : }
   15622             : |  TRANSFORM
   15623             :  { 
   15624           0 :  $$ = mm_strdup("transform");
   15625             : }
   15626             : |  TRIGGER
   15627             :  { 
   15628           2 :  $$ = mm_strdup("trigger");
   15629             : }
   15630             : |  TRUNCATE
   15631             :  { 
   15632           0 :  $$ = mm_strdup("truncate");
   15633             : }
   15634             : |  TRUSTED
   15635             :  { 
   15636           0 :  $$ = mm_strdup("trusted");
   15637             : }
   15638             : |  TYPE_P
   15639             :  { 
   15640           0 :  $$ = mm_strdup("type");
   15641             : }
   15642             : |  TYPES_P
   15643             :  { 
   15644           0 :  $$ = mm_strdup("types");
   15645             : }
   15646             : |  UESCAPE
   15647             :  { 
   15648           0 :  $$ = mm_strdup("uescape");
   15649             : }
   15650             : |  UNBOUNDED
   15651             :  { 
   15652           0 :  $$ = mm_strdup("unbounded");
   15653             : }
   15654             : |  UNCOMMITTED
   15655             :  { 
   15656           0 :  $$ = mm_strdup("uncommitted");
   15657             : }
   15658             : |  UNCONDITIONAL
   15659             :  { 
   15660           0 :  $$ = mm_strdup("unconditional");
   15661             : }
   15662             : |  UNENCRYPTED
   15663             :  { 
   15664           0 :  $$ = mm_strdup("unencrypted");
   15665             : }
   15666             : |  UNKNOWN
   15667             :  { 
   15668           0 :  $$ = mm_strdup("unknown");
   15669             : }
   15670             : |  UNLISTEN
   15671             :  { 
   15672           0 :  $$ = mm_strdup("unlisten");
   15673             : }
   15674             : |  UNLOGGED
   15675             :  { 
   15676           0 :  $$ = mm_strdup("unlogged");
   15677             : }
   15678             : |  UNTIL
   15679             :  { 
   15680           0 :  $$ = mm_strdup("until");
   15681             : }
   15682             : |  UPDATE
   15683             :  { 
   15684           0 :  $$ = mm_strdup("update");
   15685             : }
   15686             : |  VACUUM
   15687             :  { 
   15688           0 :  $$ = mm_strdup("vacuum");
   15689             : }
   15690             : |  VALID
   15691             :  { 
   15692           0 :  $$ = mm_strdup("valid");
   15693             : }
   15694             : |  VALIDATE
   15695             :  { 
   15696           0 :  $$ = mm_strdup("validate");
   15697             : }
   15698             : |  VALIDATOR
   15699             :  { 
   15700           0 :  $$ = mm_strdup("validator");
   15701             : }
   15702             : |  VALUE_P
   15703             :  { 
   15704           0 :  $$ = mm_strdup("value");
   15705             : }
   15706             : |  VARYING
   15707             :  { 
   15708           0 :  $$ = mm_strdup("varying");
   15709             : }
   15710             : |  VERSION_P
   15711             :  { 
   15712           0 :  $$ = mm_strdup("version");
   15713             : }
   15714             : |  VIEW
   15715             :  { 
   15716           0 :  $$ = mm_strdup("view");
   15717             : }
   15718             : |  VIEWS
   15719             :  { 
   15720           0 :  $$ = mm_strdup("views");
   15721             : }
   15722             : |  VOLATILE
   15723             :  { 
   15724           0 :  $$ = mm_strdup("volatile");
   15725             : }
   15726             : |  WHITESPACE_P
   15727             :  { 
   15728           0 :  $$ = mm_strdup("whitespace");
   15729             : }
   15730             : |  WITHIN
   15731             :  { 
   15732           0 :  $$ = mm_strdup("within");
   15733             : }
   15734             : |  WITHOUT
   15735             :  { 
   15736           0 :  $$ = mm_strdup("without");
   15737             : }
   15738             : |  WORK
   15739             :  { 
   15740           0 :  $$ = mm_strdup("work");
   15741             : }
   15742             : |  WRAPPER
   15743             :  { 
   15744           0 :  $$ = mm_strdup("wrapper");
   15745             : }
   15746             : |  WRITE
   15747             :  { 
   15748           0 :  $$ = mm_strdup("write");
   15749             : }
   15750             : |  XML_P
   15751             :  { 
   15752           0 :  $$ = mm_strdup("xml");
   15753             : }
   15754             : |  YES_P
   15755             :  { 
   15756           0 :  $$ = mm_strdup("yes");
   15757             : }
   15758             : |  ZONE
   15759             :  { 
   15760           0 :  $$ = mm_strdup("zone");
   15761             : }
   15762             : ;
   15763             : 
   15764             : 
   15765             :  col_name_keyword:
   15766             :  BETWEEN
   15767             :  { 
   15768           0 :  $$ = mm_strdup("between");
   15769             : }
   15770             : |  BIGINT
   15771             :  { 
   15772           0 :  $$ = mm_strdup("bigint");
   15773             : }
   15774             : |  BIT
   15775             :  { 
   15776           0 :  $$ = mm_strdup("bit");
   15777             : }
   15778             : |  BOOLEAN_P
   15779             :  { 
   15780           0 :  $$ = mm_strdup("boolean");
   15781             : }
   15782             : |  CHARACTER
   15783             :  { 
   15784           0 :  $$ = mm_strdup("character");
   15785             : }
   15786             : |  COALESCE
   15787             :  { 
   15788           0 :  $$ = mm_strdup("coalesce");
   15789             : }
   15790             : |  DEC
   15791             :  { 
   15792          10 :  $$ = mm_strdup("dec");
   15793             : }
   15794             : |  DECIMAL_P
   15795             :  { 
   15796           0 :  $$ = mm_strdup("decimal");
   15797             : }
   15798             : |  EXISTS
   15799             :  { 
   15800           0 :  $$ = mm_strdup("exists");
   15801             : }
   15802             : |  EXTRACT
   15803             :  { 
   15804           0 :  $$ = mm_strdup("extract");
   15805             : }
   15806             : |  FLOAT_P
   15807             :  { 
   15808           0 :  $$ = mm_strdup("float");
   15809             : }
   15810             : |  GREATEST
   15811             :  { 
   15812           0 :  $$ = mm_strdup("greatest");
   15813             : }
   15814             : |  GROUPING
   15815             :  { 
   15816           0 :  $$ = mm_strdup("grouping");
   15817             : }
   15818             : |  INOUT
   15819             :  { 
   15820           0 :  $$ = mm_strdup("inout");
   15821             : }
   15822             : |  INTEGER
   15823             :  { 
   15824           4 :  $$ = mm_strdup("integer");
   15825             : }
   15826             : |  INTERVAL
   15827             :  { 
   15828           0 :  $$ = mm_strdup("interval");
   15829             : }
   15830             : |  JSON
   15831             :  { 
   15832           2 :  $$ = mm_strdup("json");
   15833             : }
   15834             : |  JSON_ARRAY
   15835             :  { 
   15836           0 :  $$ = mm_strdup("json_array");
   15837             : }
   15838             : |  JSON_ARRAYAGG
   15839             :  { 
   15840           0 :  $$ = mm_strdup("json_arrayagg");
   15841             : }
   15842             : |  JSON_EXISTS
   15843             :  { 
   15844           0 :  $$ = mm_strdup("json_exists");
   15845             : }
   15846             : |  JSON_OBJECT
   15847             :  { 
   15848           0 :  $$ = mm_strdup("json_object");
   15849             : }
   15850             : |  JSON_OBJECTAGG
   15851             :  { 
   15852           0 :  $$ = mm_strdup("json_objectagg");
   15853             : }
   15854             : |  JSON_QUERY
   15855             :  { 
   15856           0 :  $$ = mm_strdup("json_query");
   15857             : }
   15858             : |  JSON_SCALAR
   15859             :  { 
   15860           0 :  $$ = mm_strdup("json_scalar");
   15861             : }
   15862             : |  JSON_SERIALIZE
   15863             :  { 
   15864           0 :  $$ = mm_strdup("json_serialize");
   15865             : }
   15866             : |  JSON_TABLE
   15867             :  { 
   15868           0 :  $$ = mm_strdup("json_table");
   15869             : }
   15870             : |  JSON_VALUE
   15871             :  { 
   15872           0 :  $$ = mm_strdup("json_value");
   15873             : }
   15874             : |  LEAST
   15875             :  { 
   15876           0 :  $$ = mm_strdup("least");
   15877             : }
   15878             : |  MERGE_ACTION
   15879             :  { 
   15880           0 :  $$ = mm_strdup("merge_action");
   15881             : }
   15882             : |  NATIONAL
   15883             :  { 
   15884           0 :  $$ = mm_strdup("national");
   15885             : }
   15886             : |  NCHAR
   15887             :  { 
   15888           0 :  $$ = mm_strdup("nchar");
   15889             : }
   15890             : |  NONE
   15891             :  { 
   15892           0 :  $$ = mm_strdup("none");
   15893             : }
   15894             : |  NORMALIZE
   15895             :  { 
   15896           0 :  $$ = mm_strdup("normalize");
   15897             : }
   15898             : |  NULLIF
   15899             :  { 
   15900           0 :  $$ = mm_strdup("nullif");
   15901             : }
   15902             : |  NUMERIC
   15903             :  { 
   15904           0 :  $$ = mm_strdup("numeric");
   15905             : }
   15906             : |  OUT_P
   15907             :  { 
   15908           0 :  $$ = mm_strdup("out");
   15909             : }
   15910             : |  OVERLAY
   15911             :  { 
   15912           0 :  $$ = mm_strdup("overlay");
   15913             : }
   15914             : |  POSITION
   15915             :  { 
   15916           0 :  $$ = mm_strdup("position");
   15917             : }
   15918             : |  PRECISION
   15919             :  { 
   15920           0 :  $$ = mm_strdup("precision");
   15921             : }
   15922             : |  REAL
   15923             :  { 
   15924           0 :  $$ = mm_strdup("real");
   15925             : }
   15926             : |  ROW
   15927             :  { 
   15928           0 :  $$ = mm_strdup("row");
   15929             : }
   15930             : |  SETOF
   15931             :  { 
   15932           0 :  $$ = mm_strdup("setof");
   15933             : }
   15934             : |  SMALLINT
   15935             :  { 
   15936           4 :  $$ = mm_strdup("smallint");
   15937             : }
   15938             : |  SUBSTRING
   15939             :  { 
   15940           0 :  $$ = mm_strdup("substring");
   15941             : }
   15942             : |  TIME
   15943             :  { 
   15944           0 :  $$ = mm_strdup("time");
   15945             : }
   15946             : |  TIMESTAMP
   15947             :  { 
   15948          12 :  $$ = mm_strdup("timestamp");
   15949             : }
   15950             : |  TREAT
   15951             :  { 
   15952           0 :  $$ = mm_strdup("treat");
   15953             : }
   15954             : |  TRIM
   15955             :  { 
   15956           0 :  $$ = mm_strdup("trim");
   15957             : }
   15958             : |  VARCHAR
   15959             :  { 
   15960           2 :  $$ = mm_strdup("varchar");
   15961             : }
   15962             : |  XMLATTRIBUTES
   15963             :  { 
   15964           0 :  $$ = mm_strdup("xmlattributes");
   15965             : }
   15966             : |  XMLCONCAT
   15967             :  { 
   15968           0 :  $$ = mm_strdup("xmlconcat");
   15969             : }
   15970             : |  XMLELEMENT
   15971             :  { 
   15972           0 :  $$ = mm_strdup("xmlelement");
   15973             : }
   15974             : |  XMLEXISTS
   15975             :  { 
   15976           0 :  $$ = mm_strdup("xmlexists");
   15977             : }
   15978             : |  XMLFOREST
   15979             :  { 
   15980           0 :  $$ = mm_strdup("xmlforest");
   15981             : }
   15982             : |  XMLNAMESPACES
   15983             :  { 
   15984           0 :  $$ = mm_strdup("xmlnamespaces");
   15985             : }
   15986             : |  XMLPARSE
   15987             :  { 
   15988           0 :  $$ = mm_strdup("xmlparse");
   15989             : }
   15990             : |  XMLPI
   15991             :  { 
   15992           0 :  $$ = mm_strdup("xmlpi");
   15993             : }
   15994             : |  XMLROOT
   15995             :  { 
   15996           0 :  $$ = mm_strdup("xmlroot");
   15997             : }
   15998             : |  XMLSERIALIZE
   15999             :  { 
   16000           0 :  $$ = mm_strdup("xmlserialize");
   16001             : }
   16002             : |  XMLTABLE
   16003             :  { 
   16004           0 :  $$ = mm_strdup("xmltable");
   16005             : }
   16006             : ;
   16007             : 
   16008             : 
   16009             :  type_func_name_keyword:
   16010             :  AUTHORIZATION
   16011             :  { 
   16012           0 :  $$ = mm_strdup("authorization");
   16013             : }
   16014             : |  BINARY
   16015             :  { 
   16016           0 :  $$ = mm_strdup("binary");
   16017             : }
   16018             : |  COLLATION
   16019             :  { 
   16020           0 :  $$ = mm_strdup("collation");
   16021             : }
   16022             : |  CONCURRENTLY
   16023             :  { 
   16024           0 :  $$ = mm_strdup("concurrently");
   16025             : }
   16026             : |  CROSS
   16027             :  { 
   16028           0 :  $$ = mm_strdup("cross");
   16029             : }
   16030             : |  CURRENT_SCHEMA
   16031             :  { 
   16032           0 :  $$ = mm_strdup("current_schema");
   16033             : }
   16034             : |  FREEZE
   16035             :  { 
   16036           0 :  $$ = mm_strdup("freeze");
   16037             : }
   16038             : |  FULL
   16039             :  { 
   16040           0 :  $$ = mm_strdup("full");
   16041             : }
   16042             : |  ILIKE
   16043             :  { 
   16044           0 :  $$ = mm_strdup("ilike");
   16045             : }
   16046             : |  INNER_P
   16047             :  { 
   16048           0 :  $$ = mm_strdup("inner");
   16049             : }
   16050             : |  IS
   16051             :  { 
   16052           0 :  $$ = mm_strdup("is");
   16053             : }
   16054             : |  ISNULL
   16055             :  { 
   16056           0 :  $$ = mm_strdup("isnull");
   16057             : }
   16058             : |  JOIN
   16059             :  { 
   16060           0 :  $$ = mm_strdup("join");
   16061             : }
   16062             : |  LEFT
   16063             :  { 
   16064           0 :  $$ = mm_strdup("left");
   16065             : }
   16066             : |  LIKE
   16067             :  { 
   16068           0 :  $$ = mm_strdup("like");
   16069             : }
   16070             : |  NATURAL
   16071             :  { 
   16072           0 :  $$ = mm_strdup("natural");
   16073             : }
   16074             : |  NOTNULL
   16075             :  { 
   16076           0 :  $$ = mm_strdup("notnull");
   16077             : }
   16078             : |  OUTER_P
   16079             :  { 
   16080           0 :  $$ = mm_strdup("outer");
   16081             : }
   16082             : |  OVERLAPS
   16083             :  { 
   16084           0 :  $$ = mm_strdup("overlaps");
   16085             : }
   16086             : |  RIGHT
   16087             :  { 
   16088           0 :  $$ = mm_strdup("right");
   16089             : }
   16090             : |  SIMILAR
   16091             :  { 
   16092           0 :  $$ = mm_strdup("similar");
   16093             : }
   16094             : |  TABLESAMPLE
   16095             :  { 
   16096           0 :  $$ = mm_strdup("tablesample");
   16097             : }
   16098             : |  VERBOSE
   16099             :  { 
   16100           0 :  $$ = mm_strdup("verbose");
   16101             : }
   16102             : ;
   16103             : 
   16104             : 
   16105             :  reserved_keyword:
   16106             :  ALL
   16107             :  { 
   16108           0 :  $$ = mm_strdup("all");
   16109             : }
   16110             : |  ANALYSE
   16111             :  { 
   16112           0 :  $$ = mm_strdup("analyse");
   16113             : }
   16114             : |  ANALYZE
   16115             :  { 
   16116           0 :  $$ = mm_strdup("analyze");
   16117             : }
   16118             : |  AND
   16119             :  { 
   16120           0 :  $$ = mm_strdup("and");
   16121             : }
   16122             : |  ANY
   16123             :  { 
   16124           0 :  $$ = mm_strdup("any");
   16125             : }
   16126             : |  ARRAY
   16127             :  { 
   16128           0 :  $$ = mm_strdup("array");
   16129             : }
   16130             : |  AS
   16131             :  { 
   16132           0 :  $$ = mm_strdup("as");
   16133             : }
   16134             : |  ASC
   16135             :  { 
   16136           0 :  $$ = mm_strdup("asc");
   16137             : }
   16138             : |  ASYMMETRIC
   16139             :  { 
   16140           0 :  $$ = mm_strdup("asymmetric");
   16141             : }
   16142             : |  BOTH
   16143             :  { 
   16144           0 :  $$ = mm_strdup("both");
   16145             : }
   16146             : |  CASE
   16147             :  { 
   16148           0 :  $$ = mm_strdup("case");
   16149             : }
   16150             : |  CAST
   16151             :  { 
   16152           0 :  $$ = mm_strdup("cast");
   16153             : }
   16154             : |  CHECK
   16155             :  { 
   16156           0 :  $$ = mm_strdup("check");
   16157             : }
   16158             : |  COLLATE
   16159             :  { 
   16160           0 :  $$ = mm_strdup("collate");
   16161             : }
   16162             : |  COLUMN
   16163             :  { 
   16164           0 :  $$ = mm_strdup("column");
   16165             : }
   16166             : |  CONSTRAINT
   16167             :  { 
   16168           0 :  $$ = mm_strdup("constraint");
   16169             : }
   16170             : |  CREATE
   16171             :  { 
   16172           0 :  $$ = mm_strdup("create");
   16173             : }
   16174             : |  CURRENT_CATALOG
   16175             :  { 
   16176           0 :  $$ = mm_strdup("current_catalog");
   16177             : }
   16178             : |  CURRENT_DATE
   16179             :  { 
   16180           0 :  $$ = mm_strdup("current_date");
   16181             : }
   16182             : |  CURRENT_ROLE
   16183             :  { 
   16184           0 :  $$ = mm_strdup("current_role");
   16185             : }
   16186             : |  CURRENT_TIME
   16187             :  { 
   16188           0 :  $$ = mm_strdup("current_time");
   16189             : }
   16190             : |  CURRENT_TIMESTAMP
   16191             :  { 
   16192           0 :  $$ = mm_strdup("current_timestamp");
   16193             : }
   16194             : |  CURRENT_USER
   16195             :  { 
   16196           0 :  $$ = mm_strdup("current_user");
   16197             : }
   16198             : |  DEFAULT
   16199             :  { 
   16200           0 :  $$ = mm_strdup("default");
   16201             : }
   16202             : |  DEFERRABLE
   16203             :  { 
   16204           0 :  $$ = mm_strdup("deferrable");
   16205             : }
   16206             : |  DESC
   16207             :  { 
   16208           0 :  $$ = mm_strdup("desc");
   16209             : }
   16210             : |  DISTINCT
   16211             :  { 
   16212           0 :  $$ = mm_strdup("distinct");
   16213             : }
   16214             : |  DO
   16215             :  { 
   16216           0 :  $$ = mm_strdup("do");
   16217             : }
   16218             : |  ELSE
   16219             :  { 
   16220           0 :  $$ = mm_strdup("else");
   16221             : }
   16222             : |  END_P
   16223             :  { 
   16224           0 :  $$ = mm_strdup("end");
   16225             : }
   16226             : |  EXCEPT
   16227             :  { 
   16228           0 :  $$ = mm_strdup("except");
   16229             : }
   16230             : |  FALSE_P
   16231             :  { 
   16232           0 :  $$ = mm_strdup("false");
   16233             : }
   16234             : |  FETCH
   16235             :  { 
   16236           0 :  $$ = mm_strdup("fetch");
   16237             : }
   16238             : |  FOR
   16239             :  { 
   16240           0 :  $$ = mm_strdup("for");
   16241             : }
   16242             : |  FOREIGN
   16243             :  { 
   16244           0 :  $$ = mm_strdup("foreign");
   16245             : }
   16246             : |  FROM
   16247             :  { 
   16248           0 :  $$ = mm_strdup("from");
   16249             : }
   16250             : |  GRANT
   16251             :  { 
   16252           0 :  $$ = mm_strdup("grant");
   16253             : }
   16254             : |  GROUP_P
   16255             :  { 
   16256           0 :  $$ = mm_strdup("group");
   16257             : }
   16258             : |  HAVING
   16259             :  { 
   16260           0 :  $$ = mm_strdup("having");
   16261             : }
   16262             : |  IN_P
   16263             :  { 
   16264           0 :  $$ = mm_strdup("in");
   16265             : }
   16266             : |  INITIALLY
   16267             :  { 
   16268           0 :  $$ = mm_strdup("initially");
   16269             : }
   16270             : |  INTERSECT
   16271             :  { 
   16272           0 :  $$ = mm_strdup("intersect");
   16273             : }
   16274             : |  INTO
   16275             :  { 
   16276           0 :  $$ = mm_strdup("into");
   16277             : }
   16278             : |  LATERAL_P
   16279             :  { 
   16280           0 :  $$ = mm_strdup("lateral");
   16281             : }
   16282             : |  LEADING
   16283             :  { 
   16284           0 :  $$ = mm_strdup("leading");
   16285             : }
   16286             : |  LIMIT
   16287             :  { 
   16288           0 :  $$ = mm_strdup("limit");
   16289             : }
   16290             : |  LOCALTIME
   16291             :  { 
   16292           0 :  $$ = mm_strdup("localtime");
   16293             : }
   16294             : |  LOCALTIMESTAMP
   16295             :  { 
   16296           0 :  $$ = mm_strdup("localtimestamp");
   16297             : }
   16298             : |  NOT
   16299             :  { 
   16300           0 :  $$ = mm_strdup("not");
   16301             : }
   16302             : |  NULL_P
   16303             :  { 
   16304           0 :  $$ = mm_strdup("null");
   16305             : }
   16306             : |  OFFSET
   16307             :  { 
   16308           0 :  $$ = mm_strdup("offset");
   16309             : }
   16310             : |  ON
   16311             :  { 
   16312           0 :  $$ = mm_strdup("on");
   16313             : }
   16314             : |  ONLY
   16315             :  { 
   16316           0 :  $$ = mm_strdup("only");
   16317             : }
   16318             : |  OR
   16319             :  { 
   16320           0 :  $$ = mm_strdup("or");
   16321             : }
   16322             : |  ORDER
   16323             :  { 
   16324           0 :  $$ = mm_strdup("order");
   16325             : }
   16326             : |  PLACING
   16327             :  { 
   16328           0 :  $$ = mm_strdup("placing");
   16329             : }
   16330             : |  PRIMARY
   16331             :  { 
   16332           0 :  $$ = mm_strdup("primary");
   16333             : }
   16334             : |  REFERENCES
   16335             :  { 
   16336           0 :  $$ = mm_strdup("references");
   16337             : }
   16338             : |  RETURNING
   16339             :  { 
   16340           0 :  $$ = mm_strdup("returning");
   16341             : }
   16342             : |  SELECT
   16343             :  { 
   16344           0 :  $$ = mm_strdup("select");
   16345             : }
   16346             : |  SESSION_USER
   16347             :  { 
   16348           0 :  $$ = mm_strdup("session_user");
   16349             : }
   16350             : |  SOME
   16351             :  { 
   16352           0 :  $$ = mm_strdup("some");
   16353             : }
   16354             : |  SYMMETRIC
   16355             :  { 
   16356           0 :  $$ = mm_strdup("symmetric");
   16357             : }
   16358             : |  SYSTEM_USER
   16359             :  { 
   16360           0 :  $$ = mm_strdup("system_user");
   16361             : }
   16362             : |  TABLE
   16363             :  { 
   16364           0 :  $$ = mm_strdup("table");
   16365             : }
   16366             : |  THEN
   16367             :  { 
   16368           0 :  $$ = mm_strdup("then");
   16369             : }
   16370             : |  TRAILING
   16371             :  { 
   16372           0 :  $$ = mm_strdup("trailing");
   16373             : }
   16374             : |  TRUE_P
   16375             :  { 
   16376           0 :  $$ = mm_strdup("true");
   16377             : }
   16378             : |  UNIQUE
   16379             :  { 
   16380           0 :  $$ = mm_strdup("unique");
   16381             : }
   16382             : |  USER
   16383             :  { 
   16384           0 :  $$ = mm_strdup("user");
   16385             : }
   16386             : |  USING
   16387             :  { 
   16388           0 :  $$ = mm_strdup("using");
   16389             : }
   16390             : |  VARIADIC
   16391             :  { 
   16392           0 :  $$ = mm_strdup("variadic");
   16393             : }
   16394             : |  WHEN
   16395             :  { 
   16396           0 :  $$ = mm_strdup("when");
   16397             : }
   16398             : |  WHERE
   16399             :  { 
   16400           0 :  $$ = mm_strdup("where");
   16401             : }
   16402             : |  WINDOW
   16403             :  { 
   16404           0 :  $$ = mm_strdup("window");
   16405             : }
   16406             : |  WITH
   16407             :  { 
   16408           0 :  $$ = mm_strdup("with");
   16409             : }
   16410             : ;
   16411             : 
   16412             : 
   16413             :  bare_label_keyword:
   16414             :  ABORT_P
   16415             :  { 
   16416           0 :  $$ = mm_strdup("abort");
   16417             : }
   16418             : |  ABSENT
   16419             :  { 
   16420           0 :  $$ = mm_strdup("absent");
   16421             : }
   16422             : |  ABSOLUTE_P
   16423             :  { 
   16424           0 :  $$ = mm_strdup("absolute");
   16425             : }
   16426             : |  ACCESS
   16427             :  { 
   16428           0 :  $$ = mm_strdup("access");
   16429             : }
   16430             : |  ACTION
   16431             :  { 
   16432           0 :  $$ = mm_strdup("action");
   16433             : }
   16434             : |  ADD_P
   16435             :  { 
   16436           0 :  $$ = mm_strdup("add");
   16437             : }
   16438             : |  ADMIN
   16439             :  { 
   16440           0 :  $$ = mm_strdup("admin");
   16441             : }
   16442             : |  AFTER
   16443             :  { 
   16444           0 :  $$ = mm_strdup("after");
   16445             : }
   16446             : |  AGGREGATE
   16447             :  { 
   16448           0 :  $$ = mm_strdup("aggregate");
   16449             : }
   16450             : |  ALL
   16451             :  { 
   16452           0 :  $$ = mm_strdup("all");
   16453             : }
   16454             : |  ALSO
   16455             :  { 
   16456           0 :  $$ = mm_strdup("also");
   16457             : }
   16458             : |  ALTER
   16459             :  { 
   16460           0 :  $$ = mm_strdup("alter");
   16461             : }
   16462             : |  ALWAYS
   16463             :  { 
   16464           0 :  $$ = mm_strdup("always");
   16465             : }
   16466             : |  ANALYSE
   16467             :  { 
   16468           0 :  $$ = mm_strdup("analyse");
   16469             : }
   16470             : |  ANALYZE
   16471             :  { 
   16472           0 :  $$ = mm_strdup("analyze");
   16473             : }
   16474             : |  AND
   16475             :  { 
   16476           0 :  $$ = mm_strdup("and");
   16477             : }
   16478             : |  ANY
   16479             :  { 
   16480           0 :  $$ = mm_strdup("any");
   16481             : }
   16482             : |  ASC
   16483             :  { 
   16484           0 :  $$ = mm_strdup("asc");
   16485             : }
   16486             : |  ASENSITIVE
   16487             :  { 
   16488           0 :  $$ = mm_strdup("asensitive");
   16489             : }
   16490             : |  ASSERTION
   16491             :  { 
   16492           0 :  $$ = mm_strdup("assertion");
   16493             : }
   16494             : |  ASSIGNMENT
   16495             :  { 
   16496           0 :  $$ = mm_strdup("assignment");
   16497             : }
   16498             : |  ASYMMETRIC
   16499             :  { 
   16500           0 :  $$ = mm_strdup("asymmetric");
   16501             : }
   16502             : |  AT
   16503             :  { 
   16504           0 :  $$ = mm_strdup("at");
   16505             : }
   16506             : |  ATOMIC
   16507             :  { 
   16508           0 :  $$ = mm_strdup("atomic");
   16509             : }
   16510             : |  ATTACH
   16511             :  { 
   16512           0 :  $$ = mm_strdup("attach");
   16513             : }
   16514             : |  ATTRIBUTE
   16515             :  { 
   16516           0 :  $$ = mm_strdup("attribute");
   16517             : }
   16518             : |  AUTHORIZATION
   16519             :  { 
   16520           0 :  $$ = mm_strdup("authorization");
   16521             : }
   16522             : |  BACKWARD
   16523             :  { 
   16524           0 :  $$ = mm_strdup("backward");
   16525             : }
   16526             : |  BEFORE
   16527             :  { 
   16528           0 :  $$ = mm_strdup("before");
   16529             : }
   16530             : |  BEGIN_P
   16531             :  { 
   16532           0 :  $$ = mm_strdup("begin");
   16533             : }
   16534             : |  BETWEEN
   16535             :  { 
   16536           0 :  $$ = mm_strdup("between");
   16537             : }
   16538             : |  BIGINT
   16539             :  { 
   16540           0 :  $$ = mm_strdup("bigint");
   16541             : }
   16542             : |  BINARY
   16543             :  { 
   16544           0 :  $$ = mm_strdup("binary");
   16545             : }
   16546             : |  BIT
   16547             :  { 
   16548           0 :  $$ = mm_strdup("bit");
   16549             : }
   16550             : |  BOOLEAN_P
   16551             :  { 
   16552           0 :  $$ = mm_strdup("boolean");
   16553             : }
   16554             : |  BOTH
   16555             :  { 
   16556           0 :  $$ = mm_strdup("both");
   16557             : }
   16558             : |  BREADTH
   16559             :  { 
   16560           0 :  $$ = mm_strdup("breadth");
   16561             : }
   16562             : |  BY
   16563             :  { 
   16564           0 :  $$ = mm_strdup("by");
   16565             : }
   16566             : |  CACHE
   16567             :  { 
   16568           0 :  $$ = mm_strdup("cache");
   16569             : }
   16570             : |  CALL
   16571             :  { 
   16572           0 :  $$ = mm_strdup("call");
   16573             : }
   16574             : |  CALLED
   16575             :  { 
   16576           0 :  $$ = mm_strdup("called");
   16577             : }
   16578             : |  CASCADE
   16579             :  { 
   16580           0 :  $$ = mm_strdup("cascade");
   16581             : }
   16582             : |  CASCADED
   16583             :  { 
   16584           0 :  $$ = mm_strdup("cascaded");
   16585             : }
   16586             : |  CASE
   16587             :  { 
   16588           0 :  $$ = mm_strdup("case");
   16589             : }
   16590             : |  CAST
   16591             :  { 
   16592           0 :  $$ = mm_strdup("cast");
   16593             : }
   16594             : |  CATALOG_P
   16595             :  { 
   16596           0 :  $$ = mm_strdup("catalog");
   16597             : }
   16598             : |  CHAIN
   16599             :  { 
   16600           0 :  $$ = mm_strdup("chain");
   16601             : }
   16602             : |  CHARACTERISTICS
   16603             :  { 
   16604           0 :  $$ = mm_strdup("characteristics");
   16605             : }
   16606             : |  CHECK
   16607             :  { 
   16608           0 :  $$ = mm_strdup("check");
   16609             : }
   16610             : |  CHECKPOINT
   16611             :  { 
   16612           0 :  $$ = mm_strdup("checkpoint");
   16613             : }
   16614             : |  CLASS
   16615             :  { 
   16616           0 :  $$ = mm_strdup("class");
   16617             : }
   16618             : |  CLOSE
   16619             :  { 
   16620           0 :  $$ = mm_strdup("close");
   16621             : }
   16622             : |  CLUSTER
   16623             :  { 
   16624           0 :  $$ = mm_strdup("cluster");
   16625             : }
   16626             : |  COALESCE
   16627             :  { 
   16628           0 :  $$ = mm_strdup("coalesce");
   16629             : }
   16630             : |  COLLATE
   16631             :  { 
   16632           0 :  $$ = mm_strdup("collate");
   16633             : }
   16634             : |  COLLATION
   16635             :  { 
   16636           0 :  $$ = mm_strdup("collation");
   16637             : }
   16638             : |  COLUMN
   16639             :  { 
   16640           0 :  $$ = mm_strdup("column");
   16641             : }
   16642             : |  COLUMNS
   16643             :  { 
   16644           0 :  $$ = mm_strdup("columns");
   16645             : }
   16646             : |  COMMENT
   16647             :  { 
   16648           0 :  $$ = mm_strdup("comment");
   16649             : }
   16650             : |  COMMENTS
   16651             :  { 
   16652           0 :  $$ = mm_strdup("comments");
   16653             : }
   16654             : |  COMMIT
   16655             :  { 
   16656           0 :  $$ = mm_strdup("commit");
   16657             : }
   16658             : |  COMMITTED
   16659             :  { 
   16660           0 :  $$ = mm_strdup("committed");
   16661             : }
   16662             : |  COMPRESSION
   16663             :  { 
   16664           0 :  $$ = mm_strdup("compression");
   16665             : }
   16666             : |  CONCURRENTLY
   16667             :  { 
   16668           0 :  $$ = mm_strdup("concurrently");
   16669             : }
   16670             : |  CONDITIONAL
   16671             :  { 
   16672           0 :  $$ = mm_strdup("conditional");
   16673             : }
   16674             : |  CONFIGURATION
   16675             :  { 
   16676           0 :  $$ = mm_strdup("configuration");
   16677             : }
   16678             : |  CONFLICT
   16679             :  { 
   16680           0 :  $$ = mm_strdup("conflict");
   16681             : }
   16682             : |  CONNECTION
   16683             :  { 
   16684           0 :  $$ = mm_strdup("connection");
   16685             : }
   16686             : |  CONSTRAINT
   16687             :  { 
   16688           0 :  $$ = mm_strdup("constraint");
   16689             : }
   16690             : |  CONSTRAINTS
   16691             :  { 
   16692           0 :  $$ = mm_strdup("constraints");
   16693             : }
   16694             : |  CONTENT_P
   16695             :  { 
   16696           0 :  $$ = mm_strdup("content");
   16697             : }
   16698             : |  CONTINUE_P
   16699             :  { 
   16700           0 :  $$ = mm_strdup("continue");
   16701             : }
   16702             : |  CONVERSION_P
   16703             :  { 
   16704           0 :  $$ = mm_strdup("conversion");
   16705             : }
   16706             : |  COPY
   16707             :  { 
   16708           0 :  $$ = mm_strdup("copy");
   16709             : }
   16710             : |  COST
   16711             :  { 
   16712           0 :  $$ = mm_strdup("cost");
   16713             : }
   16714             : |  CROSS
   16715             :  { 
   16716           0 :  $$ = mm_strdup("cross");
   16717             : }
   16718             : |  CSV
   16719             :  { 
   16720           0 :  $$ = mm_strdup("csv");
   16721             : }
   16722             : |  CUBE
   16723             :  { 
   16724           0 :  $$ = mm_strdup("cube");
   16725             : }
   16726             : |  CURRENT_P
   16727             :  { 
   16728           0 :  $$ = mm_strdup("current");
   16729             : }
   16730             : |  CURRENT_CATALOG
   16731             :  { 
   16732           0 :  $$ = mm_strdup("current_catalog");
   16733             : }
   16734             : |  CURRENT_DATE
   16735             :  { 
   16736           0 :  $$ = mm_strdup("current_date");
   16737             : }
   16738             : |  CURRENT_ROLE
   16739             :  { 
   16740           0 :  $$ = mm_strdup("current_role");
   16741             : }
   16742             : |  CURRENT_SCHEMA
   16743             :  { 
   16744           0 :  $$ = mm_strdup("current_schema");
   16745             : }
   16746             : |  CURRENT_TIME
   16747             :  { 
   16748           0 :  $$ = mm_strdup("current_time");
   16749             : }
   16750             : |  CURRENT_TIMESTAMP
   16751             :  { 
   16752           0 :  $$ = mm_strdup("current_timestamp");
   16753             : }
   16754             : |  CURRENT_USER
   16755             :  { 
   16756           0 :  $$ = mm_strdup("current_user");
   16757             : }
   16758             : |  CURSOR
   16759             :  { 
   16760           0 :  $$ = mm_strdup("cursor");
   16761             : }
   16762             : |  CYCLE
   16763             :  { 
   16764           0 :  $$ = mm_strdup("cycle");
   16765             : }
   16766             : |  DATA_P
   16767             :  { 
   16768           0 :  $$ = mm_strdup("data");
   16769             : }
   16770             : |  DATABASE
   16771             :  { 
   16772           0 :  $$ = mm_strdup("database");
   16773             : }
   16774             : |  DEALLOCATE
   16775             :  { 
   16776           0 :  $$ = mm_strdup("deallocate");
   16777             : }
   16778             : |  DEC
   16779             :  { 
   16780           0 :  $$ = mm_strdup("dec");
   16781             : }
   16782             : |  DECIMAL_P
   16783             :  { 
   16784           0 :  $$ = mm_strdup("decimal");
   16785             : }
   16786             : |  DECLARE
   16787             :  { 
   16788           0 :  $$ = mm_strdup("declare");
   16789             : }
   16790             : |  DEFAULT
   16791             :  { 
   16792           0 :  $$ = mm_strdup("default");
   16793             : }
   16794             : |  DEFAULTS
   16795             :  { 
   16796           0 :  $$ = mm_strdup("defaults");
   16797             : }
   16798             : |  DEFERRABLE
   16799             :  { 
   16800           0 :  $$ = mm_strdup("deferrable");
   16801             : }
   16802             : |  DEFERRED
   16803             :  { 
   16804           0 :  $$ = mm_strdup("deferred");
   16805             : }
   16806             : |  DEFINER
   16807             :  { 
   16808           0 :  $$ = mm_strdup("definer");
   16809             : }
   16810             : |  DELETE_P
   16811             :  { 
   16812           0 :  $$ = mm_strdup("delete");
   16813             : }
   16814             : |  DELIMITER
   16815             :  { 
   16816           0 :  $$ = mm_strdup("delimiter");
   16817             : }
   16818             : |  DELIMITERS
   16819             :  { 
   16820           0 :  $$ = mm_strdup("delimiters");
   16821             : }
   16822             : |  DEPENDS
   16823             :  { 
   16824           0 :  $$ = mm_strdup("depends");
   16825             : }
   16826             : |  DEPTH
   16827             :  { 
   16828           0 :  $$ = mm_strdup("depth");
   16829             : }
   16830             : |  DESC
   16831             :  { 
   16832           0 :  $$ = mm_strdup("desc");
   16833             : }
   16834             : |  DETACH
   16835             :  { 
   16836           0 :  $$ = mm_strdup("detach");
   16837             : }
   16838             : |  DICTIONARY
   16839             :  { 
   16840           0 :  $$ = mm_strdup("dictionary");
   16841             : }
   16842             : |  DISABLE_P
   16843             :  { 
   16844           0 :  $$ = mm_strdup("disable");
   16845             : }
   16846             : |  DISCARD
   16847             :  { 
   16848           0 :  $$ = mm_strdup("discard");
   16849             : }
   16850             : |  DISTINCT
   16851             :  { 
   16852           0 :  $$ = mm_strdup("distinct");
   16853             : }
   16854             : |  DO
   16855             :  { 
   16856           0 :  $$ = mm_strdup("do");
   16857             : }
   16858             : |  DOCUMENT_P
   16859             :  { 
   16860           0 :  $$ = mm_strdup("document");
   16861             : }
   16862             : |  DOMAIN_P
   16863             :  { 
   16864           0 :  $$ = mm_strdup("domain");
   16865             : }
   16866             : |  DOUBLE_P
   16867             :  { 
   16868           0 :  $$ = mm_strdup("double");
   16869             : }
   16870             : |  DROP
   16871             :  { 
   16872           0 :  $$ = mm_strdup("drop");
   16873             : }
   16874             : |  EACH
   16875             :  { 
   16876           0 :  $$ = mm_strdup("each");
   16877             : }
   16878             : |  ELSE
   16879             :  { 
   16880           0 :  $$ = mm_strdup("else");
   16881             : }
   16882             : |  EMPTY_P
   16883             :  { 
   16884           0 :  $$ = mm_strdup("empty");
   16885             : }
   16886             : |  ENABLE_P
   16887             :  { 
   16888           0 :  $$ = mm_strdup("enable");
   16889             : }
   16890             : |  ENCODING
   16891             :  { 
   16892           0 :  $$ = mm_strdup("encoding");
   16893             : }
   16894             : |  ENCRYPTED
   16895             :  { 
   16896           0 :  $$ = mm_strdup("encrypted");
   16897             : }
   16898             : |  END_P
   16899             :  { 
   16900           0 :  $$ = mm_strdup("end");
   16901             : }
   16902             : |  ENUM_P
   16903             :  { 
   16904           0 :  $$ = mm_strdup("enum");
   16905             : }
   16906             : |  ERROR_P
   16907             :  { 
   16908           0 :  $$ = mm_strdup("error");
   16909             : }
   16910             : |  ESCAPE
   16911             :  { 
   16912           0 :  $$ = mm_strdup("escape");
   16913             : }
   16914             : |  EVENT
   16915             :  { 
   16916           0 :  $$ = mm_strdup("event");
   16917             : }
   16918             : |  EXCLUDE
   16919             :  { 
   16920           0 :  $$ = mm_strdup("exclude");
   16921             : }
   16922             : |  EXCLUDING
   16923             :  { 
   16924           0 :  $$ = mm_strdup("excluding");
   16925             : }
   16926             : |  EXCLUSIVE
   16927             :  { 
   16928           0 :  $$ = mm_strdup("exclusive");
   16929             : }
   16930             : |  EXECUTE
   16931             :  { 
   16932           0 :  $$ = mm_strdup("execute");
   16933             : }
   16934             : |  EXISTS
   16935             :  { 
   16936           0 :  $$ = mm_strdup("exists");
   16937             : }
   16938             : |  EXPLAIN
   16939             :  { 
   16940           0 :  $$ = mm_strdup("explain");
   16941             : }
   16942             : |  EXPRESSION
   16943             :  { 
   16944           0 :  $$ = mm_strdup("expression");
   16945             : }
   16946             : |  EXTENSION
   16947             :  { 
   16948           0 :  $$ = mm_strdup("extension");
   16949             : }
   16950             : |  EXTERNAL
   16951             :  { 
   16952           0 :  $$ = mm_strdup("external");
   16953             : }
   16954             : |  EXTRACT
   16955             :  { 
   16956           0 :  $$ = mm_strdup("extract");
   16957             : }
   16958             : |  FALSE_P
   16959             :  { 
   16960           0 :  $$ = mm_strdup("false");
   16961             : }
   16962             : |  FAMILY
   16963             :  { 
   16964           0 :  $$ = mm_strdup("family");
   16965             : }
   16966             : |  FINALIZE
   16967             :  { 
   16968           0 :  $$ = mm_strdup("finalize");
   16969             : }
   16970             : |  FIRST_P
   16971             :  { 
   16972           0 :  $$ = mm_strdup("first");
   16973             : }
   16974             : |  FLOAT_P
   16975             :  { 
   16976           0 :  $$ = mm_strdup("float");
   16977             : }
   16978             : |  FOLLOWING
   16979             :  { 
   16980           0 :  $$ = mm_strdup("following");
   16981             : }
   16982             : |  FORCE
   16983             :  { 
   16984           0 :  $$ = mm_strdup("force");
   16985             : }
   16986             : |  FOREIGN
   16987             :  { 
   16988           0 :  $$ = mm_strdup("foreign");
   16989             : }
   16990             : |  FORMAT
   16991             :  { 
   16992           0 :  $$ = mm_strdup("format");
   16993             : }
   16994             : |  FORWARD
   16995             :  { 
   16996           0 :  $$ = mm_strdup("forward");
   16997             : }
   16998             : |  FREEZE
   16999             :  { 
   17000           0 :  $$ = mm_strdup("freeze");
   17001             : }
   17002             : |  FULL
   17003             :  { 
   17004           0 :  $$ = mm_strdup("full");
   17005             : }
   17006             : |  FUNCTION
   17007             :  { 
   17008           0 :  $$ = mm_strdup("function");
   17009             : }
   17010             : |  FUNCTIONS
   17011             :  { 
   17012           0 :  $$ = mm_strdup("functions");
   17013             : }
   17014             : |  GENERATED
   17015             :  { 
   17016           0 :  $$ = mm_strdup("generated");
   17017             : }
   17018             : |  GLOBAL
   17019             :  { 
   17020           0 :  $$ = mm_strdup("global");
   17021             : }
   17022             : |  GRANTED
   17023             :  { 
   17024           0 :  $$ = mm_strdup("granted");
   17025             : }
   17026             : |  GREATEST
   17027             :  { 
   17028           0 :  $$ = mm_strdup("greatest");
   17029             : }
   17030             : |  GROUPING
   17031             :  { 
   17032           0 :  $$ = mm_strdup("grouping");
   17033             : }
   17034             : |  GROUPS
   17035             :  { 
   17036           0 :  $$ = mm_strdup("groups");
   17037             : }
   17038             : |  HANDLER
   17039             :  { 
   17040           0 :  $$ = mm_strdup("handler");
   17041             : }
   17042             : |  HEADER_P
   17043             :  { 
   17044           0 :  $$ = mm_strdup("header");
   17045             : }
   17046             : |  HOLD
   17047             :  { 
   17048           0 :  $$ = mm_strdup("hold");
   17049             : }
   17050             : |  IDENTITY_P
   17051             :  { 
   17052           0 :  $$ = mm_strdup("identity");
   17053             : }
   17054             : |  IF_P
   17055             :  { 
   17056           0 :  $$ = mm_strdup("if");
   17057             : }
   17058             : |  ILIKE
   17059             :  { 
   17060           0 :  $$ = mm_strdup("ilike");
   17061             : }
   17062             : |  IMMEDIATE
   17063             :  { 
   17064           0 :  $$ = mm_strdup("immediate");
   17065             : }
   17066             : |  IMMUTABLE
   17067             :  { 
   17068           0 :  $$ = mm_strdup("immutable");
   17069             : }
   17070             : |  IMPLICIT_P
   17071             :  { 
   17072           0 :  $$ = mm_strdup("implicit");
   17073             : }
   17074             : |  IMPORT_P
   17075             :  { 
   17076           0 :  $$ = mm_strdup("import");
   17077             : }
   17078             : |  IN_P
   17079             :  { 
   17080           0 :  $$ = mm_strdup("in");
   17081             : }
   17082             : |  INCLUDE
   17083             :  { 
   17084           0 :  $$ = mm_strdup("include");
   17085             : }
   17086             : |  INCLUDING
   17087             :  { 
   17088           0 :  $$ = mm_strdup("including");
   17089             : }
   17090             : |  INCREMENT
   17091             :  { 
   17092           0 :  $$ = mm_strdup("increment");
   17093             : }
   17094             : |  INDENT
   17095             :  { 
   17096           0 :  $$ = mm_strdup("indent");
   17097             : }
   17098             : |  INDEX
   17099             :  { 
   17100           0 :  $$ = mm_strdup("index");
   17101             : }
   17102             : |  INDEXES
   17103             :  { 
   17104           0 :  $$ = mm_strdup("indexes");
   17105             : }
   17106             : |  INHERIT
   17107             :  { 
   17108           0 :  $$ = mm_strdup("inherit");
   17109             : }
   17110             : |  INHERITS
   17111             :  { 
   17112           0 :  $$ = mm_strdup("inherits");
   17113             : }
   17114             : |  INITIALLY
   17115             :  { 
   17116           0 :  $$ = mm_strdup("initially");
   17117             : }
   17118             : |  INLINE_P
   17119             :  { 
   17120           0 :  $$ = mm_strdup("inline");
   17121             : }
   17122             : |  INNER_P
   17123             :  { 
   17124           0 :  $$ = mm_strdup("inner");
   17125             : }
   17126             : |  INOUT
   17127             :  { 
   17128           0 :  $$ = mm_strdup("inout");
   17129             : }
   17130             : |  INPUT_P
   17131             :  { 
   17132           0 :  $$ = mm_strdup("input");
   17133             : }
   17134             : |  INSENSITIVE
   17135             :  { 
   17136           0 :  $$ = mm_strdup("insensitive");
   17137             : }
   17138             : |  INSERT
   17139             :  { 
   17140           0 :  $$ = mm_strdup("insert");
   17141             : }
   17142             : |  INSTEAD
   17143             :  { 
   17144           0 :  $$ = mm_strdup("instead");
   17145             : }
   17146             : |  INT_P
   17147             :  { 
   17148           0 :  $$ = mm_strdup("int");
   17149             : }
   17150             : |  INTEGER
   17151             :  { 
   17152           0 :  $$ = mm_strdup("integer");
   17153             : }
   17154             : |  INTERVAL
   17155             :  { 
   17156           0 :  $$ = mm_strdup("interval");
   17157             : }
   17158             : |  INVOKER
   17159             :  { 
   17160           0 :  $$ = mm_strdup("invoker");
   17161             : }
   17162             : |  IS
   17163             :  { 
   17164           0 :  $$ = mm_strdup("is");
   17165             : }
   17166             : |  ISOLATION
   17167             :  { 
   17168           0 :  $$ = mm_strdup("isolation");
   17169             : }
   17170             : |  JOIN
   17171             :  { 
   17172           0 :  $$ = mm_strdup("join");
   17173             : }
   17174             : |  JSON
   17175             :  { 
   17176           0 :  $$ = mm_strdup("json");
   17177             : }
   17178             : |  JSON_ARRAY
   17179             :  { 
   17180           0 :  $$ = mm_strdup("json_array");
   17181             : }
   17182             : |  JSON_ARRAYAGG
   17183             :  { 
   17184           0 :  $$ = mm_strdup("json_arrayagg");
   17185             : }
   17186             : |  JSON_EXISTS
   17187             :  { 
   17188           0 :  $$ = mm_strdup("json_exists");
   17189             : }
   17190             : |  JSON_OBJECT
   17191             :  { 
   17192           0 :  $$ = mm_strdup("json_object");
   17193             : }
   17194             : |  JSON_OBJECTAGG
   17195             :  { 
   17196           0 :  $$ = mm_strdup("json_objectagg");
   17197             : }
   17198             : |  JSON_QUERY
   17199             :  { 
   17200           0 :  $$ = mm_strdup("json_query");
   17201             : }
   17202             : |  JSON_SCALAR
   17203             :  { 
   17204           0 :  $$ = mm_strdup("json_scalar");
   17205             : }
   17206             : |  JSON_SERIALIZE
   17207             :  { 
   17208           0 :  $$ = mm_strdup("json_serialize");
   17209             : }
   17210             : |  JSON_TABLE
   17211             :  { 
   17212           0 :  $$ = mm_strdup("json_table");
   17213             : }
   17214             : |  JSON_VALUE
   17215             :  { 
   17216           0 :  $$ = mm_strdup("json_value");
   17217             : }
   17218             : |  KEEP
   17219             :  { 
   17220           0 :  $$ = mm_strdup("keep");
   17221             : }
   17222             : |  KEY
   17223             :  { 
   17224           0 :  $$ = mm_strdup("key");
   17225             : }
   17226             : |  KEYS
   17227             :  { 
   17228           0 :  $$ = mm_strdup("keys");
   17229             : }
   17230             : |  LABEL
   17231             :  { 
   17232           0 :  $$ = mm_strdup("label");
   17233             : }
   17234             : |  LANGUAGE
   17235             :  { 
   17236           0 :  $$ = mm_strdup("language");
   17237             : }
   17238             : |  LARGE_P
   17239             :  { 
   17240           0 :  $$ = mm_strdup("large");
   17241             : }
   17242             : |  LAST_P
   17243             :  { 
   17244           0 :  $$ = mm_strdup("last");
   17245             : }
   17246             : |  LATERAL_P
   17247             :  { 
   17248           0 :  $$ = mm_strdup("lateral");
   17249             : }
   17250             : |  LEADING
   17251             :  { 
   17252           0 :  $$ = mm_strdup("leading");
   17253             : }
   17254             : |  LEAKPROOF
   17255             :  { 
   17256           0 :  $$ = mm_strdup("leakproof");
   17257             : }
   17258             : |  LEAST
   17259             :  { 
   17260           0 :  $$ = mm_strdup("least");
   17261             : }
   17262             : |  LEFT
   17263             :  { 
   17264           0 :  $$ = mm_strdup("left");
   17265             : }
   17266             : |  LEVEL
   17267             :  { 
   17268           0 :  $$ = mm_strdup("level");
   17269             : }
   17270             : |  LIKE
   17271             :  { 
   17272           0 :  $$ = mm_strdup("like");
   17273             : }
   17274             : |  LISTEN
   17275             :  { 
   17276           0 :  $$ = mm_strdup("listen");
   17277             : }
   17278             : |  LOAD
   17279             :  { 
   17280           0 :  $$ = mm_strdup("load");
   17281             : }
   17282             : |  LOCAL
   17283             :  { 
   17284           0 :  $$ = mm_strdup("local");
   17285             : }
   17286             : |  LOCALTIME
   17287             :  { 
   17288           0 :  $$ = mm_strdup("localtime");
   17289             : }
   17290             : |  LOCALTIMESTAMP
   17291             :  { 
   17292           0 :  $$ = mm_strdup("localtimestamp");
   17293             : }
   17294             : |  LOCATION
   17295             :  { 
   17296           0 :  $$ = mm_strdup("location");
   17297             : }
   17298             : |  LOCK_P
   17299             :  { 
   17300           0 :  $$ = mm_strdup("lock");
   17301             : }
   17302             : |  LOCKED
   17303             :  { 
   17304           0 :  $$ = mm_strdup("locked");
   17305             : }
   17306             : |  LOGGED
   17307             :  { 
   17308           0 :  $$ = mm_strdup("logged");
   17309             : }
   17310             : |  MAPPING
   17311             :  { 
   17312           0 :  $$ = mm_strdup("mapping");
   17313             : }
   17314             : |  MATCH
   17315             :  { 
   17316           0 :  $$ = mm_strdup("match");
   17317             : }
   17318             : |  MATCHED
   17319             :  { 
   17320           0 :  $$ = mm_strdup("matched");
   17321             : }
   17322             : |  MATERIALIZED
   17323             :  { 
   17324           0 :  $$ = mm_strdup("materialized");
   17325             : }
   17326             : |  MAXVALUE
   17327             :  { 
   17328           0 :  $$ = mm_strdup("maxvalue");
   17329             : }
   17330             : |  MERGE
   17331             :  { 
   17332           0 :  $$ = mm_strdup("merge");
   17333             : }
   17334             : |  MERGE_ACTION
   17335             :  { 
   17336           0 :  $$ = mm_strdup("merge_action");
   17337             : }
   17338             : |  METHOD
   17339             :  { 
   17340           0 :  $$ = mm_strdup("method");
   17341             : }
   17342             : |  MINVALUE
   17343             :  { 
   17344           0 :  $$ = mm_strdup("minvalue");
   17345             : }
   17346             : |  MODE
   17347             :  { 
   17348           0 :  $$ = mm_strdup("mode");
   17349             : }
   17350             : |  MOVE
   17351             :  { 
   17352           0 :  $$ = mm_strdup("move");
   17353             : }
   17354             : |  NAME_P
   17355             :  { 
   17356           0 :  $$ = mm_strdup("name");
   17357             : }
   17358             : |  NAMES
   17359             :  { 
   17360           0 :  $$ = mm_strdup("names");
   17361             : }
   17362             : |  NATIONAL
   17363             :  { 
   17364           0 :  $$ = mm_strdup("national");
   17365             : }
   17366             : |  NATURAL
   17367             :  { 
   17368           0 :  $$ = mm_strdup("natural");
   17369             : }
   17370             : |  NCHAR
   17371             :  { 
   17372           0 :  $$ = mm_strdup("nchar");
   17373             : }
   17374             : |  NESTED
   17375             :  { 
   17376           0 :  $$ = mm_strdup("nested");
   17377             : }
   17378             : |  NEW
   17379             :  { 
   17380           0 :  $$ = mm_strdup("new");
   17381             : }
   17382             : |  NEXT
   17383             :  { 
   17384           0 :  $$ = mm_strdup("next");
   17385             : }
   17386             : |  NFC
   17387             :  { 
   17388           0 :  $$ = mm_strdup("nfc");
   17389             : }
   17390             : |  NFD
   17391             :  { 
   17392           0 :  $$ = mm_strdup("nfd");
   17393             : }
   17394             : |  NFKC
   17395             :  { 
   17396           0 :  $$ = mm_strdup("nfkc");
   17397             : }
   17398             : |  NFKD
   17399             :  { 
   17400           0 :  $$ = mm_strdup("nfkd");
   17401             : }
   17402             : |  NO
   17403             :  { 
   17404           0 :  $$ = mm_strdup("no");
   17405             : }
   17406             : |  NONE
   17407             :  { 
   17408           0 :  $$ = mm_strdup("none");
   17409             : }
   17410             : |  NORMALIZE
   17411             :  { 
   17412           0 :  $$ = mm_strdup("normalize");
   17413             : }
   17414             : |  NORMALIZED
   17415             :  { 
   17416           0 :  $$ = mm_strdup("normalized");
   17417             : }
   17418             : |  NOT
   17419             :  { 
   17420           0 :  $$ = mm_strdup("not");
   17421             : }
   17422             : |  NOTHING
   17423             :  { 
   17424           0 :  $$ = mm_strdup("nothing");
   17425             : }
   17426             : |  NOTIFY
   17427             :  { 
   17428           0 :  $$ = mm_strdup("notify");
   17429             : }
   17430             : |  NOWAIT
   17431             :  { 
   17432           0 :  $$ = mm_strdup("nowait");
   17433             : }
   17434             : |  NULL_P
   17435             :  { 
   17436           0 :  $$ = mm_strdup("null");
   17437             : }
   17438             : |  NULLIF
   17439             :  { 
   17440           0 :  $$ = mm_strdup("nullif");
   17441             : }
   17442             : |  NULLS_P
   17443             :  { 
   17444           0 :  $$ = mm_strdup("nulls");
   17445             : }
   17446             : |  NUMERIC
   17447             :  { 
   17448           0 :  $$ = mm_strdup("numeric");
   17449             : }
   17450             : |  OBJECT_P
   17451             :  { 
   17452           0 :  $$ = mm_strdup("object");
   17453             : }
   17454             : |  OF
   17455             :  { 
   17456           0 :  $$ = mm_strdup("of");
   17457             : }
   17458             : |  OFF
   17459             :  { 
   17460           0 :  $$ = mm_strdup("off");
   17461             : }
   17462             : |  OIDS
   17463             :  { 
   17464           0 :  $$ = mm_strdup("oids");
   17465             : }
   17466             : |  OLD
   17467             :  { 
   17468           0 :  $$ = mm_strdup("old");
   17469             : }
   17470             : |  OMIT
   17471             :  { 
   17472           0 :  $$ = mm_strdup("omit");
   17473             : }
   17474             : |  ONLY
   17475             :  { 
   17476           0 :  $$ = mm_strdup("only");
   17477             : }
   17478             : |  OPERATOR
   17479             :  { 
   17480           0 :  $$ = mm_strdup("operator");
   17481             : }
   17482             : |  OPTION
   17483             :  { 
   17484           0 :  $$ = mm_strdup("option");
   17485             : }
   17486             : |  OPTIONS
   17487             :  { 
   17488           0 :  $$ = mm_strdup("options");
   17489             : }
   17490             : |  OR
   17491             :  { 
   17492           0 :  $$ = mm_strdup("or");
   17493             : }
   17494             : |  ORDINALITY
   17495             :  { 
   17496           0 :  $$ = mm_strdup("ordinality");
   17497             : }
   17498             : |  OTHERS
   17499             :  { 
   17500           0 :  $$ = mm_strdup("others");
   17501             : }
   17502             : |  OUT_P
   17503             :  { 
   17504           0 :  $$ = mm_strdup("out");
   17505             : }
   17506             : |  OUTER_P
   17507             :  { 
   17508           0 :  $$ = mm_strdup("outer");
   17509             : }
   17510             : |  OVERLAY
   17511             :  { 
   17512           0 :  $$ = mm_strdup("overlay");
   17513             : }
   17514             : |  OVERRIDING
   17515             :  { 
   17516           0 :  $$ = mm_strdup("overriding");
   17517             : }
   17518             : |  OWNED
   17519             :  { 
   17520           0 :  $$ = mm_strdup("owned");
   17521             : }
   17522             : |  OWNER
   17523             :  { 
   17524           0 :  $$ = mm_strdup("owner");
   17525             : }
   17526             : |  PARALLEL
   17527             :  { 
   17528           0 :  $$ = mm_strdup("parallel");
   17529             : }
   17530             : |  PARAMETER
   17531             :  { 
   17532           0 :  $$ = mm_strdup("parameter");
   17533             : }
   17534             : |  PARSER
   17535             :  { 
   17536           0 :  $$ = mm_strdup("parser");
   17537             : }
   17538             : |  PARTIAL
   17539             :  { 
   17540           0 :  $$ = mm_strdup("partial");
   17541             : }
   17542             : |  PARTITION
   17543             :  { 
   17544           0 :  $$ = mm_strdup("partition");
   17545             : }
   17546             : |  PARTITIONS
   17547             :  { 
   17548           0 :  $$ = mm_strdup("partitions");
   17549             : }
   17550             : |  PASSING
   17551             :  { 
   17552           0 :  $$ = mm_strdup("passing");
   17553             : }
   17554             : |  PASSWORD
   17555             :  { 
   17556           0 :  $$ = mm_strdup("password");
   17557             : }
   17558             : |  PATH
   17559             :  { 
   17560           0 :  $$ = mm_strdup("path");
   17561             : }
   17562             : |  PERIOD
   17563             :  { 
   17564           0 :  $$ = mm_strdup("period");
   17565             : }
   17566             : |  PLACING
   17567             :  { 
   17568           0 :  $$ = mm_strdup("placing");
   17569             : }
   17570             : |  PLAN
   17571             :  { 
   17572           0 :  $$ = mm_strdup("plan");
   17573             : }
   17574             : |  PLANS
   17575             :  { 
   17576           0 :  $$ = mm_strdup("plans");
   17577             : }
   17578             : |  POLICY
   17579             :  { 
   17580           0 :  $$ = mm_strdup("policy");
   17581             : }
   17582             : |  POSITION
   17583             :  { 
   17584           0 :  $$ = mm_strdup("position");
   17585             : }
   17586             : |  PRECEDING
   17587             :  { 
   17588           0 :  $$ = mm_strdup("preceding");
   17589             : }
   17590             : |  PREPARE
   17591             :  { 
   17592           0 :  $$ = mm_strdup("prepare");
   17593             : }
   17594             : |  PREPARED
   17595             :  { 
   17596           0 :  $$ = mm_strdup("prepared");
   17597             : }
   17598             : |  PRESERVE
   17599             :  { 
   17600           0 :  $$ = mm_strdup("preserve");
   17601             : }
   17602             : |  PRIMARY
   17603             :  { 
   17604           0 :  $$ = mm_strdup("primary");
   17605             : }
   17606             : |  PRIOR
   17607             :  { 
   17608           0 :  $$ = mm_strdup("prior");
   17609             : }
   17610             : |  PRIVILEGES
   17611             :  { 
   17612           0 :  $$ = mm_strdup("privileges");
   17613             : }
   17614             : |  PROCEDURAL
   17615             :  { 
   17616           0 :  $$ = mm_strdup("procedural");
   17617             : }
   17618             : |  PROCEDURE
   17619             :  { 
   17620           0 :  $$ = mm_strdup("procedure");
   17621             : }
   17622             : |  PROCEDURES
   17623             :  { 
   17624           0 :  $$ = mm_strdup("procedures");
   17625             : }
   17626             : |  PROGRAM
   17627             :  { 
   17628           0 :  $$ = mm_strdup("program");
   17629             : }
   17630             : |  PUBLICATION
   17631             :  { 
   17632           0 :  $$ = mm_strdup("publication");
   17633             : }
   17634             : |  QUOTE
   17635             :  { 
   17636           0 :  $$ = mm_strdup("quote");
   17637             : }
   17638             : |  QUOTES
   17639             :  { 
   17640           0 :  $$ = mm_strdup("quotes");
   17641             : }
   17642             : |  RANGE
   17643             :  { 
   17644           0 :  $$ = mm_strdup("range");
   17645             : }
   17646             : |  READ
   17647             :  { 
   17648           0 :  $$ = mm_strdup("read");
   17649             : }
   17650             : |  REAL
   17651             :  { 
   17652           0 :  $$ = mm_strdup("real");
   17653             : }
   17654             : |  REASSIGN
   17655             :  { 
   17656           0 :  $$ = mm_strdup("reassign");
   17657             : }
   17658             : |  RECHECK
   17659             :  { 
   17660           0 :  $$ = mm_strdup("recheck");
   17661             : }
   17662             : |  RECURSIVE
   17663             :  { 
   17664           0 :  $$ = mm_strdup("recursive");
   17665             : }
   17666             : |  REF_P
   17667             :  { 
   17668           0 :  $$ = mm_strdup("ref");
   17669             : }
   17670             : |  REFERENCES
   17671             :  { 
   17672           0 :  $$ = mm_strdup("references");
   17673             : }
   17674             : |  REFERENCING
   17675             :  { 
   17676           0 :  $$ = mm_strdup("referencing");
   17677             : }
   17678             : |  REFRESH
   17679             :  { 
   17680           0 :  $$ = mm_strdup("refresh");
   17681             : }
   17682             : |  REINDEX
   17683             :  { 
   17684           0 :  $$ = mm_strdup("reindex");
   17685             : }
   17686             : |  RELATIVE_P
   17687             :  { 
   17688           0 :  $$ = mm_strdup("relative");
   17689             : }
   17690             : |  RELEASE
   17691             :  { 
   17692           0 :  $$ = mm_strdup("release");
   17693             : }
   17694             : |  RENAME
   17695             :  { 
   17696           0 :  $$ = mm_strdup("rename");
   17697             : }
   17698             : |  REPEATABLE
   17699             :  { 
   17700           0 :  $$ = mm_strdup("repeatable");
   17701             : }
   17702             : |  REPLACE
   17703             :  { 
   17704           0 :  $$ = mm_strdup("replace");
   17705             : }
   17706             : |  REPLICA
   17707             :  { 
   17708           0 :  $$ = mm_strdup("replica");
   17709             : }
   17710             : |  RESET
   17711             :  { 
   17712           0 :  $$ = mm_strdup("reset");
   17713             : }
   17714             : |  RESTART
   17715             :  { 
   17716           0 :  $$ = mm_strdup("restart");
   17717             : }
   17718             : |  RESTRICT
   17719             :  { 
   17720           0 :  $$ = mm_strdup("restrict");
   17721             : }
   17722             : |  RETURN
   17723             :  { 
   17724           0 :  $$ = mm_strdup("return");
   17725             : }
   17726             : |  RETURNS
   17727             :  { 
   17728           0 :  $$ = mm_strdup("returns");
   17729             : }
   17730             : |  REVOKE
   17731             :  { 
   17732           0 :  $$ = mm_strdup("revoke");
   17733             : }
   17734             : |  RIGHT
   17735             :  { 
   17736           0 :  $$ = mm_strdup("right");
   17737             : }
   17738             : |  ROLE
   17739             :  { 
   17740           0 :  $$ = mm_strdup("role");
   17741             : }
   17742             : |  ROLLBACK
   17743             :  { 
   17744           0 :  $$ = mm_strdup("rollback");
   17745             : }
   17746             : |  ROLLUP
   17747             :  { 
   17748           0 :  $$ = mm_strdup("rollup");
   17749             : }
   17750             : |  ROUTINE
   17751             :  { 
   17752           0 :  $$ = mm_strdup("routine");
   17753             : }
   17754             : |  ROUTINES
   17755             :  { 
   17756           0 :  $$ = mm_strdup("routines");
   17757             : }
   17758             : |  ROW
   17759             :  { 
   17760           0 :  $$ = mm_strdup("row");
   17761             : }
   17762             : |  ROWS
   17763             :  { 
   17764           0 :  $$ = mm_strdup("rows");
   17765             : }
   17766             : |  RULE
   17767             :  { 
   17768           0 :  $$ = mm_strdup("rule");
   17769             : }
   17770             : |  SAVEPOINT
   17771             :  { 
   17772           0 :  $$ = mm_strdup("savepoint");
   17773             : }
   17774             : |  SCALAR
   17775             :  { 
   17776           0 :  $$ = mm_strdup("scalar");
   17777             : }
   17778             : |  SCHEMA
   17779             :  { 
   17780           0 :  $$ = mm_strdup("schema");
   17781             : }
   17782             : |  SCHEMAS
   17783             :  { 
   17784           0 :  $$ = mm_strdup("schemas");
   17785             : }
   17786             : |  SCROLL
   17787             :  { 
   17788           0 :  $$ = mm_strdup("scroll");
   17789             : }
   17790             : |  SEARCH
   17791             :  { 
   17792           0 :  $$ = mm_strdup("search");
   17793             : }
   17794             : |  SECURITY
   17795             :  { 
   17796           0 :  $$ = mm_strdup("security");
   17797             : }
   17798             : |  SELECT
   17799             :  { 
   17800           0 :  $$ = mm_strdup("select");
   17801             : }
   17802             : |  SEQUENCE
   17803             :  { 
   17804           0 :  $$ = mm_strdup("sequence");
   17805             : }
   17806             : |  SEQUENCES
   17807             :  { 
   17808           0 :  $$ = mm_strdup("sequences");
   17809             : }
   17810             : |  SERIALIZABLE
   17811             :  { 
   17812           0 :  $$ = mm_strdup("serializable");
   17813             : }
   17814             : |  SERVER
   17815             :  { 
   17816           0 :  $$ = mm_strdup("server");
   17817             : }
   17818             : |  SESSION
   17819             :  { 
   17820           0 :  $$ = mm_strdup("session");
   17821             : }
   17822             : |  SESSION_USER
   17823             :  { 
   17824           0 :  $$ = mm_strdup("session_user");
   17825             : }
   17826             : |  SET
   17827             :  { 
   17828           0 :  $$ = mm_strdup("set");
   17829             : }
   17830             : |  SETOF
   17831             :  { 
   17832           0 :  $$ = mm_strdup("setof");
   17833             : }
   17834             : |  SETS
   17835             :  { 
   17836           0 :  $$ = mm_strdup("sets");
   17837             : }
   17838             : |  SHARE
   17839             :  { 
   17840           0 :  $$ = mm_strdup("share");
   17841             : }
   17842             : |  SHOW
   17843             :  { 
   17844           0 :  $$ = mm_strdup("show");
   17845             : }
   17846             : |  SIMILAR
   17847             :  { 
   17848           0 :  $$ = mm_strdup("similar");
   17849             : }
   17850             : |  SIMPLE
   17851             :  { 
   17852           0 :  $$ = mm_strdup("simple");
   17853             : }
   17854             : |  SKIP
   17855             :  { 
   17856           0 :  $$ = mm_strdup("skip");
   17857             : }
   17858             : |  SMALLINT
   17859             :  { 
   17860           0 :  $$ = mm_strdup("smallint");
   17861             : }
   17862             : |  SNAPSHOT
   17863             :  { 
   17864           0 :  $$ = mm_strdup("snapshot");
   17865             : }
   17866             : |  SOME
   17867             :  { 
   17868           0 :  $$ = mm_strdup("some");
   17869             : }
   17870             : |  SOURCE
   17871             :  { 
   17872           0 :  $$ = mm_strdup("source");
   17873             : }
   17874             : |  SPLIT
   17875             :  { 
   17876           0 :  $$ = mm_strdup("split");
   17877             : }
   17878             : |  SQL_P
   17879             :  { 
   17880           0 :  $$ = mm_strdup("sql");
   17881             : }
   17882             : |  STABLE
   17883             :  { 
   17884           0 :  $$ = mm_strdup("stable");
   17885             : }
   17886             : |  STANDALONE_P
   17887             :  { 
   17888           0 :  $$ = mm_strdup("standalone");
   17889             : }
   17890             : |  START
   17891             :  { 
   17892           0 :  $$ = mm_strdup("start");
   17893             : }
   17894             : |  STATEMENT
   17895             :  { 
   17896           0 :  $$ = mm_strdup("statement");
   17897             : }
   17898             : |  STATISTICS
   17899             :  { 
   17900           0 :  $$ = mm_strdup("statistics");
   17901             : }
   17902             : |  STDIN
   17903             :  { 
   17904           0 :  $$ = mm_strdup("stdin");
   17905             : }
   17906             : |  STDOUT
   17907             :  { 
   17908           0 :  $$ = mm_strdup("stdout");
   17909             : }
   17910             : |  STORAGE
   17911             :  { 
   17912           0 :  $$ = mm_strdup("storage");
   17913             : }
   17914             : |  STORED
   17915             :  { 
   17916           0 :  $$ = mm_strdup("stored");
   17917             : }
   17918             : |  STRICT_P
   17919             :  { 
   17920           0 :  $$ = mm_strdup("strict");
   17921             : }
   17922             : |  STRING_P
   17923             :  { 
   17924           0 :  $$ = mm_strdup("string");
   17925             : }
   17926             : |  STRIP_P
   17927             :  { 
   17928           0 :  $$ = mm_strdup("strip");
   17929             : }
   17930             : |  SUBSCRIPTION
   17931             :  { 
   17932           0 :  $$ = mm_strdup("subscription");
   17933             : }
   17934             : |  SUBSTRING
   17935             :  { 
   17936           0 :  $$ = mm_strdup("substring");
   17937             : }
   17938             : |  SUPPORT
   17939             :  { 
   17940           0 :  $$ = mm_strdup("support");
   17941             : }
   17942             : |  SYMMETRIC
   17943             :  { 
   17944           0 :  $$ = mm_strdup("symmetric");
   17945             : }
   17946             : |  SYSID
   17947             :  { 
   17948           0 :  $$ = mm_strdup("sysid");
   17949             : }
   17950             : |  SYSTEM_P
   17951             :  { 
   17952           0 :  $$ = mm_strdup("system");
   17953             : }
   17954             : |  SYSTEM_USER
   17955             :  { 
   17956           0 :  $$ = mm_strdup("system_user");
   17957             : }
   17958             : |  TABLE
   17959             :  { 
   17960           0 :  $$ = mm_strdup("table");
   17961             : }
   17962             : |  TABLES
   17963             :  { 
   17964           0 :  $$ = mm_strdup("tables");
   17965             : }
   17966             : |  TABLESAMPLE
   17967             :  { 
   17968           0 :  $$ = mm_strdup("tablesample");
   17969             : }
   17970             : |  TABLESPACE
   17971             :  { 
   17972           0 :  $$ = mm_strdup("tablespace");
   17973             : }
   17974             : |  TARGET
   17975             :  { 
   17976           0 :  $$ = mm_strdup("target");
   17977             : }
   17978             : |  TEMP
   17979             :  { 
   17980           0 :  $$ = mm_strdup("temp");
   17981             : }
   17982             : |  TEMPLATE
   17983             :  { 
   17984           0 :  $$ = mm_strdup("template");
   17985             : }
   17986             : |  TEMPORARY
   17987             :  { 
   17988           0 :  $$ = mm_strdup("temporary");
   17989             : }
   17990             : |  TEXT_P
   17991             :  { 
   17992           0 :  $$ = mm_strdup("text");
   17993             : }
   17994             : |  THEN
   17995             :  { 
   17996           0 :  $$ = mm_strdup("then");
   17997             : }
   17998             : |  TIES
   17999             :  { 
   18000           0 :  $$ = mm_strdup("ties");
   18001             : }
   18002             : |  TIME
   18003             :  { 
   18004           0 :  $$ = mm_strdup("time");
   18005             : }
   18006             : |  TIMESTAMP
   18007             :  { 
   18008           0 :  $$ = mm_strdup("timestamp");
   18009             : }
   18010             : |  TRAILING
   18011             :  { 
   18012           0 :  $$ = mm_strdup("trailing");
   18013             : }
   18014             : |  TRANSACTION
   18015             :  { 
   18016           0 :  $$ = mm_strdup("transaction");
   18017             : }
   18018             : |  TRANSFORM
   18019             :  { 
   18020           0 :  $$ = mm_strdup("transform");
   18021             : }
   18022             : |  TREAT
   18023             :  { 
   18024           0 :  $$ = mm_strdup("treat");
   18025             : }
   18026             : |  TRIGGER
   18027             :  { 
   18028           0 :  $$ = mm_strdup("trigger");
   18029             : }
   18030             : |  TRIM
   18031             :  { 
   18032           0 :  $$ = mm_strdup("trim");
   18033             : }
   18034             : |  TRUE_P
   18035             :  { 
   18036           0 :  $$ = mm_strdup("true");
   18037             : }
   18038             : |  TRUNCATE
   18039             :  { 
   18040           0 :  $$ = mm_strdup("truncate");
   18041             : }
   18042             : |  TRUSTED
   18043             :  { 
   18044           0 :  $$ = mm_strdup("trusted");
   18045             : }
   18046             : |  TYPE_P
   18047             :  { 
   18048           0 :  $$ = mm_strdup("type");
   18049             : }
   18050             : |  TYPES_P
   18051             :  { 
   18052           0 :  $$ = mm_strdup("types");
   18053             : }
   18054             : |  UESCAPE
   18055             :  { 
   18056           0 :  $$ = mm_strdup("uescape");
   18057             : }
   18058             : |  UNBOUNDED
   18059             :  { 
   18060           0 :  $$ = mm_strdup("unbounded");
   18061             : }
   18062             : |  UNCOMMITTED
   18063             :  { 
   18064           0 :  $$ = mm_strdup("uncommitted");
   18065             : }
   18066             : |  UNCONDITIONAL
   18067             :  { 
   18068           0 :  $$ = mm_strdup("unconditional");
   18069             : }
   18070             : |  UNENCRYPTED
   18071             :  { 
   18072           0 :  $$ = mm_strdup("unencrypted");
   18073             : }
   18074             : |  UNIQUE
   18075             :  { 
   18076           0 :  $$ = mm_strdup("unique");
   18077             : }
   18078             : |  UNKNOWN
   18079             :  { 
   18080           0 :  $$ = mm_strdup("unknown");
   18081             : }
   18082             : |  UNLISTEN
   18083             :  { 
   18084           0 :  $$ = mm_strdup("unlisten");
   18085             : }
   18086             : |  UNLOGGED
   18087             :  { 
   18088           0 :  $$ = mm_strdup("unlogged");
   18089             : }
   18090             : |  UNTIL
   18091             :  { 
   18092           0 :  $$ = mm_strdup("until");
   18093             : }
   18094             : |  UPDATE
   18095             :  { 
   18096           0 :  $$ = mm_strdup("update");
   18097             : }
   18098             : |  USER
   18099             :  { 
   18100           0 :  $$ = mm_strdup("user");
   18101             : }
   18102             : |  USING
   18103             :  { 
   18104           0 :  $$ = mm_strdup("using");
   18105             : }
   18106             : |  VACUUM
   18107             :  { 
   18108           0 :  $$ = mm_strdup("vacuum");
   18109             : }
   18110             : |  VALID
   18111             :  { 
   18112           0 :  $$ = mm_strdup("valid");
   18113             : }
   18114             : |  VALIDATE
   18115             :  { 
   18116           0 :  $$ = mm_strdup("validate");
   18117             : }
   18118             : |  VALIDATOR
   18119             :  { 
   18120           0 :  $$ = mm_strdup("validator");
   18121             : }
   18122             : |  VALUE_P
   18123             :  { 
   18124           0 :  $$ = mm_strdup("value");
   18125             : }
   18126             : |  VALUES
   18127             :  { 
   18128           0 :  $$ = mm_strdup("values");
   18129             : }
   18130             : |  VARCHAR
   18131             :  { 
   18132           0 :  $$ = mm_strdup("varchar");
   18133             : }
   18134             : |  VARIADIC
   18135             :  { 
   18136           0 :  $$ = mm_strdup("variadic");
   18137             : }
   18138             : |  VERBOSE
   18139             :  { 
   18140           0 :  $$ = mm_strdup("verbose");
   18141             : }
   18142             : |  VERSION_P
   18143             :  { 
   18144           0 :  $$ = mm_strdup("version");
   18145             : }
   18146             : |  VIEW
   18147             :  { 
   18148           0 :  $$ = mm_strdup("view");
   18149             : }
   18150             : |  VIEWS
   18151             :  { 
   18152           0 :  $$ = mm_strdup("views");
   18153             : }
   18154             : |  VOLATILE
   18155             :  { 
   18156           0 :  $$ = mm_strdup("volatile");
   18157             : }
   18158             : |  WHEN
   18159             :  { 
   18160           0 :  $$ = mm_strdup("when");
   18161             : }
   18162             : |  WHITESPACE_P
   18163             :  { 
   18164           0 :  $$ = mm_strdup("whitespace");
   18165             : }
   18166             : |  WORK
   18167             :  { 
   18168           0 :  $$ = mm_strdup("work");
   18169             : }
   18170             : |  WRAPPER
   18171             :  { 
   18172           0 :  $$ = mm_strdup("wrapper");
   18173             : }
   18174             : |  WRITE
   18175             :  { 
   18176           0 :  $$ = mm_strdup("write");
   18177             : }
   18178             : |  XML_P
   18179             :  { 
   18180           0 :  $$ = mm_strdup("xml");
   18181             : }
   18182             : |  XMLATTRIBUTES
   18183             :  { 
   18184           0 :  $$ = mm_strdup("xmlattributes");
   18185             : }
   18186             : |  XMLCONCAT
   18187             :  { 
   18188           0 :  $$ = mm_strdup("xmlconcat");
   18189             : }
   18190             : |  XMLELEMENT
   18191             :  { 
   18192           0 :  $$ = mm_strdup("xmlelement");
   18193             : }
   18194             : |  XMLEXISTS
   18195             :  { 
   18196           0 :  $$ = mm_strdup("xmlexists");
   18197             : }
   18198             : |  XMLFOREST
   18199             :  { 
   18200           0 :  $$ = mm_strdup("xmlforest");
   18201             : }
   18202             : |  XMLNAMESPACES
   18203             :  { 
   18204           0 :  $$ = mm_strdup("xmlnamespaces");
   18205             : }
   18206             : |  XMLPARSE
   18207             :  { 
   18208           0 :  $$ = mm_strdup("xmlparse");
   18209             : }
   18210             : |  XMLPI
   18211             :  { 
   18212           0 :  $$ = mm_strdup("xmlpi");
   18213             : }
   18214             : |  XMLROOT
   18215             :  { 
   18216           0 :  $$ = mm_strdup("xmlroot");
   18217             : }
   18218             : |  XMLSERIALIZE
   18219             :  { 
   18220           0 :  $$ = mm_strdup("xmlserialize");
   18221             : }
   18222             : |  XMLTABLE
   18223             :  { 
   18224           0 :  $$ = mm_strdup("xmltable");
   18225             : }
   18226             : |  YES_P
   18227             :  { 
   18228           0 :  $$ = mm_strdup("yes");
   18229             : }
   18230             : |  ZONE
   18231             :  { 
   18232           0 :  $$ = mm_strdup("zone");
   18233             : }
   18234             : ;
   18235             : 
   18236             : 
   18237             : /* trailer */
   18238             : /* src/interfaces/ecpg/preproc/ecpg.trailer */
   18239             : 
   18240             : statements: /*EMPTY*/
   18241             :                 | statements statement
   18242             :         ;
   18243             : 
   18244             : statement: ecpgstart at toplevel_stmt ';'
   18245             :                 {
   18246         196 :                     if (connection)
   18247         196 :                         free(connection);
   18248         196 :                     connection = NULL;
   18249             :                 }
   18250             :                 | ecpgstart toplevel_stmt ';'
   18251             :                 {
   18252        2182 :                     if (connection)
   18253          26 :                         free(connection);
   18254        2182 :                     connection = NULL;
   18255             :                 }
   18256             :                 | ecpgstart ECPGVarDeclaration
   18257             :                 {
   18258          48 :                     fprintf(base_yyout, "%s", $2);
   18259          48 :                     free($2);
   18260          48 :                     output_line_number();
   18261             :                 }
   18262             :                 | ECPGDeclaration
   18263       42228 :                 | c_thing               { fprintf(base_yyout, "%s", $1); free($1); }
   18264        1446 :                 | CPP_LINE              { fprintf(base_yyout, "%s", $1); free($1); }
   18265         656 :                 | '{'                   { braces_open++; fputs("{", base_yyout); }
   18266             :                 | '}'
   18267             :         {
   18268         656 :             remove_typedefs(braces_open);
   18269         656 :             remove_variables(braces_open--);
   18270         656 :             if (braces_open == 0)
   18271             :             {
   18272         288 :                 free(current_function);
   18273         288 :                 current_function = NULL;
   18274             :             }
   18275         656 :             fputs("}", base_yyout);
   18276             :         }
   18277             :         ;
   18278             : 
   18279           2 : CreateAsStmt: CREATE OptTemp TABLE create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
   18280             :         {
   18281           2 :             if (FoundInto == 1)
   18282           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE AS cannot specify INTO");
   18283             : 
   18284           2 :             $$ = cat_str(7, mm_strdup("create"), $2, mm_strdup("table"), $4, mm_strdup("as"), $7, $8);
   18285             :         }
   18286           2 :         |  CREATE OptTemp TABLE IF_P NOT EXISTS create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
   18287             :         {
   18288           2 :             if (FoundInto == 1)
   18289           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE AS cannot specify INTO");
   18290             : 
   18291           2 :             $$ = cat_str(7, mm_strdup("create"), $2, mm_strdup("table if not exists"), $7, mm_strdup("as"), $10, $11);
   18292             :         }
   18293             :         ;
   18294             : 
   18295             : at: AT connection_object
   18296             :         {
   18297         196 :             connection = $2;
   18298             :             /*
   18299             :              * Do we have a variable as connection target?  Remove the variable
   18300             :              * from the variable list or else it will be used twice.
   18301             :              */
   18302         196 :             if (argsinsert != NULL)
   18303           0 :                 argsinsert = NULL;
   18304             :         }
   18305             :         ;
   18306             : 
   18307             : /*
   18308             :  * the exec sql connect statement: connect to the given database
   18309             :  */
   18310             : ECPGConnect: SQL_CONNECT TO connection_target opt_connection_name opt_user
   18311         186 :             { $$ = cat_str(5, $3, mm_strdup(","), $5, mm_strdup(","), $4); }
   18312             :         | SQL_CONNECT TO DEFAULT
   18313           0 :             { $$ = mm_strdup("NULL, NULL, NULL, \"DEFAULT\""); }
   18314             :           /* also allow ORACLE syntax */
   18315             :         | SQL_CONNECT ora_user
   18316           0 :             { $$ = cat_str(3, mm_strdup("NULL,"), $2, mm_strdup(", NULL")); }
   18317             :         | DATABASE connection_target
   18318           0 :             { $$ = cat2_str($2, mm_strdup(", NULL, NULL, NULL")); }
   18319             :         ;
   18320             : 
   18321             : connection_target: opt_database_name opt_server opt_port
   18322             :         {
   18323             :             /* old style: dbname[@server][:port] */
   18324         158 :             if (strlen($2) > 0 && *($2) != '@')
   18325           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "expected \"@\", found \"%s\"", $2);
   18326             : 
   18327             :             /* C strings need to be handled differently */
   18328         158 :             if ($1[0] == '\"')
   18329          10 :                 $$ = $1;
   18330             :             else
   18331         148 :                 $$ = make3_str(mm_strdup("\""), make3_str($1, $2, $3), mm_strdup("\""));
   18332             :         }
   18333             :         |  db_prefix ':' server opt_port '/' opt_database_name opt_options
   18334             :         {
   18335             :             /* new style: <tcp|unix>:postgresql://server[:port][/dbname] */
   18336          18 :             if (strncmp($1, "unix:postgresql", strlen("unix:postgresql")) != 0 && strncmp($1, "tcp:postgresql", strlen("tcp:postgresql")) != 0)
   18337           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "only protocols \"tcp\" and \"unix\" and database type \"postgresql\" are supported");
   18338             : 
   18339          18 :             if (strncmp($3, "//", strlen("//")) != 0)
   18340           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "expected \"://\", found \"%s\"", $3);
   18341             : 
   18342          18 :             if (strncmp($1, "unix", strlen("unix")) == 0 &&
   18343          10 :                 strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0 &&
   18344           0 :                 strncmp($3 + strlen("//"), "127.0.0.1", strlen("127.0.0.1")) != 0)
   18345           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "Unix-domain sockets only work on \"localhost\" but not on \"%s\"", $3 + strlen("//"));
   18346             : 
   18347          18 :             $$ = make3_str(make3_str(mm_strdup("\""), $1, mm_strdup(":")), $3, make3_str(make3_str($4, mm_strdup("/"), $6), $7, mm_strdup("\"")));
   18348             :         }
   18349             :         | char_variable
   18350             :         {
   18351           6 :             $$ = $1;
   18352             :         }
   18353             :         | ecpg_sconst
   18354             :         {
   18355             :             /* We can only process double quoted strings not single quotes ones,
   18356             :              * so we change the quotes.
   18357             :              * Note, that the rule for ecpg_sconst adds these single quotes. */
   18358           4 :             $1[0] = '\"';
   18359           4 :             $1[strlen($1)-1] = '\"';
   18360           4 :             $$ = $1;
   18361             :         }
   18362             :         ;
   18363             : 
   18364         172 : opt_database_name: name             { $$ = $1; }
   18365           4 :         | /*EMPTY*/         { $$ = EMPTY; }
   18366             :         ;
   18367             : 
   18368             : db_prefix: ecpg_ident cvariable
   18369             :         {
   18370          18 :             if (strcmp($2, "postgresql") != 0 && strcmp($2, "postgres") != 0)
   18371           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "expected \"postgresql\", found \"%s\"", $2);
   18372             : 
   18373          18 :             if (strcmp($1, "tcp") != 0 && strcmp($1, "unix") != 0)
   18374           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "invalid connection type: %s", $1);
   18375             : 
   18376          18 :             $$ = make3_str($1, mm_strdup(":"), $2);
   18377             :         }
   18378             :         ;
   18379             : 
   18380             : server: Op server_name
   18381             :         {
   18382          22 :             if (strcmp($1, "@") != 0 && strcmp($1, "//") != 0)
   18383           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "expected \"@\" or \"://\", found \"%s\"", $1);
   18384             : 
   18385          22 :             $$ = make2_str($1, $2);
   18386             :         }
   18387             :         ;
   18388             : 
   18389           4 : opt_server: server          { $$ = $1; }
   18390         154 :         | /*EMPTY*/         { $$ = EMPTY; }
   18391             :         ;
   18392             : 
   18393          20 : server_name: ColId                  { $$ = $1; }
   18394           0 :         | ColId '.' server_name     { $$ = make3_str($1, mm_strdup("."), $3); }
   18395           2 :         | IP                        { $$ = make_name(); }
   18396             :         ;
   18397             : 
   18398           2 : opt_port: ':' Iconst        { $$ = make2_str(mm_strdup(":"), $2); }
   18399         174 :         | /*EMPTY*/ { $$ = EMPTY; }
   18400             :         ;
   18401             : 
   18402          76 : opt_connection_name: AS connection_object   { $$ = $2; }
   18403         110 :         | /*EMPTY*/         { $$ = mm_strdup("NULL"); }
   18404             :         ;
   18405             : 
   18406          32 : opt_user: USER ora_user     { $$ = $2; }
   18407         154 :         | /*EMPTY*/         { $$ = mm_strdup("NULL, NULL"); }
   18408             :         ;
   18409             : 
   18410             : ora_user: user_name
   18411           6 :             { $$ = cat2_str($1, mm_strdup(", NULL")); }
   18412             :         | user_name '/' user_name
   18413          10 :             { $$ = cat_str(3, $1, mm_strdup(","), $3); }
   18414             :         | user_name SQL_IDENTIFIED BY user_name
   18415          10 :             { $$ = cat_str(3, $1, mm_strdup(","), $4); }
   18416             :         | user_name USING user_name
   18417           6 :             { $$ = cat_str(3, $1, mm_strdup(","), $3); }
   18418             :         ;
   18419             : 
   18420             : user_name: RoleId
   18421             :         {
   18422          54 :             if ($1[0] == '\"')
   18423           6 :                 $$ = $1;
   18424             :             else
   18425          48 :                 $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
   18426             :         }
   18427             :         | ecpg_sconst
   18428             :         {
   18429           0 :             if ($1[0] == '\"')
   18430           0 :                 $$ = $1;
   18431             :             else
   18432           0 :                 $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
   18433             :         }
   18434             :         | civar
   18435             :         {
   18436           4 :             enum ECPGttype type = argsinsert->variable->type->type;
   18437             : 
   18438             :             /* if array see what's inside */
   18439           4 :             if (type == ECPGt_array)
   18440           0 :                 type = argsinsert->variable->type->u.element->type;
   18441             : 
   18442             :             /* handle varchars */
   18443           4 :             if (type == ECPGt_varchar)
   18444           0 :                 $$ = make2_str(mm_strdup(argsinsert->variable->name), mm_strdup(".arr"));
   18445             :             else
   18446           4 :                 $$ = mm_strdup(argsinsert->variable->name);
   18447             :         }
   18448             :         ;
   18449             : 
   18450             : char_variable: cvariable
   18451             :         {
   18452             :             /* check if we have a string variable */
   18453         256 :             struct variable *p = find_variable($1);
   18454         256 :             enum ECPGttype type = p->type->type;
   18455             : 
   18456             :             /* If we have just one character this is not a string */
   18457         256 :             if (atol(p->type->size) == 1)
   18458           0 :                     mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
   18459             :             else
   18460             :             {
   18461             :                 /* if array see what's inside */
   18462         256 :                 if (type == ECPGt_array)
   18463           0 :                     type = p->type->u.element->type;
   18464             : 
   18465             :                 switch (type)
   18466             :                 {
   18467         236 :                     case ECPGt_char:
   18468             :                     case ECPGt_unsigned_char:
   18469             :                     case ECPGt_string:
   18470         236 :                         $$ = $1;
   18471         236 :                         break;
   18472          20 :                     case ECPGt_varchar:
   18473          20 :                         $$ = make2_str($1, mm_strdup(".arr"));
   18474          20 :                         break;
   18475           0 :                     default:
   18476           0 :                         mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
   18477           0 :                         $$ = $1;
   18478           0 :                         break;
   18479             :                 }
   18480             :             }
   18481             :         }
   18482             :         ;
   18483             : 
   18484             : opt_options: Op connect_options
   18485             :         {
   18486           4 :             if (strlen($1) == 0)
   18487           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "incomplete statement");
   18488             : 
   18489           4 :             if (strcmp($1, "?") != 0)
   18490           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "unrecognized token \"%s\"", $1);
   18491             : 
   18492           4 :             $$ = make2_str(mm_strdup("?"), $2);
   18493             :         }
   18494          14 :         | /*EMPTY*/ { $$ = EMPTY; }
   18495             :         ;
   18496             : 
   18497             : connect_options:  ColId opt_opt_value
   18498             :             {
   18499           4 :                 $$ = make2_str($1, $2);
   18500             :             }
   18501             :         | ColId opt_opt_value Op connect_options
   18502             :             {
   18503           2 :                 if (strlen($3) == 0)
   18504           0 :                     mmerror(PARSE_ERROR, ET_ERROR, "incomplete statement");
   18505             : 
   18506           2 :                 if (strcmp($3, "&") != 0)
   18507           0 :                     mmerror(PARSE_ERROR, ET_ERROR, "unrecognized token \"%s\"", $3);
   18508             : 
   18509           2 :                 $$ = cat_str(3, make2_str($1, $2), $3, $4);
   18510             :             }
   18511             :         ;
   18512             : 
   18513             : opt_opt_value: /*EMPTY*/
   18514           0 :             { $$ = EMPTY; }
   18515             :         | '=' Iconst
   18516           4 :             { $$ = make2_str(mm_strdup("="), $2); }
   18517             :         | '=' ecpg_ident
   18518           2 :             { $$ = make2_str(mm_strdup("="), $2); }
   18519             :         | '=' civar
   18520           0 :             { $$ = make2_str(mm_strdup("="), $2); }
   18521             :         ;
   18522             : 
   18523             : prepared_name: name
   18524             :         {
   18525         310 :             if ($1[0] == '\"' && $1[strlen($1)-1] == '\"') /* already quoted? */
   18526          50 :                 $$ = $1;
   18527             :             else /* not quoted => convert to lowercase */
   18528             :             {
   18529             :                 size_t i;
   18530             : 
   18531        1666 :                 for (i = 0; i< strlen($1); i++)
   18532        1406 :                     $1[i] = tolower((unsigned char) $1[i]);
   18533             : 
   18534         260 :                 $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\""));
   18535             :             }
   18536             :         }
   18537          28 :         | char_variable { $$ = $1; }
   18538             :         ;
   18539             : 
   18540             : /*
   18541             :  * Declare Statement
   18542             :  */
   18543             : ECPGDeclareStmt: DECLARE prepared_name STATEMENT
   18544             :         {
   18545          10 :             struct declared_list *ptr = NULL;
   18546             :             /* Check whether the declared name has been defined or not */
   18547          30 :             for (ptr = g_declared_list; ptr != NULL; ptr = ptr->next)
   18548             :             {
   18549          20 :                 if (strcmp($2, ptr->name) == 0)
   18550             :                 {
   18551             :                     /* re-definition is not allowed */
   18552           0 :                     mmerror(PARSE_ERROR, ET_ERROR, "name \"%s\" is already declared", ptr->name);
   18553             :                 }
   18554             :             }
   18555             : 
   18556             :             /* Add a new declared name into the g_declared_list */
   18557          10 :             ptr = NULL;
   18558          10 :             ptr = (struct declared_list *)mm_alloc(sizeof(struct declared_list));
   18559          10 :             if (ptr)
   18560             :             {
   18561             :                 /* initial definition */
   18562          10 :                 ptr -> name = $2;
   18563          10 :                 if (connection)
   18564           4 :                     ptr -> connection = mm_strdup(connection);
   18565             :                 else
   18566           6 :                     ptr -> connection = NULL;
   18567             : 
   18568          10 :                 ptr -> next = g_declared_list;
   18569          10 :                 g_declared_list = ptr;
   18570             :             }
   18571             : 
   18572          10 :             $$ = cat_str(3 , mm_strdup("/* declare "), mm_strdup($2), mm_strdup(" as an SQL identifier */"));
   18573             :         }
   18574             : ;
   18575             : 
   18576             : /*
   18577             :  * Declare a prepared cursor. The syntax is different from the standard
   18578             :  * declare statement, so we create a new rule.
   18579             :  */
   18580             : ECPGCursorStmt:  DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name
   18581             :         {
   18582             :             struct cursor *ptr, *this;
   18583          40 :             char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : mm_strdup($2);
   18584          40 :             int (* strcmp_fn)(const char *, const char *) = (($2[0] == ':' || $2[0] == '"') ? strcmp : pg_strcasecmp);
   18585          40 :             struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
   18586             :             char *comment;
   18587             :             char *con;
   18588             : 
   18589          40 :             if (INFORMIX_MODE && pg_strcasecmp($2, "database") == 0)
   18590           0 :                                 mmfatal(PARSE_ERROR, "\"database\" cannot be used as cursor name in INFORMIX mode");
   18591             : 
   18592          40 :                         check_declared_list($7);
   18593          40 :             con = connection ? connection : "NULL";
   18594          84 :             for (ptr = cur; ptr != NULL; ptr = ptr->next)
   18595             :             {
   18596          44 :                 if (strcmp_fn($2, ptr->name) == 0)
   18597             :                 {
   18598             :                     /* re-definition is a bug */
   18599           0 :                     if ($2[0] == ':')
   18600           0 :                         mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
   18601             :                     else
   18602           0 :                         mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
   18603             :                 }
   18604             :             }
   18605             : 
   18606          40 :             this = (struct cursor *) mm_alloc(sizeof(struct cursor));
   18607             : 
   18608             :             /* initial definition */
   18609          40 :             this->next = cur;
   18610          40 :             this->name = $2;
   18611          40 :             this->function = (current_function ? mm_strdup(current_function) : NULL);
   18612          40 :             this->connection = connection ? mm_strdup(connection) : NULL;
   18613          40 :             this->command =  cat_str(6, mm_strdup("declare"), cursor_marker, $3, mm_strdup("cursor"), $5, mm_strdup("for $1"));
   18614          40 :             this->argsresult = NULL;
   18615          40 :             this->argsresult_oos = NULL;
   18616             : 
   18617          40 :             thisquery->type = &ecpg_query;
   18618          40 :             thisquery->brace_level = 0;
   18619          40 :             thisquery->next = NULL;
   18620          40 :             thisquery->name = (char *) mm_alloc(sizeof("ECPGprepared_statement(, , __LINE__)") + strlen(con) + strlen($7));
   18621          40 :             sprintf(thisquery->name, "ECPGprepared_statement(%s, %s, __LINE__)", con, $7);
   18622             : 
   18623          40 :             this->argsinsert = NULL;
   18624          40 :             this->argsinsert_oos = NULL;
   18625          40 :             if ($2[0] == ':')
   18626             :             {
   18627           6 :                 struct variable *var = find_variable($2 + 1);
   18628           6 :                 remove_variable_from_list(&argsinsert, var);
   18629           6 :                 add_variable_to_head(&(this->argsinsert), var, &no_indicator);
   18630             :             }
   18631          40 :             add_variable_to_head(&(this->argsinsert), thisquery, &no_indicator);
   18632             : 
   18633          40 :             cur = this;
   18634             : 
   18635          40 :             comment = cat_str(3, mm_strdup("/*"), mm_strdup(this->command), mm_strdup("*/"));
   18636             : 
   18637          40 :             $$ = cat_str(2, adjust_outofscope_cursor_vars(this),
   18638             :                     comment);
   18639             :         }
   18640             :         ;
   18641             : 
   18642             : ECPGExecuteImmediateStmt: EXECUTE IMMEDIATE execstring
   18643             :             {
   18644             :               /* execute immediate means prepare the statement and
   18645             :                * immediately execute it */
   18646          14 :               $$ = $3;
   18647             :             };
   18648             : /*
   18649             :  * variable declaration outside exec sql declare block
   18650             :  */
   18651             : ECPGVarDeclaration: single_vt_declaration;
   18652             : 
   18653          18 : single_vt_declaration: type_declaration     { $$ = $1; }
   18654         498 :         | var_declaration       { $$ = $1; }
   18655             :         ;
   18656             : 
   18657           2 : precision:  NumericOnly { $$ = $1; };
   18658             : 
   18659           2 : opt_scale:  ',' NumericOnly { $$ = $2; }
   18660           0 :         | /* EMPTY */   { $$ = EMPTY; }
   18661             :         ;
   18662             : 
   18663          98 : ecpg_interval:  opt_interval    { $$ = $1; }
   18664           0 :         | YEAR_P TO MINUTE_P    { $$ = mm_strdup("year to minute"); }
   18665           0 :         | YEAR_P TO SECOND_P    { $$ = mm_strdup("year to second"); }
   18666           0 :         | DAY_P TO DAY_P        { $$ = mm_strdup("day to day"); }
   18667           0 :         | MONTH_P TO MONTH_P    { $$ = mm_strdup("month to month"); }
   18668             :         ;
   18669             : 
   18670             : /*
   18671             :  * variable declaration inside exec sql declare block
   18672             :  */
   18673             : ECPGDeclaration: sql_startdeclare
   18674         128 :         { fputs("/* exec sql begin declare section */", base_yyout); }
   18675             :         var_type_declarations sql_enddeclare
   18676             :         {
   18677         128 :             fprintf(base_yyout, "%s/* exec sql end declare section */", $3);
   18678         128 :             free($3);
   18679         128 :             output_line_number();
   18680             :         }
   18681             :         ;
   18682             : 
   18683             : sql_startdeclare: ecpgstart BEGIN_P DECLARE SQL_SECTION ';' {};
   18684             : 
   18685             : sql_enddeclare: ecpgstart END_P DECLARE SQL_SECTION ';' {};
   18686             : 
   18687           0 : var_type_declarations:  /*EMPTY*/           { $$ = EMPTY; }
   18688         128 :         | vt_declarations           { $$ = $1; }
   18689             :         ;
   18690             : 
   18691         128 : vt_declarations:  single_vt_declaration         { $$ = $1; }
   18692           0 :         | CPP_LINE              { $$ = $1; }
   18693         340 :         | vt_declarations single_vt_declaration { $$ = cat2_str($1, $2); }
   18694           4 :         | vt_declarations CPP_LINE      { $$ = cat2_str($1, $2); }
   18695             :         ;
   18696             : 
   18697          46 : variable_declarations:  var_declaration { $$ = $1; }
   18698          62 :         | variable_declarations var_declaration { $$ = cat2_str($1, $2); }
   18699             :         ;
   18700             : 
   18701             : type_declaration: S_TYPEDEF
   18702             :     {
   18703             :         /* reset this variable so we see if there was */
   18704             :         /* an initializer specified */
   18705          18 :         initializer = 0;
   18706             :     }
   18707             :     var_type opt_pointer ECPGColLabel opt_array_bounds ';'
   18708             :     {
   18709          18 :         add_typedef($5, $6.index1, $6.index2, $3.type_enum, $3.type_dimension, $3.type_index, initializer, *$4 ? 1 : 0);
   18710             : 
   18711          18 :         fprintf(base_yyout, "typedef %s %s %s %s;\n", $3.type_str, *$4 ? "*" : "", $5, $6.str);
   18712          18 :         output_line_number();
   18713          18 :         $$ = mm_strdup("");
   18714             :     };
   18715             : 
   18716             : var_declaration:
   18717             :         storage_declaration var_type
   18718             :         {
   18719           4 :             actual_type[struct_level].type_storage = $1;
   18720           4 :             actual_type[struct_level].type_enum = $2.type_enum;
   18721           4 :             actual_type[struct_level].type_str = $2.type_str;
   18722           4 :             actual_type[struct_level].type_dimension = $2.type_dimension;
   18723           4 :             actual_type[struct_level].type_index = $2.type_index;
   18724           4 :             actual_type[struct_level].type_sizeof = $2.type_sizeof;
   18725             : 
   18726           4 :             actual_startline[struct_level] = hashline_number();
   18727             :         }
   18728             :         variable_list ';'
   18729             :         {
   18730           4 :             $$ = cat_str(5, actual_startline[struct_level], $1, $2.type_str, $4, mm_strdup(";\n"));
   18731             :         }
   18732             :         | var_type
   18733             :         {
   18734         588 :             actual_type[struct_level].type_storage = EMPTY;
   18735         588 :             actual_type[struct_level].type_enum = $1.type_enum;
   18736         588 :             actual_type[struct_level].type_str = $1.type_str;
   18737         588 :             actual_type[struct_level].type_dimension = $1.type_dimension;
   18738         588 :             actual_type[struct_level].type_index = $1.type_index;
   18739         588 :             actual_type[struct_level].type_sizeof = $1.type_sizeof;
   18740             : 
   18741         588 :             actual_startline[struct_level] = hashline_number();
   18742             :         }
   18743             :         variable_list ';'
   18744             :         {
   18745         588 :             $$ = cat_str(4, actual_startline[struct_level], $1.type_str, $3, mm_strdup(";\n"));
   18746             :         }
   18747             :         | struct_union_type_with_symbol ';'
   18748             :         {
   18749          14 :             $$ = cat2_str($1, mm_strdup(";"));
   18750             :         }
   18751             :         ;
   18752             : 
   18753           0 : opt_bit_field:  ':' Iconst  { $$ =cat2_str(mm_strdup(":"), $2); }
   18754         700 :         | /* EMPTY */   { $$ = EMPTY; }
   18755             :         ;
   18756             : 
   18757             : storage_declaration: storage_clause storage_modifier
   18758           0 :             {$$ = cat2_str ($1, $2); }
   18759           4 :         | storage_clause        {$$ = $1; }
   18760           0 :         | storage_modifier      {$$ = $1; }
   18761             :         ;
   18762             : 
   18763           0 : storage_clause : S_EXTERN   { $$ = mm_strdup("extern"); }
   18764           4 :         | S_STATIC          { $$ = mm_strdup("static"); }
   18765           0 :         | S_REGISTER        { $$ = mm_strdup("register"); }
   18766           0 :         | S_AUTO            { $$ = mm_strdup("auto"); }
   18767             :         ;
   18768             : 
   18769           0 : storage_modifier : S_CONST  { $$ = mm_strdup("const"); }
   18770           0 :         | S_VOLATILE        { $$ = mm_strdup("volatile"); }
   18771             :         ;
   18772             : 
   18773             : var_type:   simple_type
   18774             :         {
   18775         454 :             $$.type_enum = $1;
   18776         454 :             $$.type_str = mm_strdup(ecpg_type_name($1));
   18777         454 :             $$.type_dimension = mm_strdup("-1");
   18778         454 :             $$.type_index = mm_strdup("-1");
   18779         454 :             $$.type_sizeof = NULL;
   18780             :         }
   18781             :         | struct_union_type
   18782             :         {
   18783          32 :             $$.type_str = $1;
   18784          32 :             $$.type_dimension = mm_strdup("-1");
   18785          32 :             $$.type_index = mm_strdup("-1");
   18786             : 
   18787          32 :             if (strncmp($1, "struct", sizeof("struct")-1) == 0)
   18788             :             {
   18789          28 :                 $$.type_enum = ECPGt_struct;
   18790          28 :                 $$.type_sizeof = ECPGstruct_sizeof;
   18791             :             }
   18792             :             else
   18793             :             {
   18794           4 :                 $$.type_enum = ECPGt_union;
   18795           4 :                 $$.type_sizeof = NULL;
   18796             :             }
   18797             :         }
   18798             :         | enum_type
   18799             :         {
   18800           0 :             $$.type_str = $1;
   18801           0 :             $$.type_enum = ECPGt_int;
   18802           0 :             $$.type_dimension = mm_strdup("-1");
   18803           0 :             $$.type_index = mm_strdup("-1");
   18804           0 :             $$.type_sizeof = NULL;
   18805             :         }
   18806             :         | NUMERIC '(' precision opt_scale ')'
   18807             :         {
   18808           0 :             $$.type_enum = ECPGt_numeric;
   18809           0 :             $$.type_str = mm_strdup("numeric");
   18810           0 :             $$.type_dimension = mm_strdup("-1");
   18811           0 :             $$.type_index = mm_strdup("-1");
   18812           0 :             $$.type_sizeof = NULL;
   18813             :         }
   18814             :         | DECIMAL_P '(' precision opt_scale ')'
   18815             :         {
   18816           0 :             $$.type_enum = ECPGt_decimal;
   18817           0 :             $$.type_str = mm_strdup("decimal");
   18818           0 :             $$.type_dimension = mm_strdup("-1");
   18819           0 :             $$.type_index = mm_strdup("-1");
   18820           0 :             $$.type_sizeof = NULL;
   18821             :         }
   18822             :         | IDENT '(' precision opt_scale ')'
   18823             :         {
   18824             :             /*
   18825             :              * In C parsing mode, NUMERIC and DECIMAL are not keywords, so
   18826             :              * they will show up here as a plain identifier, and we need
   18827             :              * this duplicate code to recognize them.
   18828             :              */
   18829           2 :             if (strcmp($1, "numeric") == 0)
   18830             :             {
   18831           2 :                 $$.type_enum = ECPGt_numeric;
   18832           2 :                 $$.type_str = mm_strdup("numeric");
   18833             :             }
   18834           0 :             else if (strcmp($1, "decimal") == 0)
   18835             :             {
   18836           0 :                 $$.type_enum = ECPGt_decimal;
   18837           0 :                 $$.type_str = mm_strdup("decimal");
   18838             :             }
   18839             :             else
   18840             :             {
   18841           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "only data types numeric and decimal have precision/scale argument");
   18842           0 :                 $$.type_enum = ECPGt_numeric;
   18843           0 :                 $$.type_str = mm_strdup("numeric");
   18844             :             }
   18845             : 
   18846           2 :             $$.type_dimension = mm_strdup("-1");
   18847           2 :             $$.type_index = mm_strdup("-1");
   18848           2 :             $$.type_sizeof = NULL;
   18849             :         }
   18850             :         | VARCHAR
   18851             :         {
   18852          28 :             $$.type_enum = ECPGt_varchar;
   18853          28 :             $$.type_str = EMPTY; /*mm_strdup("varchar");*/
   18854          28 :             $$.type_dimension = mm_strdup("-1");
   18855          28 :             $$.type_index = mm_strdup("-1");
   18856          28 :             $$.type_sizeof = NULL;
   18857             :         }
   18858             :         | FLOAT_P
   18859             :         {
   18860             :             /* Note: DOUBLE is handled in simple_type */
   18861           6 :             $$.type_enum = ECPGt_float;
   18862           6 :             $$.type_str = mm_strdup("float");
   18863           6 :             $$.type_dimension = mm_strdup("-1");
   18864           6 :             $$.type_index = mm_strdup("-1");
   18865           6 :             $$.type_sizeof = NULL;
   18866             :         }
   18867             :         | NUMERIC
   18868             :         {
   18869           0 :             $$.type_enum = ECPGt_numeric;
   18870           0 :             $$.type_str = mm_strdup("numeric");
   18871           0 :             $$.type_dimension = mm_strdup("-1");
   18872           0 :             $$.type_index = mm_strdup("-1");
   18873           0 :             $$.type_sizeof = NULL;
   18874             :         }
   18875             :         | DECIMAL_P
   18876             :         {
   18877           4 :             $$.type_enum = ECPGt_decimal;
   18878           4 :             $$.type_str = mm_strdup("decimal");
   18879           4 :             $$.type_dimension = mm_strdup("-1");
   18880           4 :             $$.type_index = mm_strdup("-1");
   18881           4 :             $$.type_sizeof = NULL;
   18882             :         }
   18883             :         | TIMESTAMP
   18884             :         {
   18885           2 :             $$.type_enum = ECPGt_timestamp;
   18886           2 :             $$.type_str = mm_strdup("timestamp");
   18887           2 :             $$.type_dimension = mm_strdup("-1");
   18888           2 :             $$.type_index = mm_strdup("-1");
   18889           2 :             $$.type_sizeof = NULL;
   18890             :         }
   18891             :         | STRING_P
   18892             :         {
   18893           2 :             if (INFORMIX_MODE)
   18894             :             {
   18895             :                 /* In Informix mode, "string" is automatically a typedef */
   18896           2 :                 $$.type_enum = ECPGt_string;
   18897           2 :                 $$.type_str = mm_strdup("char");
   18898           2 :                 $$.type_dimension = mm_strdup("-1");
   18899           2 :                 $$.type_index = mm_strdup("-1");
   18900           2 :                 $$.type_sizeof = NULL;
   18901             :             }
   18902             :             else
   18903             :             {
   18904             :                 /* Otherwise, legal only if user typedef'ed it */
   18905           0 :                 struct typedefs *this = get_typedef("string", false);
   18906             : 
   18907           0 :                 $$.type_str = (this->type->type_enum == ECPGt_varchar || this->type->type_enum == ECPGt_bytea) ? EMPTY : mm_strdup(this->name);
   18908           0 :                 $$.type_enum = this->type->type_enum;
   18909           0 :                 $$.type_dimension = this->type->type_dimension;
   18910           0 :                 $$.type_index = this->type->type_index;
   18911           0 :                 if (this->type->type_sizeof && strlen(this->type->type_sizeof) != 0)
   18912           0 :                     $$.type_sizeof = this->type->type_sizeof;
   18913             :                 else
   18914           0 :                     $$.type_sizeof = cat_str(3, mm_strdup("sizeof("), mm_strdup(this->name), mm_strdup(")"));
   18915             : 
   18916           0 :                 struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
   18917             :             }
   18918             :         }
   18919             :         | INTERVAL ecpg_interval
   18920             :         {
   18921           0 :             $$.type_enum = ECPGt_interval;
   18922           0 :             $$.type_str = mm_strdup("interval");
   18923           0 :             $$.type_dimension = mm_strdup("-1");
   18924           0 :             $$.type_index = mm_strdup("-1");
   18925           0 :             $$.type_sizeof = NULL;
   18926             :         }
   18927             :         | IDENT ecpg_interval
   18928             :         {
   18929             :             /*
   18930             :              * In C parsing mode, the above SQL type names are not keywords,
   18931             :              * so they will show up here as a plain identifier, and we need
   18932             :              * this duplicate code to recognize them.
   18933             :              *
   18934             :              * Note that we also handle the type names bytea, date, and
   18935             :              * datetime here, but not above because those are not currently
   18936             :              * SQL keywords.  If they ever become so, they must gain duplicate
   18937             :              * productions above.
   18938             :              */
   18939          98 :             if (strlen($2) != 0 && strcmp ($1, "datetime") != 0 && strcmp ($1, "interval") != 0)
   18940           0 :                 mmerror (PARSE_ERROR, ET_ERROR, "interval specification not allowed here");
   18941             : 
   18942          98 :             if (strcmp($1, "varchar") == 0)
   18943             :             {
   18944           0 :                 $$.type_enum = ECPGt_varchar;
   18945           0 :                 $$.type_str = EMPTY; /*mm_strdup("varchar");*/
   18946           0 :                 $$.type_dimension = mm_strdup("-1");
   18947           0 :                 $$.type_index = mm_strdup("-1");
   18948           0 :                 $$.type_sizeof = NULL;
   18949             :             }
   18950          98 :             else if (strcmp($1, "bytea") == 0)
   18951             :             {
   18952           8 :                 $$.type_enum = ECPGt_bytea;
   18953           8 :                 $$.type_str = EMPTY;
   18954           8 :                 $$.type_dimension = mm_strdup("-1");
   18955           8 :                 $$.type_index = mm_strdup("-1");
   18956           8 :                 $$.type_sizeof = NULL;
   18957             :             }
   18958          90 :             else if (strcmp($1, "float") == 0)
   18959             :             {
   18960           0 :                 $$.type_enum = ECPGt_float;
   18961           0 :                 $$.type_str = mm_strdup("float");
   18962           0 :                 $$.type_dimension = mm_strdup("-1");
   18963           0 :                 $$.type_index = mm_strdup("-1");
   18964           0 :                 $$.type_sizeof = NULL;
   18965             :             }
   18966          90 :             else if (strcmp($1, "double") == 0)
   18967             :             {
   18968          12 :                 $$.type_enum = ECPGt_double;
   18969          12 :                 $$.type_str = mm_strdup("double");
   18970          12 :                 $$.type_dimension = mm_strdup("-1");
   18971          12 :                 $$.type_index = mm_strdup("-1");
   18972          12 :                 $$.type_sizeof = NULL;
   18973             :             }
   18974          78 :             else if (strcmp($1, "numeric") == 0)
   18975             :             {
   18976           4 :                 $$.type_enum = ECPGt_numeric;
   18977           4 :                 $$.type_str = mm_strdup("numeric");
   18978           4 :                 $$.type_dimension = mm_strdup("-1");
   18979           4 :                 $$.type_index = mm_strdup("-1");
   18980           4 :                 $$.type_sizeof = NULL;
   18981             :             }
   18982          74 :             else if (strcmp($1, "decimal") == 0)
   18983             :             {
   18984           0 :                 $$.type_enum = ECPGt_decimal;
   18985           0 :                 $$.type_str = mm_strdup("decimal");
   18986           0 :                 $$.type_dimension = mm_strdup("-1");
   18987           0 :                 $$.type_index = mm_strdup("-1");
   18988           0 :                 $$.type_sizeof = NULL;
   18989             :             }
   18990          74 :             else if (strcmp($1, "date") == 0)
   18991             :             {
   18992          10 :                 $$.type_enum = ECPGt_date;
   18993          10 :                 $$.type_str = mm_strdup("date");
   18994          10 :                 $$.type_dimension = mm_strdup("-1");
   18995          10 :                 $$.type_index = mm_strdup("-1");
   18996          10 :                 $$.type_sizeof = NULL;
   18997             :             }
   18998          64 :             else if (strcmp($1, "timestamp") == 0)
   18999             :             {
   19000          12 :                 $$.type_enum = ECPGt_timestamp;
   19001          12 :                 $$.type_str = mm_strdup("timestamp");
   19002          12 :                 $$.type_dimension = mm_strdup("-1");
   19003          12 :                 $$.type_index = mm_strdup("-1");
   19004          12 :                 $$.type_sizeof = NULL;
   19005             :             }
   19006          52 :             else if (strcmp($1, "interval") == 0)
   19007             :             {
   19008           8 :                 $$.type_enum = ECPGt_interval;
   19009           8 :                 $$.type_str = mm_strdup("interval");
   19010           8 :                 $$.type_dimension = mm_strdup("-1");
   19011           8 :                 $$.type_index = mm_strdup("-1");
   19012           8 :                 $$.type_sizeof = NULL;
   19013             :             }
   19014          44 :             else if (strcmp($1, "datetime") == 0)
   19015             :             {
   19016           0 :                 $$.type_enum = ECPGt_timestamp;
   19017           0 :                 $$.type_str = mm_strdup("timestamp");
   19018           0 :                 $$.type_dimension = mm_strdup("-1");
   19019           0 :                 $$.type_index = mm_strdup("-1");
   19020           0 :                 $$.type_sizeof = NULL;
   19021             :             }
   19022          44 :             else if ((strcmp($1, "string") == 0) && INFORMIX_MODE)
   19023             :             {
   19024           0 :                 $$.type_enum = ECPGt_string;
   19025           0 :                 $$.type_str = mm_strdup("char");
   19026           0 :                 $$.type_dimension = mm_strdup("-1");
   19027           0 :                 $$.type_index = mm_strdup("-1");
   19028           0 :                 $$.type_sizeof = NULL;
   19029             :             }
   19030             :             else
   19031             :             {
   19032             :                 /* Otherwise, it must be a user-defined typedef name */
   19033          44 :                 struct typedefs *this = get_typedef($1, false);
   19034             : 
   19035          44 :                 $$.type_str = (this->type->type_enum == ECPGt_varchar || this->type->type_enum == ECPGt_bytea) ? EMPTY : mm_strdup(this->name);
   19036          44 :                 $$.type_enum = this->type->type_enum;
   19037          44 :                 $$.type_dimension = this->type->type_dimension;
   19038          44 :                 $$.type_index = this->type->type_index;
   19039          44 :                 if (this->type->type_sizeof && strlen(this->type->type_sizeof) != 0)
   19040           8 :                     $$.type_sizeof = this->type->type_sizeof;
   19041             :                 else
   19042          36 :                     $$.type_sizeof = cat_str(3, mm_strdup("sizeof("), mm_strdup(this->name), mm_strdup(")"));
   19043             : 
   19044          44 :                 struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
   19045             :             }
   19046             :         }
   19047             :         | s_struct_union_symbol
   19048             :         {
   19049             :             /* this is for named structs/unions */
   19050             :             char *name;
   19051             :             struct typedefs *this;
   19052          12 :             bool forward = (forward_name != NULL && strcmp($1.symbol, forward_name) == 0 && strcmp($1.su, "struct") == 0);
   19053             : 
   19054          12 :             name = cat2_str($1.su, $1.symbol);
   19055             :             /* Do we have a forward definition? */
   19056          12 :             if (!forward)
   19057             :             {
   19058             :                 /* No */
   19059             : 
   19060          12 :                 this = get_typedef(name, false);
   19061          12 :                 $$.type_str = mm_strdup(this->name);
   19062          12 :                 $$.type_enum = this->type->type_enum;
   19063          12 :                 $$.type_dimension = this->type->type_dimension;
   19064          12 :                 $$.type_index = this->type->type_index;
   19065          12 :                 $$.type_sizeof = this->type->type_sizeof;
   19066          12 :                 struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
   19067          12 :                 free(name);
   19068             :             }
   19069             :             else
   19070             :             {
   19071           0 :                 $$.type_str = name;
   19072           0 :                 $$.type_enum = ECPGt_long;
   19073           0 :                 $$.type_dimension = mm_strdup("-1");
   19074           0 :                 $$.type_index = mm_strdup("-1");
   19075           0 :                 $$.type_sizeof = mm_strdup("");
   19076           0 :                 struct_member_list[struct_level] = NULL;
   19077             :             }
   19078             :         }
   19079             :         ;
   19080             : 
   19081             : enum_type: ENUM_P symbol enum_definition
   19082           0 :             { $$ = cat_str(3, mm_strdup("enum"), $2, $3); }
   19083             :         | ENUM_P enum_definition
   19084           0 :             { $$ = cat2_str(mm_strdup("enum"), $2); }
   19085             :         | ENUM_P symbol
   19086           0 :             { $$ = cat2_str(mm_strdup("enum"), $2); }
   19087             :         ;
   19088             : 
   19089             : enum_definition: '{' c_list '}'
   19090           0 :             { $$ = cat_str(3, mm_strdup("{"), $2, mm_strdup("}")); };
   19091             : 
   19092             : struct_union_type_with_symbol: s_struct_union_symbol
   19093             :         {
   19094          32 :             struct_member_list[struct_level++] = NULL;
   19095          32 :             if (struct_level >= STRUCT_DEPTH)
   19096           0 :                  mmerror(PARSE_ERROR, ET_ERROR, "too many levels in nested structure/union definition");
   19097          32 :             forward_name = mm_strdup($1.symbol);
   19098             :         }
   19099             :         '{' variable_declarations '}'
   19100             :         {
   19101             :             struct typedefs *ptr, *this;
   19102             :             struct this_type su_type;
   19103             : 
   19104          32 :             ECPGfree_struct_member(struct_member_list[struct_level]);
   19105          32 :             struct_member_list[struct_level] = NULL;
   19106          32 :             struct_level--;
   19107          32 :             if (strncmp($1.su, "struct", sizeof("struct")-1) == 0)
   19108          32 :                 su_type.type_enum = ECPGt_struct;
   19109             :             else
   19110           0 :                 su_type.type_enum = ECPGt_union;
   19111          32 :             su_type.type_str = cat2_str($1.su, $1.symbol);
   19112          32 :             free(forward_name);
   19113          32 :             forward_name = NULL;
   19114             : 
   19115             :             /* This is essentially a typedef but needs the keyword struct/union as well.
   19116             :              * So we create the typedef for each struct definition with symbol */
   19117         152 :             for (ptr = types; ptr != NULL; ptr = ptr->next)
   19118             :             {
   19119         120 :                     if (strcmp(su_type.type_str, ptr->name) == 0)
   19120             :                             /* re-definition is a bug */
   19121           0 :                             mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", su_type.type_str);
   19122             :             }
   19123             : 
   19124          32 :             this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
   19125             : 
   19126             :             /* initial definition */
   19127          32 :             this->next = types;
   19128          32 :             this->name = mm_strdup(su_type.type_str);
   19129          32 :             this->brace_level = braces_open;
   19130          32 :             this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
   19131          32 :             this->type->type_enum = su_type.type_enum;
   19132          32 :             this->type->type_str = mm_strdup(su_type.type_str);
   19133          32 :             this->type->type_dimension = mm_strdup("-1"); /* dimension of array */
   19134          32 :             this->type->type_index = mm_strdup("-1");   /* length of string */
   19135          32 :             this->type->type_sizeof = ECPGstruct_sizeof;
   19136          32 :             this->struct_member_list = struct_member_list[struct_level];
   19137             : 
   19138          32 :             types = this;
   19139          32 :             $$ = cat_str(4, su_type.type_str, mm_strdup("{"), $4, mm_strdup("}"));
   19140             :         }
   19141             :         ;
   19142             : 
   19143          18 : struct_union_type: struct_union_type_with_symbol    { $$ = $1; }
   19144             :         | s_struct_union
   19145             :         {
   19146          14 :             struct_member_list[struct_level++] = NULL;
   19147          14 :             if (struct_level >= STRUCT_DEPTH)
   19148           0 :                  mmerror(PARSE_ERROR, ET_ERROR, "too many levels in nested structure/union definition");
   19149             :         }
   19150             :         '{' variable_declarations '}'
   19151             :         {
   19152          14 :             ECPGfree_struct_member(struct_member_list[struct_level]);
   19153          14 :             struct_member_list[struct_level] = NULL;
   19154          14 :             struct_level--;
   19155          14 :             $$ = cat_str(4, $1, mm_strdup("{"), $4, mm_strdup("}"));
   19156             :         }
   19157             :         ;
   19158             : 
   19159             : s_struct_union_symbol: SQL_STRUCT symbol
   19160             :         {
   19161          44 :             $$.su = mm_strdup("struct");
   19162          44 :             $$.symbol = $2;
   19163          44 :             ECPGstruct_sizeof = cat_str(3, mm_strdup("sizeof("), cat2_str(mm_strdup($$.su), mm_strdup($$.symbol)), mm_strdup(")"));
   19164             :         }
   19165             :         | UNION symbol
   19166             :         {
   19167           0 :             $$.su = mm_strdup("union");
   19168           0 :             $$.symbol = $2;
   19169             :         }
   19170             :         ;
   19171             : 
   19172             : s_struct_union: SQL_STRUCT
   19173             :         {
   19174          10 :             ECPGstruct_sizeof = mm_strdup(""); /* This must not be NULL to distinguish from simple types. */
   19175          10 :             $$ = mm_strdup("struct");
   19176             :         }
   19177             :         | UNION
   19178             :         {
   19179           4 :             $$ = mm_strdup("union");
   19180             :         }
   19181             :         ;
   19182             : 
   19183           0 : simple_type: unsigned_type                  { $$=$1; }
   19184         454 :         |   opt_signed signed_type          { $$=$2; }
   19185             :         ;
   19186             : 
   19187           0 : unsigned_type: SQL_UNSIGNED SQL_SHORT       { $$ = ECPGt_unsigned_short; }
   19188           0 :         | SQL_UNSIGNED SQL_SHORT INT_P  { $$ = ECPGt_unsigned_short; }
   19189           0 :         | SQL_UNSIGNED                      { $$ = ECPGt_unsigned_int; }
   19190           0 :         | SQL_UNSIGNED INT_P                { $$ = ECPGt_unsigned_int; }
   19191           0 :         | SQL_UNSIGNED SQL_LONG             { $$ = ECPGt_unsigned_long; }
   19192           0 :         | SQL_UNSIGNED SQL_LONG INT_P       { $$ = ECPGt_unsigned_long; }
   19193           0 :         | SQL_UNSIGNED SQL_LONG SQL_LONG    { $$ = ECPGt_unsigned_long_long; }
   19194           0 :         | SQL_UNSIGNED SQL_LONG SQL_LONG INT_P { $$ = ECPGt_unsigned_long_long; }
   19195           0 :         | SQL_UNSIGNED CHAR_P           { $$ = ECPGt_unsigned_char; }
   19196             :         ;
   19197             : 
   19198          26 : signed_type: SQL_SHORT              { $$ = ECPGt_short; }
   19199           0 :         | SQL_SHORT INT_P           { $$ = ECPGt_short; }
   19200         208 :         | INT_P                     { $$ = ECPGt_int; }
   19201          12 :         | SQL_LONG                  { $$ = ECPGt_long; }
   19202           0 :         | SQL_LONG INT_P            { $$ = ECPGt_long; }
   19203           0 :         | SQL_LONG SQL_LONG         { $$ = ECPGt_long_long; }
   19204           0 :         | SQL_LONG SQL_LONG INT_P   { $$ = ECPGt_long_long; }
   19205           8 :         | SQL_BOOL                  { $$ = ECPGt_bool; }
   19206         198 :         | CHAR_P                    { $$ = ECPGt_char; }
   19207           2 :         | DOUBLE_P                  { $$ = ECPGt_double; }
   19208             :         ;
   19209             : 
   19210             : opt_signed: SQL_SIGNED
   19211             :         |   /* EMPTY */
   19212             :         ;
   19213             : 
   19214             : variable_list: variable
   19215         592 :             { $$ = $1; }
   19216             :         | variable_list ',' variable
   19217             :         {
   19218         108 :             if (actual_type[struct_level].type_enum == ECPGt_varchar || actual_type[struct_level].type_enum == ECPGt_bytea)
   19219           4 :                 $$ = cat_str(4, $1, mm_strdup(";"), mm_strdup(actual_type[struct_level].type_storage), $3);
   19220             :             else
   19221         104 :                 $$ = cat_str(3, $1, mm_strdup(","), $3);
   19222             :         }
   19223             :         ;
   19224             : 
   19225             : variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initializer
   19226             :         {
   19227             :             struct ECPGtype * type;
   19228         700 :             char *dimension = $3.index1;    /* dimension of array */
   19229         700 :             char *length = $3.index2;       /* length of string */
   19230             :             char *dim_str;
   19231             :             char *vcn;
   19232             :             int *varlen_type_counter;
   19233             :             char *struct_name;
   19234             : 
   19235         700 :             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);
   19236         700 :             switch (actual_type[struct_level].type_enum)
   19237             :             {
   19238          48 :                 case ECPGt_struct:
   19239             :                 case ECPGt_union:
   19240          48 :                     if (atoi(dimension) < 0)
   19241          22 :                         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);
   19242             :                     else
   19243          26 :                         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);
   19244             : 
   19245          48 :                     $$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
   19246          48 :                     break;
   19247             : 
   19248          40 :                 case ECPGt_varchar:
   19249             :                 case ECPGt_bytea:
   19250          40 :                     if (actual_type[struct_level].type_enum == ECPGt_varchar)
   19251             :                     {
   19252          32 :                         varlen_type_counter = &varchar_counter;
   19253          32 :                         struct_name = " struct varchar_";
   19254             :                     }
   19255             :                     else
   19256             :                     {
   19257           8 :                         varlen_type_counter = &bytea_counter;
   19258           8 :                         struct_name = " struct bytea_";
   19259             :                     }
   19260          40 :                     if (atoi(dimension) < 0)
   19261          30 :                         type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, *varlen_type_counter);
   19262             :                     else
   19263          10 :                         type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, *varlen_type_counter), dimension);
   19264             : 
   19265          40 :                     if (strcmp(dimension, "0") == 0 || abs(atoi(dimension)) == 1)
   19266          32 :                             dim_str=mm_strdup("");
   19267             :                     else
   19268           8 :                             dim_str=cat_str(3, mm_strdup("["), mm_strdup(dimension), mm_strdup("]"));
   19269             :                     /* cannot check for atoi <= 0 because a defined constant will yield 0 here as well */
   19270          40 :                     if (atoi(length) < 0 || strcmp(length, "0") == 0)
   19271           0 :                         mmerror(PARSE_ERROR, ET_ERROR, "pointers to varchar are not implemented");
   19272             : 
   19273             :                     /* make sure varchar struct name is unique by adding a unique counter to its definition */
   19274          40 :                     vcn = (char *) mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
   19275          40 :                     sprintf(vcn, "%d", *varlen_type_counter);
   19276          40 :                     if (strcmp(dimension, "0") == 0)
   19277           2 :                         $$ = 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);
   19278             :                     else
   19279          38 :                         $$ = 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);
   19280          40 :                     (*varlen_type_counter)++;
   19281          40 :                     break;
   19282             : 
   19283         226 :                 case ECPGt_char:
   19284             :                 case ECPGt_unsigned_char:
   19285             :                 case ECPGt_string:
   19286         226 :                     if (atoi(dimension) == -1)
   19287             :                     {
   19288         196 :                         int i = strlen($5);
   19289             : 
   19290         196 :                         if (atoi(length) == -1 && i > 0) /* char <var>[] = "string" */
   19291             :                         {
   19292             :                             /* if we have an initializer but no string size set, let's use the initializer's length */
   19293           4 :                             free(length);
   19294           4 :                             length = mm_alloc(i+sizeof("sizeof()"));
   19295           4 :                             sprintf(length, "sizeof(%s)", $5+2);
   19296             :                         }
   19297         196 :                         type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0);
   19298             :                     }
   19299             :                     else
   19300          30 :                         type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0), dimension);
   19301             : 
   19302         226 :                     $$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
   19303         226 :                     break;
   19304             : 
   19305         386 :                 default:
   19306         386 :                     if (atoi(dimension) < 0)
   19307         308 :                         type = ECPGmake_simple_type(actual_type[struct_level].type_enum, mm_strdup("1"), 0);
   19308             :                     else
   19309          78 :                         type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, mm_strdup("1"), 0), dimension);
   19310             : 
   19311         386 :                     $$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
   19312         386 :                     break;
   19313             :             }
   19314             : 
   19315         700 :             if (struct_level == 0)
   19316         592 :                 new_variable($2, type, braces_open);
   19317             :             else
   19318         108 :                 ECPGmake_struct_member($2, type, &(struct_member_list[struct_level - 1]));
   19319             : 
   19320         700 :             free($2);
   19321             :         }
   19322             :         ;
   19323             : 
   19324             : opt_initializer: /*EMPTY*/
   19325         480 :             { $$ = EMPTY; }
   19326             :         | '=' c_term
   19327             :         {
   19328         220 :             initializer = 1;
   19329         220 :             $$ = cat2_str(mm_strdup("="), $2);
   19330             :         }
   19331             :         ;
   19332             : 
   19333         578 : opt_pointer: /*EMPTY*/              { $$ = EMPTY; }
   19334         124 :         | '*'                       { $$ = mm_strdup("*"); }
   19335          16 :         | '*' '*'                   { $$ = mm_strdup("**"); }
   19336             :         ;
   19337             : 
   19338             : /*
   19339             :  * We try to simulate the correct DECLARE syntax here so we get dynamic SQL
   19340             :  */
   19341             : ECPGDeclare: DECLARE STATEMENT ecpg_ident
   19342             :         {
   19343             :             /* this is only supported for compatibility */
   19344           0 :             $$ = cat_str(3, mm_strdup("/* declare statement"), $3, mm_strdup("*/"));
   19345             :         }
   19346             :         ;
   19347             : /*
   19348             :  * the exec sql disconnect statement: disconnect from the given database
   19349             :  */
   19350         172 : ECPGDisconnect: SQL_DISCONNECT dis_name { $$ = $2; }
   19351             :         ;
   19352             : 
   19353          50 : dis_name: connection_object         { $$ = $1; }
   19354           6 :         | CURRENT_P         { $$ = mm_strdup("\"CURRENT\""); }
   19355          30 :         | ALL               { $$ = mm_strdup("\"ALL\""); }
   19356          86 :         | /* EMPTY */           { $$ = mm_strdup("\"CURRENT\""); }
   19357             :         ;
   19358             : 
   19359         288 : connection_object: name             { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
   19360           6 :         | DEFAULT           { $$ = mm_strdup("\"DEFAULT\""); }
   19361          32 :         | char_variable         { $$ = $1; }
   19362             :         ;
   19363             : 
   19364             : execstring: char_variable
   19365          96 :             { $$ = $1; }
   19366             :         |   CSTRING
   19367          12 :             { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
   19368             :         ;
   19369             : 
   19370             : /*
   19371             :  * the exec sql free command to deallocate a previously
   19372             :  * prepared statement
   19373             :  */
   19374           2 : ECPGFree:   SQL_FREE cursor_name    { $$ = $2; }
   19375           0 :         | SQL_FREE ALL  { $$ = mm_strdup("all"); }
   19376             :         ;
   19377             : 
   19378             : /*
   19379             :  * open is an open cursor, at the moment this has to be removed
   19380             :  */
   19381             : ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using
   19382             :         {
   19383          76 :             if ($2[0] == ':')
   19384          10 :                 remove_variable_from_list(&argsinsert, find_variable($2 + 1));
   19385          76 :             $$ = $2;
   19386             :         }
   19387             :         ;
   19388             : 
   19389          66 : opt_ecpg_using: /*EMPTY*/   { $$ = EMPTY; }
   19390          10 :         | ecpg_using        { $$ = $1; }
   19391             :         ;
   19392             : 
   19393          28 : ecpg_using: USING using_list    { $$ = EMPTY; }
   19394          22 :         | using_descriptor      { $$ = $1; }
   19395             :         ;
   19396             : 
   19397             : using_descriptor: USING SQL_P SQL_DESCRIPTOR quoted_ident_stringvar
   19398             :         {
   19399          22 :             add_variable_to_head(&argsinsert, descriptor_variable($4,0), &no_indicator);
   19400          22 :             $$ = EMPTY;
   19401             :         }
   19402             :         | USING SQL_DESCRIPTOR name
   19403             :         {
   19404          18 :             add_variable_to_head(&argsinsert, sqlda_variable($3), &no_indicator);
   19405          18 :             $$ = EMPTY;
   19406             :         }
   19407             :         ;
   19408             : 
   19409             : into_descriptor: INTO SQL_P SQL_DESCRIPTOR quoted_ident_stringvar
   19410             :         {
   19411          22 :             add_variable_to_head(&argsresult, descriptor_variable($4,1), &no_indicator);
   19412          22 :             $$ = EMPTY;
   19413             :         }
   19414             :         | INTO SQL_DESCRIPTOR name
   19415             :         {
   19416          24 :             add_variable_to_head(&argsresult, sqlda_variable($3), &no_indicator);
   19417          24 :             $$ = EMPTY;
   19418             :         }
   19419             :         ;
   19420             : 
   19421             : into_sqlda: INTO name
   19422             :         {
   19423           8 :             add_variable_to_head(&argsresult, sqlda_variable($2), &no_indicator);
   19424           8 :             $$ = EMPTY;
   19425             :         }
   19426             :         ;
   19427             : 
   19428             : using_list: UsingValue | UsingValue ',' using_list;
   19429             : 
   19430             : UsingValue: UsingConst
   19431             :         {
   19432           8 :             char *length = mm_alloc(32);
   19433             : 
   19434           8 :             sprintf(length, "%zu", strlen($1));
   19435           8 :             add_variable_to_head(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
   19436             :         }
   19437          34 :         | civar { $$ = EMPTY; }
   19438           0 :         | civarind { $$ = EMPTY; }
   19439             :         ;
   19440             : 
   19441           8 : UsingConst: Iconst          { $$ = $1; }
   19442           0 :         | '+' Iconst        { $$ = cat_str(2, mm_strdup("+"), $2); }
   19443           0 :         | '-' Iconst        { $$ = cat_str(2, mm_strdup("-"), $2); }
   19444           0 :         | ecpg_fconst       { $$ = $1; }
   19445           0 :         | '+' ecpg_fconst   { $$ = cat_str(2, mm_strdup("+"), $2); }
   19446           0 :         | '-' ecpg_fconst   { $$ = cat_str(2, mm_strdup("-"), $2); }
   19447           0 :         | ecpg_sconst       { $$ = $1; }
   19448           0 :         | ecpg_bconst       { $$ = $1; }
   19449           0 :         | ecpg_xconst       { $$ = $1; }
   19450             :         ;
   19451             : 
   19452             : /*
   19453             :  * We accept DESCRIBE [OUTPUT] but do nothing with DESCRIBE INPUT so far.
   19454             :  */
   19455             : ECPGDescribe: SQL_DESCRIBE INPUT_P prepared_name using_descriptor
   19456             :     {
   19457           0 :         $$.input = 1;
   19458           0 :         $$.stmt_name = $3;
   19459             :     }
   19460             :     | SQL_DESCRIBE opt_output prepared_name using_descriptor
   19461             :     {
   19462             :         struct variable *var;
   19463          16 :         var = argsinsert->variable;
   19464          16 :         remove_variable_from_list(&argsinsert, var);
   19465          16 :         add_variable_to_head(&argsresult, var, &no_indicator);
   19466             : 
   19467          16 :         $$.input = 0;
   19468          16 :         $$.stmt_name = $3;
   19469             :     }
   19470             :     | SQL_DESCRIBE opt_output prepared_name into_descriptor
   19471             :     {
   19472          18 :         $$.input = 0;
   19473          18 :         $$.stmt_name = $3;
   19474             :     }
   19475             :     | SQL_DESCRIBE INPUT_P prepared_name into_sqlda
   19476             :     {
   19477           0 :         $$.input = 1;
   19478           0 :         $$.stmt_name = $3;
   19479             :     }
   19480             :     | SQL_DESCRIBE opt_output prepared_name into_sqlda
   19481             :     {
   19482           8 :         $$.input = 0;
   19483           8 :         $$.stmt_name = $3;
   19484             :     }
   19485             :     ;
   19486             : 
   19487           0 : opt_output: SQL_OUTPUT  { $$ = mm_strdup("output"); }
   19488          42 :     |   /* EMPTY */ { $$ = EMPTY; }
   19489             :     ;
   19490             : 
   19491             : /*
   19492             :  * dynamic SQL: descriptor based access
   19493             :  *  originally written by Christof Petig <christof.petig@wtal.de>
   19494             :  *          and Peter Eisentraut <peter.eisentraut@credativ.de>
   19495             :  */
   19496             : 
   19497             : /*
   19498             :  * allocate a descriptor
   19499             :  */
   19500             : ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
   19501             :         {
   19502          36 :             add_descriptor($3,connection);
   19503          36 :             $$ = $3;
   19504             :         }
   19505             :         ;
   19506             : 
   19507             : 
   19508             : /*
   19509             :  * deallocate a descriptor
   19510             :  */
   19511             : ECPGDeallocateDescr:    DEALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
   19512             :         {
   19513          32 :             drop_descriptor($3,connection);
   19514          32 :             $$ = $3;
   19515             :         }
   19516             :         ;
   19517             : 
   19518             : /*
   19519             :  * manipulate a descriptor header
   19520             :  */
   19521             : 
   19522             : ECPGGetDescriptorHeader: SQL_GET SQL_DESCRIPTOR quoted_ident_stringvar ECPGGetDescHeaderItems
   19523          22 :             {  $$ = $3; }
   19524             :         ;
   19525             : 
   19526             : ECPGGetDescHeaderItems: ECPGGetDescHeaderItem
   19527             :         | ECPGGetDescHeaderItems ',' ECPGGetDescHeaderItem
   19528             :         ;
   19529             : 
   19530             : ECPGGetDescHeaderItem: cvariable '=' desc_header_item
   19531          22 :             { push_assignment($1, $3); }
   19532             :         ;
   19533             : 
   19534             : 
   19535             : ECPGSetDescriptorHeader: SET SQL_DESCRIPTOR quoted_ident_stringvar ECPGSetDescHeaderItems
   19536           2 :             { $$ = $3; }
   19537             :         ;
   19538             : 
   19539             : ECPGSetDescHeaderItems: ECPGSetDescHeaderItem
   19540             :         | ECPGSetDescHeaderItems ',' ECPGSetDescHeaderItem
   19541             :         ;
   19542             : 
   19543             : ECPGSetDescHeaderItem: desc_header_item '=' IntConstVar
   19544             :         {
   19545           2 :             push_assignment($3, $1);
   19546             :         }
   19547             :         ;
   19548             : 
   19549             : IntConstVar: Iconst
   19550             :         {
   19551          60 :             char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
   19552             : 
   19553          60 :             sprintf(length, "%zu", strlen($1));
   19554          60 :             new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
   19555          60 :             $$ = $1;
   19556             :         }
   19557             :         | cvariable
   19558             :         {
   19559          54 :             $$ = $1;
   19560             :         }
   19561             :         ;
   19562             : 
   19563          24 : desc_header_item:   SQL_COUNT           { $$ = ECPGd_count; }
   19564             :         ;
   19565             : 
   19566             : /*
   19567             :  * manipulate a descriptor
   19568             :  */
   19569             : 
   19570             : ECPGGetDescriptor:  SQL_GET SQL_DESCRIPTOR quoted_ident_stringvar VALUE_P IntConstVar ECPGGetDescItems
   19571          62 :             {  $$.str = $5; $$.name = $3; }
   19572             :         ;
   19573             : 
   19574             : ECPGGetDescItems: ECPGGetDescItem
   19575             :         | ECPGGetDescItems ',' ECPGGetDescItem
   19576             :         ;
   19577             : 
   19578         102 : ECPGGetDescItem: cvariable '=' descriptor_item  { push_assignment($1, $3); };
   19579             : 
   19580             : 
   19581             : ECPGSetDescriptor:  SET SQL_DESCRIPTOR quoted_ident_stringvar VALUE_P IntConstVar ECPGSetDescItems
   19582          22 :             {  $$.str = $5; $$.name = $3; }
   19583             :         ;
   19584             : 
   19585             : ECPGSetDescItems: ECPGSetDescItem
   19586             :         | ECPGSetDescItems ',' ECPGSetDescItem
   19587             :         ;
   19588             : 
   19589             : ECPGSetDescItem: descriptor_item '=' AllConstVar
   19590             :         {
   19591          30 :             push_assignment($3, $1);
   19592             :         }
   19593             :         ;
   19594             : 
   19595             : AllConstVar: ecpg_fconst
   19596             :         {
   19597           0 :             char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
   19598             : 
   19599           0 :             sprintf(length, "%zu", strlen($1));
   19600           0 :             new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
   19601           0 :             $$ = $1;
   19602             :         }
   19603             : 
   19604             :         | IntConstVar
   19605             :         {
   19606          28 :             $$ = $1;
   19607             :         }
   19608             : 
   19609             :         | '-' ecpg_fconst
   19610             :         {
   19611           0 :             char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
   19612           0 :             char *var = cat2_str(mm_strdup("-"), $2);
   19613             : 
   19614           0 :             sprintf(length, "%zu", strlen(var));
   19615           0 :             new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
   19616           0 :             $$ = var;
   19617             :         }
   19618             : 
   19619             :         | '-' Iconst
   19620             :         {
   19621           0 :             char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
   19622           0 :             char *var = cat2_str(mm_strdup("-"), $2);
   19623             : 
   19624           0 :             sprintf(length, "%zu", strlen(var));
   19625           0 :             new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
   19626           0 :             $$ = var;
   19627             :         }
   19628             : 
   19629             :         | ecpg_sconst
   19630             :         {
   19631           2 :             char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
   19632           2 :             char *var = $1 + 1;
   19633             : 
   19634           2 :             var[strlen(var) - 1] = '\0';
   19635           2 :             sprintf(length, "%zu", strlen(var));
   19636           2 :             new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
   19637           2 :             $$ = var;
   19638             :         }
   19639             :         ;
   19640             : 
   19641           0 : descriptor_item:    SQL_CARDINALITY         { $$ = ECPGd_cardinality; }
   19642          62 :         | DATA_P                { $$ = ECPGd_data; }
   19643           4 :         | SQL_DATETIME_INTERVAL_CODE        { $$ = ECPGd_di_code; }
   19644           0 :         | SQL_DATETIME_INTERVAL_PRECISION   { $$ = ECPGd_di_precision; }
   19645          34 :         | SQL_INDICATOR             { $$ = ECPGd_indicator; }
   19646           0 :         | SQL_KEY_MEMBER            { $$ = ECPGd_key_member; }
   19647           4 :         | SQL_LENGTH                { $$ = ECPGd_length; }
   19648          18 :         | NAME_P                { $$ = ECPGd_name; }
   19649           0 :         | SQL_NULLABLE              { $$ = ECPGd_nullable; }
   19650           2 :         | SQL_OCTET_LENGTH          { $$ = ECPGd_octet; }
   19651           2 :         | PRECISION             { $$ = ECPGd_precision; }
   19652           0 :         | SQL_RETURNED_LENGTH           { $$ = ECPGd_length; }
   19653           2 :         | SQL_RETURNED_OCTET_LENGTH     { $$ = ECPGd_ret_octet; }
   19654           2 :         | SQL_SCALE             { $$ = ECPGd_scale; }
   19655           2 :         | TYPE_P                { $$ = ECPGd_type; }
   19656             :         ;
   19657             : 
   19658             : /*
   19659             :  * set/reset the automatic transaction mode, this needs a different handling
   19660             :  * as the other set commands
   19661             :  */
   19662           8 : ECPGSetAutocommit:  SET SQL_AUTOCOMMIT '=' on_off   { $$ = $4; }
   19663          18 :         |  SET SQL_AUTOCOMMIT TO on_off   { $$ = $4; }
   19664             :         ;
   19665             : 
   19666          20 : on_off: ON              { $$ = mm_strdup("on"); }
   19667           6 :         | OFF           { $$ = mm_strdup("off"); }
   19668             :         ;
   19669             : 
   19670             : /*
   19671             :  * set the actual connection, this needs a different handling as the other
   19672             :  * set commands
   19673             :  */
   19674           2 : ECPGSetConnection:  SET CONNECTION TO connection_object { $$ = $4; }
   19675           0 :         | SET CONNECTION '=' connection_object { $$ = $4; }
   19676           2 :         | SET CONNECTION  connection_object { $$ = $3; }
   19677             :         ;
   19678             : 
   19679             : /*
   19680             :  * define a new type for embedded SQL
   19681             :  */
   19682             : ECPGTypedef: TYPE_P
   19683             :         {
   19684             :             /* reset this variable so we see if there was */
   19685             :             /* an initializer specified */
   19686          26 :             initializer = 0;
   19687             :         }
   19688             :         ECPGColLabel IS var_type opt_array_bounds opt_reference
   19689             :         {
   19690          26 :             add_typedef($3, $6.index1, $6.index2, $5.type_enum, $5.type_dimension, $5.type_index, initializer, *$7 ? 1 : 0);
   19691             : 
   19692          26 :             if (auto_create_c == false)
   19693          18 :                 $$ = 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("*/"));
   19694             :             else
   19695           8 :                 $$ = 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(";"));
   19696             :         }
   19697             :         ;
   19698             : 
   19699           6 : opt_reference: SQL_REFERENCE        { $$ = mm_strdup("reference"); }
   19700          24 :         | /*EMPTY*/                 { $$ = EMPTY; }
   19701             :         ;
   19702             : 
   19703             : /*
   19704             :  * define the type of one variable for embedded SQL
   19705             :  */
   19706             : ECPGVar: SQL_VAR
   19707             :         {
   19708             :             /* reset this variable so we see if there was */
   19709             :             /* an initializer specified */
   19710           4 :             initializer = 0;
   19711             :         }
   19712             :         ColLabel IS var_type opt_array_bounds opt_reference
   19713             :         {
   19714           4 :             struct variable *p = find_variable($3);
   19715           4 :             char *dimension = $6.index1;
   19716           4 :             char *length = $6.index2;
   19717             :             struct ECPGtype * type;
   19718             : 
   19719           4 :             if (($5.type_enum == ECPGt_struct ||
   19720           4 :                  $5.type_enum == ECPGt_union) &&
   19721           0 :                 initializer == 1)
   19722           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in EXEC SQL VAR command");
   19723             :             else
   19724             :             {
   19725           4 :                 adjust_array($5.type_enum, &dimension, &length, $5.type_dimension, $5.type_index, *$7?1:0, false);
   19726             : 
   19727           4 :                 switch ($5.type_enum)
   19728             :                 {
   19729           0 :                     case ECPGt_struct:
   19730             :                     case ECPGt_union:
   19731           0 :                         if (atoi(dimension) < 0)
   19732           0 :                             type = ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof);
   19733             :                         else
   19734           0 :                             type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof), dimension);
   19735           0 :                         break;
   19736             : 
   19737           2 :                     case ECPGt_varchar:
   19738             :                     case ECPGt_bytea:
   19739           2 :                         if (atoi(dimension) == -1)
   19740           2 :                             type = ECPGmake_simple_type($5.type_enum, length, 0);
   19741             :                         else
   19742           0 :                             type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
   19743           2 :                         break;
   19744             : 
   19745           0 :                     case ECPGt_char:
   19746             :                     case ECPGt_unsigned_char:
   19747             :                     case ECPGt_string:
   19748           0 :                         if (atoi(dimension) == -1)
   19749           0 :                             type = ECPGmake_simple_type($5.type_enum, length, 0);
   19750             :                         else
   19751           0 :                             type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
   19752           0 :                         break;
   19753             : 
   19754           2 :                     default:
   19755           2 :                         if (atoi(length) >= 0)
   19756           0 :                             mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
   19757             : 
   19758           2 :                         if (atoi(dimension) < 0)
   19759           2 :                             type = ECPGmake_simple_type($5.type_enum, mm_strdup("1"), 0);
   19760             :                         else
   19761           0 :                             type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, mm_strdup("1"), 0), dimension);
   19762           2 :                         break;
   19763             :                 }
   19764             : 
   19765           4 :                 ECPGfree_type(p->type);
   19766           4 :                 p->type = type;
   19767             :             }
   19768             : 
   19769           4 :             $$ = 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("*/"));
   19770             :         }
   19771             :         ;
   19772             : 
   19773             : /*
   19774             :  * whenever statement: decide what to do in case of error/no data found
   19775             :  * according to SQL standards we lack: SQLSTATE, CONSTRAINT and SQLEXCEPTION
   19776             :  */
   19777             : ECPGWhenever: SQL_WHENEVER SQL_SQLERROR action
   19778             :         {
   19779         124 :             when_error.code = $<action>3.code;
   19780         124 :             when_error.command = $<action>3.command;
   19781         124 :             $$ = cat_str(3, mm_strdup("/* exec sql whenever sqlerror "), $3.str, mm_strdup("; */"));
   19782             :         }
   19783             :         | SQL_WHENEVER NOT SQL_FOUND action
   19784             :         {
   19785          50 :             when_nf.code = $<action>4.code;
   19786          50 :             when_nf.command = $<action>4.command;
   19787          50 :             $$ = cat_str(3, mm_strdup("/* exec sql whenever not found "), $4.str, mm_strdup("; */"));
   19788             :         }
   19789             :         | SQL_WHENEVER SQL_SQLWARNING action
   19790             :         {
   19791          26 :             when_warn.code = $<action>3.code;
   19792          26 :             when_warn.command = $<action>3.command;
   19793          26 :             $$ = cat_str(3, mm_strdup("/* exec sql whenever sql_warning "), $3.str, mm_strdup("; */"));
   19794             :         }
   19795             :         ;
   19796             : 
   19797             : action : CONTINUE_P
   19798             :         {
   19799          18 :             $<action>$.code = W_NOTHING;
   19800          18 :             $<action>$.command = NULL;
   19801          18 :             $<action>$.str = mm_strdup("continue");
   19802             :         }
   19803             :         | SQL_SQLPRINT
   19804             :         {
   19805          86 :             $<action>$.code = W_SQLPRINT;
   19806          86 :             $<action>$.command = NULL;
   19807          86 :             $<action>$.str = mm_strdup("sqlprint");
   19808             :         }
   19809             :         | SQL_STOP
   19810             :         {
   19811          30 :             $<action>$.code = W_STOP;
   19812          30 :             $<action>$.command = NULL;
   19813          30 :             $<action>$.str = mm_strdup("stop");
   19814             :         }
   19815             :         | SQL_GOTO name
   19816             :         {
   19817           2 :             $<action>$.code = W_GOTO;
   19818           2 :             $<action>$.command = mm_strdup($2);
   19819           2 :             $<action>$.str = cat2_str(mm_strdup("goto "), $2);
   19820             :         }
   19821             :         | SQL_GO TO name
   19822             :         {
   19823           0 :             $<action>$.code = W_GOTO;
   19824           0 :             $<action>$.command = mm_strdup($3);
   19825           0 :             $<action>$.str = cat2_str(mm_strdup("goto "), $3);
   19826             :         }
   19827             :         | DO name '(' c_args ')'
   19828             :         {
   19829          36 :             $<action>$.code = W_DO;
   19830          36 :             $<action>$.command = cat_str(4, $2, mm_strdup("("), $4, mm_strdup(")"));
   19831          36 :             $<action>$.str = cat2_str(mm_strdup("do"), mm_strdup($<action>$.command));
   19832             :         }
   19833             :         | DO SQL_BREAK
   19834             :         {
   19835          24 :             $<action>$.code = W_BREAK;
   19836          24 :             $<action>$.command = NULL;
   19837          24 :             $<action>$.str = mm_strdup("break");
   19838             :         }
   19839             :         | DO CONTINUE_P
   19840             :         {
   19841           2 :             $<action>$.code = W_CONTINUE;
   19842           2 :             $<action>$.command = NULL;
   19843           2 :             $<action>$.str = mm_strdup("continue");
   19844             :         }
   19845             :         | CALL name '(' c_args ')'
   19846             :         {
   19847           2 :             $<action>$.code = W_DO;
   19848           2 :             $<action>$.command = cat_str(4, $2, mm_strdup("("), $4, mm_strdup(")"));
   19849           2 :             $<action>$.str = cat2_str(mm_strdup("call"), mm_strdup($<action>$.command));
   19850             :         }
   19851             :         | CALL name
   19852             :         {
   19853           0 :             $<action>$.code = W_DO;
   19854           0 :             $<action>$.command = cat2_str($2, mm_strdup("()"));
   19855           0 :             $<action>$.str = cat2_str(mm_strdup("call"), mm_strdup($<action>$.command));
   19856             :         }
   19857             :         ;
   19858             : 
   19859             : /* some other stuff for ecpg */
   19860             : 
   19861             : /* additional unreserved keywords */
   19862          20 : ECPGKeywords: ECPGKeywords_vanames  { $$ = $1; }
   19863           0 :         | ECPGKeywords_rest { $$ = $1; }
   19864             :         ;
   19865             : 
   19866           0 : ECPGKeywords_vanames:  SQL_BREAK        { $$ = mm_strdup("break"); }
   19867           0 :         | SQL_CARDINALITY               { $$ = mm_strdup("cardinality"); }
   19868           6 :         | SQL_COUNT                     { $$ = mm_strdup("count"); }
   19869           0 :         | SQL_DATETIME_INTERVAL_CODE    { $$ = mm_strdup("datetime_interval_code"); }
   19870           0 :         | SQL_DATETIME_INTERVAL_PRECISION   { $$ = mm_strdup("datetime_interval_precision"); }
   19871           0 :         | SQL_FOUND                     { $$ = mm_strdup("found"); }
   19872           0 :         | SQL_GO                        { $$ = mm_strdup("go"); }
   19873           0 :         | SQL_GOTO                      { $$ = mm_strdup("goto"); }
   19874           0 :         | SQL_IDENTIFIED                { $$ = mm_strdup("identified"); }
   19875           0 :         | SQL_INDICATOR             { $$ = mm_strdup("indicator"); }
   19876           0 :         | SQL_KEY_MEMBER            { $$ = mm_strdup("key_member"); }
   19877           0 :         | SQL_LENGTH                { $$ = mm_strdup("length"); }
   19878           0 :         | SQL_NULLABLE              { $$ = mm_strdup("nullable"); }
   19879           0 :         | SQL_OCTET_LENGTH          { $$ = mm_strdup("octet_length"); }
   19880           0 :         | SQL_RETURNED_LENGTH       { $$ = mm_strdup("returned_length"); }
   19881           0 :         | SQL_RETURNED_OCTET_LENGTH { $$ = mm_strdup("returned_octet_length"); }
   19882           0 :         | SQL_SCALE                 { $$ = mm_strdup("scale"); }
   19883           0 :         | SQL_SECTION               { $$ = mm_strdup("section"); }
   19884           0 :         | SQL_SQLERROR              { $$ = mm_strdup("sqlerror"); }
   19885          14 :         | SQL_SQLPRINT              { $$ = mm_strdup("sqlprint"); }
   19886           0 :         | SQL_SQLWARNING            { $$ = mm_strdup("sqlwarning"); }
   19887           0 :         | SQL_STOP                  { $$ = mm_strdup("stop"); }
   19888             :         ;
   19889             : 
   19890           0 : ECPGKeywords_rest:  SQL_CONNECT     { $$ = mm_strdup("connect"); }
   19891           0 :         | SQL_DESCRIBE              { $$ = mm_strdup("describe"); }
   19892           0 :         | SQL_DISCONNECT            { $$ = mm_strdup("disconnect"); }
   19893           0 :         | SQL_OPEN                  { $$ = mm_strdup("open"); }
   19894           0 :         | SQL_VAR                   { $$ = mm_strdup("var"); }
   19895           0 :         | SQL_WHENEVER              { $$ = mm_strdup("whenever"); }
   19896             :         ;
   19897             : 
   19898             : /* additional keywords that can be SQL type names (but not ECPGColLabels) */
   19899           2 : ECPGTypeName:  SQL_BOOL             { $$ = mm_strdup("bool"); }
   19900           0 :         | SQL_LONG                  { $$ = mm_strdup("long"); }
   19901           0 :         | SQL_OUTPUT                { $$ = mm_strdup("output"); }
   19902           0 :         | SQL_SHORT                 { $$ = mm_strdup("short"); }
   19903           0 :         | SQL_STRUCT                { $$ = mm_strdup("struct"); }
   19904           0 :         | SQL_SIGNED                { $$ = mm_strdup("signed"); }
   19905           0 :         | SQL_UNSIGNED              { $$ = mm_strdup("unsigned"); }
   19906             :         ;
   19907             : 
   19908          44 : symbol: ColLabel                    { $$ = $1; }
   19909             :         ;
   19910             : 
   19911          52 : ECPGColId: ecpg_ident               { $$ = $1; }
   19912           0 :         | unreserved_keyword        { $$ = $1; }
   19913           0 :         | col_name_keyword          { $$ = $1; }
   19914           0 :         | ECPGunreserved_interval   { $$ = $1; }
   19915           0 :         | ECPGKeywords              { $$ = $1; }
   19916           0 :         | ECPGCKeywords             { $$ = $1; }
   19917           0 :         | CHAR_P                    { $$ = mm_strdup("char"); }
   19918           0 :         | VALUES                    { $$ = mm_strdup("values"); }
   19919             :         ;
   19920             : 
   19921             : /*
   19922             :  * Name classification hierarchy.
   19923             :  *
   19924             :  * These productions should match those in the core grammar, except that
   19925             :  * we use all_unreserved_keyword instead of unreserved_keyword, and
   19926             :  * where possible include ECPG keywords as well as core keywords.
   19927             :  */
   19928             : 
   19929             : /* Column identifier --- names that can be column, table, etc names.
   19930             :  */
   19931        2886 : ColId:  ecpg_ident                  { $$ = $1; }
   19932         124 :         | all_unreserved_keyword    { $$ = $1; }
   19933          22 :         | col_name_keyword          { $$ = $1; }
   19934          14 :         | ECPGKeywords              { $$ = $1; }
   19935           0 :         | ECPGCKeywords             { $$ = $1; }
   19936           0 :         | CHAR_P                    { $$ = mm_strdup("char"); }
   19937           0 :         | VALUES                    { $$ = mm_strdup("values"); }
   19938             :         ;
   19939             : 
   19940             : /* Type/function identifier --- names that can be type or function names.
   19941             :  */
   19942         116 : type_function_name: ecpg_ident      { $$ = $1; }
   19943          48 :         | all_unreserved_keyword    { $$ = $1; }
   19944           0 :         | type_func_name_keyword    { $$ = $1; }
   19945           6 :         | ECPGKeywords              { $$ = $1; }
   19946           0 :         | ECPGCKeywords             { $$ = $1; }
   19947           2 :         | ECPGTypeName              { $$ = $1; }
   19948             :         ;
   19949             : 
   19950             : /* Column label --- allowed labels in "AS" clauses.
   19951             :  * This presently includes *all* Postgres keywords.
   19952             :  */
   19953          54 : ColLabel:  ECPGColLabel             { $$ = $1; }
   19954           0 :         | ECPGTypeName              { $$ = $1; }
   19955           0 :         | CHAR_P                    { $$ = mm_strdup("char"); }
   19956           0 :         | CURRENT_P                 { $$ = mm_strdup("current"); }
   19957           0 :         | INPUT_P                   { $$ = mm_strdup("input"); }
   19958           0 :         | INT_P                     { $$ = mm_strdup("int"); }
   19959           0 :         | TO                        { $$ = mm_strdup("to"); }
   19960           0 :         | UNION                     { $$ = mm_strdup("union"); }
   19961           0 :         | VALUES                    { $$ = mm_strdup("values"); }
   19962           0 :         | ECPGCKeywords             { $$ = $1; }
   19963           0 :         | ECPGunreserved_interval   { $$ = $1; }
   19964             :         ;
   19965             : 
   19966         776 : ECPGColLabel:  ecpg_ident           { $$ = $1; }
   19967          10 :         | unreserved_keyword        { $$ = $1; }
   19968          12 :         | col_name_keyword          { $$ = $1; }
   19969           0 :         | type_func_name_keyword    { $$ = $1; }
   19970           0 :         | reserved_keyword          { $$ = $1; }
   19971           0 :         | ECPGKeywords_vanames      { $$ = $1; }
   19972           0 :         | ECPGKeywords_rest         { $$ = $1; }
   19973           0 :         | CONNECTION                { $$ = mm_strdup("connection"); }
   19974             :         ;
   19975             : 
   19976           0 : ECPGCKeywords: S_AUTO               { $$ = mm_strdup("auto"); }
   19977           0 :         | S_CONST                   { $$ = mm_strdup("const"); }
   19978           0 :         | S_EXTERN                  { $$ = mm_strdup("extern"); }
   19979           0 :         | S_REGISTER                { $$ = mm_strdup("register"); }
   19980           0 :         | S_STATIC                  { $$ = mm_strdup("static"); }
   19981           0 :         | S_TYPEDEF                 { $$ = mm_strdup("typedef"); }
   19982           0 :         | S_VOLATILE                { $$ = mm_strdup("volatile"); }
   19983             :         ;
   19984             : 
   19985             : /* "Unreserved" keywords --- available for use as any kind of name.
   19986             :  */
   19987             : 
   19988             : /*
   19989             :  * The following symbols must be excluded from ECPGColLabel and directly
   19990             :  * included into ColLabel to enable C variables to get names from ECPGColLabel:
   19991             :  * DAY_P, HOUR_P, MINUTE_P, MONTH_P, SECOND_P, YEAR_P.
   19992             :  *
   19993             :  * We also have to exclude CONNECTION, CURRENT, and INPUT for various reasons.
   19994             :  * CONNECTION can be added back in all_unreserved_keyword, but CURRENT and
   19995             :  * INPUT are reserved for ecpg purposes.
   19996             :  *
   19997             :  * The mentioned exclusions are done by $replace_line settings in parse.pl.
   19998             :  */
   19999         160 : all_unreserved_keyword: unreserved_keyword  { $$ = $1; }
   20000          12 :         | ECPGunreserved_interval           { $$ = $1; }
   20001           0 :         | CONNECTION                        { $$ = mm_strdup("connection"); }
   20002             :         ;
   20003             : 
   20004           2 : ECPGunreserved_interval: DAY_P              { $$ = mm_strdup("day"); }
   20005           0 :         | HOUR_P                            { $$ = mm_strdup("hour"); }
   20006           0 :         | MINUTE_P                          { $$ = mm_strdup("minute"); }
   20007           0 :         | MONTH_P                           { $$ = mm_strdup("month"); }
   20008          10 :         | SECOND_P                          { $$ = mm_strdup("second"); }
   20009           0 :         | YEAR_P                            { $$ = mm_strdup("year"); }
   20010             :         ;
   20011             : 
   20012             : 
   20013             : into_list : coutputvariable | into_list ',' coutputvariable
   20014             :         ;
   20015             : 
   20016             : ecpgstart: SQL_START    {
   20017        2682 :                 reset_variables();
   20018        2682 :                 pacounter = 1;
   20019             :             }
   20020             :         ;
   20021             : 
   20022          26 : c_args: /*EMPTY*/       { $$ = EMPTY; }
   20023          12 :         | c_list        { $$ = $1; }
   20024             :         ;
   20025             : 
   20026             : coutputvariable: cvariable indicator
   20027          56 :             { add_variable_to_head(&argsresult, find_variable($1), find_variable($2)); }
   20028             :         | cvariable
   20029         456 :             { add_variable_to_head(&argsresult, find_variable($1), &no_indicator); }
   20030             :         ;
   20031             : 
   20032             : 
   20033             : civarind: cvariable indicator
   20034             :         {
   20035           6 :             if (find_variable($2)->type->type == ECPGt_array)
   20036           0 :                 mmerror(PARSE_ERROR, ET_ERROR, "arrays of indicators are not allowed on input");
   20037             : 
   20038           6 :             add_variable_to_head(&argsinsert, find_variable($1), find_variable($2));
   20039           6 :             $$ = create_questionmarks($1, false);
   20040             :         }
   20041             :         ;
   20042             : 
   20043             : char_civar: char_variable
   20044             :         {
   20045          86 :             char *ptr = strstr($1, ".arr");
   20046             : 
   20047          86 :             if (ptr) /* varchar, we need the struct name here, not the struct element */
   20048          20 :                 *ptr = '\0';
   20049          86 :             add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
   20050          86 :             $$ = $1;
   20051             :         }
   20052             :         ;
   20053             : 
   20054             : civar: cvariable
   20055             :         {
   20056         240 :             add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
   20057         240 :             $$ = create_questionmarks($1, false);
   20058             :         }
   20059             :         ;
   20060             : 
   20061          62 : indicator: cvariable                { check_indicator((find_variable($1))->type); $$ = $1; }
   20062           0 :         | SQL_INDICATOR cvariable   { check_indicator((find_variable($2))->type); $$ = $2; }
   20063           0 :         | SQL_INDICATOR name        { check_indicator((find_variable($2))->type); $$ = $2; }
   20064             :         ;
   20065             : 
   20066             : cvariable:  CVARIABLE
   20067             :         {
   20068             :             /* As long as multidimensional arrays are not implemented we have to check for those here */
   20069        1272 :             char *ptr = $1;
   20070        1272 :             int brace_open=0, brace = false;
   20071             : 
   20072        7958 :             for (; *ptr; ptr++)
   20073             :             {
   20074        6686 :                 switch (*ptr)
   20075             :                 {
   20076          84 :                     case '[':
   20077          84 :                             if (brace)
   20078           0 :                                 mmfatal(PARSE_ERROR, "multidimensional arrays for simple data types are not supported");
   20079          84 :                             brace_open++;
   20080          84 :                             break;
   20081          84 :                     case ']':
   20082          84 :                             brace_open--;
   20083          84 :                             if (brace_open == 0)
   20084          84 :                                 brace = true;
   20085          84 :                             break;
   20086           0 :                     case '\t':
   20087             :                     case ' ':
   20088           0 :                             break;
   20089        6518 :                     default:
   20090        6518 :                             if (brace_open == 0)
   20091        6434 :                                 brace = false;
   20092        6518 :                             break;
   20093             :                 }
   20094             :             }
   20095        1272 :             $$ = $1;
   20096             :         }
   20097             :         ;
   20098             : 
   20099          22 : ecpg_param: PARAM       { $$ = make_name(); } ;
   20100             : 
   20101           2 : ecpg_bconst:    BCONST      { $$ = $1; } ;
   20102             : 
   20103          50 : ecpg_fconst:    FCONST      { $$ = make_name(); } ;
   20104             : 
   20105         374 : ecpg_sconst:    SCONST      { $$ = $1; } ;
   20106             : 
   20107           2 : ecpg_xconst:    XCONST      { $$ = $1; } ;
   20108             : 
   20109       18072 : ecpg_ident: IDENT       { $$ = $1; }
   20110        2328 :         | CSTRING   { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
   20111             :         ;
   20112             : 
   20113             : quoted_ident_stringvar: name
   20114         212 :             { $$ = make3_str(mm_strdup("\""), $1, mm_strdup("\"")); }
   20115             :         | char_variable
   20116           8 :             { $$ = make3_str(mm_strdup("("), $1, mm_strdup(")")); }
   20117             :         ;
   20118             : 
   20119             : /*
   20120             :  * C stuff
   20121             :  */
   20122             : 
   20123         460 : c_stuff_item: c_anything            { $$ = $1; }
   20124           0 :         | '(' ')'           { $$ = mm_strdup("()"); }
   20125             :         | '(' c_stuff ')'
   20126          50 :             { $$ = cat_str(3, mm_strdup("("), $2, mm_strdup(")")); }
   20127             :         ;
   20128             : 
   20129         304 : c_stuff: c_stuff_item           { $$ = $1; }
   20130             :         | c_stuff c_stuff_item
   20131         206 :             { $$ = cat2_str($1, $2); }
   20132             :         ;
   20133             : 
   20134          14 : c_list: c_term              { $$ = $1; }
   20135          22 :         | c_list ',' c_term { $$ = cat_str(3, $1, mm_strdup(","), $3); }
   20136             :         ;
   20137             : 
   20138         254 : c_term:  c_stuff            { $$ = $1; }
   20139           2 :         | '{' c_list '}'    { $$ = cat_str(3, mm_strdup("{"), $2, mm_strdup("}")); }
   20140             :         ;
   20141             : 
   20142       25644 : c_thing:    c_anything      { $$ = $1; }
   20143        4110 :         |   '('     { $$ = mm_strdup("("); }
   20144        4110 :         |   ')'     { $$ = mm_strdup(")"); }
   20145        3540 :         |   ','     { $$ = mm_strdup(","); }
   20146        4824 :         |   ';'     { $$ = mm_strdup(";"); }
   20147             :         ;
   20148             : 
   20149       16446 : c_anything:  ecpg_ident             { $$ = $1; }
   20150        1642 :         | Iconst            { $$ = $1; }
   20151           8 :         | ecpg_fconst           { $$ = $1; }
   20152          30 :         | ecpg_sconst           { $$ = $1; }
   20153         622 :         | '*'               { $$ = mm_strdup("*"); }
   20154          26 :         | '+'               { $$ = mm_strdup("+"); }
   20155         178 :         | '-'               { $$ = mm_strdup("-"); }
   20156           0 :         | '/'               { $$ = mm_strdup("/"); }
   20157           0 :         | '%'               { $$ = mm_strdup("%"); }
   20158           4 :         | NULL_P            { $$ = mm_strdup("NULL"); }
   20159           0 :         | S_ADD             { $$ = mm_strdup("+="); }
   20160          28 :         | S_AND             { $$ = mm_strdup("&&"); }
   20161        2234 :         | S_ANYTHING            { $$ = make_name(); }
   20162           0 :         | S_AUTO            { $$ = mm_strdup("auto"); }
   20163          26 :         | S_CONST           { $$ = mm_strdup("const"); }
   20164           2 :         | S_DEC             { $$ = mm_strdup("--"); }
   20165           0 :         | S_DIV             { $$ = mm_strdup("/="); }
   20166           0 :         | S_DOTPOINT            { $$ = mm_strdup(".*"); }
   20167         110 :         | S_EQUAL           { $$ = mm_strdup("=="); }
   20168          36 :         | S_EXTERN          { $$ = mm_strdup("extern"); }
   20169         192 :         | S_INC             { $$ = mm_strdup("++"); }
   20170           0 :         | S_LSHIFT          { $$ = mm_strdup("<<"); }
   20171         202 :         | S_MEMBER          { $$ = mm_strdup("->"); }
   20172           0 :         | S_MEMPOINT            { $$ = mm_strdup("->*"); }
   20173           0 :         | S_MOD             { $$ = mm_strdup("%="); }
   20174           0 :         | S_MUL             { $$ = mm_strdup("*="); }
   20175          50 :         | S_NEQUAL          { $$ = mm_strdup("!="); }
   20176          10 :         | S_OR              { $$ = mm_strdup("||"); }
   20177           0 :         | S_REGISTER            { $$ = mm_strdup("register"); }
   20178           2 :         | S_RSHIFT          { $$ = mm_strdup(">>"); }
   20179         104 :         | S_STATIC          { $$ = mm_strdup("static"); }
   20180           0 :         | S_SUB             { $$ = mm_strdup("-="); }
   20181          66 :         | S_TYPEDEF         { $$ = mm_strdup("typedef"); }
   20182           0 :         | S_VOLATILE            { $$ = mm_strdup("volatile"); }
   20183           2 :         | SQL_BOOL          { $$ = mm_strdup("bool"); }
   20184           8 :         | ENUM_P            { $$ = mm_strdup("enum"); }
   20185           0 :         | HOUR_P            { $$ = mm_strdup("hour"); }
   20186         434 :         | INT_P             { $$ = mm_strdup("int"); }
   20187         122 :         | SQL_LONG          { $$ = mm_strdup("long"); }
   20188           0 :         | MINUTE_P          { $$ = mm_strdup("minute"); }
   20189           2 :         | MONTH_P           { $$ = mm_strdup("month"); }
   20190           0 :         | SECOND_P          { $$ = mm_strdup("second"); }
   20191           8 :         | SQL_SHORT         { $$ = mm_strdup("short"); }
   20192           8 :         | SQL_SIGNED            { $$ = mm_strdup("signed"); }
   20193         156 :         | SQL_STRUCT            { $$ = mm_strdup("struct"); }
   20194          20 :         | SQL_UNSIGNED          { $$ = mm_strdup("unsigned"); }
   20195           0 :         | YEAR_P            { $$ = mm_strdup("year"); }
   20196         388 :         | CHAR_P            { $$ = mm_strdup("char"); }
   20197           4 :         | FLOAT_P           { $$ = mm_strdup("float"); }
   20198           0 :         | TO                { $$ = mm_strdup("to"); }
   20199           4 :         | UNION             { $$ = mm_strdup("union"); }
   20200           0 :         | VARCHAR           { $$ = mm_strdup("varchar"); }
   20201         822 :         | '['               { $$ = mm_strdup("["); }
   20202         822 :         | ']'               { $$ = mm_strdup("]"); }
   20203        1098 :         | '='               { $$ = mm_strdup("="); }
   20204         188 :         | ':'               { $$ = mm_strdup(":"); }
   20205             :         ;
   20206             : 
   20207          36 : DeallocateStmt: DEALLOCATE prepared_name    { check_declared_list($2); $$ = $2; }
   20208          38 :         | DEALLOCATE PREPARE prepared_name  { check_declared_list($3); $$ = $3; }
   20209           2 :         | DEALLOCATE ALL                    { $$ = mm_strdup("all"); }
   20210           0 :         | DEALLOCATE PREPARE ALL            { $$ = mm_strdup("all"); }
   20211             :         ;
   20212             : 
   20213         230 : Iresult: Iconst                     { $$ = $1; }
   20214           0 :         | '(' Iresult ')'           { $$ = cat_str(3, mm_strdup("("), $2, mm_strdup(")")); }
   20215           0 :         | Iresult '+' Iresult       { $$ = cat_str(3, $1, mm_strdup("+"), $3); }
   20216           2 :         | Iresult '-' Iresult       { $$ = cat_str(3, $1, mm_strdup("-"), $3); }
   20217           0 :         | Iresult '*' Iresult       { $$ = cat_str(3, $1, mm_strdup("*"), $3); }
   20218           0 :         | Iresult '/' Iresult       { $$ = cat_str(3, $1, mm_strdup("/"), $3); }
   20219           0 :         | Iresult '%' Iresult       { $$ = cat_str(3, $1, mm_strdup("%"), $3); }
   20220           0 :         | ecpg_sconst               { $$ = $1; }
   20221          18 :         | ColId                     { $$ = $1; }
   20222           0 :         | ColId '(' var_type ')'    { if (pg_strcasecmp($1, "sizeof") != 0)
   20223           0 :                             mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition");
   20224             :                           else
   20225           0 :                             $$ = cat_str(4, $1, mm_strdup("("), $3.type_str, mm_strdup(")"));
   20226             :                         }
   20227             :         ;
   20228             : 
   20229          20 : execute_rest: /* EMPTY */   { $$ = EMPTY; }
   20230          40 :     | ecpg_using opt_ecpg_into  { $$ = EMPTY; }
   20231           0 :     | ecpg_into ecpg_using  { $$ = EMPTY; }
   20232           6 :     | ecpg_into             { $$ = EMPTY; }
   20233             :     ;
   20234             : 
   20235         290 : ecpg_into: INTO into_list   { $$ = EMPTY; }
   20236          28 :     | into_descriptor       { $$ = $1; }
   20237             :     ;
   20238             : 
   20239          28 : opt_ecpg_into:  /* EMPTY */ { $$ = EMPTY; }
   20240          16 :     | ecpg_into     { $$ = $1; }
   20241             :     ;
   20242             : 
   20243         100 : ecpg_fetch_into: ecpg_into  { $$ = $1; }
   20244             :     | using_descriptor
   20245             :     {
   20246             :         struct variable *var;
   20247             : 
   20248           2 :         var = argsinsert->variable;
   20249           2 :         remove_variable_from_list(&argsinsert, var);
   20250           2 :         add_variable_to_head(&argsresult, var, &no_indicator);
   20251           2 :         $$ = $1;
   20252             :     }
   20253             :     ;
   20254             : 
   20255           0 : opt_ecpg_fetch_into:    /* EMPTY */ { $$ = EMPTY; }
   20256           6 :     | ecpg_fetch_into       { $$ = $1; }
   20257             :     ;
   20258             : 
   20259             : %%
   20260             : 
   20261           0 : void base_yyerror(const char *error)
   20262             : {
   20263             :     /* translator: %s is typically the translation of "syntax error" */
   20264           0 :     mmerror(PARSE_ERROR, ET_ERROR, "%s at or near \"%s\"",
   20265           0 :             _(error), token_start ? token_start : base_yytext);
   20266           0 : }
   20267             : 
   20268           0 : void parser_init(void)
   20269             : {
   20270             :  /* This function is empty. It only exists for compatibility with the backend parser right now. */
   20271           0 : }

Generated by: LCOV version 1.14