Branch data 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 "preproc.h"
10 : : #include "ecpg_config.h"
11 : : #include <unistd.h>
12 : :
13 : : /* silence -Wmissing-variable-declarations */
14 : : extern int base_yychar;
15 : : extern int base_yynerrs;
16 : :
17 : :
18 : : /*
19 : : * The %name-prefix option below will make bison call base_yylex, but we
20 : : * really want it to call filtered_base_yylex (see parser.c).
21 : : */
22 : : #define base_yylex filtered_base_yylex
23 : :
24 : : /*
25 : : * This is only here so the string gets into the POT. Bison uses it
26 : : * internally.
27 : : */
28 : : #define bison_gettext_dummy gettext_noop("syntax error")
29 : :
30 : : /*
31 : : * Variables containing simple states.
32 : : */
33 : : int struct_level = 0;
34 : : int braces_open; /* brace level counter */
35 : : char *current_function;
36 : : int ecpg_internal_var = 0;
37 : : char *connection = NULL;
38 : : char *input_filename = NULL;
39 : :
40 : : static int FoundInto = 0;
41 : : static int initializer = 0;
42 : : static int pacounter = 1;
43 : : static struct this_type actual_type[STRUCT_DEPTH];
44 : : static char *actual_startline[STRUCT_DEPTH];
45 : : static int varchar_counter = 1;
46 : : static int bytea_counter = 1;
47 : :
48 : : /*
49 : : * We temporarily store struct members here while parsing struct declarations.
50 : : * The struct_member_list (at a given nesting depth) is constructed while
51 : : * scanning the fields within "struct { .... }", but we can't remove it upon
52 : : * seeing the right brace. It's kept around and copied into the variables
53 : : * or typedefs that follow, in order to handle cases like
54 : : * "struct foo { ... } foovar1, foovar2;". We recycle the storage only
55 : : * upon closing the current nesting level or starting the next struct
56 : : * declaration within the same nesting level.
57 : : * For cases like "struct foo foovar1, foovar2;", we copy the saved struct
58 : : * field list for the typedef or struct tag into the struct_member_list
59 : : * global variable, and then copy it again to the newly-declared variables.
60 : : */
61 : : struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH] = {NULL};
62 : :
63 : : /* also store struct type so we can do a sizeof() later */
64 : : static char *ECPGstruct_sizeof = NULL;
65 : :
66 : : /* for forward declarations we have to store some data as well */
67 : : static char *forward_name = NULL;
68 : :
69 : : struct ECPGtype ecpg_no_indicator = {ECPGt_NO_INDICATOR, NULL, NULL, NULL, {NULL}, 0};
70 : : struct variable no_indicator = {"no_indicator", &ecpg_no_indicator, 0, NULL};
71 : :
72 : : static struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, NULL, {NULL}, 0};
73 : :
74 : : static bool check_declared_list(const char *name);
75 : : static void update_connection(const char *newconn);
76 : :
77 : :
78 : : /*
79 : : * "Location tracking" support. We commandeer Bison's location tracking
80 : : * mechanism to manage the output string for productions that ordinarily would
81 : : * return a <str> result. This allows the majority of those productions to
82 : : * have default semantic actions, reducing the size of the parser, and also
83 : : * greatly reducing its compilation time on some versions of clang.
84 : : *
85 : : * To do this, we make YYLTYPE be a pointer to a malloc'd string, and then
86 : : * merge the location strings of the input tokens in the default YYLLOC
87 : : * computation. Productions that are okay with the standard merge need not
88 : : * do anything more; otherwise, they can override it by assigning to @$.
89 : : */
90 : : #define YYLLOC_DEFAULT(Current, Rhs, N) yylloc_default(&(Current), Rhs, N)
91 : :
92 : : static void
93 : 124512 : yylloc_default(YYLTYPE *target, YYLTYPE *rhs, int N)
94 : : {
95 [ + + ]: 124512 : if (N > 1)
96 : : {
97 : : /* Concatenate non-empty inputs with one space between them */
98 : : char *result,
99 : : *ptr;
100 : 31580 : size_t needed = 0;
101 : :
102 [ + + ]: 105223 : for (int i = 1; i <= N; i++)
103 : : {
104 : 73643 : size_t thislen = strlen(rhs[i]);
105 : :
106 [ + + + + ]: 73643 : if (needed > 0 && thislen > 0)
107 : 10531 : needed++;
108 : 73643 : needed += thislen;
109 : : }
110 : 31580 : result = (char *) loc_alloc(needed + 1);
111 : 31580 : ptr = result;
112 [ + + ]: 105223 : for (int i = 1; i <= N; i++)
113 : : {
114 : 73643 : size_t thislen = strlen(rhs[i]);
115 : :
116 [ + + + + ]: 73643 : if (ptr > result && thislen > 0)
117 : 10531 : *ptr++ = ' ';
118 : 73643 : memcpy(ptr, rhs[i], thislen);
119 : 73643 : ptr += thislen;
120 : : }
121 : 31580 : *ptr = '\0';
122 : 31580 : *target = result;
123 : : }
124 [ + + ]: 92932 : else if (N == 1)
125 : : {
126 : : /* Just re-use the single input */
127 : 87074 : *target = rhs[1];
128 : : }
129 : : else
130 : : {
131 : : /* No need to allocate any space */
132 : 5858 : *target = "";
133 : : }
134 : 124512 : }
135 : :
136 : : /* and the rest */
137 : : static char *
138 : 131 : create_questionmarks(const char *name, bool array)
139 : : {
140 : 131 : struct variable *p = find_variable(name);
141 : : int count;
142 : 131 : char *result = "";
143 : :
144 : : /*
145 : : * In case we have a struct, we have to print as many "?" as there are
146 : : * attributes in the struct
147 : : *
148 : : * An array is only allowed together with an element argument
149 : : *
150 : : * This is essentially only used for inserts, but using a struct as input
151 : : * parameter is an error anywhere else so we don't have to worry here.
152 : : */
153 : :
154 [ + - - + : 131 : if (p->type->type == ECPGt_struct || (array && p->type->type == ECPGt_array && p->type->u.element->type == ECPGt_struct))
- - - - ]
155 : 0 : {
156 : : struct ECPGstruct_member *m;
157 : :
158 [ # # ]: 0 : if (p->type->type == ECPGt_struct)
159 : 0 : m = p->type->u.members;
160 : : else
161 : 0 : m = p->type->u.element->u.members;
162 : :
163 [ # # ]: 0 : for (count = 0; m != NULL; m = m->next, count++);
164 : : }
165 : : else
166 : 131 : count = 1;
167 : :
168 [ + + ]: 262 : for (; count > 0; count--)
169 : : {
170 : : char buf[32];
171 : :
172 : 131 : snprintf(buf, sizeof(buf), "$%d", pacounter++);
173 : 131 : result = cat_str(3, result, buf, " , ");
174 : : }
175 : :
176 : : /* remove the trailing " ," */
177 : 131 : result[strlen(result) - 3] = '\0';
178 : 131 : return result;
179 : : }
180 : :
181 : : static char *
182 : 42 : adjust_outofscope_cursor_vars(struct cursor *cur)
183 : : {
184 : : /*
185 : : * Informix accepts DECLARE with variables that are out of scope when OPEN
186 : : * is called. For instance you can DECLARE a cursor in one function, and
187 : : * OPEN/FETCH/CLOSE it in another functions. This is very useful for e.g.
188 : : * event-driver programming, but may also lead to dangerous programming.
189 : : * The limitation when this is allowed and doesn't cause problems have to
190 : : * be documented, like the allocated variables must not be realloc()'ed.
191 : : *
192 : : * We have to change the variables to our own struct and just store the
193 : : * pointer instead of the variable. Do it only for local variables, not
194 : : * for globals.
195 : : */
196 : 42 : char *result = "";
197 : : int insert;
198 : :
199 [ + + ]: 126 : for (insert = 1; insert >= 0; insert--)
200 : : {
201 : : struct arguments *list;
202 : : struct arguments *ptr;
203 : 84 : struct arguments *newlist = NULL;
204 : : struct variable *newvar,
205 : : *newind;
206 : :
207 [ + + ]: 84 : list = (insert ? cur->argsinsert : cur->argsresult);
208 : :
209 [ + + ]: 120 : for (ptr = list; ptr != NULL; ptr = ptr->next)
210 : : {
211 : : char var_text[20];
212 : : char *original_var;
213 : 36 : bool skip_set_var = false;
214 : 36 : bool var_ptr = false;
215 : :
216 : : /* change variable name to "ECPGget_var(<counter>)" */
217 : 36 : original_var = ptr->variable->name;
218 : 36 : snprintf(var_text, sizeof(var_text), "%d))", ecpg_internal_var);
219 : :
220 : : /* Don't emit ECPGset_var() calls for global variables */
221 [ + + ]: 36 : if (ptr->variable->brace_level == 0)
222 : : {
223 : 21 : newvar = ptr->variable;
224 : 21 : skip_set_var = true;
225 : : }
226 [ - + ]: 15 : else if ((ptr->variable->type->type == ECPGt_char_variable)
227 [ # # ]: 0 : && (strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement")) == 0))
228 : : {
229 : 0 : newvar = ptr->variable;
230 : 0 : skip_set_var = true;
231 : : }
232 [ + + ]: 15 : else if ((ptr->variable->type->type != ECPGt_varchar
233 [ + + ]: 14 : && ptr->variable->type->type != ECPGt_char
234 [ + - ]: 7 : && ptr->variable->type->type != ECPGt_unsigned_char
235 [ + - ]: 7 : && ptr->variable->type->type != ECPGt_string
236 [ + + ]: 7 : && ptr->variable->type->type != ECPGt_bytea)
237 [ - + ]: 6 : && atoi(ptr->variable->type->size) > 1)
238 : : {
239 : 0 : newvar = new_variable(cat_str(4, "(",
240 : 0 : ecpg_type_name(ptr->variable->type->u.element->type),
241 : : " *)(ECPGget_var(",
242 : : var_text),
243 : 0 : ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
244 : : "1",
245 : 0 : ptr->variable->type->u.element->counter),
246 : 0 : ptr->variable->type->size),
247 : : 0);
248 : : }
249 [ + + ]: 15 : else if ((ptr->variable->type->type == ECPGt_varchar
250 [ + + ]: 14 : || ptr->variable->type->type == ECPGt_char
251 [ + - ]: 7 : || ptr->variable->type->type == ECPGt_unsigned_char
252 [ + - ]: 7 : || ptr->variable->type->type == ECPGt_string
253 [ + + ]: 7 : || ptr->variable->type->type == ECPGt_bytea)
254 [ + + ]: 9 : && atoi(ptr->variable->type->size) > 1)
255 : : {
256 : 3 : newvar = new_variable(cat_str(4, "(",
257 : 3 : ecpg_type_name(ptr->variable->type->type),
258 : : " *)(ECPGget_var(",
259 : : var_text),
260 : 3 : ECPGmake_simple_type(ptr->variable->type->type,
261 : 3 : ptr->variable->type->size,
262 : 3 : ptr->variable->type->counter),
263 : : 0);
264 [ + + ]: 3 : if (ptr->variable->type->type == ECPGt_varchar ||
265 [ + + ]: 2 : ptr->variable->type->type == ECPGt_bytea)
266 : 2 : var_ptr = true;
267 : : }
268 [ + - ]: 12 : else if (ptr->variable->type->type == ECPGt_struct
269 [ - + ]: 12 : || ptr->variable->type->type == ECPGt_union)
270 : : {
271 : 0 : newvar = new_variable(cat_str(5, "(*(",
272 : 0 : ptr->variable->type->type_name,
273 : : " *)(ECPGget_var(",
274 : : var_text,
275 : : ")"),
276 : 0 : ECPGmake_struct_type(ptr->variable->type->u.members,
277 : 0 : ptr->variable->type->type,
278 : 0 : ptr->variable->type->type_name,
279 : 0 : ptr->variable->type->struct_sizeof),
280 : : 0);
281 : 0 : var_ptr = true;
282 : : }
283 [ + + ]: 12 : else if (ptr->variable->type->type == ECPGt_array)
284 : : {
285 [ - + ]: 1 : if (ptr->variable->type->u.element->type == ECPGt_struct
286 [ # # ]: 0 : || ptr->variable->type->u.element->type == ECPGt_union)
287 : : {
288 : 1 : newvar = new_variable(cat_str(5, "(*(",
289 : 1 : ptr->variable->type->u.element->type_name,
290 : : " *)(ECPGget_var(",
291 : : var_text,
292 : : ")"),
293 : 1 : ECPGmake_struct_type(ptr->variable->type->u.element->u.members,
294 : 1 : ptr->variable->type->u.element->type,
295 : 1 : ptr->variable->type->u.element->type_name,
296 : 1 : ptr->variable->type->u.element->struct_sizeof),
297 : : 0);
298 : : }
299 : : else
300 : : {
301 : 0 : newvar = new_variable(cat_str(4, "(",
302 : 0 : ecpg_type_name(ptr->variable->type->u.element->type),
303 : : " *)(ECPGget_var(",
304 : : var_text),
305 : 0 : ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
306 : 0 : ptr->variable->type->u.element->size,
307 : 0 : ptr->variable->type->u.element->counter),
308 : 0 : ptr->variable->type->size),
309 : : 0);
310 : 0 : var_ptr = true;
311 : : }
312 : : }
313 : : else
314 : : {
315 : 11 : newvar = new_variable(cat_str(4, "*(",
316 : 11 : ecpg_type_name(ptr->variable->type->type),
317 : : " *)(ECPGget_var(",
318 : : var_text),
319 : 11 : ECPGmake_simple_type(ptr->variable->type->type,
320 : 11 : ptr->variable->type->size,
321 : 11 : ptr->variable->type->counter),
322 : : 0);
323 : 11 : var_ptr = true;
324 : : }
325 : :
326 : : /*
327 : : * create call to "ECPGset_var(<counter>, <connection>, <pointer>.
328 : : * <line number>)"
329 : : */
330 [ + + ]: 36 : if (!skip_set_var)
331 : : {
332 [ + + ]: 15 : snprintf(var_text, sizeof(var_text), "%d, %s",
333 : : ecpg_internal_var++, var_ptr ? "&(" : "(");
334 : 15 : result = cat_str(5, result, "ECPGset_var(",
335 : : var_text, original_var,
336 : : "), __LINE__);\n");
337 : : }
338 : :
339 : : /*
340 : : * now the indicator if there is one and it's not a global
341 : : * variable
342 : : */
343 [ + + - + ]: 36 : if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
344 : : {
345 : 35 : newind = ptr->indicator;
346 : : }
347 : : else
348 : : {
349 : : /* change variable name to "ECPGget_var(<counter>)" */
350 : 1 : original_var = ptr->indicator->name;
351 : 1 : snprintf(var_text, sizeof(var_text), "%d))", ecpg_internal_var);
352 : 1 : var_ptr = false;
353 : :
354 [ + - ]: 1 : if (ptr->indicator->type->type == ECPGt_struct
355 [ - + ]: 1 : || ptr->indicator->type->type == ECPGt_union)
356 : : {
357 : 0 : newind = new_variable(cat_str(5, "(*(",
358 : 0 : ptr->indicator->type->type_name,
359 : : " *)(ECPGget_var(",
360 : : var_text,
361 : : ")"),
362 : 0 : ECPGmake_struct_type(ptr->indicator->type->u.members,
363 : 0 : ptr->indicator->type->type,
364 : 0 : ptr->indicator->type->type_name,
365 : 0 : ptr->indicator->type->struct_sizeof),
366 : : 0);
367 : 0 : var_ptr = true;
368 : : }
369 [ + - ]: 1 : else if (ptr->indicator->type->type == ECPGt_array)
370 : : {
371 [ - + ]: 1 : if (ptr->indicator->type->u.element->type == ECPGt_struct
372 [ # # ]: 0 : || ptr->indicator->type->u.element->type == ECPGt_union)
373 : : {
374 : 1 : newind = new_variable(cat_str(5, "(*(",
375 : 1 : ptr->indicator->type->u.element->type_name,
376 : : " *)(ECPGget_var(",
377 : : var_text,
378 : : ")"),
379 : 1 : ECPGmake_struct_type(ptr->indicator->type->u.element->u.members,
380 : 1 : ptr->indicator->type->u.element->type,
381 : 1 : ptr->indicator->type->u.element->type_name,
382 : 1 : ptr->indicator->type->u.element->struct_sizeof),
383 : : 0);
384 : : }
385 : : else
386 : : {
387 : 0 : newind = new_variable(cat_str(4, "(",
388 : 0 : ecpg_type_name(ptr->indicator->type->u.element->type),
389 : : " *)(ECPGget_var(",
390 : : var_text),
391 : 0 : ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type,
392 : 0 : ptr->indicator->type->u.element->size,
393 : 0 : ptr->indicator->type->u.element->counter),
394 : 0 : ptr->indicator->type->size),
395 : : 0);
396 : 0 : var_ptr = true;
397 : : }
398 : : }
399 [ # # ]: 0 : else if (atoi(ptr->indicator->type->size) > 1)
400 : : {
401 : 0 : newind = new_variable(cat_str(4, "(",
402 : 0 : ecpg_type_name(ptr->indicator->type->type),
403 : : " *)(ECPGget_var(",
404 : : var_text),
405 : 0 : ECPGmake_simple_type(ptr->indicator->type->type,
406 : 0 : ptr->indicator->type->size,
407 : 0 : ptr->variable->type->counter),
408 : : 0);
409 : : }
410 : : else
411 : : {
412 : 0 : newind = new_variable(cat_str(4, "*(",
413 : 0 : ecpg_type_name(ptr->indicator->type->type),
414 : : " *)(ECPGget_var(",
415 : : var_text),
416 : 0 : ECPGmake_simple_type(ptr->indicator->type->type,
417 : 0 : ptr->indicator->type->size,
418 : 0 : ptr->variable->type->counter),
419 : : 0);
420 : 0 : var_ptr = true;
421 : : }
422 : :
423 : : /*
424 : : * create call to "ECPGset_var(<counter>, <pointer>. <line
425 : : * number>)"
426 : : */
427 [ - + ]: 1 : snprintf(var_text, sizeof(var_text), "%d, %s",
428 : : ecpg_internal_var++, var_ptr ? "&(" : "(");
429 : 1 : result = cat_str(5, result, "ECPGset_var(",
430 : : var_text, original_var,
431 : : "), __LINE__);\n");
432 : : }
433 : :
434 : 36 : add_variable_to_tail(&newlist, newvar, newind);
435 : : }
436 : :
437 [ + + ]: 84 : if (insert)
438 : 42 : cur->argsinsert_oos = newlist;
439 : : else
440 : 42 : cur->argsresult_oos = newlist;
441 : : }
442 : :
443 : 42 : return result;
444 : : }
445 : :
446 : : /* This tests whether the cursor was declared and opened in the same function. */
447 : : #define SAMEFUNC(cur) \
448 : : ((cur->function == NULL) || \
449 : : (cur->function != NULL && current_function != NULL && \
450 : : strcmp(cur->function, current_function) == 0))
451 : :
452 : : static struct cursor *
453 : 102 : add_additional_variables(const char *name, bool insert)
454 : : {
455 : : struct cursor *ptr;
456 : : struct arguments *p;
457 [ + + - + ]: 102 : int (*strcmp_fn) (const char *, const char *) = ((name[0] == ':' || name[0] == '"') ? strcmp : pg_strcasecmp);
458 : :
459 [ + - ]: 109 : for (ptr = cur; ptr != NULL; ptr = ptr->next)
460 : : {
461 [ + + ]: 109 : if (strcmp_fn(ptr->name, name) == 0)
462 : 102 : break;
463 : : }
464 : :
465 [ - + ]: 102 : if (ptr == NULL)
466 : : {
467 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" does not exist", name);
468 : 0 : return NULL;
469 : : }
470 : :
471 [ + + ]: 102 : if (insert)
472 : : {
473 : : /*
474 : : * add all those input variables that were given earlier
475 : : *
476 : : * note that we have to append here but have to keep the existing
477 : : * order
478 : : */
479 [ + - + - : 70 : for (p = (SAMEFUNC(ptr) ? ptr->argsinsert : ptr->argsinsert_oos); p; p = p->next)
+ - + + +
+ ]
480 : 31 : add_variable_to_tail(&argsinsert, p->variable, p->indicator);
481 : : }
482 : :
483 : : /* add all those output variables that were given earlier */
484 [ + - + - : 120 : for (p = (SAMEFUNC(ptr) ? ptr->argsresult : ptr->argsresult_oos); p; p = p->next)
+ - + + +
+ ]
485 : 18 : add_variable_to_tail(&argsresult, p->variable, p->indicator);
486 : :
487 : 102 : return ptr;
488 : : }
489 : :
490 : : static void
491 : 25 : add_typedef(const char *name, const char *dimension, const char *length,
492 : : enum ECPGttype type_enum,
493 : : const char *type_dimension, const char *type_index,
494 : : int initializer, int array)
495 : : {
496 : : /* add entry to list */
497 : : struct typedefs *ptr,
498 : : *this;
499 : :
500 [ + + + + ]: 25 : if ((type_enum == ECPGt_struct ||
501 [ - + ]: 12 : type_enum == ECPGt_union) &&
502 : : initializer == 1)
503 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
504 [ + - - + : 25 : else if (INFORMIX_MODE && strcmp(name, "string") == 0)
- - ]
505 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "type name \"string\" is reserved in Informix mode");
506 : : else
507 : : {
508 [ + + ]: 69 : for (ptr = types; ptr != NULL; ptr = ptr->next)
509 : : {
510 [ - + ]: 44 : if (strcmp(name, ptr->name) == 0)
511 : : /* re-definition is a bug */
512 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", name);
513 : : }
514 : 25 : adjust_array(type_enum, &dimension, &length,
515 : : type_dimension, type_index, array, true);
516 : :
517 : 25 : this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
518 : :
519 : : /* initial definition */
520 : 25 : this->next = types;
521 : 25 : this->name = mm_strdup(name);
522 : 25 : this->brace_level = braces_open;
523 : 25 : this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
524 : 25 : this->type->type_storage = NULL;
525 : 25 : this->type->type_enum = type_enum;
526 : 25 : this->type->type_str = mm_strdup(name);
527 : 25 : this->type->type_dimension = mm_strdup(dimension); /* dimension of array */
528 : 25 : this->type->type_index = mm_strdup(length); /* length of string */
529 [ + + ]: 25 : this->type->type_sizeof = ECPGstruct_sizeof ? mm_strdup(ECPGstruct_sizeof) : NULL;
530 [ + + ]: 15 : this->struct_member_list = (type_enum == ECPGt_struct || type_enum == ECPGt_union) ?
531 [ + + ]: 40 : ECPGstruct_member_dup(struct_member_list[struct_level]) : NULL;
532 : :
533 [ + + + - ]: 25 : if (type_enum != ECPGt_varchar &&
534 [ + + ]: 23 : type_enum != ECPGt_bytea &&
535 [ + - ]: 16 : type_enum != ECPGt_char &&
536 [ + - ]: 16 : type_enum != ECPGt_unsigned_char &&
537 : 16 : type_enum != ECPGt_string &&
538 [ - + ]: 16 : atoi(this->type->type_index) >= 0)
539 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
540 : :
541 : 25 : types = this;
542 : : }
543 : 25 : }
544 : :
545 : : /*
546 : : * check an SQL identifier is declared or not.
547 : : * If it is already declared, the global variable
548 : : * connection will be changed to the related connection.
549 : : */
550 : : static bool
551 : 168 : check_declared_list(const char *name)
552 : : {
553 : 168 : struct declared_list *ptr = NULL;
554 : :
555 [ + + ]: 192 : for (ptr = g_declared_list; ptr != NULL; ptr = ptr->next)
556 : : {
557 [ + + ]: 31 : if (!ptr->connection)
558 : 18 : continue;
559 [ + + ]: 13 : if (strcmp(name, ptr->name) == 0)
560 : : {
561 [ - + - - ]: 7 : if (connection && strcmp(ptr->connection, connection) != 0)
562 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "connection %s is overwritten with %s by DECLARE statement %s", connection, ptr->connection, name);
563 : 7 : update_connection(ptr->connection);
564 : 7 : return true;
565 : : }
566 : : }
567 : 161 : return false;
568 : : }
569 : :
570 : : /*
571 : : * If newconn isn't NULL, update the global "connection" variable to that;
572 : : * otherwise do nothing.
573 : : */
574 : : static void
575 : 106 : update_connection(const char *newconn)
576 : : {
577 [ + + ]: 106 : if (newconn)
578 : : {
579 : 46 : free(connection);
580 : 46 : connection = mm_strdup(newconn);
581 : : }
582 : 106 : }
583 : : %}
584 : :
585 : : %expect 0
586 : : %name-prefix="base_yy"
587 : : %locations
588 : :
589 : : %union {
590 : : double dval;
591 : : char *str;
592 : : int ival;
593 : : struct when action;
594 : : struct index index;
595 : : int tagname;
596 : : struct this_type type;
597 : : enum ECPGttype type_enum;
598 : : enum ECPGdtype dtype_enum;
599 : : struct fetch_desc descriptor;
600 : : struct su_symbol struct_union;
601 : : struct prep prep;
602 : : struct exec exec;
603 : : struct describe describe;
604 : : }
605 : : /* tokens */
606 : : /* src/interfaces/ecpg/preproc/ecpg.tokens */
607 : :
608 : : /* special embedded SQL tokens */
609 : : %token SQL_ALLOCATE SQL_AUTOCOMMIT SQL_BOOL SQL_BREAK
610 : : SQL_CARDINALITY SQL_CONNECT
611 : : SQL_COUNT
612 : : SQL_DATETIME_INTERVAL_CODE
613 : : SQL_DATETIME_INTERVAL_PRECISION SQL_DESCRIBE
614 : : SQL_DESCRIPTOR SQL_DISCONNECT SQL_FOUND
615 : : SQL_FREE SQL_GET SQL_GO SQL_GOTO SQL_IDENTIFIED
616 : : SQL_INDICATOR SQL_KEY_MEMBER SQL_LENGTH
617 : : SQL_LONG SQL_NULLABLE SQL_OCTET_LENGTH
618 : : SQL_OPEN SQL_OUTPUT SQL_REFERENCE
619 : : SQL_RETURNED_LENGTH SQL_RETURNED_OCTET_LENGTH SQL_SCALE
620 : : SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQLERROR
621 : : SQL_SQLPRINT SQL_SQLWARNING SQL_START SQL_STOP
622 : : SQL_STRUCT SQL_UNSIGNED SQL_VAR SQL_WHENEVER
623 : :
624 : : /* C tokens */
625 : : %token S_ADD S_AND S_ANYTHING S_AUTO S_CONST S_DEC S_DIV
626 : : S_DOTPOINT S_EQUAL S_EXTERN S_INC S_LSHIFT S_MEMPOINT
627 : : S_MEMBER S_MOD S_MUL S_NEQUAL S_OR S_REGISTER S_RSHIFT
628 : : S_STATIC S_SUB S_VOLATILE
629 : : S_TYPEDEF
630 : :
631 : : %token CSTRING CVARIABLE CPP_LINE IP
632 : : /* types */
633 : : %type <prep> PrepareStmt
634 : : %type <exec> ExecuteStmt
635 : : %type <index> opt_array_bounds
636 : : /* ecpgtype */
637 : : /* src/interfaces/ecpg/preproc/ecpg.type */
638 : : %type <struct_union> s_struct_union_symbol
639 : :
640 : : %type <descriptor> ECPGGetDescriptor
641 : : %type <descriptor> ECPGSetDescriptor
642 : :
643 : : %type <type_enum> simple_type
644 : : %type <type_enum> signed_type
645 : : %type <type_enum> unsigned_type
646 : :
647 : : %type <dtype_enum> descriptor_item
648 : : %type <dtype_enum> desc_header_item
649 : :
650 : : %type <type> var_type
651 : :
652 : : %type <action> action
653 : :
654 : : %type <describe> ECPGDescribe
655 : : /* orig_tokens */
656 : : %token IDENT UIDENT FCONST SCONST USCONST BCONST XCONST Op
657 : : %token ICONST PARAM
658 : : %token TYPECAST DOT_DOT COLON_EQUALS EQUALS_GREATER
659 : : %token LESS_EQUALS GREATER_EQUALS NOT_EQUALS
660 : :
661 : :
662 : :
663 : :
664 : :
665 : :
666 : :
667 : : %token ABORT_P ABSENT ABSOLUTE_P ACCESS ACTION ADD_P ADMIN AFTER
668 : : AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY ARRAY AS ASC
669 : : ASENSITIVE ASSERTION ASSIGNMENT ASYMMETRIC ATOMIC AT ATTACH ATTRIBUTE AUTHORIZATION
670 : : BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
671 : : BOOLEAN_P BOTH BREADTH BY
672 : : CACHE CALL CALLED CASCADE CASCADED CASE CAST CATALOG_P CHAIN CHAR_P
673 : : CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE
674 : : CLUSTER COALESCE COLLATE COLLATION COLUMN COLUMNS COMMENT COMMENTS COMMIT
675 : : COMMITTED COMPRESSION CONCURRENTLY CONDITIONAL CONFIGURATION CONFLICT
676 : : CONNECTION CONSTRAINT CONSTRAINTS CONTENT_P CONTINUE_P CONVERSION_P COPY
677 : : COST CREATE CROSS CSV CUBE CURRENT_P
678 : : CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA
679 : : CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
680 : : DATA_P DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
681 : : DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS DEPENDS DEPTH DESC
682 : : DETACH DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P
683 : : DOUBLE_P DROP
684 : : EACH ELSE EMPTY_P ENABLE_P ENCODING ENCRYPTED END_P ENFORCED ENUM_P ERROR_P
685 : : ESCAPE EVENT EXCEPT EXCLUDE EXCLUDING EXCLUSIVE EXECUTE EXISTS EXPLAIN
686 : : EXPRESSION EXTENSION EXTERNAL EXTRACT
687 : : FALSE_P FAMILY FETCH FILTER FINALIZE FIRST_P FLOAT_P FOLLOWING FOR
688 : : FORCE FOREIGN FORMAT FORWARD FREEZE FROM FULL FUNCTION FUNCTIONS
689 : : GENERATED GLOBAL GRANT GRANTED GREATEST GROUP_P GROUPING GROUPS
690 : : HANDLER HAVING HEADER_P HOLD HOUR_P
691 : : IDENTITY_P IF_P IGNORE_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IMPORT_P IN_P INCLUDE
692 : : INCLUDING INCREMENT INDENT INDEX INDEXES INHERIT INHERITS INITIALLY INLINE_P
693 : : INNER_P INOUT INPUT_P INSENSITIVE INSERT INSTEAD INT_P INTEGER
694 : : INTERSECT INTERVAL INTO INVOKER IS ISNULL ISOLATION
695 : : JOIN JSON JSON_ARRAY JSON_ARRAYAGG JSON_EXISTS JSON_OBJECT JSON_OBJECTAGG
696 : : JSON_QUERY JSON_SCALAR JSON_SERIALIZE JSON_TABLE JSON_VALUE
697 : : KEEP KEY KEYS
698 : : LABEL LANGUAGE LARGE_P LAST_P LATERAL_P
699 : : LEADING LEAKPROOF LEAST LEFT LEVEL LIKE LIMIT LISTEN LOAD LOCAL
700 : : LOCALTIME LOCALTIMESTAMP LOCATION LOCK_P LOCKED LOGGED LSN_P
701 : : MAPPING MATCH MATCHED MATERIALIZED MAXVALUE MERGE MERGE_ACTION METHOD
702 : : MINUTE_P MINVALUE MODE MONTH_P MOVE
703 : : NAME_P NAMES NATIONAL NATURAL NCHAR NESTED NEW NEXT NFC NFD NFKC NFKD NO
704 : : NONE NORMALIZE NORMALIZED
705 : : NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
706 : : NULLS_P NUMERIC
707 : : OBJECT_P OBJECTS_P OF OFF OFFSET OIDS OLD OMIT ON ONLY OPERATOR OPTION OPTIONS OR
708 : : ORDER ORDINALITY OTHERS OUT_P OUTER_P
709 : : OVER OVERLAPS OVERLAY OVERRIDING OWNED OWNER
710 : : PARALLEL PARAMETER PARSER PARTIAL PARTITION PASSING PASSWORD PATH
711 : : PERIOD PLACING PLAN PLANS POLICY
712 : : POSITION PRECEDING PRECISION PRESERVE PREPARE PREPARED PRIMARY
713 : : PRIOR PRIVILEGES PROCEDURAL PROCEDURE PROCEDURES PROGRAM PUBLICATION
714 : : QUOTE QUOTES
715 : : RANGE READ REAL REASSIGN RECURSIVE REF_P REFERENCES REFERENCING
716 : : REFRESH REINDEX RELATIVE_P RELEASE RENAME REPACK REPEATABLE REPLACE REPLICA
717 : : RESET RESPECT_P RESTART RESTRICT RETURN RETURNING RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
718 : : ROUTINE ROUTINES ROW ROWS RULE
719 : : SAVEPOINT SCALAR SCHEMA SCHEMAS SCROLL SEARCH SECOND_P SECURITY SELECT
720 : : SEQUENCE SEQUENCES
721 : : SERIALIZABLE SERVER SESSION SESSION_USER SET SETS SETOF SHARE SHOW
722 : : SIMILAR SIMPLE SKIP SMALLINT SNAPSHOT SOME SOURCE SQL_P STABLE STANDALONE_P
723 : : START STATEMENT STATISTICS STDIN STDOUT STORAGE STORED STRICT_P STRING_P STRIP_P
724 : : SUBSCRIPTION SUBSTRING SUPPORT SYMMETRIC SYSID SYSTEM_P SYSTEM_USER
725 : : TABLE TABLES TABLESAMPLE TABLESPACE TARGET TEMP TEMPLATE TEMPORARY TEXT_P THEN
726 : : TIES TIME TIMESTAMP TO TRAILING TRANSACTION TRANSFORM
727 : : TREAT TRIGGER TRIM TRUE_P
728 : : TRUNCATE TRUSTED TYPE_P TYPES_P
729 : : UESCAPE UNBOUNDED UNCONDITIONAL UNCOMMITTED UNENCRYPTED UNION UNIQUE UNKNOWN
730 : : UNLISTEN UNLOGGED UNTIL UPDATE USER USING
731 : : VACUUM VALID VALIDATE VALIDATOR VALUE_P VALUES VARCHAR VARIADIC VARYING
732 : : VERBOSE VERSION_P VIEW VIEWS VIRTUAL VOLATILE
733 : : WAIT WHEN WHERE WHITESPACE_P WINDOW WITH WITHIN WITHOUT WORK WRAPPER WRITE
734 : : XML_P XMLATTRIBUTES XMLCONCAT XMLELEMENT XMLEXISTS XMLFOREST XMLNAMESPACES
735 : : XMLPARSE XMLPI XMLROOT XMLSERIALIZE XMLTABLE
736 : : YEAR_P YES_P
737 : : ZONE
738 : :
739 : :
740 : :
741 : :
742 : :
743 : :
744 : :
745 : :
746 : :
747 : :
748 : :
749 : : %token FORMAT_LA NOT_LA NULLS_LA WITH_LA WITHOUT_LA
750 : :
751 : :
752 : :
753 : :
754 : :
755 : :
756 : :
757 : : %token MODE_TYPE_NAME
758 : : %token MODE_PLPGSQL_EXPR
759 : : %token MODE_PLPGSQL_ASSIGN1
760 : : %token MODE_PLPGSQL_ASSIGN2
761 : : %token MODE_PLPGSQL_ASSIGN3
762 : :
763 : : %left UNION EXCEPT
764 : : %left INTERSECT
765 : : %left OR
766 : : %left AND
767 : : %right NOT
768 : : %nonassoc IS ISNULL NOTNULL
769 : : %nonassoc '<' '>' '=' LESS_EQUALS GREATER_EQUALS NOT_EQUALS
770 : : %nonassoc BETWEEN IN_P LIKE ILIKE SIMILAR NOT_LA
771 : : %nonassoc ESCAPE
772 : :
773 : :
774 : :
775 : :
776 : :
777 : :
778 : :
779 : :
780 : :
781 : :
782 : :
783 : :
784 : :
785 : :
786 : :
787 : :
788 : :
789 : :
790 : :
791 : :
792 : :
793 : :
794 : :
795 : :
796 : :
797 : :
798 : :
799 : :
800 : :
801 : :
802 : :
803 : :
804 : :
805 : :
806 : :
807 : :
808 : :
809 : :
810 : :
811 : :
812 : :
813 : :
814 : :
815 : :
816 : :
817 : :
818 : : %nonassoc UNBOUNDED NESTED
819 : : %nonassoc IDENT CSTRING PARTITION RANGE ROWS GROUPS PRECEDING FOLLOWING CUBE ROLLUP
820 : : SET KEYS OBJECT_P SCALAR VALUE_P WITH WITHOUT PATH
821 : : %left Op OPERATOR
822 : : %left '+' '-'
823 : : %left '*' '/' '%'
824 : : %left '^'
825 : :
826 : : %left AT
827 : : %left COLLATE
828 : : %right UMINUS
829 : : %left '[' ']'
830 : : %left '(' ')'
831 : : %left TYPECAST
832 : : %left '.'
833 : :
834 : :
835 : :
836 : :
837 : :
838 : :
839 : :
840 : : %left JOIN CROSS LEFT FULL RIGHT INNER_P NATURAL
841 : : %%
842 : : prog: statements;
843 : : /* rules */
844 : : toplevel_stmt:
845 : : stmt
846 : : | TransactionStmtLegacy
847 : : {
848 [ + + ]: 8 : fprintf(base_yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", @1);
849 : 8 : whenever_action(2);
850 : : }
851 : : ;
852 : :
853 : :
854 : : stmt:
855 : : AlterEventTrigStmt
856 : 0 : { output_statement(@1, 0, ECPGst_normal); }
857 : : | AlterCollationStmt
858 : 0 : { output_statement(@1, 0, ECPGst_normal); }
859 : : | AlterDatabaseStmt
860 : 0 : { output_statement(@1, 0, ECPGst_normal); }
861 : : | AlterDatabaseSetStmt
862 : 0 : { output_statement(@1, 0, ECPGst_normal); }
863 : : | AlterDefaultPrivilegesStmt
864 : 0 : { output_statement(@1, 0, ECPGst_normal); }
865 : : | AlterDomainStmt
866 : 0 : { output_statement(@1, 0, ECPGst_normal); }
867 : : | AlterEnumStmt
868 : 0 : { output_statement(@1, 0, ECPGst_normal); }
869 : : | AlterExtensionStmt
870 : 0 : { output_statement(@1, 0, ECPGst_normal); }
871 : : | AlterExtensionContentsStmt
872 : 0 : { output_statement(@1, 0, ECPGst_normal); }
873 : : | AlterFdwStmt
874 : 0 : { output_statement(@1, 0, ECPGst_normal); }
875 : : | AlterForeignServerStmt
876 : 0 : { output_statement(@1, 0, ECPGst_normal); }
877 : : | AlterFunctionStmt
878 : 0 : { output_statement(@1, 0, ECPGst_normal); }
879 : : | AlterGroupStmt
880 : 0 : { output_statement(@1, 0, ECPGst_normal); }
881 : : | AlterObjectDependsStmt
882 : 0 : { output_statement(@1, 0, ECPGst_normal); }
883 : : | AlterObjectSchemaStmt
884 : 0 : { output_statement(@1, 0, ECPGst_normal); }
885 : : | AlterOwnerStmt
886 : 0 : { output_statement(@1, 0, ECPGst_normal); }
887 : : | AlterOperatorStmt
888 : 0 : { output_statement(@1, 0, ECPGst_normal); }
889 : : | AlterTypeStmt
890 : 0 : { output_statement(@1, 0, ECPGst_normal); }
891 : : | AlterPolicyStmt
892 : 0 : { output_statement(@1, 0, ECPGst_normal); }
893 : : | AlterSeqStmt
894 : 0 : { output_statement(@1, 0, ECPGst_normal); }
895 : : | AlterSystemStmt
896 : 0 : { output_statement(@1, 0, ECPGst_normal); }
897 : : | AlterTableStmt
898 : 2 : { output_statement(@1, 0, ECPGst_normal); }
899 : : | AlterTblSpcStmt
900 : 0 : { output_statement(@1, 0, ECPGst_normal); }
901 : : | AlterCompositeTypeStmt
902 : 0 : { output_statement(@1, 0, ECPGst_normal); }
903 : : | AlterPublicationStmt
904 : 0 : { output_statement(@1, 0, ECPGst_normal); }
905 : : | AlterRoleSetStmt
906 : 0 : { output_statement(@1, 0, ECPGst_normal); }
907 : : | AlterRoleStmt
908 : 3 : { output_statement(@1, 0, ECPGst_normal); }
909 : : | AlterSubscriptionStmt
910 : 0 : { output_statement(@1, 0, ECPGst_normal); }
911 : : | AlterStatsStmt
912 : 0 : { output_statement(@1, 0, ECPGst_normal); }
913 : : | AlterTSConfigurationStmt
914 : 0 : { output_statement(@1, 0, ECPGst_normal); }
915 : : | AlterTSDictionaryStmt
916 : 0 : { output_statement(@1, 0, ECPGst_normal); }
917 : : | AlterUserMappingStmt
918 : 0 : { output_statement(@1, 0, ECPGst_normal); }
919 : : | AnalyzeStmt
920 : 0 : { output_statement(@1, 0, ECPGst_normal); }
921 : : | CallStmt
922 : 0 : { output_statement(@1, 0, ECPGst_normal); }
923 : : | CheckPointStmt
924 : 0 : { output_statement(@1, 0, ECPGst_normal); }
925 : : | ClosePortalStmt
926 : : {
927 [ + + - + ]: 39 : if (INFORMIX_MODE)
928 : : {
929 [ + + ]: 5 : if (pg_strcasecmp(@1 + strlen("close "), "database") == 0)
930 : : {
931 [ + + ]: 3 : if (connection)
932 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CLOSE DATABASE statement");
933 : :
934 : 3 : fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, \"CURRENT\");");
935 : 3 : whenever_action(2);
936 : 3 : break;
937 : : }
938 : : }
939 : :
940 : 36 : output_statement(@1, 0, ECPGst_normal);
941 : : }
942 : : | CommentStmt
943 : 0 : { output_statement(@1, 0, ECPGst_normal); }
944 : : | ConstraintsSetStmt
945 : 0 : { output_statement(@1, 0, ECPGst_normal); }
946 : : | CopyStmt
947 : 2 : { output_statement(@1, 0, ECPGst_normal); }
948 : : | CreateAmStmt
949 : 0 : { output_statement(@1, 0, ECPGst_normal); }
950 : : | CreateAsStmt
951 : 2 : { output_statement(@1, 0, ECPGst_normal); }
952 : : | CreateAssertionStmt
953 : 0 : { output_statement(@1, 0, ECPGst_normal); }
954 : : | CreateCastStmt
955 : 0 : { output_statement(@1, 0, ECPGst_normal); }
956 : : | CreateConversionStmt
957 : 0 : { output_statement(@1, 0, ECPGst_normal); }
958 : : | CreateDomainStmt
959 : 0 : { output_statement(@1, 0, ECPGst_normal); }
960 : : | CreateExtensionStmt
961 : 0 : { output_statement(@1, 0, ECPGst_normal); }
962 : : | CreateFdwStmt
963 : 0 : { output_statement(@1, 0, ECPGst_normal); }
964 : : | CreateForeignServerStmt
965 : 0 : { output_statement(@1, 0, ECPGst_normal); }
966 : : | CreateForeignTableStmt
967 : 0 : { output_statement(@1, 0, ECPGst_normal); }
968 : : | CreateFunctionStmt
969 : 1 : { output_statement(@1, 0, ECPGst_normal); }
970 : : | CreateGroupStmt
971 : 0 : { output_statement(@1, 0, ECPGst_normal); }
972 : : | CreateMatViewStmt
973 : 0 : { output_statement(@1, 0, ECPGst_normal); }
974 : : | CreateOpClassStmt
975 : 0 : { output_statement(@1, 0, ECPGst_normal); }
976 : : | CreateOpFamilyStmt
977 : 0 : { output_statement(@1, 0, ECPGst_normal); }
978 : : | CreatePublicationStmt
979 : 0 : { output_statement(@1, 0, ECPGst_normal); }
980 : : | AlterOpFamilyStmt
981 : 0 : { output_statement(@1, 0, ECPGst_normal); }
982 : : | CreatePolicyStmt
983 : 0 : { output_statement(@1, 0, ECPGst_normal); }
984 : : | CreatePLangStmt
985 : 0 : { output_statement(@1, 0, ECPGst_normal); }
986 : : | CreateSchemaStmt
987 : 0 : { output_statement(@1, 0, ECPGst_normal); }
988 : : | CreateSeqStmt
989 : 0 : { output_statement(@1, 0, ECPGst_normal); }
990 : : | CreateStmt
991 : 51 : { output_statement(@1, 0, ECPGst_normal); }
992 : : | CreateSubscriptionStmt
993 : 0 : { output_statement(@1, 0, ECPGst_normal); }
994 : : | CreateStatsStmt
995 : 0 : { output_statement(@1, 0, ECPGst_normal); }
996 : : | CreateTableSpaceStmt
997 : 0 : { output_statement(@1, 0, ECPGst_normal); }
998 : : | CreateTransformStmt
999 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1000 : : | CreateTrigStmt
1001 : 1 : { output_statement(@1, 0, ECPGst_normal); }
1002 : : | CreateEventTrigStmt
1003 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1004 : : | CreateRoleStmt
1005 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1006 : : | CreateUserStmt
1007 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1008 : : | CreateUserMappingStmt
1009 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1010 : : | CreatedbStmt
1011 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1012 : : | DeallocateStmt
1013 : : {
1014 : 40 : output_deallocate_prepare_statement(@1);
1015 : : }
1016 : : | DeclareCursorStmt
1017 : : {
1018 [ + + ]: 21 : output_simple_statement(@1, (strncmp(@1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0);
1019 : : }
1020 : : | DefineStmt
1021 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1022 : : | DeleteStmt
1023 : 2 : { output_statement(@1, 1, ECPGst_prepnormal); }
1024 : : | DiscardStmt
1025 : 0 : { output_statement(@1, 1, ECPGst_normal); }
1026 : : | DoStmt
1027 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1028 : : | DropCastStmt
1029 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1030 : : | DropOpClassStmt
1031 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1032 : : | DropOpFamilyStmt
1033 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1034 : : | DropOwnedStmt
1035 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1036 : : | DropStmt
1037 : 38 : { output_statement(@1, 0, ECPGst_normal); }
1038 : : | DropSubscriptionStmt
1039 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1040 : : | DropTableSpaceStmt
1041 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1042 : : | DropTransformStmt
1043 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1044 : : | DropRoleStmt
1045 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1046 : : | DropUserMappingStmt
1047 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1048 : : | DropdbStmt
1049 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1050 : : | ExecuteStmt
1051 : : {
1052 : 34 : check_declared_list($1.name);
1053 [ + - + + ]: 34 : if ($1.type == NULL || strlen($1.type) == 0)
1054 : 25 : output_statement($1.name, 1, ECPGst_execute);
1055 : : else
1056 : : {
1057 [ + + ]: 9 : if ($1.name[0] != '"')
1058 : : /* case of char_variable */
1059 : 4 : add_variable_to_tail(&argsinsert, find_variable($1.name), &no_indicator);
1060 : : else
1061 : : {
1062 : : /* case of ecpg_ident or CSTRING */
1063 : : char length[32];
1064 : : char *str;
1065 : :
1066 : : /* Remove double quotes from name */
1067 : 5 : str = loc_strdup($1.name + 1);
1068 : 5 : str[strlen(str) - 1] = '\0';
1069 : 5 : snprintf(length, sizeof(length), "%zu", strlen(str));
1070 : 5 : add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
1071 : : }
1072 : 9 : output_statement(cat_str(3, "execute", "$0", $1.type), 0, ECPGst_exec_with_exprlist);
1073 : : }
1074 : : }
1075 : : | ExplainStmt
1076 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1077 : : | FetchStmt
1078 : 63 : { output_statement(@1, 1, ECPGst_normal); }
1079 : : | GrantStmt
1080 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1081 : : | GrantRoleStmt
1082 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1083 : : | ImportForeignSchemaStmt
1084 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1085 : : | IndexStmt
1086 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1087 : : | InsertStmt
1088 : 111 : { output_statement(@1, 1, ECPGst_prepnormal); }
1089 : : | ListenStmt
1090 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1091 : : | RefreshMatViewStmt
1092 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1093 : : | LoadStmt
1094 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1095 : : | LockStmt
1096 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1097 : : | MergeStmt
1098 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1099 : : | NotifyStmt
1100 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1101 : : | PrepareStmt
1102 : : {
1103 : 55 : check_declared_list($1.name);
1104 [ + + ]: 55 : if ($1.type == NULL)
1105 : 49 : output_prepare_statement($1.name, $1.stmt);
1106 [ + + ]: 6 : else if (strlen($1.type) == 0)
1107 : : {
1108 : 1 : char *stmt = cat_str(3, "\"", $1.stmt, "\"");
1109 : :
1110 : 1 : output_prepare_statement($1.name, stmt);
1111 : : }
1112 : : else
1113 : : {
1114 [ + + ]: 5 : if ($1.name[0] != '"')
1115 : : /* case of char_variable */
1116 : 2 : add_variable_to_tail(&argsinsert, find_variable($1.name), &no_indicator);
1117 : : else
1118 : : {
1119 : : char length[32];
1120 : : char *str;
1121 : :
1122 : : /* Remove double quotes from name */
1123 : 3 : str = loc_strdup($1.name + 1);
1124 : 3 : str[strlen(str) - 1] = '\0';
1125 : 3 : snprintf(length, sizeof(length), "%zu", strlen(str));
1126 : 3 : add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
1127 : : }
1128 : 5 : output_statement(cat_str(5, "prepare", "$0", $1.type, "as", $1.stmt), 0, ECPGst_prepare);
1129 : : }
1130 : : }
1131 : : | ReassignOwnedStmt
1132 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1133 : : | ReindexStmt
1134 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1135 : : | RemoveAggrStmt
1136 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1137 : : | RemoveFuncStmt
1138 : 1 : { output_statement(@1, 0, ECPGst_normal); }
1139 : : | RemoveOperStmt
1140 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1141 : : | RenameStmt
1142 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1143 : : | RepackStmt
1144 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1145 : : | RevokeStmt
1146 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1147 : : | RevokeRoleStmt
1148 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1149 : : | RuleStmt
1150 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1151 : : | SecLabelStmt
1152 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1153 : : | SelectStmt
1154 : 104 : { output_statement(@1, 1, ECPGst_prepnormal); }
1155 : : | TransactionStmt
1156 : : {
1157 [ + + ]: 80 : fprintf(base_yyout, "{ ECPGtrans(__LINE__, %s, \"%s\");", connection ? connection : "NULL", @1);
1158 : 80 : whenever_action(2);
1159 : : }
1160 : : | TruncateStmt
1161 : 22 : { output_statement(@1, 0, ECPGst_normal); }
1162 : : | UnlistenStmt
1163 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1164 : : | UpdateStmt
1165 : 5 : { output_statement(@1, 1, ECPGst_prepnormal); }
1166 : : | VacuumStmt
1167 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1168 : : | VariableResetStmt
1169 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1170 : : | VariableSetStmt
1171 : 22 : { output_statement(@1, 0, ECPGst_normal); }
1172 : : | VariableShowStmt
1173 : 7 : { output_statement(@1, 0, ECPGst_normal); }
1174 : : | ViewStmt
1175 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1176 : : | ECPGAllocateDescr
1177 : : {
1178 : 20 : fprintf(base_yyout, "ECPGallocate_desc(__LINE__, %s);", @1);
1179 : 20 : whenever_action(0);
1180 : : }
1181 : : | ECPGConnect
1182 : : {
1183 [ + + ]: 97 : if (connection)
1184 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CONNECT statement");
1185 : :
1186 : 97 : fprintf(base_yyout, "{ ECPGconnect(__LINE__, %d, %s, %d); ", compat, @1, autocommit);
1187 : 97 : reset_variables();
1188 : 97 : whenever_action(2);
1189 : : }
1190 : : | ECPGDeclareStmt
1191 : : {
1192 : 5 : output_simple_statement(@1, 0);
1193 : : }
1194 : : | ECPGCursorStmt
1195 : : {
1196 [ + + ]: 21 : output_simple_statement(@1, (strncmp(@1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0);
1197 : : }
1198 : : | ECPGDeallocateDescr
1199 : : {
1200 : 16 : fprintf(base_yyout, "ECPGdeallocate_desc(__LINE__, %s);", @1);
1201 : 16 : whenever_action(0);
1202 : : }
1203 : : | ECPGDeclare
1204 : : {
1205 : 0 : output_simple_statement(@1, 0);
1206 : : }
1207 : : | ECPGDescribe
1208 : : {
1209 : 21 : check_declared_list($1.stmt_name);
1210 : :
1211 [ + + ]: 21 : fprintf(base_yyout, "{ ECPGdescribe(__LINE__, %d, %d, %s, %s,", compat, $1.input, connection ? connection : "NULL", $1.stmt_name);
1212 : 21 : dump_variables(argsresult, 1);
1213 : 21 : argsresult = NULL;
1214 : 21 : fputs("ECPGt_EORT);", base_yyout);
1215 : 21 : fprintf(base_yyout, "}");
1216 : 21 : output_line_number();
1217 : : }
1218 : : | ECPGDisconnect
1219 : : {
1220 [ + + ]: 88 : if (connection)
1221 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DISCONNECT statement");
1222 : :
1223 : 88 : fprintf(base_yyout, "{ ECPGdisconnect(__LINE__, %s);",
1224 [ + - ]: 88 : @1 ? @1 : "\"CURRENT\"");
1225 : 88 : whenever_action(2);
1226 : : }
1227 : : | ECPGExecuteImmediateStmt
1228 : : {
1229 : 7 : output_statement(@1, 0, ECPGst_exec_immediate);
1230 : : }
1231 : : | ECPGFree
1232 : : {
1233 [ - + ]: 1 : const char *con = connection ? connection : "NULL";
1234 : :
1235 [ - + ]: 1 : if (strcmp(@1, "all") == 0)
1236 : 0 : fprintf(base_yyout, "{ ECPGdeallocate_all(__LINE__, %d, %s);", compat, con);
1237 [ - + ]: 1 : else if (@1[0] == ':')
1238 : 0 : fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, %s);", compat, con, @1 + 1);
1239 : : else
1240 : 1 : fprintf(base_yyout, "{ ECPGdeallocate(__LINE__, %d, %s, \"%s\");", compat, con, @1);
1241 : :
1242 : 1 : whenever_action(2);
1243 : : }
1244 : : | ECPGGetDescriptor
1245 : : {
1246 : 32 : lookup_descriptor($1.name, connection);
1247 : 32 : output_get_descr($1.name, $1.str);
1248 : : }
1249 : : | ECPGGetDescriptorHeader
1250 : : {
1251 : 11 : lookup_descriptor(@1, connection);
1252 : 11 : output_get_descr_header(@1);
1253 : : }
1254 : : | ECPGOpen
1255 : : {
1256 : : struct cursor *ptr;
1257 : :
1258 [ + - ]: 39 : if ((ptr = add_additional_variables(@1, true)) != NULL)
1259 : : {
1260 : 39 : free(connection);
1261 [ + + ]: 39 : connection = ptr->connection ? mm_strdup(ptr->connection) : NULL;
1262 : 39 : output_statement(ptr->command, 0, ECPGst_normal);
1263 : 39 : ptr->opened = true;
1264 : : }
1265 : : }
1266 : : | ECPGSetAutocommit
1267 : : {
1268 [ - + ]: 13 : fprintf(base_yyout, "{ ECPGsetcommit(__LINE__, \"%s\", %s);", @1, connection ? connection : "NULL");
1269 : 13 : whenever_action(2);
1270 : : }
1271 : : | ECPGSetConnection
1272 : : {
1273 [ + + ]: 3 : if (connection)
1274 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in SET CONNECTION statement");
1275 : :
1276 : 3 : fprintf(base_yyout, "{ ECPGsetconn(__LINE__, %s);", @1);
1277 : 3 : whenever_action(2);
1278 : : }
1279 : : | ECPGSetDescriptor
1280 : : {
1281 : 13 : lookup_descriptor($1.name, connection);
1282 : 13 : output_set_descr($1.name, $1.str);
1283 : : }
1284 : : | ECPGSetDescriptorHeader
1285 : : {
1286 : 1 : lookup_descriptor(@1, connection);
1287 : 1 : output_set_descr_header(@1);
1288 : : }
1289 : : | ECPGTypedef
1290 : : {
1291 [ + + ]: 16 : if (connection)
1292 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in TYPE statement");
1293 : :
1294 : 16 : fprintf(base_yyout, "%s", @1);
1295 : 16 : output_line_number();
1296 : : }
1297 : : | ECPGVar
1298 : : {
1299 [ + + ]: 3 : if (connection)
1300 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in VAR statement");
1301 : :
1302 : 3 : output_simple_statement(@1, 0);
1303 : : }
1304 : : | ECPGWhenever
1305 : : {
1306 [ + + ]: 101 : if (connection)
1307 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in WHENEVER statement");
1308 : :
1309 : 101 : output_simple_statement(@1, 0);
1310 : : }
1311 : : | WaitStmt
1312 : 0 : { output_statement(@1, 0, ECPGst_normal); }
1313 : : |
1314 : : ;
1315 : :
1316 : :
1317 : : opt_single_name:
1318 : : ColId
1319 : : |
1320 : : ;
1321 : :
1322 : :
1323 : : opt_qualified_name:
1324 : : any_name
1325 : : |
1326 : : ;
1327 : :
1328 : :
1329 : : opt_concurrently:
1330 : : CONCURRENTLY
1331 : : |
1332 : : ;
1333 : :
1334 : :
1335 : : opt_usingindex:
1336 : : USING INDEX
1337 : : |
1338 : : ;
1339 : :
1340 : :
1341 : : opt_drop_behavior:
1342 : : CASCADE
1343 : : | RESTRICT
1344 : : |
1345 : : ;
1346 : :
1347 : :
1348 : : opt_utility_option_list:
1349 : : '(' utility_option_list ')'
1350 : : |
1351 : : ;
1352 : :
1353 : :
1354 : : utility_option_list:
1355 : : utility_option_elem
1356 : : | utility_option_list ',' utility_option_elem
1357 : : ;
1358 : :
1359 : :
1360 : : utility_option_elem:
1361 : : utility_option_name utility_option_arg
1362 : : ;
1363 : :
1364 : :
1365 : : utility_option_name:
1366 : : NonReservedWord
1367 : : | analyze_keyword
1368 : : | FORMAT_LA
1369 : : ;
1370 : :
1371 : :
1372 : : utility_option_arg:
1373 : : opt_boolean_or_string
1374 : : | NumericOnly
1375 : : |
1376 : : ;
1377 : :
1378 : :
1379 : : CallStmt:
1380 : : CALL func_application
1381 : : ;
1382 : :
1383 : :
1384 : : CreateRoleStmt:
1385 : : CREATE ROLE RoleId opt_with OptRoleList
1386 : : ;
1387 : :
1388 : :
1389 : : opt_with:
1390 : : WITH
1391 : : | WITH_LA
1392 : : |
1393 : : ;
1394 : :
1395 : :
1396 : : OptRoleList:
1397 : : OptRoleList CreateOptRoleElem
1398 : : |
1399 : : ;
1400 : :
1401 : :
1402 : : AlterOptRoleList:
1403 : : AlterOptRoleList AlterOptRoleElem
1404 : : |
1405 : : ;
1406 : :
1407 : :
1408 : : AlterOptRoleElem:
1409 : : PASSWORD ecpg_sconst
1410 : : | PASSWORD NULL_P
1411 : : | ENCRYPTED PASSWORD ecpg_sconst
1412 : : | UNENCRYPTED PASSWORD ecpg_sconst
1413 : : {
1414 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
1415 : : }
1416 : : | INHERIT
1417 : : | CONNECTION LIMIT SignedIconst
1418 : : | VALID UNTIL ecpg_sconst
1419 : : | USER role_list
1420 : : | ecpg_ident
1421 : : ;
1422 : :
1423 : :
1424 : : CreateOptRoleElem:
1425 : : AlterOptRoleElem
1426 : : | SYSID Iconst
1427 : : | ADMIN role_list
1428 : : | ROLE role_list
1429 : : | IN_P ROLE role_list
1430 : : | IN_P GROUP_P role_list
1431 : : ;
1432 : :
1433 : :
1434 : : CreateUserStmt:
1435 : : CREATE USER RoleId opt_with OptRoleList
1436 : : ;
1437 : :
1438 : :
1439 : : AlterRoleStmt:
1440 : : ALTER ROLE RoleSpec opt_with AlterOptRoleList
1441 : : | ALTER USER RoleSpec opt_with AlterOptRoleList
1442 : : ;
1443 : :
1444 : :
1445 : : opt_in_database:
1446 : :
1447 : : | IN_P DATABASE name
1448 : : ;
1449 : :
1450 : :
1451 : : AlterRoleSetStmt:
1452 : : ALTER ROLE RoleSpec opt_in_database SetResetClause
1453 : : | ALTER ROLE ALL opt_in_database SetResetClause
1454 : : | ALTER USER RoleSpec opt_in_database SetResetClause
1455 : : | ALTER USER ALL opt_in_database SetResetClause
1456 : : ;
1457 : :
1458 : :
1459 : : DropRoleStmt:
1460 : : DROP ROLE role_list
1461 : : | DROP ROLE IF_P EXISTS role_list
1462 : : | DROP USER role_list
1463 : : | DROP USER IF_P EXISTS role_list
1464 : : | DROP GROUP_P role_list
1465 : : | DROP GROUP_P IF_P EXISTS role_list
1466 : : ;
1467 : :
1468 : :
1469 : : CreateGroupStmt:
1470 : : CREATE GROUP_P RoleId opt_with OptRoleList
1471 : : ;
1472 : :
1473 : :
1474 : : AlterGroupStmt:
1475 : : ALTER GROUP_P RoleSpec add_drop USER role_list
1476 : : ;
1477 : :
1478 : :
1479 : : add_drop:
1480 : : ADD_P
1481 : : | DROP
1482 : : ;
1483 : :
1484 : :
1485 : : CreateSchemaStmt:
1486 : : CREATE SCHEMA opt_single_name AUTHORIZATION RoleSpec OptSchemaEltList
1487 : : | CREATE SCHEMA ColId OptSchemaEltList
1488 : : | CREATE SCHEMA IF_P NOT EXISTS opt_single_name AUTHORIZATION RoleSpec OptSchemaEltList
1489 : : | CREATE SCHEMA IF_P NOT EXISTS ColId OptSchemaEltList
1490 : : ;
1491 : :
1492 : :
1493 : : OptSchemaEltList:
1494 : : OptSchemaEltList schema_stmt
1495 : : |
1496 : : ;
1497 : :
1498 : :
1499 : : schema_stmt:
1500 : : CreateStmt
1501 : : | IndexStmt
1502 : : | CreateSeqStmt
1503 : : | CreateTrigStmt
1504 : : | GrantStmt
1505 : : | ViewStmt
1506 : : ;
1507 : :
1508 : :
1509 : : VariableSetStmt:
1510 : : SET set_rest
1511 : : | SET LOCAL set_rest
1512 : : | SET SESSION set_rest
1513 : : ;
1514 : :
1515 : :
1516 : : set_rest:
1517 : : TRANSACTION transaction_mode_list
1518 : : | SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list
1519 : : | set_rest_more
1520 : : ;
1521 : :
1522 : :
1523 : : generic_set:
1524 : : var_name TO var_list
1525 : : | var_name '=' var_list
1526 : : | var_name TO NULL_P
1527 : : | var_name '=' NULL_P
1528 : : | var_name TO DEFAULT
1529 : : | var_name '=' DEFAULT
1530 : : ;
1531 : :
1532 : :
1533 : : set_rest_more:
1534 : : generic_set
1535 : : | var_name FROM CURRENT_P
1536 : : | TIME ZONE zone_value
1537 : : | CATALOG_P ecpg_sconst
1538 : : {
1539 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
1540 : : }
1541 : : | SCHEMA ecpg_sconst
1542 : : | NAMES opt_encoding
1543 : : | ROLE NonReservedWord_or_Sconst
1544 : : | SESSION AUTHORIZATION NonReservedWord_or_Sconst
1545 : : | SESSION AUTHORIZATION DEFAULT
1546 : : | XML_P OPTION document_or_content
1547 : : | TRANSACTION SNAPSHOT ecpg_sconst
1548 : : ;
1549 : :
1550 : :
1551 : : var_name:
1552 : : ECPGColId
1553 : : | var_name '.' ColId
1554 : : ;
1555 : :
1556 : :
1557 : : var_list:
1558 : : var_value
1559 : : | var_list ',' var_value
1560 : : ;
1561 : :
1562 : :
1563 : : var_value:
1564 : : opt_boolean_or_string
1565 : : | NumericOnly
1566 : : {
1567 [ + - ]: 1 : if (@1[0] == '$')
1568 : 1 : @$ = "$0";
1569 : : }
1570 : : ;
1571 : :
1572 : :
1573 : : iso_level:
1574 : : READ UNCOMMITTED
1575 : : | READ COMMITTED
1576 : : | REPEATABLE READ
1577 : : | SERIALIZABLE
1578 : : ;
1579 : :
1580 : :
1581 : : opt_boolean_or_string:
1582 : : TRUE_P
1583 : : | FALSE_P
1584 : : | ON
1585 : : | NonReservedWord_or_Sconst
1586 : : ;
1587 : :
1588 : :
1589 : : zone_value:
1590 : : ecpg_sconst
1591 : : | ecpg_ident
1592 : : | ConstInterval ecpg_sconst opt_interval
1593 : : | ConstInterval '(' Iconst ')' ecpg_sconst
1594 : : | NumericOnly
1595 : : | DEFAULT
1596 : : | LOCAL
1597 : : ;
1598 : :
1599 : :
1600 : : opt_encoding:
1601 : : ecpg_sconst
1602 : : | DEFAULT
1603 : : |
1604 : : ;
1605 : :
1606 : :
1607 : : NonReservedWord_or_Sconst:
1608 : : NonReservedWord
1609 : : | ecpg_sconst
1610 : : ;
1611 : :
1612 : :
1613 : : VariableResetStmt:
1614 : : RESET reset_rest
1615 : : ;
1616 : :
1617 : :
1618 : : reset_rest:
1619 : : generic_reset
1620 : : | TIME ZONE
1621 : : | TRANSACTION ISOLATION LEVEL
1622 : : | SESSION AUTHORIZATION
1623 : : ;
1624 : :
1625 : :
1626 : : generic_reset:
1627 : : var_name
1628 : : | ALL
1629 : : ;
1630 : :
1631 : :
1632 : : SetResetClause:
1633 : : SET set_rest
1634 : : | VariableResetStmt
1635 : : ;
1636 : :
1637 : :
1638 : : FunctionSetResetClause:
1639 : : SET set_rest_more
1640 : : | VariableResetStmt
1641 : : ;
1642 : :
1643 : :
1644 : : VariableShowStmt:
1645 : : SHOW var_name ecpg_into
1646 : : | SHOW TIME ZONE ecpg_into
1647 : : | SHOW TRANSACTION ISOLATION LEVEL ecpg_into
1648 : : | SHOW SESSION AUTHORIZATION ecpg_into
1649 : : | SHOW ALL
1650 : : {
1651 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL is not implemented");
1652 : : }
1653 : : ;
1654 : :
1655 : :
1656 : : ConstraintsSetStmt:
1657 : : SET CONSTRAINTS constraints_set_list constraints_set_mode
1658 : : ;
1659 : :
1660 : :
1661 : : constraints_set_list:
1662 : : ALL
1663 : : | qualified_name_list
1664 : : ;
1665 : :
1666 : :
1667 : : constraints_set_mode:
1668 : : DEFERRED
1669 : : | IMMEDIATE
1670 : : ;
1671 : :
1672 : :
1673 : : CheckPointStmt:
1674 : : CHECKPOINT opt_utility_option_list
1675 : : ;
1676 : :
1677 : :
1678 : : DiscardStmt:
1679 : : DISCARD ALL
1680 : : | DISCARD TEMP
1681 : : | DISCARD TEMPORARY
1682 : : | DISCARD PLANS
1683 : : | DISCARD SEQUENCES
1684 : : ;
1685 : :
1686 : :
1687 : : AlterTableStmt:
1688 : : ALTER TABLE relation_expr alter_table_cmds
1689 : : | ALTER TABLE IF_P EXISTS relation_expr alter_table_cmds
1690 : : | ALTER TABLE relation_expr partition_cmd
1691 : : | ALTER TABLE IF_P EXISTS relation_expr partition_cmd
1692 : : | ALTER TABLE ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
1693 : : | ALTER TABLE ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
1694 : : | ALTER INDEX qualified_name alter_table_cmds
1695 : : | ALTER INDEX IF_P EXISTS qualified_name alter_table_cmds
1696 : : | ALTER INDEX qualified_name index_partition_cmd
1697 : : | ALTER INDEX ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
1698 : : | ALTER INDEX ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
1699 : : | ALTER SEQUENCE qualified_name alter_table_cmds
1700 : : | ALTER SEQUENCE IF_P EXISTS qualified_name alter_table_cmds
1701 : : | ALTER VIEW qualified_name alter_table_cmds
1702 : : | ALTER VIEW IF_P EXISTS qualified_name alter_table_cmds
1703 : : | ALTER MATERIALIZED VIEW qualified_name alter_table_cmds
1704 : : | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name alter_table_cmds
1705 : : | ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name SET TABLESPACE name opt_nowait
1706 : : | ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name OWNED BY role_list SET TABLESPACE name opt_nowait
1707 : : | ALTER FOREIGN TABLE relation_expr alter_table_cmds
1708 : : | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
1709 : : ;
1710 : :
1711 : :
1712 : : alter_table_cmds:
1713 : : alter_table_cmd
1714 : : | alter_table_cmds ',' alter_table_cmd
1715 : : ;
1716 : :
1717 : :
1718 : : partition_cmd:
1719 : : ATTACH PARTITION qualified_name PartitionBoundSpec
1720 : : | DETACH PARTITION qualified_name opt_concurrently
1721 : : | DETACH PARTITION qualified_name FINALIZE
1722 : : ;
1723 : :
1724 : :
1725 : : index_partition_cmd:
1726 : : ATTACH PARTITION qualified_name
1727 : : ;
1728 : :
1729 : :
1730 : : alter_table_cmd:
1731 : : ADD_P columnDef
1732 : : | ADD_P IF_P NOT EXISTS columnDef
1733 : : | ADD_P COLUMN columnDef
1734 : : | ADD_P COLUMN IF_P NOT EXISTS columnDef
1735 : : | ALTER opt_column ColId alter_column_default
1736 : : | ALTER opt_column ColId DROP NOT NULL_P
1737 : : | ALTER opt_column ColId SET NOT NULL_P
1738 : : | ALTER opt_column ColId SET EXPRESSION AS '(' a_expr ')'
1739 : : | ALTER opt_column ColId DROP EXPRESSION
1740 : : | ALTER opt_column ColId DROP EXPRESSION IF_P EXISTS
1741 : : | ALTER opt_column ColId SET STATISTICS set_statistics_value
1742 : : | ALTER opt_column Iconst SET STATISTICS set_statistics_value
1743 : : | ALTER opt_column ColId SET reloptions
1744 : : | ALTER opt_column ColId RESET reloptions
1745 : : | ALTER opt_column ColId SET column_storage
1746 : : | ALTER opt_column ColId SET column_compression
1747 : : | ALTER opt_column ColId ADD_P GENERATED generated_when AS IDENTITY_P OptParenthesizedSeqOptList
1748 : : | ALTER opt_column ColId alter_identity_column_option_list
1749 : : | ALTER opt_column ColId DROP IDENTITY_P
1750 : : | ALTER opt_column ColId DROP IDENTITY_P IF_P EXISTS
1751 : : | DROP opt_column IF_P EXISTS ColId opt_drop_behavior
1752 : : | DROP opt_column ColId opt_drop_behavior
1753 : : | ALTER opt_column ColId opt_set_data TYPE_P Typename opt_collate_clause alter_using
1754 : : | ALTER opt_column ColId alter_generic_options
1755 : : | ADD_P TableConstraint
1756 : : | ALTER CONSTRAINT name ConstraintAttributeSpec
1757 : : | ALTER CONSTRAINT name INHERIT
1758 : : | VALIDATE CONSTRAINT name
1759 : : | DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
1760 : : | DROP CONSTRAINT name opt_drop_behavior
1761 : : | SET WITHOUT OIDS
1762 : : | CLUSTER ON name
1763 : : | SET WITHOUT CLUSTER
1764 : : | SET LOGGED
1765 : : | SET UNLOGGED
1766 : : | ENABLE_P TRIGGER name
1767 : : | ENABLE_P ALWAYS TRIGGER name
1768 : : | ENABLE_P REPLICA TRIGGER name
1769 : : | ENABLE_P TRIGGER ALL
1770 : : | ENABLE_P TRIGGER USER
1771 : : | DISABLE_P TRIGGER name
1772 : : | DISABLE_P TRIGGER ALL
1773 : : | DISABLE_P TRIGGER USER
1774 : : | ENABLE_P RULE name
1775 : : | ENABLE_P ALWAYS RULE name
1776 : : | ENABLE_P REPLICA RULE name
1777 : : | DISABLE_P RULE name
1778 : : | INHERIT qualified_name
1779 : : | NO INHERIT qualified_name
1780 : : | OF any_name
1781 : : | NOT OF
1782 : : | OWNER TO RoleSpec
1783 : : | SET ACCESS METHOD set_access_method_name
1784 : : | SET TABLESPACE name
1785 : : | SET reloptions
1786 : : | RESET reloptions
1787 : : | REPLICA IDENTITY_P replica_identity
1788 : : | ENABLE_P ROW LEVEL SECURITY
1789 : : | DISABLE_P ROW LEVEL SECURITY
1790 : : | FORCE ROW LEVEL SECURITY
1791 : : | NO FORCE ROW LEVEL SECURITY
1792 : : | alter_generic_options
1793 : : ;
1794 : :
1795 : :
1796 : : alter_column_default:
1797 : : SET DEFAULT a_expr
1798 : : | DROP DEFAULT
1799 : : ;
1800 : :
1801 : :
1802 : : opt_collate_clause:
1803 : : COLLATE any_name
1804 : : |
1805 : : ;
1806 : :
1807 : :
1808 : : alter_using:
1809 : : USING a_expr
1810 : : |
1811 : : ;
1812 : :
1813 : :
1814 : : replica_identity:
1815 : : NOTHING
1816 : : | FULL
1817 : : | DEFAULT
1818 : : | USING INDEX name
1819 : : ;
1820 : :
1821 : :
1822 : : reloptions:
1823 : : '(' reloption_list ')'
1824 : : ;
1825 : :
1826 : :
1827 : : opt_reloptions:
1828 : : WITH reloptions
1829 : : |
1830 : : ;
1831 : :
1832 : :
1833 : : reloption_list:
1834 : : reloption_elem
1835 : : | reloption_list ',' reloption_elem
1836 : : ;
1837 : :
1838 : :
1839 : : reloption_elem:
1840 : : ColLabel '=' def_arg
1841 : : | ColLabel
1842 : : | ColLabel '.' ColLabel '=' def_arg
1843 : : | ColLabel '.' ColLabel
1844 : : ;
1845 : :
1846 : :
1847 : : alter_identity_column_option_list:
1848 : : alter_identity_column_option
1849 : : | alter_identity_column_option_list alter_identity_column_option
1850 : : ;
1851 : :
1852 : :
1853 : : alter_identity_column_option:
1854 : : RESTART
1855 : : | RESTART opt_with NumericOnly
1856 : : | SET SeqOptElem
1857 : : | SET GENERATED generated_when
1858 : : ;
1859 : :
1860 : :
1861 : : set_statistics_value:
1862 : : SignedIconst
1863 : : | DEFAULT
1864 : : ;
1865 : :
1866 : :
1867 : : set_access_method_name:
1868 : : ColId
1869 : : | DEFAULT
1870 : : ;
1871 : :
1872 : :
1873 : : PartitionBoundSpec:
1874 : : FOR VALUES WITH '(' hash_partbound ')'
1875 : : | FOR VALUES IN_P '(' expr_list ')'
1876 : : | FOR VALUES FROM '(' expr_list ')' TO '(' expr_list ')'
1877 : : | DEFAULT
1878 : : ;
1879 : :
1880 : :
1881 : : hash_partbound_elem:
1882 : : NonReservedWord Iconst
1883 : : ;
1884 : :
1885 : :
1886 : : hash_partbound:
1887 : : hash_partbound_elem
1888 : : | hash_partbound ',' hash_partbound_elem
1889 : : ;
1890 : :
1891 : :
1892 : : AlterCompositeTypeStmt:
1893 : : ALTER TYPE_P any_name alter_type_cmds
1894 : : ;
1895 : :
1896 : :
1897 : : alter_type_cmds:
1898 : : alter_type_cmd
1899 : : | alter_type_cmds ',' alter_type_cmd
1900 : : ;
1901 : :
1902 : :
1903 : : alter_type_cmd:
1904 : : ADD_P ATTRIBUTE TableFuncElement opt_drop_behavior
1905 : : | DROP ATTRIBUTE IF_P EXISTS ColId opt_drop_behavior
1906 : : | DROP ATTRIBUTE ColId opt_drop_behavior
1907 : : | ALTER ATTRIBUTE ColId opt_set_data TYPE_P Typename opt_collate_clause opt_drop_behavior
1908 : : ;
1909 : :
1910 : :
1911 : : ClosePortalStmt:
1912 : : CLOSE cursor_name
1913 : : {
1914 [ + + ]: 39 : const char *cursor_marker = @2[0] == ':' ? "$0" : @2;
1915 : 39 : struct cursor *ptr = NULL;
1916 : :
1917 [ + + ]: 41 : for (ptr = cur; ptr != NULL; ptr = ptr->next)
1918 : : {
1919 [ + + ]: 38 : if (strcmp(@2, ptr->name) == 0)
1920 : : {
1921 : 36 : update_connection(ptr->connection);
1922 : 36 : break;
1923 : : }
1924 : : }
1925 : 39 : @$ = cat2_str("close", cursor_marker);
1926 : : }
1927 : : | CLOSE ALL
1928 : : ;
1929 : :
1930 : :
1931 : : CopyStmt:
1932 : : COPY opt_binary qualified_name opt_column_list copy_from opt_program copy_file_name copy_delimiter opt_with copy_options where_clause
1933 : : {
1934 [ + + ]: 2 : if (strcmp(@5, "from") == 0 &&
1935 [ - + - - ]: 1 : (strcmp(@7, "stdin") == 0 || strcmp(@7, "stdout") == 0))
1936 : 1 : mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not implemented");
1937 : : }
1938 : : | COPY '(' PreparableStmt ')' TO opt_program copy_file_name opt_with copy_options
1939 : : ;
1940 : :
1941 : :
1942 : : copy_from:
1943 : : FROM
1944 : : | TO
1945 : : ;
1946 : :
1947 : :
1948 : : opt_program:
1949 : : PROGRAM
1950 : : |
1951 : : ;
1952 : :
1953 : :
1954 : : copy_file_name:
1955 : : ecpg_sconst
1956 : : | STDIN
1957 : : | STDOUT
1958 : : ;
1959 : :
1960 : :
1961 : : copy_options:
1962 : : copy_opt_list
1963 : : | '(' copy_generic_opt_list ')'
1964 : : ;
1965 : :
1966 : :
1967 : : copy_opt_list:
1968 : : copy_opt_list copy_opt_item
1969 : : |
1970 : : ;
1971 : :
1972 : :
1973 : : copy_opt_item:
1974 : : BINARY
1975 : : | FREEZE
1976 : : | DELIMITER opt_as ecpg_sconst
1977 : : | NULL_P opt_as ecpg_sconst
1978 : : | CSV
1979 : : | JSON
1980 : : | HEADER_P
1981 : : | QUOTE opt_as ecpg_sconst
1982 : : | ESCAPE opt_as ecpg_sconst
1983 : : | FORCE QUOTE columnList
1984 : : | FORCE QUOTE '*'
1985 : : | FORCE NOT NULL_P columnList
1986 : : | FORCE NOT NULL_P '*'
1987 : : | FORCE NULL_P columnList
1988 : : | FORCE NULL_P '*'
1989 : : | ENCODING ecpg_sconst
1990 : : ;
1991 : :
1992 : :
1993 : : opt_binary:
1994 : : BINARY
1995 : : |
1996 : : ;
1997 : :
1998 : :
1999 : : copy_delimiter:
2000 : : opt_using DELIMITERS ecpg_sconst
2001 : : |
2002 : : ;
2003 : :
2004 : :
2005 : : opt_using:
2006 : : USING
2007 : : |
2008 : : ;
2009 : :
2010 : :
2011 : : copy_generic_opt_list:
2012 : : copy_generic_opt_elem
2013 : : | copy_generic_opt_list ',' copy_generic_opt_elem
2014 : : ;
2015 : :
2016 : :
2017 : : copy_generic_opt_elem:
2018 : : ColLabel copy_generic_opt_arg
2019 : : | FORMAT_LA copy_generic_opt_arg
2020 : : ;
2021 : :
2022 : :
2023 : : copy_generic_opt_arg:
2024 : : opt_boolean_or_string
2025 : : | NumericOnly
2026 : : | '*'
2027 : : | DEFAULT
2028 : : | '(' copy_generic_opt_arg_list ')'
2029 : : |
2030 : : ;
2031 : :
2032 : :
2033 : : copy_generic_opt_arg_list:
2034 : : copy_generic_opt_arg_list_item
2035 : : | copy_generic_opt_arg_list ',' copy_generic_opt_arg_list_item
2036 : : ;
2037 : :
2038 : :
2039 : : copy_generic_opt_arg_list_item:
2040 : : opt_boolean_or_string
2041 : : ;
2042 : :
2043 : :
2044 : : CreateStmt:
2045 : : CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' OptInherit OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
2046 : : | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name '(' OptTableElementList ')' OptInherit OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
2047 : : | CREATE OptTemp TABLE qualified_name OF any_name OptTypedTableElementList OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
2048 : : | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name OF any_name OptTypedTableElementList OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
2049 : : | CREATE OptTemp TABLE qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
2050 : : | CREATE OptTemp TABLE IF_P NOT EXISTS qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec OptPartitionSpec table_access_method_clause OptWith OnCommitOption OptTableSpace
2051 : : ;
2052 : :
2053 : :
2054 : : OptTemp:
2055 : : TEMPORARY
2056 : : | TEMP
2057 : : | LOCAL TEMPORARY
2058 : : | LOCAL TEMP
2059 : : | GLOBAL TEMPORARY
2060 : : | GLOBAL TEMP
2061 : : | UNLOGGED
2062 : : |
2063 : : ;
2064 : :
2065 : :
2066 : : OptTableElementList:
2067 : : TableElementList
2068 : : |
2069 : : ;
2070 : :
2071 : :
2072 : : OptTypedTableElementList:
2073 : : '(' TypedTableElementList ')'
2074 : : |
2075 : : ;
2076 : :
2077 : :
2078 : : TableElementList:
2079 : : TableElement
2080 : : | TableElementList ',' TableElement
2081 : : ;
2082 : :
2083 : :
2084 : : TypedTableElementList:
2085 : : TypedTableElement
2086 : : | TypedTableElementList ',' TypedTableElement
2087 : : ;
2088 : :
2089 : :
2090 : : TableElement:
2091 : : columnDef
2092 : : | TableLikeClause
2093 : : | TableConstraint
2094 : : ;
2095 : :
2096 : :
2097 : : TypedTableElement:
2098 : : columnOptions
2099 : : | TableConstraint
2100 : : ;
2101 : :
2102 : :
2103 : : columnDef:
2104 : : ColId Typename opt_column_storage opt_column_compression create_generic_options ColQualList
2105 : : ;
2106 : :
2107 : :
2108 : : columnOptions:
2109 : : ColId ColQualList
2110 : : | ColId WITH OPTIONS ColQualList
2111 : : ;
2112 : :
2113 : :
2114 : : column_compression:
2115 : : COMPRESSION ColId
2116 : : | COMPRESSION DEFAULT
2117 : : ;
2118 : :
2119 : :
2120 : : opt_column_compression:
2121 : : column_compression
2122 : : |
2123 : : ;
2124 : :
2125 : :
2126 : : column_storage:
2127 : : STORAGE ColId
2128 : : | STORAGE DEFAULT
2129 : : ;
2130 : :
2131 : :
2132 : : opt_column_storage:
2133 : : column_storage
2134 : : |
2135 : : ;
2136 : :
2137 : :
2138 : : ColQualList:
2139 : : ColQualList ColConstraint
2140 : : |
2141 : : ;
2142 : :
2143 : :
2144 : : ColConstraint:
2145 : : CONSTRAINT name ColConstraintElem
2146 : : | ColConstraintElem
2147 : : | ConstraintAttr
2148 : : | COLLATE any_name
2149 : : ;
2150 : :
2151 : :
2152 : : ColConstraintElem:
2153 : : NOT NULL_P opt_no_inherit
2154 : : | NULL_P
2155 : : | UNIQUE opt_unique_null_treatment opt_definition OptConsTableSpace
2156 : : | PRIMARY KEY opt_definition OptConsTableSpace
2157 : : | CHECK '(' a_expr ')' opt_no_inherit
2158 : : | DEFAULT b_expr
2159 : : | GENERATED generated_when AS IDENTITY_P OptParenthesizedSeqOptList
2160 : : | GENERATED generated_when AS '(' a_expr ')' opt_virtual_or_stored
2161 : : | REFERENCES qualified_name opt_column_list key_match key_actions
2162 : : ;
2163 : :
2164 : :
2165 : : opt_unique_null_treatment:
2166 : : NULLS_P DISTINCT
2167 : : | NULLS_P NOT DISTINCT
2168 : : |
2169 : : ;
2170 : :
2171 : :
2172 : : generated_when:
2173 : : ALWAYS
2174 : : | BY DEFAULT
2175 : : ;
2176 : :
2177 : :
2178 : : opt_virtual_or_stored:
2179 : : STORED
2180 : : | VIRTUAL
2181 : : |
2182 : : ;
2183 : :
2184 : :
2185 : : ConstraintAttr:
2186 : : DEFERRABLE
2187 : : | NOT DEFERRABLE
2188 : : | INITIALLY DEFERRED
2189 : : | INITIALLY IMMEDIATE
2190 : : | ENFORCED
2191 : : | NOT ENFORCED
2192 : : ;
2193 : :
2194 : :
2195 : : TableLikeClause:
2196 : : LIKE qualified_name TableLikeOptionList
2197 : : ;
2198 : :
2199 : :
2200 : : TableLikeOptionList:
2201 : : TableLikeOptionList INCLUDING TableLikeOption
2202 : : | TableLikeOptionList EXCLUDING TableLikeOption
2203 : : |
2204 : : ;
2205 : :
2206 : :
2207 : : TableLikeOption:
2208 : : COMMENTS
2209 : : | COMPRESSION
2210 : : | CONSTRAINTS
2211 : : | DEFAULTS
2212 : : | IDENTITY_P
2213 : : | GENERATED
2214 : : | INDEXES
2215 : : | STATISTICS
2216 : : | STORAGE
2217 : : | ALL
2218 : : ;
2219 : :
2220 : :
2221 : : TableConstraint:
2222 : : CONSTRAINT name ConstraintElem
2223 : : | ConstraintElem
2224 : : ;
2225 : :
2226 : :
2227 : : ConstraintElem:
2228 : : CHECK '(' a_expr ')' ConstraintAttributeSpec
2229 : : | NOT NULL_P ColId ConstraintAttributeSpec
2230 : : | UNIQUE opt_unique_null_treatment '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace ConstraintAttributeSpec
2231 : : | UNIQUE ExistingIndex ConstraintAttributeSpec
2232 : : | PRIMARY KEY '(' columnList opt_without_overlaps ')' opt_c_include opt_definition OptConsTableSpace ConstraintAttributeSpec
2233 : : | PRIMARY KEY ExistingIndex ConstraintAttributeSpec
2234 : : | EXCLUDE access_method_clause '(' ExclusionConstraintList ')' opt_c_include opt_definition OptConsTableSpace OptWhereClause ConstraintAttributeSpec
2235 : : | FOREIGN KEY '(' columnList optionalPeriodName ')' REFERENCES qualified_name opt_column_and_period_list key_match key_actions ConstraintAttributeSpec
2236 : : ;
2237 : :
2238 : :
2239 : : DomainConstraint:
2240 : : CONSTRAINT name DomainConstraintElem
2241 : : | DomainConstraintElem
2242 : : ;
2243 : :
2244 : :
2245 : : DomainConstraintElem:
2246 : : CHECK '(' a_expr ')' ConstraintAttributeSpec
2247 : : | NOT NULL_P ConstraintAttributeSpec
2248 : : ;
2249 : :
2250 : :
2251 : : opt_no_inherit:
2252 : : NO INHERIT
2253 : : |
2254 : : ;
2255 : :
2256 : :
2257 : : opt_without_overlaps:
2258 : : WITHOUT OVERLAPS
2259 : : |
2260 : : ;
2261 : :
2262 : :
2263 : : opt_column_list:
2264 : : '(' columnList ')'
2265 : : |
2266 : : ;
2267 : :
2268 : :
2269 : : columnList:
2270 : : columnElem
2271 : : | columnList ',' columnElem
2272 : : ;
2273 : :
2274 : :
2275 : : optionalPeriodName:
2276 : : ',' PERIOD columnElem
2277 : : |
2278 : : ;
2279 : :
2280 : :
2281 : : opt_column_and_period_list:
2282 : : '(' columnList optionalPeriodName ')'
2283 : : |
2284 : : ;
2285 : :
2286 : :
2287 : : columnElem:
2288 : : ColId
2289 : : ;
2290 : :
2291 : :
2292 : : opt_c_include:
2293 : : INCLUDE '(' columnList ')'
2294 : : |
2295 : : ;
2296 : :
2297 : :
2298 : : key_match:
2299 : : MATCH FULL
2300 : : | MATCH PARTIAL
2301 : : {
2302 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
2303 : : }
2304 : : | MATCH SIMPLE
2305 : : |
2306 : : ;
2307 : :
2308 : :
2309 : : ExclusionConstraintList:
2310 : : ExclusionConstraintElem
2311 : : | ExclusionConstraintList ',' ExclusionConstraintElem
2312 : : ;
2313 : :
2314 : :
2315 : : ExclusionConstraintElem:
2316 : : index_elem WITH any_operator
2317 : : | index_elem WITH OPERATOR '(' any_operator ')'
2318 : : ;
2319 : :
2320 : :
2321 : : OptWhereClause:
2322 : : WHERE '(' a_expr ')'
2323 : : |
2324 : : ;
2325 : :
2326 : :
2327 : : key_actions:
2328 : : key_update
2329 : : | key_delete
2330 : : | key_update key_delete
2331 : : | key_delete key_update
2332 : : |
2333 : : ;
2334 : :
2335 : :
2336 : : key_update:
2337 : : ON UPDATE key_action
2338 : : ;
2339 : :
2340 : :
2341 : : key_delete:
2342 : : ON DELETE_P key_action
2343 : : ;
2344 : :
2345 : :
2346 : : key_action:
2347 : : NO ACTION
2348 : : | RESTRICT
2349 : : | CASCADE
2350 : : | SET NULL_P opt_column_list
2351 : : | SET DEFAULT opt_column_list
2352 : : ;
2353 : :
2354 : :
2355 : : OptInherit:
2356 : : INHERITS '(' qualified_name_list ')'
2357 : : |
2358 : : ;
2359 : :
2360 : :
2361 : : OptPartitionSpec:
2362 : : PartitionSpec
2363 : : |
2364 : : ;
2365 : :
2366 : :
2367 : : PartitionSpec:
2368 : : PARTITION BY ColId '(' part_params ')'
2369 : : ;
2370 : :
2371 : :
2372 : : part_params:
2373 : : part_elem
2374 : : | part_params ',' part_elem
2375 : : ;
2376 : :
2377 : :
2378 : : part_elem:
2379 : : ColId opt_collate opt_qualified_name
2380 : : | func_expr_windowless opt_collate opt_qualified_name
2381 : : | '(' a_expr ')' opt_collate opt_qualified_name
2382 : : ;
2383 : :
2384 : :
2385 : : table_access_method_clause:
2386 : : USING name
2387 : : |
2388 : : ;
2389 : :
2390 : :
2391 : : OptWith:
2392 : : WITH reloptions
2393 : : | WITHOUT OIDS
2394 : : |
2395 : : ;
2396 : :
2397 : :
2398 : : OnCommitOption:
2399 : : ON COMMIT DROP
2400 : : | ON COMMIT DELETE_P ROWS
2401 : : | ON COMMIT PRESERVE ROWS
2402 : : |
2403 : : ;
2404 : :
2405 : :
2406 : : OptTableSpace:
2407 : : TABLESPACE name
2408 : : |
2409 : : ;
2410 : :
2411 : :
2412 : : OptConsTableSpace:
2413 : : USING INDEX TABLESPACE name
2414 : : |
2415 : : ;
2416 : :
2417 : :
2418 : : ExistingIndex:
2419 : : USING INDEX name
2420 : : ;
2421 : :
2422 : :
2423 : : CreateStatsStmt:
2424 : : CREATE STATISTICS opt_qualified_name opt_name_list ON stats_params FROM from_list
2425 : : | CREATE STATISTICS IF_P NOT EXISTS any_name opt_name_list ON stats_params FROM from_list
2426 : : ;
2427 : :
2428 : :
2429 : : stats_params:
2430 : : stats_param
2431 : : | stats_params ',' stats_param
2432 : : ;
2433 : :
2434 : :
2435 : : stats_param:
2436 : : ColId
2437 : : | func_expr_windowless
2438 : : | '(' a_expr ')'
2439 : : ;
2440 : :
2441 : :
2442 : : AlterStatsStmt:
2443 : : ALTER STATISTICS any_name SET STATISTICS set_statistics_value
2444 : : | ALTER STATISTICS IF_P EXISTS any_name SET STATISTICS set_statistics_value
2445 : : ;
2446 : :
2447 : :
2448 : : create_as_target:
2449 : : qualified_name opt_column_list table_access_method_clause OptWith OnCommitOption OptTableSpace
2450 : : ;
2451 : :
2452 : :
2453 : : opt_with_data:
2454 : : WITH DATA_P
2455 : : | WITH NO DATA_P
2456 : : |
2457 : : ;
2458 : :
2459 : :
2460 : : CreateMatViewStmt:
2461 : : CREATE OptNoLog MATERIALIZED VIEW create_mv_target AS SelectStmt opt_with_data
2462 : : | CREATE OptNoLog MATERIALIZED VIEW IF_P NOT EXISTS create_mv_target AS SelectStmt opt_with_data
2463 : : ;
2464 : :
2465 : :
2466 : : create_mv_target:
2467 : : qualified_name opt_column_list table_access_method_clause opt_reloptions OptTableSpace
2468 : : ;
2469 : :
2470 : :
2471 : : OptNoLog:
2472 : : UNLOGGED
2473 : : |
2474 : : ;
2475 : :
2476 : :
2477 : : RefreshMatViewStmt:
2478 : : REFRESH MATERIALIZED VIEW opt_concurrently qualified_name opt_with_data
2479 : : ;
2480 : :
2481 : :
2482 : : CreateSeqStmt:
2483 : : CREATE OptTemp SEQUENCE qualified_name OptSeqOptList
2484 : : | CREATE OptTemp SEQUENCE IF_P NOT EXISTS qualified_name OptSeqOptList
2485 : : ;
2486 : :
2487 : :
2488 : : AlterSeqStmt:
2489 : : ALTER SEQUENCE qualified_name SeqOptList
2490 : : | ALTER SEQUENCE IF_P EXISTS qualified_name SeqOptList
2491 : : ;
2492 : :
2493 : :
2494 : : OptSeqOptList:
2495 : : SeqOptList
2496 : : |
2497 : : ;
2498 : :
2499 : :
2500 : : OptParenthesizedSeqOptList:
2501 : : '(' SeqOptList ')'
2502 : : |
2503 : : ;
2504 : :
2505 : :
2506 : : SeqOptList:
2507 : : SeqOptElem
2508 : : | SeqOptList SeqOptElem
2509 : : ;
2510 : :
2511 : :
2512 : : SeqOptElem:
2513 : : AS SimpleTypename
2514 : : | CACHE NumericOnly
2515 : : | CYCLE
2516 : : | NO CYCLE
2517 : : | INCREMENT opt_by NumericOnly
2518 : : | LOGGED
2519 : : | MAXVALUE NumericOnly
2520 : : | MINVALUE NumericOnly
2521 : : | NO MAXVALUE
2522 : : | NO MINVALUE
2523 : : | OWNED BY any_name
2524 : : | SEQUENCE NAME_P any_name
2525 : : | START opt_with NumericOnly
2526 : : | RESTART
2527 : : | RESTART opt_with NumericOnly
2528 : : | UNLOGGED
2529 : : ;
2530 : :
2531 : :
2532 : : opt_by:
2533 : : BY
2534 : : |
2535 : : ;
2536 : :
2537 : :
2538 : : NumericOnly:
2539 : : ecpg_fconst
2540 : : | '+' ecpg_fconst
2541 : : | '-' ecpg_fconst
2542 : : | SignedIconst
2543 : : ;
2544 : :
2545 : :
2546 : : NumericOnly_list:
2547 : : NumericOnly
2548 : : | NumericOnly_list ',' NumericOnly
2549 : : ;
2550 : :
2551 : :
2552 : : CreatePLangStmt:
2553 : : CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE name
2554 : : | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE name HANDLER handler_name opt_inline_handler opt_validator
2555 : : ;
2556 : :
2557 : :
2558 : : opt_trusted:
2559 : : TRUSTED
2560 : : |
2561 : : ;
2562 : :
2563 : :
2564 : : handler_name:
2565 : : name
2566 : : | name attrs
2567 : : ;
2568 : :
2569 : :
2570 : : opt_inline_handler:
2571 : : INLINE_P handler_name
2572 : : |
2573 : : ;
2574 : :
2575 : :
2576 : : validator_clause:
2577 : : VALIDATOR handler_name
2578 : : | NO VALIDATOR
2579 : : ;
2580 : :
2581 : :
2582 : : opt_validator:
2583 : : validator_clause
2584 : : |
2585 : : ;
2586 : :
2587 : :
2588 : : opt_procedural:
2589 : : PROCEDURAL
2590 : : |
2591 : : ;
2592 : :
2593 : :
2594 : : CreateTableSpaceStmt:
2595 : : CREATE TABLESPACE name OptTableSpaceOwner LOCATION ecpg_sconst opt_reloptions
2596 : : ;
2597 : :
2598 : :
2599 : : OptTableSpaceOwner:
2600 : : OWNER RoleSpec
2601 : : |
2602 : : ;
2603 : :
2604 : :
2605 : : DropTableSpaceStmt:
2606 : : DROP TABLESPACE name
2607 : : | DROP TABLESPACE IF_P EXISTS name
2608 : : ;
2609 : :
2610 : :
2611 : : CreateExtensionStmt:
2612 : : CREATE EXTENSION name opt_with create_extension_opt_list
2613 : : | CREATE EXTENSION IF_P NOT EXISTS name opt_with create_extension_opt_list
2614 : : ;
2615 : :
2616 : :
2617 : : create_extension_opt_list:
2618 : : create_extension_opt_list create_extension_opt_item
2619 : : |
2620 : : ;
2621 : :
2622 : :
2623 : : create_extension_opt_item:
2624 : : SCHEMA name
2625 : : | VERSION_P NonReservedWord_or_Sconst
2626 : : | FROM NonReservedWord_or_Sconst
2627 : : {
2628 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
2629 : : }
2630 : : | CASCADE
2631 : : ;
2632 : :
2633 : :
2634 : : AlterExtensionStmt:
2635 : : ALTER EXTENSION name UPDATE alter_extension_opt_list
2636 : : ;
2637 : :
2638 : :
2639 : : alter_extension_opt_list:
2640 : : alter_extension_opt_list alter_extension_opt_item
2641 : : |
2642 : : ;
2643 : :
2644 : :
2645 : : alter_extension_opt_item:
2646 : : TO NonReservedWord_or_Sconst
2647 : : ;
2648 : :
2649 : :
2650 : : AlterExtensionContentsStmt:
2651 : : ALTER EXTENSION name add_drop object_type_name name
2652 : : | ALTER EXTENSION name add_drop object_type_any_name any_name
2653 : : | ALTER EXTENSION name add_drop AGGREGATE aggregate_with_argtypes
2654 : : | ALTER EXTENSION name add_drop CAST '(' Typename AS Typename ')'
2655 : : | ALTER EXTENSION name add_drop DOMAIN_P Typename
2656 : : | ALTER EXTENSION name add_drop FUNCTION function_with_argtypes
2657 : : | ALTER EXTENSION name add_drop OPERATOR operator_with_argtypes
2658 : : | ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING name
2659 : : | ALTER EXTENSION name add_drop OPERATOR FAMILY any_name USING name
2660 : : | ALTER EXTENSION name add_drop PROCEDURE function_with_argtypes
2661 : : | ALTER EXTENSION name add_drop ROUTINE function_with_argtypes
2662 : : | ALTER EXTENSION name add_drop TRANSFORM FOR Typename LANGUAGE name
2663 : : | ALTER EXTENSION name add_drop TYPE_P Typename
2664 : : ;
2665 : :
2666 : :
2667 : : CreateFdwStmt:
2668 : : CREATE FOREIGN DATA_P WRAPPER name opt_fdw_options create_generic_options
2669 : : ;
2670 : :
2671 : :
2672 : : fdw_option:
2673 : : HANDLER handler_name
2674 : : | NO HANDLER
2675 : : | VALIDATOR handler_name
2676 : : | NO VALIDATOR
2677 : : | CONNECTION handler_name
2678 : : | NO CONNECTION
2679 : : ;
2680 : :
2681 : :
2682 : : fdw_options:
2683 : : fdw_option
2684 : : | fdw_options fdw_option
2685 : : ;
2686 : :
2687 : :
2688 : : opt_fdw_options:
2689 : : fdw_options
2690 : : |
2691 : : ;
2692 : :
2693 : :
2694 : : AlterFdwStmt:
2695 : : ALTER FOREIGN DATA_P WRAPPER name opt_fdw_options alter_generic_options
2696 : : | ALTER FOREIGN DATA_P WRAPPER name fdw_options
2697 : : ;
2698 : :
2699 : :
2700 : : create_generic_options:
2701 : : OPTIONS '(' generic_option_list ')'
2702 : : |
2703 : : ;
2704 : :
2705 : :
2706 : : generic_option_list:
2707 : : generic_option_elem
2708 : : | generic_option_list ',' generic_option_elem
2709 : : ;
2710 : :
2711 : :
2712 : : alter_generic_options:
2713 : : OPTIONS '(' alter_generic_option_list ')'
2714 : : ;
2715 : :
2716 : :
2717 : : alter_generic_option_list:
2718 : : alter_generic_option_elem
2719 : : | alter_generic_option_list ',' alter_generic_option_elem
2720 : : ;
2721 : :
2722 : :
2723 : : alter_generic_option_elem:
2724 : : generic_option_elem
2725 : : | SET generic_option_elem
2726 : : | ADD_P generic_option_elem
2727 : : | DROP generic_option_name
2728 : : ;
2729 : :
2730 : :
2731 : : generic_option_elem:
2732 : : generic_option_name generic_option_arg
2733 : : ;
2734 : :
2735 : :
2736 : : generic_option_name:
2737 : : ColLabel
2738 : : ;
2739 : :
2740 : :
2741 : : generic_option_arg:
2742 : : ecpg_sconst
2743 : : ;
2744 : :
2745 : :
2746 : : CreateForeignServerStmt:
2747 : : CREATE SERVER name opt_type opt_foreign_server_version FOREIGN DATA_P WRAPPER name create_generic_options
2748 : : | CREATE SERVER IF_P NOT EXISTS name opt_type opt_foreign_server_version FOREIGN DATA_P WRAPPER name create_generic_options
2749 : : ;
2750 : :
2751 : :
2752 : : opt_type:
2753 : : TYPE_P ecpg_sconst
2754 : : |
2755 : : ;
2756 : :
2757 : :
2758 : : foreign_server_version:
2759 : : VERSION_P ecpg_sconst
2760 : : | VERSION_P NULL_P
2761 : : ;
2762 : :
2763 : :
2764 : : opt_foreign_server_version:
2765 : : foreign_server_version
2766 : : |
2767 : : ;
2768 : :
2769 : :
2770 : : AlterForeignServerStmt:
2771 : : ALTER SERVER name foreign_server_version alter_generic_options
2772 : : | ALTER SERVER name foreign_server_version
2773 : : | ALTER SERVER name alter_generic_options
2774 : : ;
2775 : :
2776 : :
2777 : : CreateForeignTableStmt:
2778 : : CREATE FOREIGN TABLE qualified_name '(' OptTableElementList ')' OptInherit SERVER name create_generic_options
2779 : : | CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name '(' OptTableElementList ')' OptInherit SERVER name create_generic_options
2780 : : | CREATE FOREIGN TABLE qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec SERVER name create_generic_options
2781 : : | CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name PARTITION OF qualified_name OptTypedTableElementList PartitionBoundSpec SERVER name create_generic_options
2782 : : ;
2783 : :
2784 : :
2785 : : ImportForeignSchemaStmt:
2786 : : IMPORT_P FOREIGN SCHEMA name import_qualification FROM SERVER name INTO name create_generic_options
2787 : : ;
2788 : :
2789 : :
2790 : : import_qualification_type:
2791 : : LIMIT TO
2792 : : | EXCEPT
2793 : : ;
2794 : :
2795 : :
2796 : : import_qualification:
2797 : : import_qualification_type '(' relation_expr_list ')'
2798 : : |
2799 : : ;
2800 : :
2801 : :
2802 : : CreateUserMappingStmt:
2803 : : CREATE USER MAPPING FOR auth_ident SERVER name create_generic_options
2804 : : | CREATE USER MAPPING IF_P NOT EXISTS FOR auth_ident SERVER name create_generic_options
2805 : : ;
2806 : :
2807 : :
2808 : : auth_ident:
2809 : : RoleSpec
2810 : : | USER
2811 : : ;
2812 : :
2813 : :
2814 : : DropUserMappingStmt:
2815 : : DROP USER MAPPING FOR auth_ident SERVER name
2816 : : | DROP USER MAPPING IF_P EXISTS FOR auth_ident SERVER name
2817 : : ;
2818 : :
2819 : :
2820 : : AlterUserMappingStmt:
2821 : : ALTER USER MAPPING FOR auth_ident SERVER name alter_generic_options
2822 : : ;
2823 : :
2824 : :
2825 : : CreatePolicyStmt:
2826 : : CREATE POLICY name ON qualified_name RowSecurityDefaultPermissive RowSecurityDefaultForCmd RowSecurityDefaultToRole RowSecurityOptionalExpr RowSecurityOptionalWithCheck
2827 : : ;
2828 : :
2829 : :
2830 : : AlterPolicyStmt:
2831 : : ALTER POLICY name ON qualified_name RowSecurityOptionalToRole RowSecurityOptionalExpr RowSecurityOptionalWithCheck
2832 : : ;
2833 : :
2834 : :
2835 : : RowSecurityOptionalExpr:
2836 : : USING '(' a_expr ')'
2837 : : |
2838 : : ;
2839 : :
2840 : :
2841 : : RowSecurityOptionalWithCheck:
2842 : : WITH CHECK '(' a_expr ')'
2843 : : |
2844 : : ;
2845 : :
2846 : :
2847 : : RowSecurityDefaultToRole:
2848 : : TO role_list
2849 : : |
2850 : : ;
2851 : :
2852 : :
2853 : : RowSecurityOptionalToRole:
2854 : : TO role_list
2855 : : |
2856 : : ;
2857 : :
2858 : :
2859 : : RowSecurityDefaultPermissive:
2860 : : AS ecpg_ident
2861 : : |
2862 : : ;
2863 : :
2864 : :
2865 : : RowSecurityDefaultForCmd:
2866 : : FOR row_security_cmd
2867 : : |
2868 : : ;
2869 : :
2870 : :
2871 : : row_security_cmd:
2872 : : ALL
2873 : : | SELECT
2874 : : | INSERT
2875 : : | UPDATE
2876 : : | DELETE_P
2877 : : ;
2878 : :
2879 : :
2880 : : CreateAmStmt:
2881 : : CREATE ACCESS METHOD name TYPE_P am_type HANDLER handler_name
2882 : : ;
2883 : :
2884 : :
2885 : : am_type:
2886 : : INDEX
2887 : : | TABLE
2888 : : ;
2889 : :
2890 : :
2891 : : CreateTrigStmt:
2892 : : CREATE opt_or_replace TRIGGER name TriggerActionTime TriggerEvents ON qualified_name TriggerReferencing TriggerForSpec TriggerWhen EXECUTE FUNCTION_or_PROCEDURE func_name '(' TriggerFuncArgs ')'
2893 : : | 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 ')'
2894 : : ;
2895 : :
2896 : :
2897 : : TriggerActionTime:
2898 : : BEFORE
2899 : : | AFTER
2900 : : | INSTEAD OF
2901 : : ;
2902 : :
2903 : :
2904 : : TriggerEvents:
2905 : : TriggerOneEvent
2906 : : | TriggerEvents OR TriggerOneEvent
2907 : : ;
2908 : :
2909 : :
2910 : : TriggerOneEvent:
2911 : : INSERT
2912 : : | DELETE_P
2913 : : | UPDATE
2914 : : | UPDATE OF columnList
2915 : : | TRUNCATE
2916 : : ;
2917 : :
2918 : :
2919 : : TriggerReferencing:
2920 : : REFERENCING TriggerTransitions
2921 : : |
2922 : : ;
2923 : :
2924 : :
2925 : : TriggerTransitions:
2926 : : TriggerTransition
2927 : : | TriggerTransitions TriggerTransition
2928 : : ;
2929 : :
2930 : :
2931 : : TriggerTransition:
2932 : : TransitionOldOrNew TransitionRowOrTable opt_as TransitionRelName
2933 : : ;
2934 : :
2935 : :
2936 : : TransitionOldOrNew:
2937 : : NEW
2938 : : | OLD
2939 : : ;
2940 : :
2941 : :
2942 : : TransitionRowOrTable:
2943 : : TABLE
2944 : : | ROW
2945 : : ;
2946 : :
2947 : :
2948 : : TransitionRelName:
2949 : : ColId
2950 : : ;
2951 : :
2952 : :
2953 : : TriggerForSpec:
2954 : : FOR TriggerForOptEach TriggerForType
2955 : : |
2956 : : ;
2957 : :
2958 : :
2959 : : TriggerForOptEach:
2960 : : EACH
2961 : : |
2962 : : ;
2963 : :
2964 : :
2965 : : TriggerForType:
2966 : : ROW
2967 : : | STATEMENT
2968 : : ;
2969 : :
2970 : :
2971 : : TriggerWhen:
2972 : : WHEN '(' a_expr ')'
2973 : : |
2974 : : ;
2975 : :
2976 : :
2977 : : FUNCTION_or_PROCEDURE:
2978 : : FUNCTION
2979 : : | PROCEDURE
2980 : : ;
2981 : :
2982 : :
2983 : : TriggerFuncArgs:
2984 : : TriggerFuncArg
2985 : : | TriggerFuncArgs ',' TriggerFuncArg
2986 : : |
2987 : : ;
2988 : :
2989 : :
2990 : : TriggerFuncArg:
2991 : : Iconst
2992 : : | ecpg_fconst
2993 : : | ecpg_sconst
2994 : : | ColLabel
2995 : : ;
2996 : :
2997 : :
2998 : : OptConstrFromTable:
2999 : : FROM qualified_name
3000 : : |
3001 : : ;
3002 : :
3003 : :
3004 : : ConstraintAttributeSpec:
3005 : :
3006 : : | ConstraintAttributeSpec ConstraintAttributeElem
3007 : : ;
3008 : :
3009 : :
3010 : : ConstraintAttributeElem:
3011 : : NOT DEFERRABLE
3012 : : | DEFERRABLE
3013 : : | INITIALLY IMMEDIATE
3014 : : | INITIALLY DEFERRED
3015 : : | NOT VALID
3016 : : | NO INHERIT
3017 : : | NOT ENFORCED
3018 : : | ENFORCED
3019 : : ;
3020 : :
3021 : :
3022 : : CreateEventTrigStmt:
3023 : : CREATE EVENT TRIGGER name ON ColLabel EXECUTE FUNCTION_or_PROCEDURE func_name '(' ')'
3024 : : | CREATE EVENT TRIGGER name ON ColLabel WHEN event_trigger_when_list EXECUTE FUNCTION_or_PROCEDURE func_name '(' ')'
3025 : : ;
3026 : :
3027 : :
3028 : : event_trigger_when_list:
3029 : : event_trigger_when_item
3030 : : | event_trigger_when_list AND event_trigger_when_item
3031 : : ;
3032 : :
3033 : :
3034 : : event_trigger_when_item:
3035 : : ColId IN_P '(' event_trigger_value_list ')'
3036 : : ;
3037 : :
3038 : :
3039 : : event_trigger_value_list:
3040 : : SCONST
3041 : : | event_trigger_value_list ',' SCONST
3042 : : ;
3043 : :
3044 : :
3045 : : AlterEventTrigStmt:
3046 : : ALTER EVENT TRIGGER name enable_trigger
3047 : : ;
3048 : :
3049 : :
3050 : : enable_trigger:
3051 : : ENABLE_P
3052 : : | ENABLE_P REPLICA
3053 : : | ENABLE_P ALWAYS
3054 : : | DISABLE_P
3055 : : ;
3056 : :
3057 : :
3058 : : CreateAssertionStmt:
3059 : : CREATE ASSERTION any_name CHECK '(' a_expr ')' ConstraintAttributeSpec
3060 : : {
3061 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
3062 : : }
3063 : : ;
3064 : :
3065 : :
3066 : : DefineStmt:
3067 : : CREATE opt_or_replace AGGREGATE func_name aggr_args definition
3068 : : | CREATE opt_or_replace AGGREGATE func_name old_aggr_definition
3069 : : | CREATE OPERATOR any_operator definition
3070 : : | CREATE TYPE_P any_name definition
3071 : : | CREATE TYPE_P any_name
3072 : : | CREATE TYPE_P any_name AS '(' OptTableFuncElementList ')'
3073 : : | CREATE TYPE_P any_name AS ENUM_P '(' opt_enum_val_list ')'
3074 : : | CREATE TYPE_P any_name AS RANGE definition
3075 : : | CREATE TEXT_P SEARCH PARSER any_name definition
3076 : : | CREATE TEXT_P SEARCH DICTIONARY any_name definition
3077 : : | CREATE TEXT_P SEARCH TEMPLATE any_name definition
3078 : : | CREATE TEXT_P SEARCH CONFIGURATION any_name definition
3079 : : | CREATE COLLATION any_name definition
3080 : : | CREATE COLLATION IF_P NOT EXISTS any_name definition
3081 : : | CREATE COLLATION any_name FROM any_name
3082 : : | CREATE COLLATION IF_P NOT EXISTS any_name FROM any_name
3083 : : ;
3084 : :
3085 : :
3086 : : definition:
3087 : : '(' def_list ')'
3088 : : ;
3089 : :
3090 : :
3091 : : def_list:
3092 : : def_elem
3093 : : | def_list ',' def_elem
3094 : : ;
3095 : :
3096 : :
3097 : : def_elem:
3098 : : ColLabel '=' def_arg
3099 : : | ColLabel
3100 : : ;
3101 : :
3102 : :
3103 : : def_arg:
3104 : : func_type
3105 : : | reserved_keyword
3106 : : | qual_all_Op
3107 : : | NumericOnly
3108 : : | ecpg_sconst
3109 : : | NONE
3110 : : ;
3111 : :
3112 : :
3113 : : old_aggr_definition:
3114 : : '(' old_aggr_list ')'
3115 : : ;
3116 : :
3117 : :
3118 : : old_aggr_list:
3119 : : old_aggr_elem
3120 : : | old_aggr_list ',' old_aggr_elem
3121 : : ;
3122 : :
3123 : :
3124 : : old_aggr_elem:
3125 : : ecpg_ident '=' def_arg
3126 : : ;
3127 : :
3128 : :
3129 : : opt_enum_val_list:
3130 : : enum_val_list
3131 : : |
3132 : : ;
3133 : :
3134 : :
3135 : : enum_val_list:
3136 : : ecpg_sconst
3137 : : | enum_val_list ',' ecpg_sconst
3138 : : ;
3139 : :
3140 : :
3141 : : AlterEnumStmt:
3142 : : ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst
3143 : : | ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst BEFORE ecpg_sconst
3144 : : | ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists ecpg_sconst AFTER ecpg_sconst
3145 : : | ALTER TYPE_P any_name RENAME VALUE_P ecpg_sconst TO ecpg_sconst
3146 : : | ALTER TYPE_P any_name DROP VALUE_P ecpg_sconst
3147 : : {
3148 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
3149 : : }
3150 : : ;
3151 : :
3152 : :
3153 : : opt_if_not_exists:
3154 : : IF_P NOT EXISTS
3155 : : |
3156 : : ;
3157 : :
3158 : :
3159 : : CreateOpClassStmt:
3160 : : CREATE OPERATOR CLASS any_name opt_default FOR TYPE_P Typename USING name opt_opfamily AS opclass_item_list
3161 : : ;
3162 : :
3163 : :
3164 : : opclass_item_list:
3165 : : opclass_item
3166 : : | opclass_item_list ',' opclass_item
3167 : : ;
3168 : :
3169 : :
3170 : : opclass_item:
3171 : : OPERATOR Iconst any_operator opclass_purpose
3172 : : | OPERATOR Iconst operator_with_argtypes opclass_purpose
3173 : : | FUNCTION Iconst function_with_argtypes
3174 : : | FUNCTION Iconst '(' type_list ')' function_with_argtypes
3175 : : | STORAGE Typename
3176 : : ;
3177 : :
3178 : :
3179 : : opt_default:
3180 : : DEFAULT
3181 : : |
3182 : : ;
3183 : :
3184 : :
3185 : : opt_opfamily:
3186 : : FAMILY any_name
3187 : : |
3188 : : ;
3189 : :
3190 : :
3191 : : opclass_purpose:
3192 : : FOR SEARCH
3193 : : | FOR ORDER BY any_name
3194 : : |
3195 : : ;
3196 : :
3197 : :
3198 : : CreateOpFamilyStmt:
3199 : : CREATE OPERATOR FAMILY any_name USING name
3200 : : ;
3201 : :
3202 : :
3203 : : AlterOpFamilyStmt:
3204 : : ALTER OPERATOR FAMILY any_name USING name ADD_P opclass_item_list
3205 : : | ALTER OPERATOR FAMILY any_name USING name DROP opclass_drop_list
3206 : : ;
3207 : :
3208 : :
3209 : : opclass_drop_list:
3210 : : opclass_drop
3211 : : | opclass_drop_list ',' opclass_drop
3212 : : ;
3213 : :
3214 : :
3215 : : opclass_drop:
3216 : : OPERATOR Iconst '(' type_list ')'
3217 : : | FUNCTION Iconst '(' type_list ')'
3218 : : ;
3219 : :
3220 : :
3221 : : DropOpClassStmt:
3222 : : DROP OPERATOR CLASS any_name USING name opt_drop_behavior
3223 : : | DROP OPERATOR CLASS IF_P EXISTS any_name USING name opt_drop_behavior
3224 : : ;
3225 : :
3226 : :
3227 : : DropOpFamilyStmt:
3228 : : DROP OPERATOR FAMILY any_name USING name opt_drop_behavior
3229 : : | DROP OPERATOR FAMILY IF_P EXISTS any_name USING name opt_drop_behavior
3230 : : ;
3231 : :
3232 : :
3233 : : DropOwnedStmt:
3234 : : DROP OWNED BY role_list opt_drop_behavior
3235 : : ;
3236 : :
3237 : :
3238 : : ReassignOwnedStmt:
3239 : : REASSIGN OWNED BY role_list TO RoleSpec
3240 : : ;
3241 : :
3242 : :
3243 : : DropStmt:
3244 : : DROP object_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
3245 : : | DROP object_type_any_name any_name_list opt_drop_behavior
3246 : : | DROP drop_type_name IF_P EXISTS name_list opt_drop_behavior
3247 : : | DROP drop_type_name name_list opt_drop_behavior
3248 : : | DROP object_type_name_on_any_name name ON any_name opt_drop_behavior
3249 : : | DROP object_type_name_on_any_name IF_P EXISTS name ON any_name opt_drop_behavior
3250 : : | DROP TYPE_P type_name_list opt_drop_behavior
3251 : : | DROP TYPE_P IF_P EXISTS type_name_list opt_drop_behavior
3252 : : | DROP DOMAIN_P type_name_list opt_drop_behavior
3253 : : | DROP DOMAIN_P IF_P EXISTS type_name_list opt_drop_behavior
3254 : : | DROP INDEX CONCURRENTLY any_name_list opt_drop_behavior
3255 : : | DROP INDEX CONCURRENTLY IF_P EXISTS any_name_list opt_drop_behavior
3256 : : ;
3257 : :
3258 : :
3259 : : object_type_any_name:
3260 : : TABLE
3261 : : | SEQUENCE
3262 : : | VIEW
3263 : : | MATERIALIZED VIEW
3264 : : | INDEX
3265 : : | FOREIGN TABLE
3266 : : | COLLATION
3267 : : | CONVERSION_P
3268 : : | STATISTICS
3269 : : | TEXT_P SEARCH PARSER
3270 : : | TEXT_P SEARCH DICTIONARY
3271 : : | TEXT_P SEARCH TEMPLATE
3272 : : | TEXT_P SEARCH CONFIGURATION
3273 : : ;
3274 : :
3275 : :
3276 : : object_type_name:
3277 : : drop_type_name
3278 : : | DATABASE
3279 : : | ROLE
3280 : : | SUBSCRIPTION
3281 : : | TABLESPACE
3282 : : ;
3283 : :
3284 : :
3285 : : drop_type_name:
3286 : : ACCESS METHOD
3287 : : | EVENT TRIGGER
3288 : : | EXTENSION
3289 : : | FOREIGN DATA_P WRAPPER
3290 : : | opt_procedural LANGUAGE
3291 : : | PUBLICATION
3292 : : | SCHEMA
3293 : : | SERVER
3294 : : ;
3295 : :
3296 : :
3297 : : object_type_name_on_any_name:
3298 : : POLICY
3299 : : | RULE
3300 : : | TRIGGER
3301 : : ;
3302 : :
3303 : :
3304 : : any_name_list:
3305 : : any_name
3306 : : | any_name_list ',' any_name
3307 : : ;
3308 : :
3309 : :
3310 : : any_name:
3311 : : ColId
3312 : : | ColId attrs
3313 : : ;
3314 : :
3315 : :
3316 : : attrs:
3317 : : '.' attr_name
3318 : : | attrs '.' attr_name
3319 : : ;
3320 : :
3321 : :
3322 : : type_name_list:
3323 : : Typename
3324 : : | type_name_list ',' Typename
3325 : : ;
3326 : :
3327 : :
3328 : : TruncateStmt:
3329 : : TRUNCATE opt_table relation_expr_list opt_restart_seqs opt_drop_behavior
3330 : : ;
3331 : :
3332 : :
3333 : : opt_restart_seqs:
3334 : : CONTINUE_P IDENTITY_P
3335 : : | RESTART IDENTITY_P
3336 : : |
3337 : : ;
3338 : :
3339 : :
3340 : : CommentStmt:
3341 : : COMMENT ON object_type_any_name any_name IS comment_text
3342 : : | COMMENT ON COLUMN any_name IS comment_text
3343 : : | COMMENT ON object_type_name name IS comment_text
3344 : : | COMMENT ON TYPE_P Typename IS comment_text
3345 : : | COMMENT ON DOMAIN_P Typename IS comment_text
3346 : : | COMMENT ON AGGREGATE aggregate_with_argtypes IS comment_text
3347 : : | COMMENT ON FUNCTION function_with_argtypes IS comment_text
3348 : : | COMMENT ON OPERATOR operator_with_argtypes IS comment_text
3349 : : | COMMENT ON CONSTRAINT name ON any_name IS comment_text
3350 : : | COMMENT ON CONSTRAINT name ON DOMAIN_P any_name IS comment_text
3351 : : | COMMENT ON object_type_name_on_any_name name ON any_name IS comment_text
3352 : : | COMMENT ON PROCEDURE function_with_argtypes IS comment_text
3353 : : | COMMENT ON ROUTINE function_with_argtypes IS comment_text
3354 : : | COMMENT ON TRANSFORM FOR Typename LANGUAGE name IS comment_text
3355 : : | COMMENT ON OPERATOR CLASS any_name USING name IS comment_text
3356 : : | COMMENT ON OPERATOR FAMILY any_name USING name IS comment_text
3357 : : | COMMENT ON LARGE_P OBJECT_P NumericOnly IS comment_text
3358 : : | COMMENT ON CAST '(' Typename AS Typename ')' IS comment_text
3359 : : ;
3360 : :
3361 : :
3362 : : comment_text:
3363 : : ecpg_sconst
3364 : : | NULL_P
3365 : : ;
3366 : :
3367 : :
3368 : : SecLabelStmt:
3369 : : SECURITY LABEL opt_provider ON object_type_any_name any_name IS security_label
3370 : : | SECURITY LABEL opt_provider ON COLUMN any_name IS security_label
3371 : : | SECURITY LABEL opt_provider ON object_type_name name IS security_label
3372 : : | SECURITY LABEL opt_provider ON TYPE_P Typename IS security_label
3373 : : | SECURITY LABEL opt_provider ON DOMAIN_P Typename IS security_label
3374 : : | SECURITY LABEL opt_provider ON AGGREGATE aggregate_with_argtypes IS security_label
3375 : : | SECURITY LABEL opt_provider ON FUNCTION function_with_argtypes IS security_label
3376 : : | SECURITY LABEL opt_provider ON LARGE_P OBJECT_P NumericOnly IS security_label
3377 : : | SECURITY LABEL opt_provider ON PROCEDURE function_with_argtypes IS security_label
3378 : : | SECURITY LABEL opt_provider ON ROUTINE function_with_argtypes IS security_label
3379 : : ;
3380 : :
3381 : :
3382 : : opt_provider:
3383 : : FOR NonReservedWord_or_Sconst
3384 : : |
3385 : : ;
3386 : :
3387 : :
3388 : : security_label:
3389 : : ecpg_sconst
3390 : : | NULL_P
3391 : : ;
3392 : :
3393 : :
3394 : : FetchStmt:
3395 : : FETCH fetch_args
3396 : : | MOVE fetch_args
3397 : : | FETCH fetch_args ecpg_fetch_into
3398 : : | FETCH FORWARD cursor_name opt_ecpg_fetch_into
3399 : : {
3400 [ + + ]: 2 : const char *cursor_marker = @3[0] == ':' ? "$0" : @3;
3401 : 2 : struct cursor *ptr = add_additional_variables(@3, false);
3402 : :
3403 : 2 : update_connection(ptr->connection);
3404 : :
3405 : 2 : @$ = cat_str(2, "fetch forward", cursor_marker);
3406 : : }
3407 : : | FETCH FORWARD from_in cursor_name opt_ecpg_fetch_into
3408 : : {
3409 [ - + ]: 1 : const char *cursor_marker = @4[0] == ':' ? "$0" : @4;
3410 : 1 : struct cursor *ptr = add_additional_variables(@4, false);
3411 : :
3412 : 1 : update_connection(ptr->connection);
3413 : :
3414 : 1 : @$ = cat_str(2, "fetch forward from", cursor_marker);
3415 : : }
3416 : : | FETCH BACKWARD cursor_name opt_ecpg_fetch_into
3417 : : {
3418 [ # # ]: 0 : const char *cursor_marker = @3[0] == ':' ? "$0" : @3;
3419 : 0 : struct cursor *ptr = add_additional_variables(@3, false);
3420 : :
3421 : 0 : update_connection(ptr->connection);
3422 : :
3423 : 0 : @$ = cat_str(2, "fetch backward", cursor_marker);
3424 : : }
3425 : : | FETCH BACKWARD from_in cursor_name opt_ecpg_fetch_into
3426 : : {
3427 [ # # ]: 0 : const char *cursor_marker = @4[0] == ':' ? "$0" : @4;
3428 : 0 : struct cursor *ptr = add_additional_variables(@4, false);
3429 : :
3430 : 0 : update_connection(ptr->connection);
3431 : :
3432 : 0 : @$ = cat_str(2, "fetch backward from", cursor_marker);
3433 : : }
3434 : : | MOVE FORWARD cursor_name
3435 : : {
3436 [ # # ]: 0 : const char *cursor_marker = @3[0] == ':' ? "$0" : @3;
3437 : 0 : struct cursor *ptr = add_additional_variables(@3, false);
3438 : :
3439 : 0 : update_connection(ptr->connection);
3440 : :
3441 : 0 : @$ = cat_str(2, "move forward", cursor_marker);
3442 : : }
3443 : : | MOVE FORWARD from_in cursor_name
3444 : : {
3445 [ # # ]: 0 : const char *cursor_marker = @4[0] == ':' ? "$0" : @4;
3446 : 0 : struct cursor *ptr = add_additional_variables(@4, false);
3447 : :
3448 : 0 : update_connection(ptr->connection);
3449 : :
3450 : 0 : @$ = cat_str(2, "move forward from", cursor_marker);
3451 : : }
3452 : : | MOVE BACKWARD cursor_name
3453 : : {
3454 [ # # ]: 0 : const char *cursor_marker = @3[0] == ':' ? "$0" : @3;
3455 : 0 : struct cursor *ptr = add_additional_variables(@3, false);
3456 : :
3457 : 0 : update_connection(ptr->connection);
3458 : :
3459 : 0 : @$ = cat_str(2, "move backward", cursor_marker);
3460 : : }
3461 : : | MOVE BACKWARD from_in cursor_name
3462 : : {
3463 [ # # ]: 0 : const char *cursor_marker = @4[0] == ':' ? "$0" : @4;
3464 : 0 : struct cursor *ptr = add_additional_variables(@4, false);
3465 : :
3466 : 0 : update_connection(ptr->connection);
3467 : :
3468 : 0 : @$ = cat_str(2, "move backward from", cursor_marker);
3469 : : }
3470 : : ;
3471 : :
3472 : :
3473 : : fetch_args:
3474 : : cursor_name
3475 : : {
3476 : 16 : struct cursor *ptr = add_additional_variables(@1, false);
3477 : :
3478 : 16 : update_connection(ptr->connection);
3479 [ + + ]: 16 : if (@1[0] == ':')
3480 : 3 : @$ = "$0";
3481 : : }
3482 : : | from_in cursor_name
3483 : : {
3484 : 11 : struct cursor *ptr = add_additional_variables(@2, false);
3485 : :
3486 : 11 : update_connection(ptr->connection);
3487 [ + + ]: 11 : if (@2[0] == ':')
3488 : 3 : @$ = cat2_str(@1, "$0");
3489 : : }
3490 : : | SignedIconst opt_from_in cursor_name
3491 : : {
3492 : 24 : struct cursor *ptr = add_additional_variables(@3, false);
3493 : 24 : bool replace = false;
3494 : :
3495 : 24 : update_connection(ptr->connection);
3496 [ + + ]: 24 : if (@3[0] == ':')
3497 : : {
3498 : 16 : @3 = "$0";
3499 : 16 : replace = true;
3500 : : }
3501 [ + + ]: 24 : if (@1[0] == '$')
3502 : : {
3503 : 9 : @1 = "$0";
3504 : 9 : replace = true;
3505 : : }
3506 [ + + ]: 24 : if (replace)
3507 : 17 : @$ = cat_str(3, @1, @2, @3);
3508 : : }
3509 : : | NEXT opt_from_in cursor_name
3510 : : {
3511 : 3 : struct cursor *ptr = add_additional_variables(@3, false);
3512 : :
3513 : 3 : update_connection(ptr->connection);
3514 [ - + ]: 3 : if (@3[0] == ':')
3515 : 0 : @$ = cat_str(3, @1, @2, "$0");
3516 : : }
3517 : : | PRIOR opt_from_in cursor_name
3518 : : {
3519 : 0 : struct cursor *ptr = add_additional_variables(@3, false);
3520 : :
3521 : 0 : update_connection(ptr->connection);
3522 [ # # ]: 0 : if (@3[0] == ':')
3523 : 0 : @$ = cat_str(3, @1, @2, "$0");
3524 : : }
3525 : : | FIRST_P opt_from_in cursor_name
3526 : : {
3527 : 0 : struct cursor *ptr = add_additional_variables(@3, false);
3528 : :
3529 : 0 : update_connection(ptr->connection);
3530 [ # # ]: 0 : if (@3[0] == ':')
3531 : 0 : @$ = cat_str(3, @1, @2, "$0");
3532 : : }
3533 : : | LAST_P opt_from_in cursor_name
3534 : : {
3535 : 0 : struct cursor *ptr = add_additional_variables(@3, false);
3536 : :
3537 : 0 : update_connection(ptr->connection);
3538 [ # # ]: 0 : if (@3[0] == ':')
3539 : 0 : @$ = cat_str(3, @1, @2, "$0");
3540 : : }
3541 : : | ABSOLUTE_P SignedIconst opt_from_in cursor_name
3542 : : {
3543 : 4 : struct cursor *ptr = add_additional_variables(@4, false);
3544 : 4 : bool replace = false;
3545 : :
3546 : 4 : update_connection(ptr->connection);
3547 [ + - ]: 4 : if (@4[0] == ':')
3548 : : {
3549 : 4 : @4 = "$0";
3550 : 4 : replace = true;
3551 : : }
3552 [ - + ]: 4 : if (@2[0] == '$')
3553 : : {
3554 : 0 : @2 = "$0";
3555 : 0 : replace = true;
3556 : : }
3557 [ + - ]: 4 : if (replace)
3558 : 4 : @$ = cat_str(4, @1, @2, @3, @4);
3559 : : }
3560 : : | RELATIVE_P SignedIconst opt_from_in cursor_name
3561 : : {
3562 : 0 : struct cursor *ptr = add_additional_variables(@4, false);
3563 : 0 : bool replace = false;
3564 : :
3565 : 0 : update_connection(ptr->connection);
3566 [ # # ]: 0 : if (@4[0] == ':')
3567 : : {
3568 : 0 : @4 = "$0";
3569 : 0 : replace = true;
3570 : : }
3571 [ # # ]: 0 : if (@2[0] == '$')
3572 : : {
3573 : 0 : @2 = "$0";
3574 : 0 : replace = true;
3575 : : }
3576 [ # # ]: 0 : if (replace)
3577 : 0 : @$ = cat_str(4, @1, @2, @3, @4);
3578 : : }
3579 : : | ALL opt_from_in cursor_name
3580 : : {
3581 : 1 : struct cursor *ptr = add_additional_variables(@3, false);
3582 : :
3583 : 1 : update_connection(ptr->connection);
3584 [ - + ]: 1 : if (@3[0] == ':')
3585 : 0 : @$ = cat_str(3, @1, @2, "$0");
3586 : : }
3587 : : | FORWARD SignedIconst opt_from_in cursor_name
3588 : : {
3589 : 0 : struct cursor *ptr = add_additional_variables(@4, false);
3590 : 0 : bool replace = false;
3591 : :
3592 : 0 : update_connection(ptr->connection);
3593 [ # # ]: 0 : if (@4[0] == ':')
3594 : : {
3595 : 0 : @4 = "$0";
3596 : 0 : replace = true;
3597 : : }
3598 [ # # ]: 0 : if (@2[0] == '$')
3599 : : {
3600 : 0 : @2 = "$0";
3601 : 0 : replace = true;
3602 : : }
3603 [ # # ]: 0 : if (replace)
3604 : 0 : @$ = cat_str(4, @1, @2, @3, @4);
3605 : : }
3606 : : | FORWARD ALL opt_from_in cursor_name
3607 : : {
3608 : 0 : struct cursor *ptr = add_additional_variables(@4, false);
3609 : :
3610 : 0 : update_connection(ptr->connection);
3611 [ # # ]: 0 : if (@4[0] == ':')
3612 : 0 : @$ = cat_str(4, @1, @2, @3, "$0");
3613 : : }
3614 : : | BACKWARD SignedIconst opt_from_in cursor_name
3615 : : {
3616 : 1 : struct cursor *ptr = add_additional_variables(@4, false);
3617 : 1 : bool replace = false;
3618 : :
3619 : 1 : update_connection(ptr->connection);
3620 [ - + ]: 1 : if (@4[0] == ':')
3621 : : {
3622 : 0 : @4 = "$0";
3623 : 0 : replace = true;
3624 : : }
3625 [ - + ]: 1 : if (@2[0] == '$')
3626 : : {
3627 : 0 : @2 = "$0";
3628 : 0 : replace = true;
3629 : : }
3630 [ - + ]: 1 : if (replace)
3631 : 0 : @$ = cat_str(4, @1, @2, @3, @4);
3632 : : }
3633 : : | BACKWARD ALL opt_from_in cursor_name
3634 : : {
3635 : 0 : struct cursor *ptr = add_additional_variables(@4, false);
3636 : :
3637 : 0 : update_connection(ptr->connection);
3638 [ # # ]: 0 : if (@4[0] == ':')
3639 : 0 : @$ = cat_str(4, @1, @2, @3, "$0");
3640 : : }
3641 : : ;
3642 : :
3643 : :
3644 : : from_in:
3645 : : FROM
3646 : : | IN_P
3647 : : ;
3648 : :
3649 : :
3650 : : opt_from_in:
3651 : : from_in
3652 : : |
3653 : : ;
3654 : :
3655 : :
3656 : : GrantStmt:
3657 : : GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_option opt_granted_by
3658 : : ;
3659 : :
3660 : :
3661 : : RevokeStmt:
3662 : : REVOKE privileges ON privilege_target FROM grantee_list opt_granted_by opt_drop_behavior
3663 : : | REVOKE GRANT OPTION FOR privileges ON privilege_target FROM grantee_list opt_granted_by opt_drop_behavior
3664 : : ;
3665 : :
3666 : :
3667 : : privileges:
3668 : : privilege_list
3669 : : | ALL
3670 : : | ALL PRIVILEGES
3671 : : | ALL '(' columnList ')'
3672 : : | ALL PRIVILEGES '(' columnList ')'
3673 : : ;
3674 : :
3675 : :
3676 : : privilege_list:
3677 : : privilege
3678 : : | privilege_list ',' privilege
3679 : : ;
3680 : :
3681 : :
3682 : : privilege:
3683 : : SELECT opt_column_list
3684 : : | REFERENCES opt_column_list
3685 : : | CREATE opt_column_list
3686 : : | ALTER SYSTEM_P
3687 : : | ColId opt_column_list
3688 : : ;
3689 : :
3690 : :
3691 : : parameter_name_list:
3692 : : parameter_name
3693 : : | parameter_name_list ',' parameter_name
3694 : : ;
3695 : :
3696 : :
3697 : : parameter_name:
3698 : : ColId
3699 : : | parameter_name '.' ColId
3700 : : ;
3701 : :
3702 : :
3703 : : privilege_target:
3704 : : qualified_name_list
3705 : : | TABLE qualified_name_list
3706 : : | SEQUENCE qualified_name_list
3707 : : | FOREIGN DATA_P WRAPPER name_list
3708 : : | FOREIGN SERVER name_list
3709 : : | FUNCTION function_with_argtypes_list
3710 : : | PROCEDURE function_with_argtypes_list
3711 : : | ROUTINE function_with_argtypes_list
3712 : : | DATABASE name_list
3713 : : | DOMAIN_P any_name_list
3714 : : | LANGUAGE name_list
3715 : : | LARGE_P OBJECT_P NumericOnly_list
3716 : : | PARAMETER parameter_name_list
3717 : : | SCHEMA name_list
3718 : : | TABLESPACE name_list
3719 : : | TYPE_P any_name_list
3720 : : | ALL TABLES IN_P SCHEMA name_list
3721 : : | ALL SEQUENCES IN_P SCHEMA name_list
3722 : : | ALL FUNCTIONS IN_P SCHEMA name_list
3723 : : | ALL PROCEDURES IN_P SCHEMA name_list
3724 : : | ALL ROUTINES IN_P SCHEMA name_list
3725 : : ;
3726 : :
3727 : :
3728 : : grantee_list:
3729 : : grantee
3730 : : | grantee_list ',' grantee
3731 : : ;
3732 : :
3733 : :
3734 : : grantee:
3735 : : RoleSpec
3736 : : | GROUP_P RoleSpec
3737 : : ;
3738 : :
3739 : :
3740 : : opt_grant_grant_option:
3741 : : WITH GRANT OPTION
3742 : : |
3743 : : ;
3744 : :
3745 : :
3746 : : GrantRoleStmt:
3747 : : GRANT privilege_list TO role_list opt_granted_by
3748 : : | GRANT privilege_list TO role_list WITH grant_role_opt_list opt_granted_by
3749 : : ;
3750 : :
3751 : :
3752 : : RevokeRoleStmt:
3753 : : REVOKE privilege_list FROM role_list opt_granted_by opt_drop_behavior
3754 : : | REVOKE ColId OPTION FOR privilege_list FROM role_list opt_granted_by opt_drop_behavior
3755 : : ;
3756 : :
3757 : :
3758 : : grant_role_opt_list:
3759 : : grant_role_opt_list ',' grant_role_opt
3760 : : | grant_role_opt
3761 : : ;
3762 : :
3763 : :
3764 : : grant_role_opt:
3765 : : ColLabel grant_role_opt_value
3766 : : ;
3767 : :
3768 : :
3769 : : grant_role_opt_value:
3770 : : OPTION
3771 : : | TRUE_P
3772 : : | FALSE_P
3773 : : ;
3774 : :
3775 : :
3776 : : opt_granted_by:
3777 : : GRANTED BY RoleSpec
3778 : : |
3779 : : ;
3780 : :
3781 : :
3782 : : AlterDefaultPrivilegesStmt:
3783 : : ALTER DEFAULT PRIVILEGES DefACLOptionList DefACLAction
3784 : : ;
3785 : :
3786 : :
3787 : : DefACLOptionList:
3788 : : DefACLOptionList DefACLOption
3789 : : |
3790 : : ;
3791 : :
3792 : :
3793 : : DefACLOption:
3794 : : IN_P SCHEMA name_list
3795 : : | FOR ROLE role_list
3796 : : | FOR USER role_list
3797 : : ;
3798 : :
3799 : :
3800 : : DefACLAction:
3801 : : GRANT privileges ON defacl_privilege_target TO grantee_list opt_grant_grant_option
3802 : : | REVOKE privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior
3803 : : | REVOKE GRANT OPTION FOR privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior
3804 : : ;
3805 : :
3806 : :
3807 : : defacl_privilege_target:
3808 : : TABLES
3809 : : | FUNCTIONS
3810 : : | ROUTINES
3811 : : | SEQUENCES
3812 : : | TYPES_P
3813 : : | SCHEMAS
3814 : : | LARGE_P OBJECTS_P
3815 : : ;
3816 : :
3817 : :
3818 : : IndexStmt:
3819 : : 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
3820 : : | 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
3821 : : ;
3822 : :
3823 : :
3824 : : opt_unique:
3825 : : UNIQUE
3826 : : |
3827 : : ;
3828 : :
3829 : :
3830 : : access_method_clause:
3831 : : USING name
3832 : : |
3833 : : ;
3834 : :
3835 : :
3836 : : index_params:
3837 : : index_elem
3838 : : | index_params ',' index_elem
3839 : : ;
3840 : :
3841 : :
3842 : : index_elem_options:
3843 : : opt_collate opt_qualified_name opt_asc_desc opt_nulls_order
3844 : : | opt_collate any_name reloptions opt_asc_desc opt_nulls_order
3845 : : ;
3846 : :
3847 : :
3848 : : index_elem:
3849 : : ColId index_elem_options
3850 : : | func_expr_windowless index_elem_options
3851 : : | '(' a_expr ')' index_elem_options
3852 : : ;
3853 : :
3854 : :
3855 : : opt_include:
3856 : : INCLUDE '(' index_including_params ')'
3857 : : |
3858 : : ;
3859 : :
3860 : :
3861 : : index_including_params:
3862 : : index_elem
3863 : : | index_including_params ',' index_elem
3864 : : ;
3865 : :
3866 : :
3867 : : opt_collate:
3868 : : COLLATE any_name
3869 : : |
3870 : : ;
3871 : :
3872 : :
3873 : : opt_asc_desc:
3874 : : ASC
3875 : : | DESC
3876 : : |
3877 : : ;
3878 : :
3879 : :
3880 : : opt_nulls_order:
3881 : : NULLS_LA FIRST_P
3882 : : | NULLS_LA LAST_P
3883 : : |
3884 : : ;
3885 : :
3886 : :
3887 : : CreateFunctionStmt:
3888 : : CREATE opt_or_replace FUNCTION func_name func_args_with_defaults RETURNS func_return opt_createfunc_opt_list opt_routine_body
3889 : : | CREATE opt_or_replace FUNCTION func_name func_args_with_defaults RETURNS TABLE '(' table_func_column_list ')' opt_createfunc_opt_list opt_routine_body
3890 : : | CREATE opt_or_replace FUNCTION func_name func_args_with_defaults opt_createfunc_opt_list opt_routine_body
3891 : : | CREATE opt_or_replace PROCEDURE func_name func_args_with_defaults opt_createfunc_opt_list opt_routine_body
3892 : : ;
3893 : :
3894 : :
3895 : : opt_or_replace:
3896 : : OR REPLACE
3897 : : |
3898 : : ;
3899 : :
3900 : :
3901 : : func_args:
3902 : : '(' func_args_list ')'
3903 : : | '(' ')'
3904 : : ;
3905 : :
3906 : :
3907 : : func_args_list:
3908 : : func_arg
3909 : : | func_args_list ',' func_arg
3910 : : ;
3911 : :
3912 : :
3913 : : function_with_argtypes_list:
3914 : : function_with_argtypes
3915 : : | function_with_argtypes_list ',' function_with_argtypes
3916 : : ;
3917 : :
3918 : :
3919 : : function_with_argtypes:
3920 : : func_name func_args
3921 : : | type_func_name_keyword
3922 : : | ColId
3923 : : | ColId indirection
3924 : : ;
3925 : :
3926 : :
3927 : : func_args_with_defaults:
3928 : : '(' func_args_with_defaults_list ')'
3929 : : | '(' ')'
3930 : : ;
3931 : :
3932 : :
3933 : : func_args_with_defaults_list:
3934 : : func_arg_with_default
3935 : : | func_args_with_defaults_list ',' func_arg_with_default
3936 : : ;
3937 : :
3938 : :
3939 : : func_arg:
3940 : : arg_class param_name func_type
3941 : : | param_name arg_class func_type
3942 : : | param_name func_type
3943 : : | arg_class func_type
3944 : : | func_type
3945 : : ;
3946 : :
3947 : :
3948 : : arg_class:
3949 : : IN_P
3950 : : | OUT_P
3951 : : | INOUT
3952 : : | IN_P OUT_P
3953 : : | VARIADIC
3954 : : ;
3955 : :
3956 : :
3957 : : param_name:
3958 : : type_function_name
3959 : : ;
3960 : :
3961 : :
3962 : : func_return:
3963 : : func_type
3964 : : ;
3965 : :
3966 : :
3967 : : func_type:
3968 : : Typename
3969 : : | type_function_name attrs '%' TYPE_P
3970 : : | SETOF type_function_name attrs '%' TYPE_P
3971 : : ;
3972 : :
3973 : :
3974 : : func_arg_with_default:
3975 : : func_arg
3976 : : | func_arg DEFAULT a_expr
3977 : : | func_arg '=' a_expr
3978 : : ;
3979 : :
3980 : :
3981 : : aggr_arg:
3982 : : func_arg
3983 : : ;
3984 : :
3985 : :
3986 : : aggr_args:
3987 : : '(' '*' ')'
3988 : : | '(' aggr_args_list ')'
3989 : : | '(' ORDER BY aggr_args_list ')'
3990 : : | '(' aggr_args_list ORDER BY aggr_args_list ')'
3991 : : ;
3992 : :
3993 : :
3994 : : aggr_args_list:
3995 : : aggr_arg
3996 : : | aggr_args_list ',' aggr_arg
3997 : : ;
3998 : :
3999 : :
4000 : : aggregate_with_argtypes:
4001 : : func_name aggr_args
4002 : : ;
4003 : :
4004 : :
4005 : : aggregate_with_argtypes_list:
4006 : : aggregate_with_argtypes
4007 : : | aggregate_with_argtypes_list ',' aggregate_with_argtypes
4008 : : ;
4009 : :
4010 : :
4011 : : opt_createfunc_opt_list:
4012 : : createfunc_opt_list
4013 : : |
4014 : : ;
4015 : :
4016 : :
4017 : : createfunc_opt_list:
4018 : : createfunc_opt_item
4019 : : | createfunc_opt_list createfunc_opt_item
4020 : : ;
4021 : :
4022 : :
4023 : : common_func_opt_item:
4024 : : CALLED ON NULL_P INPUT_P
4025 : : | RETURNS NULL_P ON NULL_P INPUT_P
4026 : : | STRICT_P
4027 : : | IMMUTABLE
4028 : : | STABLE
4029 : : | VOLATILE
4030 : : | EXTERNAL SECURITY DEFINER
4031 : : | EXTERNAL SECURITY INVOKER
4032 : : | SECURITY DEFINER
4033 : : | SECURITY INVOKER
4034 : : | LEAKPROOF
4035 : : | NOT LEAKPROOF
4036 : : | COST NumericOnly
4037 : : | ROWS NumericOnly
4038 : : | SUPPORT any_name
4039 : : | FunctionSetResetClause
4040 : : | PARALLEL ColId
4041 : : ;
4042 : :
4043 : :
4044 : : createfunc_opt_item:
4045 : : AS func_as
4046 : : | LANGUAGE NonReservedWord_or_Sconst
4047 : : | TRANSFORM transform_type_list
4048 : : | WINDOW
4049 : : | common_func_opt_item
4050 : : ;
4051 : :
4052 : :
4053 : : func_as:
4054 : : ecpg_sconst
4055 : : | ecpg_sconst ',' ecpg_sconst
4056 : : ;
4057 : :
4058 : :
4059 : : ReturnStmt:
4060 : : RETURN a_expr
4061 : : ;
4062 : :
4063 : :
4064 : : opt_routine_body:
4065 : : ReturnStmt
4066 : : | BEGIN_P ATOMIC routine_body_stmt_list END_P
4067 : : |
4068 : : ;
4069 : :
4070 : :
4071 : : routine_body_stmt_list:
4072 : : routine_body_stmt_list routine_body_stmt ';'
4073 : : |
4074 : : ;
4075 : :
4076 : :
4077 : : routine_body_stmt:
4078 : : stmt
4079 : : | ReturnStmt
4080 : : ;
4081 : :
4082 : :
4083 : : transform_type_list:
4084 : : FOR TYPE_P Typename
4085 : : | transform_type_list ',' FOR TYPE_P Typename
4086 : : ;
4087 : :
4088 : :
4089 : : opt_definition:
4090 : : WITH definition
4091 : : |
4092 : : ;
4093 : :
4094 : :
4095 : : table_func_column:
4096 : : param_name func_type
4097 : : ;
4098 : :
4099 : :
4100 : : table_func_column_list:
4101 : : table_func_column
4102 : : | table_func_column_list ',' table_func_column
4103 : : ;
4104 : :
4105 : :
4106 : : AlterFunctionStmt:
4107 : : ALTER FUNCTION function_with_argtypes alterfunc_opt_list opt_restrict
4108 : : | ALTER PROCEDURE function_with_argtypes alterfunc_opt_list opt_restrict
4109 : : | ALTER ROUTINE function_with_argtypes alterfunc_opt_list opt_restrict
4110 : : ;
4111 : :
4112 : :
4113 : : alterfunc_opt_list:
4114 : : common_func_opt_item
4115 : : | alterfunc_opt_list common_func_opt_item
4116 : : ;
4117 : :
4118 : :
4119 : : opt_restrict:
4120 : : RESTRICT
4121 : : |
4122 : : ;
4123 : :
4124 : :
4125 : : RemoveFuncStmt:
4126 : : DROP FUNCTION function_with_argtypes_list opt_drop_behavior
4127 : : | DROP FUNCTION IF_P EXISTS function_with_argtypes_list opt_drop_behavior
4128 : : | DROP PROCEDURE function_with_argtypes_list opt_drop_behavior
4129 : : | DROP PROCEDURE IF_P EXISTS function_with_argtypes_list opt_drop_behavior
4130 : : | DROP ROUTINE function_with_argtypes_list opt_drop_behavior
4131 : : | DROP ROUTINE IF_P EXISTS function_with_argtypes_list opt_drop_behavior
4132 : : ;
4133 : :
4134 : :
4135 : : RemoveAggrStmt:
4136 : : DROP AGGREGATE aggregate_with_argtypes_list opt_drop_behavior
4137 : : | DROP AGGREGATE IF_P EXISTS aggregate_with_argtypes_list opt_drop_behavior
4138 : : ;
4139 : :
4140 : :
4141 : : RemoveOperStmt:
4142 : : DROP OPERATOR operator_with_argtypes_list opt_drop_behavior
4143 : : | DROP OPERATOR IF_P EXISTS operator_with_argtypes_list opt_drop_behavior
4144 : : ;
4145 : :
4146 : :
4147 : : oper_argtypes:
4148 : : '(' Typename ')'
4149 : : | '(' Typename ',' Typename ')'
4150 : : | '(' NONE ',' Typename ')'
4151 : : | '(' Typename ',' NONE ')'
4152 : : ;
4153 : :
4154 : :
4155 : : any_operator:
4156 : : all_Op
4157 : : | ColId '.' any_operator
4158 : : ;
4159 : :
4160 : :
4161 : : operator_with_argtypes_list:
4162 : : operator_with_argtypes
4163 : : | operator_with_argtypes_list ',' operator_with_argtypes
4164 : : ;
4165 : :
4166 : :
4167 : : operator_with_argtypes:
4168 : : any_operator oper_argtypes
4169 : : ;
4170 : :
4171 : :
4172 : : DoStmt:
4173 : : DO dostmt_opt_list
4174 : : ;
4175 : :
4176 : :
4177 : : dostmt_opt_list:
4178 : : dostmt_opt_item
4179 : : | dostmt_opt_list dostmt_opt_item
4180 : : ;
4181 : :
4182 : :
4183 : : dostmt_opt_item:
4184 : : ecpg_sconst
4185 : : | LANGUAGE NonReservedWord_or_Sconst
4186 : : ;
4187 : :
4188 : :
4189 : : CreateCastStmt:
4190 : : CREATE CAST '(' Typename AS Typename ')' WITH FUNCTION function_with_argtypes cast_context
4191 : : | CREATE CAST '(' Typename AS Typename ')' WITHOUT FUNCTION cast_context
4192 : : | CREATE CAST '(' Typename AS Typename ')' WITH INOUT cast_context
4193 : : ;
4194 : :
4195 : :
4196 : : cast_context:
4197 : : AS IMPLICIT_P
4198 : : | AS ASSIGNMENT
4199 : : |
4200 : : ;
4201 : :
4202 : :
4203 : : DropCastStmt:
4204 : : DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_behavior
4205 : : ;
4206 : :
4207 : :
4208 : : opt_if_exists:
4209 : : IF_P EXISTS
4210 : : |
4211 : : ;
4212 : :
4213 : :
4214 : : CreateTransformStmt:
4215 : : CREATE opt_or_replace TRANSFORM FOR Typename LANGUAGE name '(' transform_element_list ')'
4216 : : ;
4217 : :
4218 : :
4219 : : transform_element_list:
4220 : : FROM SQL_P WITH FUNCTION function_with_argtypes ',' TO SQL_P WITH FUNCTION function_with_argtypes
4221 : : | TO SQL_P WITH FUNCTION function_with_argtypes ',' FROM SQL_P WITH FUNCTION function_with_argtypes
4222 : : | FROM SQL_P WITH FUNCTION function_with_argtypes
4223 : : | TO SQL_P WITH FUNCTION function_with_argtypes
4224 : : ;
4225 : :
4226 : :
4227 : : DropTransformStmt:
4228 : : DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_drop_behavior
4229 : : ;
4230 : :
4231 : :
4232 : : ReindexStmt:
4233 : : REINDEX opt_utility_option_list reindex_target_relation opt_concurrently qualified_name
4234 : : | REINDEX opt_utility_option_list SCHEMA opt_concurrently name
4235 : : | REINDEX opt_utility_option_list reindex_target_all opt_concurrently opt_single_name
4236 : : ;
4237 : :
4238 : :
4239 : : reindex_target_relation:
4240 : : INDEX
4241 : : | TABLE
4242 : : ;
4243 : :
4244 : :
4245 : : reindex_target_all:
4246 : : SYSTEM_P
4247 : : | DATABASE
4248 : : ;
4249 : :
4250 : :
4251 : : AlterTblSpcStmt:
4252 : : ALTER TABLESPACE name SET reloptions
4253 : : | ALTER TABLESPACE name RESET reloptions
4254 : : ;
4255 : :
4256 : :
4257 : : RenameStmt:
4258 : : ALTER AGGREGATE aggregate_with_argtypes RENAME TO name
4259 : : | ALTER COLLATION any_name RENAME TO name
4260 : : | ALTER CONVERSION_P any_name RENAME TO name
4261 : : | ALTER DATABASE name RENAME TO name
4262 : : | ALTER DOMAIN_P any_name RENAME TO name
4263 : : | ALTER DOMAIN_P any_name RENAME CONSTRAINT name TO name
4264 : : | ALTER FOREIGN DATA_P WRAPPER name RENAME TO name
4265 : : | ALTER FUNCTION function_with_argtypes RENAME TO name
4266 : : | ALTER GROUP_P RoleId RENAME TO RoleId
4267 : : | ALTER opt_procedural LANGUAGE name RENAME TO name
4268 : : | ALTER OPERATOR CLASS any_name USING name RENAME TO name
4269 : : | ALTER OPERATOR FAMILY any_name USING name RENAME TO name
4270 : : | ALTER POLICY name ON qualified_name RENAME TO name
4271 : : | ALTER POLICY IF_P EXISTS name ON qualified_name RENAME TO name
4272 : : | ALTER PROCEDURE function_with_argtypes RENAME TO name
4273 : : | ALTER PUBLICATION name RENAME TO name
4274 : : | ALTER ROUTINE function_with_argtypes RENAME TO name
4275 : : | ALTER SCHEMA name RENAME TO name
4276 : : | ALTER SERVER name RENAME TO name
4277 : : | ALTER SUBSCRIPTION name RENAME TO name
4278 : : | ALTER TABLE relation_expr RENAME TO name
4279 : : | ALTER TABLE IF_P EXISTS relation_expr RENAME TO name
4280 : : | ALTER SEQUENCE qualified_name RENAME TO name
4281 : : | ALTER SEQUENCE IF_P EXISTS qualified_name RENAME TO name
4282 : : | ALTER VIEW qualified_name RENAME TO name
4283 : : | ALTER VIEW IF_P EXISTS qualified_name RENAME TO name
4284 : : | ALTER MATERIALIZED VIEW qualified_name RENAME TO name
4285 : : | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME TO name
4286 : : | ALTER INDEX qualified_name RENAME TO name
4287 : : | ALTER INDEX IF_P EXISTS qualified_name RENAME TO name
4288 : : | ALTER FOREIGN TABLE relation_expr RENAME TO name
4289 : : | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME TO name
4290 : : | ALTER TABLE relation_expr RENAME opt_column name TO name
4291 : : | ALTER TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name
4292 : : | ALTER VIEW qualified_name RENAME opt_column name TO name
4293 : : | ALTER VIEW IF_P EXISTS qualified_name RENAME opt_column name TO name
4294 : : | ALTER MATERIALIZED VIEW qualified_name RENAME opt_column name TO name
4295 : : | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME opt_column name TO name
4296 : : | ALTER TABLE relation_expr RENAME CONSTRAINT name TO name
4297 : : | ALTER TABLE IF_P EXISTS relation_expr RENAME CONSTRAINT name TO name
4298 : : | ALTER FOREIGN TABLE relation_expr RENAME opt_column name TO name
4299 : : | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME opt_column name TO name
4300 : : | ALTER RULE name ON qualified_name RENAME TO name
4301 : : | ALTER TRIGGER name ON qualified_name RENAME TO name
4302 : : | ALTER EVENT TRIGGER name RENAME TO name
4303 : : | ALTER ROLE RoleId RENAME TO RoleId
4304 : : | ALTER USER RoleId RENAME TO RoleId
4305 : : | ALTER TABLESPACE name RENAME TO name
4306 : : | ALTER STATISTICS any_name RENAME TO name
4307 : : | ALTER TEXT_P SEARCH PARSER any_name RENAME TO name
4308 : : | ALTER TEXT_P SEARCH DICTIONARY any_name RENAME TO name
4309 : : | ALTER TEXT_P SEARCH TEMPLATE any_name RENAME TO name
4310 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name RENAME TO name
4311 : : | ALTER TYPE_P any_name RENAME TO name
4312 : : | ALTER TYPE_P any_name RENAME ATTRIBUTE name TO name opt_drop_behavior
4313 : : ;
4314 : :
4315 : :
4316 : : opt_column:
4317 : : COLUMN
4318 : : |
4319 : : ;
4320 : :
4321 : :
4322 : : opt_set_data:
4323 : : SET DATA_P
4324 : : |
4325 : : ;
4326 : :
4327 : :
4328 : : AlterObjectDependsStmt:
4329 : : ALTER FUNCTION function_with_argtypes opt_no DEPENDS ON EXTENSION name
4330 : : | ALTER PROCEDURE function_with_argtypes opt_no DEPENDS ON EXTENSION name
4331 : : | ALTER ROUTINE function_with_argtypes opt_no DEPENDS ON EXTENSION name
4332 : : | ALTER TRIGGER name ON qualified_name opt_no DEPENDS ON EXTENSION name
4333 : : | ALTER MATERIALIZED VIEW qualified_name opt_no DEPENDS ON EXTENSION name
4334 : : | ALTER INDEX qualified_name opt_no DEPENDS ON EXTENSION name
4335 : : ;
4336 : :
4337 : :
4338 : : opt_no:
4339 : : NO
4340 : : |
4341 : : ;
4342 : :
4343 : :
4344 : : AlterObjectSchemaStmt:
4345 : : ALTER AGGREGATE aggregate_with_argtypes SET SCHEMA name
4346 : : | ALTER COLLATION any_name SET SCHEMA name
4347 : : | ALTER CONVERSION_P any_name SET SCHEMA name
4348 : : | ALTER DOMAIN_P any_name SET SCHEMA name
4349 : : | ALTER EXTENSION name SET SCHEMA name
4350 : : | ALTER FUNCTION function_with_argtypes SET SCHEMA name
4351 : : | ALTER OPERATOR operator_with_argtypes SET SCHEMA name
4352 : : | ALTER OPERATOR CLASS any_name USING name SET SCHEMA name
4353 : : | ALTER OPERATOR FAMILY any_name USING name SET SCHEMA name
4354 : : | ALTER PROCEDURE function_with_argtypes SET SCHEMA name
4355 : : | ALTER ROUTINE function_with_argtypes SET SCHEMA name
4356 : : | ALTER TABLE relation_expr SET SCHEMA name
4357 : : | ALTER TABLE IF_P EXISTS relation_expr SET SCHEMA name
4358 : : | ALTER STATISTICS any_name SET SCHEMA name
4359 : : | ALTER TEXT_P SEARCH PARSER any_name SET SCHEMA name
4360 : : | ALTER TEXT_P SEARCH DICTIONARY any_name SET SCHEMA name
4361 : : | ALTER TEXT_P SEARCH TEMPLATE any_name SET SCHEMA name
4362 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name SET SCHEMA name
4363 : : | ALTER SEQUENCE qualified_name SET SCHEMA name
4364 : : | ALTER SEQUENCE IF_P EXISTS qualified_name SET SCHEMA name
4365 : : | ALTER VIEW qualified_name SET SCHEMA name
4366 : : | ALTER VIEW IF_P EXISTS qualified_name SET SCHEMA name
4367 : : | ALTER MATERIALIZED VIEW qualified_name SET SCHEMA name
4368 : : | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name SET SCHEMA name
4369 : : | ALTER FOREIGN TABLE relation_expr SET SCHEMA name
4370 : : | ALTER FOREIGN TABLE IF_P EXISTS relation_expr SET SCHEMA name
4371 : : | ALTER TYPE_P any_name SET SCHEMA name
4372 : : ;
4373 : :
4374 : :
4375 : : AlterOperatorStmt:
4376 : : ALTER OPERATOR operator_with_argtypes SET '(' operator_def_list ')'
4377 : : ;
4378 : :
4379 : :
4380 : : operator_def_list:
4381 : : operator_def_elem
4382 : : | operator_def_list ',' operator_def_elem
4383 : : ;
4384 : :
4385 : :
4386 : : operator_def_elem:
4387 : : ColLabel '=' NONE
4388 : : | ColLabel '=' operator_def_arg
4389 : : | ColLabel
4390 : : ;
4391 : :
4392 : :
4393 : : operator_def_arg:
4394 : : func_type
4395 : : | reserved_keyword
4396 : : | qual_all_Op
4397 : : | NumericOnly
4398 : : | ecpg_sconst
4399 : : ;
4400 : :
4401 : :
4402 : : AlterTypeStmt:
4403 : : ALTER TYPE_P any_name SET '(' operator_def_list ')'
4404 : : ;
4405 : :
4406 : :
4407 : : AlterOwnerStmt:
4408 : : ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec
4409 : : | ALTER COLLATION any_name OWNER TO RoleSpec
4410 : : | ALTER CONVERSION_P any_name OWNER TO RoleSpec
4411 : : | ALTER DATABASE name OWNER TO RoleSpec
4412 : : | ALTER DOMAIN_P any_name OWNER TO RoleSpec
4413 : : | ALTER FUNCTION function_with_argtypes OWNER TO RoleSpec
4414 : : | ALTER opt_procedural LANGUAGE name OWNER TO RoleSpec
4415 : : | ALTER LARGE_P OBJECT_P NumericOnly OWNER TO RoleSpec
4416 : : | ALTER OPERATOR operator_with_argtypes OWNER TO RoleSpec
4417 : : | ALTER OPERATOR CLASS any_name USING name OWNER TO RoleSpec
4418 : : | ALTER OPERATOR FAMILY any_name USING name OWNER TO RoleSpec
4419 : : | ALTER PROCEDURE function_with_argtypes OWNER TO RoleSpec
4420 : : | ALTER ROUTINE function_with_argtypes OWNER TO RoleSpec
4421 : : | ALTER SCHEMA name OWNER TO RoleSpec
4422 : : | ALTER TYPE_P any_name OWNER TO RoleSpec
4423 : : | ALTER TABLESPACE name OWNER TO RoleSpec
4424 : : | ALTER STATISTICS any_name OWNER TO RoleSpec
4425 : : | ALTER TEXT_P SEARCH DICTIONARY any_name OWNER TO RoleSpec
4426 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name OWNER TO RoleSpec
4427 : : | ALTER FOREIGN DATA_P WRAPPER name OWNER TO RoleSpec
4428 : : | ALTER SERVER name OWNER TO RoleSpec
4429 : : | ALTER EVENT TRIGGER name OWNER TO RoleSpec
4430 : : | ALTER PUBLICATION name OWNER TO RoleSpec
4431 : : | ALTER SUBSCRIPTION name OWNER TO RoleSpec
4432 : : ;
4433 : :
4434 : :
4435 : : CreatePublicationStmt:
4436 : : CREATE PUBLICATION name opt_definition
4437 : : | CREATE PUBLICATION name FOR pub_all_obj_type_list opt_definition
4438 : : | CREATE PUBLICATION name FOR pub_obj_list opt_definition
4439 : : ;
4440 : :
4441 : :
4442 : : PublicationObjSpec:
4443 : : TABLE relation_expr opt_column_list OptWhereClause
4444 : : | TABLES IN_P SCHEMA ColId
4445 : : | TABLES IN_P SCHEMA CURRENT_SCHEMA
4446 : : | ColId opt_column_list OptWhereClause
4447 : : | ColId indirection opt_column_list OptWhereClause
4448 : : | extended_relation_expr opt_column_list OptWhereClause
4449 : : | CURRENT_SCHEMA
4450 : : ;
4451 : :
4452 : :
4453 : : pub_obj_list:
4454 : : PublicationObjSpec
4455 : : | pub_obj_list ',' PublicationObjSpec
4456 : : ;
4457 : :
4458 : :
4459 : : opt_pub_except_clause:
4460 : : EXCEPT '(' TABLE pub_except_obj_list ')'
4461 : : |
4462 : : ;
4463 : :
4464 : :
4465 : : PublicationAllObjSpec:
4466 : : ALL TABLES opt_pub_except_clause
4467 : : | ALL SEQUENCES
4468 : : ;
4469 : :
4470 : :
4471 : : pub_all_obj_type_list:
4472 : : PublicationAllObjSpec
4473 : : | pub_all_obj_type_list ',' PublicationAllObjSpec
4474 : : ;
4475 : :
4476 : :
4477 : : PublicationExceptObjSpec:
4478 : : relation_expr
4479 : : ;
4480 : :
4481 : :
4482 : : pub_except_obj_list:
4483 : : PublicationExceptObjSpec
4484 : : | pub_except_obj_list ',' opt_table PublicationExceptObjSpec
4485 : : ;
4486 : :
4487 : :
4488 : : AlterPublicationStmt:
4489 : : ALTER PUBLICATION name SET definition
4490 : : | ALTER PUBLICATION name ADD_P pub_obj_list
4491 : : | ALTER PUBLICATION name SET pub_obj_list
4492 : : | ALTER PUBLICATION name SET pub_all_obj_type_list
4493 : : | ALTER PUBLICATION name DROP pub_obj_list
4494 : : ;
4495 : :
4496 : :
4497 : : CreateSubscriptionStmt:
4498 : : CREATE SUBSCRIPTION name CONNECTION ecpg_sconst PUBLICATION name_list opt_definition
4499 : : | CREATE SUBSCRIPTION name SERVER name PUBLICATION name_list opt_definition
4500 : : ;
4501 : :
4502 : :
4503 : : AlterSubscriptionStmt:
4504 : : ALTER SUBSCRIPTION name SET definition
4505 : : | ALTER SUBSCRIPTION name CONNECTION ecpg_sconst
4506 : : | ALTER SUBSCRIPTION name SERVER name
4507 : : | ALTER SUBSCRIPTION name REFRESH PUBLICATION opt_definition
4508 : : | ALTER SUBSCRIPTION name REFRESH SEQUENCES
4509 : : | ALTER SUBSCRIPTION name ADD_P PUBLICATION name_list opt_definition
4510 : : | ALTER SUBSCRIPTION name DROP PUBLICATION name_list opt_definition
4511 : : | ALTER SUBSCRIPTION name SET PUBLICATION name_list opt_definition
4512 : : | ALTER SUBSCRIPTION name ENABLE_P
4513 : : | ALTER SUBSCRIPTION name DISABLE_P
4514 : : | ALTER SUBSCRIPTION name SKIP definition
4515 : : ;
4516 : :
4517 : :
4518 : : DropSubscriptionStmt:
4519 : : DROP SUBSCRIPTION name opt_drop_behavior
4520 : : | DROP SUBSCRIPTION IF_P EXISTS name opt_drop_behavior
4521 : : ;
4522 : :
4523 : :
4524 : : RuleStmt:
4525 : : CREATE opt_or_replace RULE name AS ON event TO qualified_name where_clause DO opt_instead RuleActionList
4526 : : ;
4527 : :
4528 : :
4529 : : RuleActionList:
4530 : : NOTHING
4531 : : | RuleActionStmt
4532 : : | '(' RuleActionMulti ')'
4533 : : ;
4534 : :
4535 : :
4536 : : RuleActionMulti:
4537 : : RuleActionMulti ';' RuleActionStmtOrEmpty
4538 : : | RuleActionStmtOrEmpty
4539 : : ;
4540 : :
4541 : :
4542 : : RuleActionStmt:
4543 : : SelectStmt
4544 : : | InsertStmt
4545 : : | UpdateStmt
4546 : : | DeleteStmt
4547 : : | NotifyStmt
4548 : : ;
4549 : :
4550 : :
4551 : : RuleActionStmtOrEmpty:
4552 : : RuleActionStmt
4553 : : |
4554 : : ;
4555 : :
4556 : :
4557 : : event:
4558 : : SELECT
4559 : : | UPDATE
4560 : : | DELETE_P
4561 : : | INSERT
4562 : : ;
4563 : :
4564 : :
4565 : : opt_instead:
4566 : : INSTEAD
4567 : : | ALSO
4568 : : |
4569 : : ;
4570 : :
4571 : :
4572 : : NotifyStmt:
4573 : : NOTIFY ColId notify_payload
4574 : : ;
4575 : :
4576 : :
4577 : : notify_payload:
4578 : : ',' ecpg_sconst
4579 : : |
4580 : : ;
4581 : :
4582 : :
4583 : : ListenStmt:
4584 : : LISTEN ColId
4585 : : ;
4586 : :
4587 : :
4588 : : UnlistenStmt:
4589 : : UNLISTEN ColId
4590 : : | UNLISTEN '*'
4591 : : ;
4592 : :
4593 : :
4594 : : TransactionStmt:
4595 : : ABORT_P opt_transaction opt_transaction_chain
4596 : : | START TRANSACTION transaction_mode_list_or_empty
4597 : : | COMMIT opt_transaction opt_transaction_chain
4598 : : | ROLLBACK opt_transaction opt_transaction_chain
4599 : : | SAVEPOINT ColId
4600 : : | RELEASE SAVEPOINT ColId
4601 : : | RELEASE ColId
4602 : : | ROLLBACK opt_transaction TO SAVEPOINT ColId
4603 : : | ROLLBACK opt_transaction TO ColId
4604 : : | PREPARE TRANSACTION ecpg_sconst
4605 : : | COMMIT PREPARED ecpg_sconst
4606 : : | ROLLBACK PREPARED ecpg_sconst
4607 : : ;
4608 : :
4609 : :
4610 : : TransactionStmtLegacy:
4611 : : BEGIN_P opt_transaction transaction_mode_list_or_empty
4612 : : | END_P opt_transaction opt_transaction_chain
4613 : : ;
4614 : :
4615 : :
4616 : : opt_transaction:
4617 : : WORK
4618 : : | TRANSACTION
4619 : : |
4620 : : ;
4621 : :
4622 : :
4623 : : transaction_mode_item:
4624 : : ISOLATION LEVEL iso_level
4625 : : | READ ONLY
4626 : : | READ WRITE
4627 : : | DEFERRABLE
4628 : : | NOT DEFERRABLE
4629 : : ;
4630 : :
4631 : :
4632 : : transaction_mode_list:
4633 : : transaction_mode_item
4634 : : | transaction_mode_list ',' transaction_mode_item
4635 : : | transaction_mode_list transaction_mode_item
4636 : : ;
4637 : :
4638 : :
4639 : : transaction_mode_list_or_empty:
4640 : : transaction_mode_list
4641 : : |
4642 : : ;
4643 : :
4644 : :
4645 : : opt_transaction_chain:
4646 : : AND CHAIN
4647 : : | AND NO CHAIN
4648 : : |
4649 : : ;
4650 : :
4651 : :
4652 : : ViewStmt:
4653 : : CREATE OptTemp VIEW qualified_name opt_column_list opt_reloptions AS SelectStmt opt_check_option
4654 : : | CREATE OR REPLACE OptTemp VIEW qualified_name opt_column_list opt_reloptions AS SelectStmt opt_check_option
4655 : : | CREATE OptTemp RECURSIVE VIEW qualified_name '(' columnList ')' opt_reloptions AS SelectStmt opt_check_option
4656 : : | CREATE OR REPLACE OptTemp RECURSIVE VIEW qualified_name '(' columnList ')' opt_reloptions AS SelectStmt opt_check_option
4657 : : ;
4658 : :
4659 : :
4660 : : opt_check_option:
4661 : : WITH CHECK OPTION
4662 : : | WITH CASCADED CHECK OPTION
4663 : : | WITH LOCAL CHECK OPTION
4664 : : |
4665 : : ;
4666 : :
4667 : :
4668 : : LoadStmt:
4669 : : LOAD file_name
4670 : : ;
4671 : :
4672 : :
4673 : : CreatedbStmt:
4674 : : CREATE DATABASE name opt_with createdb_opt_list
4675 : : ;
4676 : :
4677 : :
4678 : : createdb_opt_list:
4679 : : createdb_opt_items
4680 : : |
4681 : : ;
4682 : :
4683 : :
4684 : : createdb_opt_items:
4685 : : createdb_opt_item
4686 : : | createdb_opt_items createdb_opt_item
4687 : : ;
4688 : :
4689 : :
4690 : : createdb_opt_item:
4691 : : createdb_opt_name opt_equal NumericOnly
4692 : : | createdb_opt_name opt_equal opt_boolean_or_string
4693 : : | createdb_opt_name opt_equal DEFAULT
4694 : : ;
4695 : :
4696 : :
4697 : : createdb_opt_name:
4698 : : ecpg_ident
4699 : : | CONNECTION LIMIT
4700 : : | ENCODING
4701 : : | LOCATION
4702 : : | OWNER
4703 : : | TABLESPACE
4704 : : | TEMPLATE
4705 : : ;
4706 : :
4707 : :
4708 : : opt_equal:
4709 : : '='
4710 : : |
4711 : : ;
4712 : :
4713 : :
4714 : : AlterDatabaseStmt:
4715 : : ALTER DATABASE name WITH createdb_opt_list
4716 : : | ALTER DATABASE name createdb_opt_list
4717 : : | ALTER DATABASE name SET TABLESPACE name
4718 : : | ALTER DATABASE name REFRESH COLLATION VERSION_P
4719 : : ;
4720 : :
4721 : :
4722 : : AlterDatabaseSetStmt:
4723 : : ALTER DATABASE name SetResetClause
4724 : : ;
4725 : :
4726 : :
4727 : : DropdbStmt:
4728 : : DROP DATABASE name
4729 : : | DROP DATABASE IF_P EXISTS name
4730 : : | DROP DATABASE name opt_with '(' drop_option_list ')'
4731 : : | DROP DATABASE IF_P EXISTS name opt_with '(' drop_option_list ')'
4732 : : ;
4733 : :
4734 : :
4735 : : drop_option_list:
4736 : : drop_option
4737 : : | drop_option_list ',' drop_option
4738 : : ;
4739 : :
4740 : :
4741 : : drop_option:
4742 : : FORCE
4743 : : ;
4744 : :
4745 : :
4746 : : AlterCollationStmt:
4747 : : ALTER COLLATION any_name REFRESH VERSION_P
4748 : : ;
4749 : :
4750 : :
4751 : : AlterSystemStmt:
4752 : : ALTER SYSTEM_P SET generic_set
4753 : : | ALTER SYSTEM_P RESET generic_reset
4754 : : ;
4755 : :
4756 : :
4757 : : CreateDomainStmt:
4758 : : CREATE DOMAIN_P any_name opt_as Typename ColQualList
4759 : : ;
4760 : :
4761 : :
4762 : : AlterDomainStmt:
4763 : : ALTER DOMAIN_P any_name alter_column_default
4764 : : | ALTER DOMAIN_P any_name DROP NOT NULL_P
4765 : : | ALTER DOMAIN_P any_name SET NOT NULL_P
4766 : : | ALTER DOMAIN_P any_name ADD_P DomainConstraint
4767 : : | ALTER DOMAIN_P any_name DROP CONSTRAINT name opt_drop_behavior
4768 : : | ALTER DOMAIN_P any_name DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
4769 : : | ALTER DOMAIN_P any_name VALIDATE CONSTRAINT name
4770 : : ;
4771 : :
4772 : :
4773 : : opt_as:
4774 : : AS
4775 : : |
4776 : : ;
4777 : :
4778 : :
4779 : : AlterTSDictionaryStmt:
4780 : : ALTER TEXT_P SEARCH DICTIONARY any_name definition
4781 : : ;
4782 : :
4783 : :
4784 : : AlterTSConfigurationStmt:
4785 : : ALTER TEXT_P SEARCH CONFIGURATION any_name ADD_P MAPPING FOR name_list any_with any_name_list
4786 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list any_with any_name_list
4787 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING REPLACE any_name any_with any_name
4788 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list REPLACE any_name any_with any_name
4789 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING FOR name_list
4790 : : | ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING IF_P EXISTS FOR name_list
4791 : : ;
4792 : :
4793 : :
4794 : : any_with:
4795 : : WITH
4796 : : | WITH_LA
4797 : : ;
4798 : :
4799 : :
4800 : : CreateConversionStmt:
4801 : : CREATE opt_default CONVERSION_P any_name FOR ecpg_sconst TO ecpg_sconst FROM any_name
4802 : : ;
4803 : :
4804 : :
4805 : : RepackStmt:
4806 : : REPACK opt_utility_option_list qualified_name opt_name_list USING INDEX name
4807 : : | REPACK opt_utility_option_list qualified_name opt_name_list opt_usingindex
4808 : : | REPACK opt_utility_option_list opt_usingindex
4809 : : | CLUSTER '(' utility_option_list ')' qualified_name cluster_index_specification
4810 : : | CLUSTER opt_utility_option_list
4811 : : | CLUSTER opt_verbose qualified_name cluster_index_specification
4812 : : | CLUSTER VERBOSE
4813 : : | CLUSTER opt_verbose name ON qualified_name
4814 : : ;
4815 : :
4816 : :
4817 : : cluster_index_specification:
4818 : : USING name
4819 : : |
4820 : : ;
4821 : :
4822 : :
4823 : : VacuumStmt:
4824 : : VACUUM opt_full opt_freeze opt_verbose opt_analyze opt_vacuum_relation_list
4825 : : | VACUUM '(' utility_option_list ')' opt_vacuum_relation_list
4826 : : ;
4827 : :
4828 : :
4829 : : AnalyzeStmt:
4830 : : analyze_keyword opt_utility_option_list opt_vacuum_relation_list
4831 : : | analyze_keyword VERBOSE opt_vacuum_relation_list
4832 : : ;
4833 : :
4834 : :
4835 : : analyze_keyword:
4836 : : ANALYZE
4837 : : | ANALYSE
4838 : : ;
4839 : :
4840 : :
4841 : : opt_analyze:
4842 : : analyze_keyword
4843 : : |
4844 : : ;
4845 : :
4846 : :
4847 : : opt_verbose:
4848 : : VERBOSE
4849 : : |
4850 : : ;
4851 : :
4852 : :
4853 : : opt_full:
4854 : : FULL
4855 : : |
4856 : : ;
4857 : :
4858 : :
4859 : : opt_freeze:
4860 : : FREEZE
4861 : : |
4862 : : ;
4863 : :
4864 : :
4865 : : opt_name_list:
4866 : : '(' name_list ')'
4867 : : |
4868 : : ;
4869 : :
4870 : :
4871 : : vacuum_relation:
4872 : : relation_expr opt_name_list
4873 : : ;
4874 : :
4875 : :
4876 : : vacuum_relation_list:
4877 : : vacuum_relation
4878 : : | vacuum_relation_list ',' vacuum_relation
4879 : : ;
4880 : :
4881 : :
4882 : : opt_vacuum_relation_list:
4883 : : vacuum_relation_list
4884 : : |
4885 : : ;
4886 : :
4887 : :
4888 : : ExplainStmt:
4889 : : EXPLAIN ExplainableStmt
4890 : : | EXPLAIN analyze_keyword opt_verbose ExplainableStmt
4891 : : | EXPLAIN VERBOSE ExplainableStmt
4892 : : | EXPLAIN '(' utility_option_list ')' ExplainableStmt
4893 : : ;
4894 : :
4895 : :
4896 : : ExplainableStmt:
4897 : : SelectStmt
4898 : : | InsertStmt
4899 : : | UpdateStmt
4900 : : | DeleteStmt
4901 : : | MergeStmt
4902 : : | DeclareCursorStmt
4903 : : | CreateAsStmt
4904 : : | CreateMatViewStmt
4905 : : | RefreshMatViewStmt
4906 : : | ExecuteStmt
4907 : : {
4908 : 0 : @$ = $1.name;
4909 : : }
4910 : : ;
4911 : :
4912 : :
4913 : : PrepareStmt:
4914 : : PREPARE prepared_name prep_type_clause AS PreparableStmt
4915 : : {
4916 : 6 : $$.name = @2;
4917 : 6 : $$.type = @3;
4918 : 6 : $$.stmt = @5;
4919 : : }
4920 : : | PREPARE prepared_name FROM execstring
4921 : : {
4922 : 49 : $$.name = @2;
4923 : 49 : $$.type = NULL;
4924 : 49 : $$.stmt = @4;
4925 : : }
4926 : : ;
4927 : :
4928 : :
4929 : : prep_type_clause:
4930 : : '(' type_list ')'
4931 : : |
4932 : : ;
4933 : :
4934 : :
4935 : : PreparableStmt:
4936 : : SelectStmt
4937 : : | InsertStmt
4938 : : | UpdateStmt
4939 : : | DeleteStmt
4940 : : | MergeStmt
4941 : : ;
4942 : :
4943 : :
4944 : : ExecuteStmt:
4945 : : EXECUTE prepared_name execute_param_clause execute_rest
4946 : : {
4947 : 34 : $$.name = @2;
4948 : 34 : $$.type = @3;
4949 : : }
4950 : : | CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause opt_with_data execute_rest
4951 : : {
4952 : 0 : $$.name = @$;
4953 : : }
4954 : : | CREATE OptTemp TABLE IF_P NOT EXISTS create_as_target AS EXECUTE prepared_name execute_param_clause opt_with_data execute_rest
4955 : : {
4956 : 0 : $$.name = @$;
4957 : : }
4958 : : ;
4959 : :
4960 : :
4961 : : execute_param_clause:
4962 : : '(' expr_list ')'
4963 : : |
4964 : : ;
4965 : :
4966 : :
4967 : : InsertStmt:
4968 : : opt_with_clause INSERT INTO insert_target insert_rest opt_on_conflict returning_clause
4969 : : ;
4970 : :
4971 : :
4972 : : insert_target:
4973 : : qualified_name
4974 : : | qualified_name AS ColId
4975 : : ;
4976 : :
4977 : :
4978 : : insert_rest:
4979 : : SelectStmt
4980 : : | OVERRIDING override_kind VALUE_P SelectStmt
4981 : : | '(' insert_column_list ')' SelectStmt
4982 : : | '(' insert_column_list ')' OVERRIDING override_kind VALUE_P SelectStmt
4983 : : | DEFAULT VALUES
4984 : : ;
4985 : :
4986 : :
4987 : : override_kind:
4988 : : USER
4989 : : | SYSTEM_P
4990 : : ;
4991 : :
4992 : :
4993 : : insert_column_list:
4994 : : insert_column_item
4995 : : | insert_column_list ',' insert_column_item
4996 : : ;
4997 : :
4998 : :
4999 : : insert_column_item:
5000 : : ColId opt_indirection
5001 : : ;
5002 : :
5003 : :
5004 : : opt_on_conflict:
5005 : : ON CONFLICT opt_conf_expr DO SELECT opt_for_locking_strength where_clause
5006 : : | ON CONFLICT opt_conf_expr DO UPDATE SET set_clause_list where_clause
5007 : : | ON CONFLICT opt_conf_expr DO NOTHING
5008 : : |
5009 : : ;
5010 : :
5011 : :
5012 : : opt_conf_expr:
5013 : : '(' index_params ')' where_clause
5014 : : | ON CONSTRAINT name
5015 : : |
5016 : : ;
5017 : :
5018 : :
5019 : : returning_clause:
5020 : : RETURNING returning_with_clause target_list opt_ecpg_into
5021 : : |
5022 : : ;
5023 : :
5024 : :
5025 : : returning_with_clause:
5026 : : WITH '(' returning_options ')'
5027 : : |
5028 : : ;
5029 : :
5030 : :
5031 : : returning_options:
5032 : : returning_option
5033 : : | returning_options ',' returning_option
5034 : : ;
5035 : :
5036 : :
5037 : : returning_option:
5038 : : returning_option_kind AS ColId
5039 : : ;
5040 : :
5041 : :
5042 : : returning_option_kind:
5043 : : OLD
5044 : : | NEW
5045 : : ;
5046 : :
5047 : :
5048 : : DeleteStmt:
5049 : : opt_with_clause DELETE_P FROM relation_expr_opt_alias using_clause where_or_current_clause returning_clause
5050 : : ;
5051 : :
5052 : :
5053 : : using_clause:
5054 : : USING from_list
5055 : : |
5056 : : ;
5057 : :
5058 : :
5059 : : LockStmt:
5060 : : LOCK_P opt_table relation_expr_list opt_lock opt_nowait
5061 : : ;
5062 : :
5063 : :
5064 : : opt_lock:
5065 : : IN_P lock_type MODE
5066 : : |
5067 : : ;
5068 : :
5069 : :
5070 : : lock_type:
5071 : : ACCESS SHARE
5072 : : | ROW SHARE
5073 : : | ROW EXCLUSIVE
5074 : : | SHARE UPDATE EXCLUSIVE
5075 : : | SHARE
5076 : : | SHARE ROW EXCLUSIVE
5077 : : | EXCLUSIVE
5078 : : | ACCESS EXCLUSIVE
5079 : : ;
5080 : :
5081 : :
5082 : : opt_nowait:
5083 : : NOWAIT
5084 : : |
5085 : : ;
5086 : :
5087 : :
5088 : : opt_nowait_or_skip:
5089 : : NOWAIT
5090 : : | SKIP LOCKED
5091 : : |
5092 : : ;
5093 : :
5094 : :
5095 : : UpdateStmt:
5096 : : opt_with_clause UPDATE relation_expr_opt_alias SET set_clause_list from_clause where_or_current_clause returning_clause
5097 : : ;
5098 : :
5099 : :
5100 : : set_clause_list:
5101 : : set_clause
5102 : : | set_clause_list ',' set_clause
5103 : : ;
5104 : :
5105 : :
5106 : : set_clause:
5107 : : set_target '=' a_expr
5108 : : | '(' set_target_list ')' '=' a_expr
5109 : : ;
5110 : :
5111 : :
5112 : : set_target:
5113 : : ColId opt_indirection
5114 : : ;
5115 : :
5116 : :
5117 : : set_target_list:
5118 : : set_target
5119 : : | set_target_list ',' set_target
5120 : : ;
5121 : :
5122 : :
5123 : : MergeStmt:
5124 : : opt_with_clause MERGE INTO relation_expr_opt_alias USING table_ref ON a_expr merge_when_list returning_clause
5125 : : ;
5126 : :
5127 : :
5128 : : merge_when_list:
5129 : : merge_when_clause
5130 : : | merge_when_list merge_when_clause
5131 : : ;
5132 : :
5133 : :
5134 : : merge_when_clause:
5135 : : merge_when_tgt_matched opt_merge_when_condition THEN merge_update
5136 : : | merge_when_tgt_matched opt_merge_when_condition THEN merge_delete
5137 : : | merge_when_tgt_not_matched opt_merge_when_condition THEN merge_insert
5138 : : | merge_when_tgt_matched opt_merge_when_condition THEN DO NOTHING
5139 : : | merge_when_tgt_not_matched opt_merge_when_condition THEN DO NOTHING
5140 : : ;
5141 : :
5142 : :
5143 : : merge_when_tgt_matched:
5144 : : WHEN MATCHED
5145 : : | WHEN NOT MATCHED BY SOURCE
5146 : : ;
5147 : :
5148 : :
5149 : : merge_when_tgt_not_matched:
5150 : : WHEN NOT MATCHED
5151 : : | WHEN NOT MATCHED BY TARGET
5152 : : ;
5153 : :
5154 : :
5155 : : opt_merge_when_condition:
5156 : : AND a_expr
5157 : : |
5158 : : ;
5159 : :
5160 : :
5161 : : merge_update:
5162 : : UPDATE SET set_clause_list
5163 : : ;
5164 : :
5165 : :
5166 : : merge_delete:
5167 : : DELETE_P
5168 : : ;
5169 : :
5170 : :
5171 : : merge_insert:
5172 : : INSERT merge_values_clause
5173 : : | INSERT OVERRIDING override_kind VALUE_P merge_values_clause
5174 : : | INSERT '(' insert_column_list ')' merge_values_clause
5175 : : | INSERT '(' insert_column_list ')' OVERRIDING override_kind VALUE_P merge_values_clause
5176 : : | INSERT DEFAULT VALUES
5177 : : ;
5178 : :
5179 : :
5180 : : merge_values_clause:
5181 : : VALUES '(' expr_list ')'
5182 : : ;
5183 : :
5184 : :
5185 : : DeclareCursorStmt:
5186 : : DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt
5187 : : {
5188 : : struct cursor *ptr,
5189 : : *this;
5190 [ + + ]: 22 : const char *cursor_marker = @2[0] == ':' ? "$0" : @2;
5191 : : char *comment,
5192 : : *c1,
5193 : : *c2;
5194 [ + + - + ]: 22 : int (*strcmp_fn) (const char *, const char *) = ((@2[0] == ':' || @2[0] == '"') ? strcmp : pg_strcasecmp);
5195 : :
5196 [ + + - + : 22 : if (INFORMIX_MODE && pg_strcasecmp(@2, "database") == 0)
+ + ]
5197 : 1 : mmfatal(PARSE_ERROR, "\"database\" cannot be used as cursor name in INFORMIX mode");
5198 : :
5199 [ + + ]: 33 : for (ptr = cur; ptr != NULL; ptr = ptr->next)
5200 : : {
5201 [ + + ]: 12 : if (strcmp_fn(@2, ptr->name) == 0)
5202 : : {
5203 [ + + ]: 2 : if (@2[0] == ':')
5204 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", @2 + 1);
5205 : : else
5206 : 1 : mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", @2);
5207 : : }
5208 : : }
5209 : :
5210 : 21 : this = (struct cursor *) mm_alloc(sizeof(struct cursor));
5211 : :
5212 : 21 : this->next = cur;
5213 : 21 : this->name = mm_strdup(@2);
5214 [ + - ]: 21 : this->function = (current_function ? mm_strdup(current_function) : NULL);
5215 [ + + ]: 21 : this->connection = connection ? mm_strdup(connection) : NULL;
5216 : 21 : this->opened = false;
5217 : 21 : this->command = mm_strdup(cat_str(7, "declare", cursor_marker, @3, "cursor", @5, "for", @7));
5218 : 21 : this->argsinsert = argsinsert;
5219 : 21 : this->argsinsert_oos = NULL;
5220 : 21 : this->argsresult = argsresult;
5221 : 21 : this->argsresult_oos = NULL;
5222 : 21 : argsinsert = argsresult = NULL;
5223 : 21 : cur = this;
5224 : :
5225 : 21 : c1 = loc_strdup(this->command);
5226 [ - + ]: 21 : while ((c2 = strstr(c1, "*/")) != NULL)
5227 : : {
5228 : : /* We put this text into a comment, so we better remove [*][/]. */
5229 : 0 : c2[0] = '.';
5230 : 0 : c2[1] = '.';
5231 : : }
5232 : 21 : comment = cat_str(3, "/*", c1, "*/");
5233 : :
5234 : 21 : @$ = cat2_str(adjust_outofscope_cursor_vars(this), comment);
5235 : : }
5236 : : ;
5237 : :
5238 : :
5239 : : cursor_name:
5240 : : name
5241 : : | char_civar
5242 : : {
5243 : 45 : char *curname = loc_alloc(strlen(@1) + 2);
5244 : :
5245 : 45 : sprintf(curname, ":%s", @1);
5246 : 45 : @$ = curname;
5247 : : }
5248 : : ;
5249 : :
5250 : :
5251 : : cursor_options:
5252 : :
5253 : : | cursor_options NO SCROLL
5254 : : | cursor_options SCROLL
5255 : : | cursor_options BINARY
5256 : : | cursor_options ASENSITIVE
5257 : : | cursor_options INSENSITIVE
5258 : : ;
5259 : :
5260 : :
5261 : : opt_hold:
5262 : :
5263 : : {
5264 [ - + - - ]: 43 : if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit)
5265 : 0 : @$ = "with hold";
5266 : : else
5267 : 43 : @$ = "";
5268 : : }
5269 : : | WITH HOLD
5270 : : | WITHOUT HOLD
5271 : : ;
5272 : :
5273 : :
5274 : : SelectStmt:
5275 : : select_no_parens %prec UMINUS
5276 : : | select_with_parens %prec UMINUS
5277 : : ;
5278 : :
5279 : :
5280 : : select_with_parens:
5281 : : '(' select_no_parens ')'
5282 : : | '(' select_with_parens ')'
5283 : : ;
5284 : :
5285 : :
5286 : : select_no_parens:
5287 : : simple_select
5288 : : | select_clause sort_clause
5289 : : | select_clause opt_sort_clause for_locking_clause opt_select_limit
5290 : : | select_clause opt_sort_clause select_limit opt_for_locking_clause
5291 : : | with_clause select_clause
5292 : : | with_clause select_clause sort_clause
5293 : : | with_clause select_clause opt_sort_clause for_locking_clause opt_select_limit
5294 : : | with_clause select_clause opt_sort_clause select_limit opt_for_locking_clause
5295 : : ;
5296 : :
5297 : :
5298 : : select_clause:
5299 : : simple_select
5300 : : | select_with_parens
5301 : : ;
5302 : :
5303 : :
5304 : : simple_select:
5305 : : SELECT opt_all_clause opt_target_list into_clause from_clause where_clause group_clause having_clause window_clause
5306 : : | SELECT distinct_clause target_list into_clause from_clause where_clause group_clause having_clause window_clause
5307 : : | values_clause
5308 : : | TABLE relation_expr
5309 : : | select_clause UNION set_quantifier select_clause
5310 : : | select_clause INTERSECT set_quantifier select_clause
5311 : : | select_clause EXCEPT set_quantifier select_clause
5312 : : ;
5313 : :
5314 : :
5315 : : with_clause:
5316 : : WITH cte_list
5317 : : | WITH_LA cte_list
5318 : : | WITH RECURSIVE cte_list
5319 : : ;
5320 : :
5321 : :
5322 : : cte_list:
5323 : : common_table_expr
5324 : : | cte_list ',' common_table_expr
5325 : : ;
5326 : :
5327 : :
5328 : : common_table_expr:
5329 : : name opt_name_list AS opt_materialized '(' PreparableStmt ')' opt_search_clause opt_cycle_clause
5330 : : ;
5331 : :
5332 : :
5333 : : opt_materialized:
5334 : : MATERIALIZED
5335 : : | NOT MATERIALIZED
5336 : : |
5337 : : ;
5338 : :
5339 : :
5340 : : opt_search_clause:
5341 : : SEARCH DEPTH FIRST_P BY columnList SET ColId
5342 : : | SEARCH BREADTH FIRST_P BY columnList SET ColId
5343 : : |
5344 : : ;
5345 : :
5346 : :
5347 : : opt_cycle_clause:
5348 : : CYCLE columnList SET ColId TO AexprConst DEFAULT AexprConst USING ColId
5349 : : | CYCLE columnList SET ColId USING ColId
5350 : : |
5351 : : ;
5352 : :
5353 : :
5354 : : opt_with_clause:
5355 : : with_clause
5356 : : |
5357 : : ;
5358 : :
5359 : :
5360 : : into_clause:
5361 : : INTO OptTempTableName
5362 : : {
5363 : 1 : FoundInto = 1;
5364 : 1 : @$ = cat2_str("into", @2);
5365 : : }
5366 : : | ecpg_into
5367 : : {
5368 : 93 : @$ = "";
5369 : : }
5370 : : |
5371 : : ;
5372 : :
5373 : :
5374 : : OptTempTableName:
5375 : : TEMPORARY opt_table qualified_name
5376 : : | TEMP opt_table qualified_name
5377 : : | LOCAL TEMPORARY opt_table qualified_name
5378 : : | LOCAL TEMP opt_table qualified_name
5379 : : | GLOBAL TEMPORARY opt_table qualified_name
5380 : : | GLOBAL TEMP opt_table qualified_name
5381 : : | UNLOGGED opt_table qualified_name
5382 : : | TABLE qualified_name
5383 : : | qualified_name
5384 : : ;
5385 : :
5386 : :
5387 : : opt_table:
5388 : : TABLE
5389 : : |
5390 : : ;
5391 : :
5392 : :
5393 : : set_quantifier:
5394 : : ALL
5395 : : | DISTINCT
5396 : : |
5397 : : ;
5398 : :
5399 : :
5400 : : distinct_clause:
5401 : : DISTINCT
5402 : : | DISTINCT ON '(' expr_list ')'
5403 : : ;
5404 : :
5405 : :
5406 : : opt_all_clause:
5407 : : ALL
5408 : : |
5409 : : ;
5410 : :
5411 : :
5412 : : opt_sort_clause:
5413 : : sort_clause
5414 : : |
5415 : : ;
5416 : :
5417 : :
5418 : : sort_clause:
5419 : : ORDER BY sortby_list
5420 : : ;
5421 : :
5422 : :
5423 : : sortby_list:
5424 : : sortby
5425 : : | sortby_list ',' sortby
5426 : : ;
5427 : :
5428 : :
5429 : : sortby:
5430 : : a_expr USING qual_all_Op opt_nulls_order
5431 : : | a_expr opt_asc_desc opt_nulls_order
5432 : : ;
5433 : :
5434 : :
5435 : : select_limit:
5436 : : limit_clause offset_clause
5437 : : | offset_clause limit_clause
5438 : : | limit_clause
5439 : : | offset_clause
5440 : : ;
5441 : :
5442 : :
5443 : : opt_select_limit:
5444 : : select_limit
5445 : : |
5446 : : ;
5447 : :
5448 : :
5449 : : limit_clause:
5450 : : LIMIT select_limit_value
5451 : : | LIMIT select_limit_value ',' select_offset_value
5452 : : {
5453 : 1 : mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
5454 : : }
5455 : : | FETCH first_or_next select_fetch_first_value row_or_rows ONLY
5456 : : | FETCH first_or_next select_fetch_first_value row_or_rows WITH TIES
5457 : : | FETCH first_or_next row_or_rows ONLY
5458 : : | FETCH first_or_next row_or_rows WITH TIES
5459 : : ;
5460 : :
5461 : :
5462 : : offset_clause:
5463 : : OFFSET select_offset_value
5464 : : | OFFSET select_fetch_first_value row_or_rows
5465 : : ;
5466 : :
5467 : :
5468 : : select_limit_value:
5469 : : a_expr
5470 : : | ALL
5471 : : ;
5472 : :
5473 : :
5474 : : select_offset_value:
5475 : : a_expr
5476 : : ;
5477 : :
5478 : :
5479 : : select_fetch_first_value:
5480 : : c_expr
5481 : : | '+' I_or_F_const
5482 : : | '-' I_or_F_const
5483 : : ;
5484 : :
5485 : :
5486 : : I_or_F_const:
5487 : : Iconst
5488 : : | ecpg_fconst
5489 : : ;
5490 : :
5491 : :
5492 : : row_or_rows:
5493 : : ROW
5494 : : | ROWS
5495 : : ;
5496 : :
5497 : :
5498 : : first_or_next:
5499 : : FIRST_P
5500 : : | NEXT
5501 : : ;
5502 : :
5503 : :
5504 : : group_clause:
5505 : : GROUP_P BY set_quantifier group_by_list
5506 : : |
5507 : : ;
5508 : :
5509 : :
5510 : : group_by_list:
5511 : : group_by_item
5512 : : | group_by_list ',' group_by_item
5513 : : ;
5514 : :
5515 : :
5516 : : group_by_item:
5517 : : a_expr
5518 : : | empty_grouping_set
5519 : : | cube_clause
5520 : : | rollup_clause
5521 : : | grouping_sets_clause
5522 : : ;
5523 : :
5524 : :
5525 : : empty_grouping_set:
5526 : : '(' ')'
5527 : : ;
5528 : :
5529 : :
5530 : : rollup_clause:
5531 : : ROLLUP '(' expr_list ')'
5532 : : ;
5533 : :
5534 : :
5535 : : cube_clause:
5536 : : CUBE '(' expr_list ')'
5537 : : ;
5538 : :
5539 : :
5540 : : grouping_sets_clause:
5541 : : GROUPING SETS '(' group_by_list ')'
5542 : : ;
5543 : :
5544 : :
5545 : : having_clause:
5546 : : HAVING a_expr
5547 : : |
5548 : : ;
5549 : :
5550 : :
5551 : : for_locking_clause:
5552 : : for_locking_items
5553 : : | FOR READ ONLY
5554 : : ;
5555 : :
5556 : :
5557 : : opt_for_locking_clause:
5558 : : for_locking_clause
5559 : : |
5560 : : ;
5561 : :
5562 : :
5563 : : for_locking_items:
5564 : : for_locking_item
5565 : : | for_locking_items for_locking_item
5566 : : ;
5567 : :
5568 : :
5569 : : for_locking_item:
5570 : : for_locking_strength locked_rels_list opt_nowait_or_skip
5571 : : ;
5572 : :
5573 : :
5574 : : for_locking_strength:
5575 : : FOR UPDATE
5576 : : | FOR NO KEY UPDATE
5577 : : | FOR SHARE
5578 : : | FOR KEY SHARE
5579 : : ;
5580 : :
5581 : :
5582 : : opt_for_locking_strength:
5583 : : for_locking_strength
5584 : : |
5585 : : ;
5586 : :
5587 : :
5588 : : locked_rels_list:
5589 : : OF qualified_name_list
5590 : : |
5591 : : ;
5592 : :
5593 : :
5594 : : values_clause:
5595 : : VALUES '(' expr_list ')'
5596 : : | values_clause ',' '(' expr_list ')'
5597 : : ;
5598 : :
5599 : :
5600 : : from_clause:
5601 : : FROM from_list
5602 : : |
5603 : : ;
5604 : :
5605 : :
5606 : : from_list:
5607 : : table_ref
5608 : : | from_list ',' table_ref
5609 : : ;
5610 : :
5611 : :
5612 : : table_ref:
5613 : : relation_expr opt_alias_clause
5614 : : | relation_expr opt_alias_clause tablesample_clause
5615 : : | func_table func_alias_clause
5616 : : | LATERAL_P func_table func_alias_clause
5617 : : | xmltable opt_alias_clause
5618 : : | LATERAL_P xmltable opt_alias_clause
5619 : : | select_with_parens opt_alias_clause
5620 : : | LATERAL_P select_with_parens opt_alias_clause
5621 : : | joined_table
5622 : : | '(' joined_table ')' alias_clause
5623 : : | json_table opt_alias_clause
5624 : : | LATERAL_P json_table opt_alias_clause
5625 : : ;
5626 : :
5627 : :
5628 : : joined_table:
5629 : : '(' joined_table ')'
5630 : : | table_ref CROSS JOIN table_ref
5631 : : | table_ref join_type JOIN table_ref join_qual
5632 : : | table_ref JOIN table_ref join_qual
5633 : : | table_ref NATURAL join_type JOIN table_ref
5634 : : | table_ref NATURAL JOIN table_ref
5635 : : ;
5636 : :
5637 : :
5638 : : alias_clause:
5639 : : AS ColId '(' name_list ')'
5640 : : | AS ColId
5641 : : | ColId '(' name_list ')'
5642 : : | ColId
5643 : : ;
5644 : :
5645 : :
5646 : : opt_alias_clause:
5647 : : alias_clause
5648 : : |
5649 : : ;
5650 : :
5651 : :
5652 : : opt_alias_clause_for_join_using:
5653 : : AS ColId
5654 : : |
5655 : : ;
5656 : :
5657 : :
5658 : : func_alias_clause:
5659 : : alias_clause
5660 : : | AS '(' TableFuncElementList ')'
5661 : : | AS ColId '(' TableFuncElementList ')'
5662 : : | ColId '(' TableFuncElementList ')'
5663 : : |
5664 : : ;
5665 : :
5666 : :
5667 : : join_type:
5668 : : FULL opt_outer
5669 : : | LEFT opt_outer
5670 : : | RIGHT opt_outer
5671 : : | INNER_P
5672 : : ;
5673 : :
5674 : :
5675 : : opt_outer:
5676 : : OUTER_P
5677 : : |
5678 : : ;
5679 : :
5680 : :
5681 : : join_qual:
5682 : : USING '(' name_list ')' opt_alias_clause_for_join_using
5683 : : | ON a_expr
5684 : : ;
5685 : :
5686 : :
5687 : : relation_expr:
5688 : : qualified_name
5689 : : | extended_relation_expr
5690 : : ;
5691 : :
5692 : :
5693 : : extended_relation_expr:
5694 : : qualified_name '*'
5695 : : | ONLY qualified_name
5696 : : | ONLY '(' qualified_name ')'
5697 : : ;
5698 : :
5699 : :
5700 : : relation_expr_list:
5701 : : relation_expr
5702 : : | relation_expr_list ',' relation_expr
5703 : : ;
5704 : :
5705 : :
5706 : : relation_expr_opt_alias:
5707 : : relation_expr %prec UMINUS
5708 : : | relation_expr ColId
5709 : : | relation_expr AS ColId
5710 : : ;
5711 : :
5712 : :
5713 : : tablesample_clause:
5714 : : TABLESAMPLE func_name '(' expr_list ')' opt_repeatable_clause
5715 : : ;
5716 : :
5717 : :
5718 : : opt_repeatable_clause:
5719 : : REPEATABLE '(' a_expr ')'
5720 : : |
5721 : : ;
5722 : :
5723 : :
5724 : : func_table:
5725 : : func_expr_windowless opt_ordinality
5726 : : | ROWS FROM '(' rowsfrom_list ')' opt_ordinality
5727 : : ;
5728 : :
5729 : :
5730 : : rowsfrom_item:
5731 : : func_expr_windowless opt_col_def_list
5732 : : ;
5733 : :
5734 : :
5735 : : rowsfrom_list:
5736 : : rowsfrom_item
5737 : : | rowsfrom_list ',' rowsfrom_item
5738 : : ;
5739 : :
5740 : :
5741 : : opt_col_def_list:
5742 : : AS '(' TableFuncElementList ')'
5743 : : |
5744 : : ;
5745 : :
5746 : :
5747 : : opt_ordinality:
5748 : : WITH_LA ORDINALITY
5749 : : |
5750 : : ;
5751 : :
5752 : :
5753 : : where_clause:
5754 : : WHERE a_expr
5755 : : |
5756 : : ;
5757 : :
5758 : :
5759 : : where_or_current_clause:
5760 : : WHERE a_expr
5761 : : | WHERE CURRENT_P OF cursor_name
5762 : : {
5763 [ # # ]: 0 : const char *cursor_marker = @4[0] == ':' ? "$0" : @4;
5764 : :
5765 : 0 : @$ = cat_str(2, "where current of", cursor_marker);
5766 : : }
5767 : : |
5768 : : ;
5769 : :
5770 : :
5771 : : OptTableFuncElementList:
5772 : : TableFuncElementList
5773 : : |
5774 : : ;
5775 : :
5776 : :
5777 : : TableFuncElementList:
5778 : : TableFuncElement
5779 : : | TableFuncElementList ',' TableFuncElement
5780 : : ;
5781 : :
5782 : :
5783 : : TableFuncElement:
5784 : : ColId Typename opt_collate_clause
5785 : : ;
5786 : :
5787 : :
5788 : : xmltable:
5789 : : XMLTABLE '(' c_expr xmlexists_argument COLUMNS xmltable_column_list ')'
5790 : : | XMLTABLE '(' XMLNAMESPACES '(' xml_namespace_list ')' ',' c_expr xmlexists_argument COLUMNS xmltable_column_list ')'
5791 : : ;
5792 : :
5793 : :
5794 : : xmltable_column_list:
5795 : : xmltable_column_el
5796 : : | xmltable_column_list ',' xmltable_column_el
5797 : : ;
5798 : :
5799 : :
5800 : : xmltable_column_el:
5801 : : ColId Typename
5802 : : | ColId Typename xmltable_column_option_list
5803 : : | ColId FOR ORDINALITY
5804 : : ;
5805 : :
5806 : :
5807 : : xmltable_column_option_list:
5808 : : xmltable_column_option_el
5809 : : | xmltable_column_option_list xmltable_column_option_el
5810 : : ;
5811 : :
5812 : :
5813 : : xmltable_column_option_el:
5814 : : ecpg_ident b_expr
5815 : : | DEFAULT b_expr
5816 : : | NOT NULL_P
5817 : : | NULL_P
5818 : : | PATH b_expr
5819 : : ;
5820 : :
5821 : :
5822 : : xml_namespace_list:
5823 : : xml_namespace_el
5824 : : | xml_namespace_list ',' xml_namespace_el
5825 : : ;
5826 : :
5827 : :
5828 : : xml_namespace_el:
5829 : : b_expr AS ColLabel
5830 : : | DEFAULT b_expr
5831 : : ;
5832 : :
5833 : :
5834 : : json_table:
5835 : : JSON_TABLE '(' json_value_expr ',' a_expr json_table_path_name_opt json_passing_clause_opt COLUMNS '(' json_table_column_definition_list ')' json_table_plan_clause_opt json_on_error_clause_opt ')'
5836 : : ;
5837 : :
5838 : :
5839 : : json_table_path_name_opt:
5840 : : AS name
5841 : : |
5842 : : ;
5843 : :
5844 : :
5845 : : json_table_column_definition_list:
5846 : : json_table_column_definition
5847 : : | json_table_column_definition_list ',' json_table_column_definition
5848 : : ;
5849 : :
5850 : :
5851 : : json_table_column_definition:
5852 : : ColId FOR ORDINALITY
5853 : : | ColId Typename json_table_column_path_clause_opt json_wrapper_behavior json_quotes_clause_opt json_behavior_clause_opt
5854 : : | ColId Typename json_format_clause json_table_column_path_clause_opt json_wrapper_behavior json_quotes_clause_opt json_behavior_clause_opt
5855 : : | ColId Typename EXISTS json_table_column_path_clause_opt json_on_error_clause_opt
5856 : : | NESTED path_opt ecpg_sconst COLUMNS '(' json_table_column_definition_list ')'
5857 : : | NESTED path_opt ecpg_sconst AS name COLUMNS '(' json_table_column_definition_list ')'
5858 : : ;
5859 : :
5860 : :
5861 : : path_opt:
5862 : : PATH
5863 : : |
5864 : : ;
5865 : :
5866 : :
5867 : : json_table_column_path_clause_opt:
5868 : : PATH ecpg_sconst
5869 : : |
5870 : : ;
5871 : :
5872 : :
5873 : : json_table_plan_clause_opt:
5874 : : PLAN '(' json_table_plan ')'
5875 : : | PLAN DEFAULT '(' json_table_default_plan_choices ')'
5876 : : |
5877 : : ;
5878 : :
5879 : :
5880 : : json_table_plan:
5881 : : json_table_plan_simple
5882 : : | json_table_plan_outer
5883 : : | json_table_plan_inner
5884 : : | json_table_plan_union
5885 : : | json_table_plan_cross
5886 : : ;
5887 : :
5888 : :
5889 : : json_table_plan_simple:
5890 : : name
5891 : : ;
5892 : :
5893 : :
5894 : : json_table_plan_outer:
5895 : : json_table_plan_simple OUTER_P json_table_plan_primary
5896 : : ;
5897 : :
5898 : :
5899 : : json_table_plan_inner:
5900 : : json_table_plan_simple INNER_P json_table_plan_primary
5901 : : ;
5902 : :
5903 : :
5904 : : json_table_plan_union:
5905 : : json_table_plan_primary UNION json_table_plan_primary
5906 : : | json_table_plan_union UNION json_table_plan_primary
5907 : : ;
5908 : :
5909 : :
5910 : : json_table_plan_cross:
5911 : : json_table_plan_primary CROSS json_table_plan_primary
5912 : : | json_table_plan_cross CROSS json_table_plan_primary
5913 : : ;
5914 : :
5915 : :
5916 : : json_table_plan_primary:
5917 : : json_table_plan_simple
5918 : : | '(' json_table_plan ')'
5919 : : ;
5920 : :
5921 : :
5922 : : json_table_default_plan_choices:
5923 : : json_table_default_plan_inner_outer
5924 : : | json_table_default_plan_union_cross
5925 : : | json_table_default_plan_inner_outer ',' json_table_default_plan_union_cross
5926 : : | json_table_default_plan_union_cross ',' json_table_default_plan_inner_outer
5927 : : ;
5928 : :
5929 : :
5930 : : json_table_default_plan_inner_outer:
5931 : : INNER_P
5932 : : | OUTER_P
5933 : : ;
5934 : :
5935 : :
5936 : : json_table_default_plan_union_cross:
5937 : : UNION
5938 : : | CROSS
5939 : : ;
5940 : :
5941 : :
5942 : : Typename:
5943 : : SimpleTypename opt_array_bounds
5944 : : {
5945 : 193 : @$ = cat2_str(@1, $2.str);
5946 : : }
5947 : : | SETOF SimpleTypename opt_array_bounds
5948 : : {
5949 : 0 : @$ = cat_str(3, "setof", @2, $3.str);
5950 : : }
5951 : : | SimpleTypename ARRAY '[' Iconst ']'
5952 : : | SETOF SimpleTypename ARRAY '[' Iconst ']'
5953 : : | SimpleTypename ARRAY
5954 : : | SETOF SimpleTypename ARRAY
5955 : : ;
5956 : :
5957 : :
5958 : : opt_array_bounds:
5959 : : opt_array_bounds '[' ']'
5960 : : {
5961 : 3 : $$.index1 = $1.index1;
5962 : 3 : $$.index2 = $1.index2;
5963 [ + - ]: 3 : if (strcmp($$.index1, "-1") == 0)
5964 : 3 : $$.index1 = "0";
5965 [ # # ]: 0 : else if (strcmp($1.index2, "-1") == 0)
5966 : 0 : $$.index2 = "0";
5967 : 3 : $$.str = cat_str(2, $1.str, "[]");
5968 : : }
5969 : : | opt_array_bounds '[' Iresult ']'
5970 : : {
5971 : 126 : $$.index1 = $1.index1;
5972 : 126 : $$.index2 = $1.index2;
5973 [ + + ]: 126 : if (strcmp($1.index1, "-1") == 0)
5974 : 114 : $$.index1 = @3;
5975 [ + - ]: 12 : else if (strcmp($1.index2, "-1") == 0)
5976 : 12 : $$.index2 = @3;
5977 : 126 : $$.str = cat_str(4, $1.str, "[", @3, "]");
5978 : : }
5979 : : |
5980 : : {
5981 : 589 : $$.index1 = "-1";
5982 : 589 : $$.index2 = "-1";
5983 : 589 : $$.str = "";
5984 : : }
5985 : : ;
5986 : :
5987 : :
5988 : : SimpleTypename:
5989 : : GenericType
5990 : : | Numeric
5991 : : | Bit
5992 : : | Character
5993 : : | ConstDatetime
5994 : : | ConstInterval opt_interval
5995 : : | ConstInterval '(' Iconst ')'
5996 : : | JsonType
5997 : : ;
5998 : :
5999 : :
6000 : : ConstTypename:
6001 : : Numeric
6002 : : | ConstBit
6003 : : | ConstCharacter
6004 : : | ConstDatetime
6005 : : | JsonType
6006 : : ;
6007 : :
6008 : :
6009 : : GenericType:
6010 : : type_function_name opt_type_modifiers
6011 : : | type_function_name attrs opt_type_modifiers
6012 : : ;
6013 : :
6014 : :
6015 : : opt_type_modifiers:
6016 : : '(' expr_list ')'
6017 : : |
6018 : : ;
6019 : :
6020 : :
6021 : : Numeric:
6022 : : INT_P
6023 : : | INTEGER
6024 : : | SMALLINT
6025 : : | BIGINT
6026 : : | REAL
6027 : : | FLOAT_P opt_float
6028 : : | DOUBLE_P PRECISION
6029 : : | DECIMAL_P opt_type_modifiers
6030 : : | DEC opt_type_modifiers
6031 : : | NUMERIC opt_type_modifiers
6032 : : | BOOLEAN_P
6033 : : ;
6034 : :
6035 : :
6036 : : opt_float:
6037 : : '(' Iconst ')'
6038 : : |
6039 : : ;
6040 : :
6041 : :
6042 : : Bit:
6043 : : BitWithLength
6044 : : | BitWithoutLength
6045 : : ;
6046 : :
6047 : :
6048 : : ConstBit:
6049 : : BitWithLength
6050 : : | BitWithoutLength
6051 : : ;
6052 : :
6053 : :
6054 : : BitWithLength:
6055 : : BIT opt_varying '(' expr_list ')'
6056 : : ;
6057 : :
6058 : :
6059 : : BitWithoutLength:
6060 : : BIT opt_varying
6061 : : ;
6062 : :
6063 : :
6064 : : Character:
6065 : : CharacterWithLength
6066 : : | CharacterWithoutLength
6067 : : ;
6068 : :
6069 : :
6070 : : ConstCharacter:
6071 : : CharacterWithLength
6072 : : | CharacterWithoutLength
6073 : : ;
6074 : :
6075 : :
6076 : : CharacterWithLength:
6077 : : character '(' Iconst ')'
6078 : : ;
6079 : :
6080 : :
6081 : : CharacterWithoutLength:
6082 : : character
6083 : : ;
6084 : :
6085 : :
6086 : : character:
6087 : : CHARACTER opt_varying
6088 : : | CHAR_P opt_varying
6089 : : | VARCHAR
6090 : : | NATIONAL CHARACTER opt_varying
6091 : : | NATIONAL CHAR_P opt_varying
6092 : : | NCHAR opt_varying
6093 : : ;
6094 : :
6095 : :
6096 : : opt_varying:
6097 : : VARYING
6098 : : |
6099 : : ;
6100 : :
6101 : :
6102 : : ConstDatetime:
6103 : : TIMESTAMP '(' Iconst ')' opt_timezone
6104 : : | TIMESTAMP opt_timezone
6105 : : | TIME '(' Iconst ')' opt_timezone
6106 : : | TIME opt_timezone
6107 : : ;
6108 : :
6109 : :
6110 : : ConstInterval:
6111 : : INTERVAL
6112 : : ;
6113 : :
6114 : :
6115 : : opt_timezone:
6116 : : WITH_LA TIME ZONE
6117 : : | WITHOUT_LA TIME ZONE
6118 : : |
6119 : : ;
6120 : :
6121 : :
6122 : : opt_interval:
6123 : : YEAR_P
6124 : : | MONTH_P
6125 : : | DAY_P
6126 : : | HOUR_P
6127 : : | MINUTE_P
6128 : : | interval_second
6129 : : | YEAR_P TO MONTH_P
6130 : : | DAY_P TO HOUR_P
6131 : : | DAY_P TO MINUTE_P
6132 : : | DAY_P TO interval_second
6133 : : | HOUR_P TO MINUTE_P
6134 : : | HOUR_P TO interval_second
6135 : : | MINUTE_P TO interval_second
6136 : : |
6137 : : ;
6138 : :
6139 : :
6140 : : interval_second:
6141 : : SECOND_P
6142 : : | SECOND_P '(' Iconst ')'
6143 : : ;
6144 : :
6145 : :
6146 : : JsonType:
6147 : : JSON
6148 : : ;
6149 : :
6150 : :
6151 : : a_expr:
6152 : : c_expr
6153 : : | a_expr TYPECAST Typename
6154 : : | a_expr COLLATE any_name
6155 : : | a_expr AT TIME ZONE a_expr %prec AT
6156 : : | a_expr AT LOCAL %prec AT
6157 : : | '+' a_expr %prec UMINUS
6158 : : | '-' a_expr %prec UMINUS
6159 : : | a_expr '+' a_expr
6160 : : | a_expr '-' a_expr
6161 : : | a_expr '*' a_expr
6162 : : | a_expr '/' a_expr
6163 : : | a_expr '%' a_expr
6164 : : | a_expr '^' a_expr
6165 : : | a_expr '<' a_expr
6166 : : | a_expr '>' a_expr
6167 : : | a_expr '=' a_expr
6168 : : | a_expr LESS_EQUALS a_expr
6169 : : | a_expr GREATER_EQUALS a_expr
6170 : : | a_expr NOT_EQUALS a_expr
6171 : : | a_expr qual_Op a_expr %prec Op
6172 : : | qual_Op a_expr %prec Op
6173 : : | a_expr AND a_expr
6174 : : | a_expr OR a_expr
6175 : : | NOT a_expr
6176 : : | NOT_LA a_expr %prec NOT
6177 : : | a_expr LIKE a_expr
6178 : : | a_expr LIKE a_expr ESCAPE a_expr %prec LIKE
6179 : : | a_expr NOT_LA LIKE a_expr %prec NOT_LA
6180 : : | a_expr NOT_LA LIKE a_expr ESCAPE a_expr %prec NOT_LA
6181 : : | a_expr ILIKE a_expr
6182 : : | a_expr ILIKE a_expr ESCAPE a_expr %prec ILIKE
6183 : : | a_expr NOT_LA ILIKE a_expr %prec NOT_LA
6184 : : | a_expr NOT_LA ILIKE a_expr ESCAPE a_expr %prec NOT_LA
6185 : : | a_expr SIMILAR TO a_expr %prec SIMILAR
6186 : : | a_expr SIMILAR TO a_expr ESCAPE a_expr %prec SIMILAR
6187 : : | a_expr NOT_LA SIMILAR TO a_expr %prec NOT_LA
6188 : : | a_expr NOT_LA SIMILAR TO a_expr ESCAPE a_expr %prec NOT_LA
6189 : : | a_expr IS NULL_P %prec IS
6190 : : | a_expr ISNULL
6191 : : | a_expr IS NOT NULL_P %prec IS
6192 : : | a_expr NOTNULL
6193 : : | row OVERLAPS row
6194 : : | a_expr IS TRUE_P %prec IS
6195 : : | a_expr IS NOT TRUE_P %prec IS
6196 : : | a_expr IS FALSE_P %prec IS
6197 : : | a_expr IS NOT FALSE_P %prec IS
6198 : : | a_expr IS UNKNOWN %prec IS
6199 : : | a_expr IS NOT UNKNOWN %prec IS
6200 : : | a_expr IS DISTINCT FROM a_expr %prec IS
6201 : : | a_expr IS NOT DISTINCT FROM a_expr %prec IS
6202 : : | a_expr BETWEEN opt_asymmetric b_expr AND a_expr %prec BETWEEN
6203 : : | a_expr NOT_LA BETWEEN opt_asymmetric b_expr AND a_expr %prec NOT_LA
6204 : : | a_expr BETWEEN SYMMETRIC b_expr AND a_expr %prec BETWEEN
6205 : : | a_expr NOT_LA BETWEEN SYMMETRIC b_expr AND a_expr %prec NOT_LA
6206 : : | a_expr IN_P select_with_parens
6207 : : | a_expr IN_P '(' expr_list ')'
6208 : : | a_expr NOT_LA IN_P select_with_parens %prec NOT_LA
6209 : : | a_expr NOT_LA IN_P '(' expr_list ')'
6210 : : | a_expr subquery_Op sub_type select_with_parens %prec Op
6211 : : | a_expr subquery_Op sub_type '(' a_expr ')' %prec Op
6212 : : | UNIQUE opt_unique_null_treatment select_with_parens
6213 : : {
6214 : 0 : mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");
6215 : : }
6216 : : | a_expr IS DOCUMENT_P %prec IS
6217 : : | a_expr IS NOT DOCUMENT_P %prec IS
6218 : : | a_expr IS NORMALIZED %prec IS
6219 : : | a_expr IS unicode_normal_form NORMALIZED %prec IS
6220 : : | a_expr IS NOT NORMALIZED %prec IS
6221 : : | a_expr IS NOT unicode_normal_form NORMALIZED %prec IS
6222 : : | a_expr IS json_predicate_type_constraint json_key_uniqueness_constraint_opt %prec IS
6223 : : | a_expr IS NOT json_predicate_type_constraint json_key_uniqueness_constraint_opt %prec IS
6224 : : | DEFAULT
6225 : : ;
6226 : :
6227 : :
6228 : : b_expr:
6229 : : c_expr
6230 : : | b_expr TYPECAST Typename
6231 : : | '+' b_expr %prec UMINUS
6232 : : | '-' b_expr %prec UMINUS
6233 : : | b_expr '+' b_expr
6234 : : | b_expr '-' b_expr
6235 : : | b_expr '*' b_expr
6236 : : | b_expr '/' b_expr
6237 : : | b_expr '%' b_expr
6238 : : | b_expr '^' b_expr
6239 : : | b_expr '<' b_expr
6240 : : | b_expr '>' b_expr
6241 : : | b_expr '=' b_expr
6242 : : | b_expr LESS_EQUALS b_expr
6243 : : | b_expr GREATER_EQUALS b_expr
6244 : : | b_expr NOT_EQUALS b_expr
6245 : : | b_expr qual_Op b_expr %prec Op
6246 : : | qual_Op b_expr %prec Op
6247 : : | b_expr IS DISTINCT FROM b_expr %prec IS
6248 : : | b_expr IS NOT DISTINCT FROM b_expr %prec IS
6249 : : | b_expr IS DOCUMENT_P %prec IS
6250 : : | b_expr IS NOT DOCUMENT_P %prec IS
6251 : : ;
6252 : :
6253 : :
6254 : : c_expr:
6255 : : columnref
6256 : : | AexprConst
6257 : : | ecpg_param opt_indirection
6258 : : | '(' a_expr ')' opt_indirection
6259 : : | case_expr
6260 : : | func_expr
6261 : : | select_with_parens %prec UMINUS
6262 : : | select_with_parens indirection
6263 : : | EXISTS select_with_parens
6264 : : | ARRAY select_with_parens
6265 : : | ARRAY array_expr
6266 : : | explicit_row
6267 : : | implicit_row
6268 : : | GROUPING '(' expr_list ')'
6269 : : ;
6270 : :
6271 : :
6272 : : func_application:
6273 : : func_name '(' ')'
6274 : : | func_name '(' func_arg_list opt_sort_clause ')'
6275 : : | func_name '(' VARIADIC func_arg_expr opt_sort_clause ')'
6276 : : | func_name '(' func_arg_list ',' VARIADIC func_arg_expr opt_sort_clause ')'
6277 : : | func_name '(' ALL func_arg_list opt_sort_clause ')'
6278 : : | func_name '(' DISTINCT func_arg_list opt_sort_clause ')'
6279 : : | func_name '(' '*' ')'
6280 : : ;
6281 : :
6282 : :
6283 : : func_expr:
6284 : : func_application within_group_clause filter_clause null_treatment over_clause
6285 : : | json_aggregate_func filter_clause over_clause
6286 : : | func_expr_common_subexpr
6287 : : ;
6288 : :
6289 : :
6290 : : func_expr_windowless:
6291 : : func_application
6292 : : | func_expr_common_subexpr
6293 : : | json_aggregate_func
6294 : : ;
6295 : :
6296 : :
6297 : : func_expr_common_subexpr:
6298 : : COLLATION FOR '(' a_expr ')'
6299 : : | CURRENT_DATE
6300 : : | CURRENT_TIME
6301 : : | CURRENT_TIME '(' Iconst ')'
6302 : : | CURRENT_TIMESTAMP
6303 : : | CURRENT_TIMESTAMP '(' Iconst ')'
6304 : : | LOCALTIME
6305 : : | LOCALTIME '(' Iconst ')'
6306 : : | LOCALTIMESTAMP
6307 : : | LOCALTIMESTAMP '(' Iconst ')'
6308 : : | CURRENT_ROLE
6309 : : | CURRENT_USER
6310 : : | SESSION_USER
6311 : : | SYSTEM_USER
6312 : : | USER
6313 : : | CURRENT_CATALOG
6314 : : | CURRENT_SCHEMA
6315 : : | CAST '(' a_expr AS Typename ')'
6316 : : | EXTRACT '(' extract_list ')'
6317 : : | NORMALIZE '(' a_expr ')'
6318 : : | NORMALIZE '(' a_expr ',' unicode_normal_form ')'
6319 : : | OVERLAY '(' overlay_list ')'
6320 : : | OVERLAY '(' func_arg_list_opt ')'
6321 : : | POSITION '(' position_list ')'
6322 : : | SUBSTRING '(' substr_list ')'
6323 : : | SUBSTRING '(' func_arg_list_opt ')'
6324 : : | TREAT '(' a_expr AS Typename ')'
6325 : : | TRIM '(' BOTH trim_list ')'
6326 : : | TRIM '(' LEADING trim_list ')'
6327 : : | TRIM '(' TRAILING trim_list ')'
6328 : : | TRIM '(' trim_list ')'
6329 : : | NULLIF '(' a_expr ',' a_expr ')'
6330 : : | COALESCE '(' expr_list ')'
6331 : : | GREATEST '(' expr_list ')'
6332 : : | LEAST '(' expr_list ')'
6333 : : | XMLCONCAT '(' expr_list ')'
6334 : : | XMLELEMENT '(' NAME_P ColLabel ')'
6335 : : | XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ')'
6336 : : | XMLELEMENT '(' NAME_P ColLabel ',' expr_list ')'
6337 : : | XMLELEMENT '(' NAME_P ColLabel ',' xml_attributes ',' expr_list ')'
6338 : : | XMLEXISTS '(' c_expr xmlexists_argument ')'
6339 : : | XMLFOREST '(' labeled_expr_list ')'
6340 : : | XMLPARSE '(' document_or_content a_expr xml_whitespace_option ')'
6341 : : | XMLPI '(' NAME_P ColLabel ')'
6342 : : | XMLPI '(' NAME_P ColLabel ',' a_expr ')'
6343 : : | XMLROOT '(' a_expr ',' xml_root_version opt_xml_root_standalone ')'
6344 : : | XMLSERIALIZE '(' document_or_content a_expr AS SimpleTypename xml_indent_option ')'
6345 : : | JSON_OBJECT '(' func_arg_list ')'
6346 : : | JSON_OBJECT '(' json_name_and_value_list json_object_constructor_null_clause_opt json_key_uniqueness_constraint_opt json_returning_clause_opt ')'
6347 : : | JSON_OBJECT '(' json_returning_clause_opt ')'
6348 : : | JSON_ARRAY '(' json_value_expr_list json_array_constructor_null_clause_opt json_returning_clause_opt ')'
6349 : : | JSON_ARRAY '(' select_no_parens json_format_clause_opt json_returning_clause_opt ')'
6350 : : | JSON_ARRAY '(' json_returning_clause_opt ')'
6351 : : | JSON '(' json_value_expr json_key_uniqueness_constraint_opt ')'
6352 : : | JSON_SCALAR '(' a_expr ')'
6353 : : | JSON_SERIALIZE '(' json_value_expr json_returning_clause_opt ')'
6354 : : | MERGE_ACTION '(' ')'
6355 : : | 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 ')'
6356 : : | JSON_EXISTS '(' json_value_expr ',' a_expr json_passing_clause_opt json_on_error_clause_opt ')'
6357 : : | JSON_VALUE '(' json_value_expr ',' a_expr json_passing_clause_opt json_returning_clause_opt json_behavior_clause_opt ')'
6358 : : ;
6359 : :
6360 : :
6361 : : xml_root_version:
6362 : : VERSION_P a_expr
6363 : : | VERSION_P NO VALUE_P
6364 : : ;
6365 : :
6366 : :
6367 : : opt_xml_root_standalone:
6368 : : ',' STANDALONE_P YES_P
6369 : : | ',' STANDALONE_P NO
6370 : : | ',' STANDALONE_P NO VALUE_P
6371 : : |
6372 : : ;
6373 : :
6374 : :
6375 : : xml_attributes:
6376 : : XMLATTRIBUTES '(' labeled_expr_list ')'
6377 : : ;
6378 : :
6379 : :
6380 : : labeled_expr_list:
6381 : : labeled_expr
6382 : : | labeled_expr_list ',' labeled_expr
6383 : : ;
6384 : :
6385 : :
6386 : : labeled_expr:
6387 : : a_expr AS ColLabel
6388 : : | a_expr
6389 : : ;
6390 : :
6391 : :
6392 : : document_or_content:
6393 : : DOCUMENT_P
6394 : : | CONTENT_P
6395 : : ;
6396 : :
6397 : :
6398 : : xml_indent_option:
6399 : : INDENT
6400 : : | NO INDENT
6401 : : |
6402 : : ;
6403 : :
6404 : :
6405 : : xml_whitespace_option:
6406 : : PRESERVE WHITESPACE_P
6407 : : | STRIP_P WHITESPACE_P
6408 : : |
6409 : : ;
6410 : :
6411 : :
6412 : : xmlexists_argument:
6413 : : PASSING c_expr
6414 : : | PASSING c_expr xml_passing_mech
6415 : : | PASSING xml_passing_mech c_expr
6416 : : | PASSING xml_passing_mech c_expr xml_passing_mech
6417 : : ;
6418 : :
6419 : :
6420 : : xml_passing_mech:
6421 : : BY REF_P
6422 : : | BY VALUE_P
6423 : : ;
6424 : :
6425 : :
6426 : : WaitStmt:
6427 : : WAIT FOR LSN_P ecpg_sconst opt_wait_with_clause
6428 : : ;
6429 : :
6430 : :
6431 : : opt_wait_with_clause:
6432 : : WITH '(' utility_option_list ')'
6433 : : |
6434 : : ;
6435 : :
6436 : :
6437 : : within_group_clause:
6438 : : WITHIN GROUP_P '(' sort_clause ')'
6439 : : |
6440 : : ;
6441 : :
6442 : :
6443 : : filter_clause:
6444 : : FILTER '(' WHERE a_expr ')'
6445 : : |
6446 : : ;
6447 : :
6448 : :
6449 : : null_treatment:
6450 : : IGNORE_P NULLS_P
6451 : : | RESPECT_P NULLS_P
6452 : : |
6453 : : ;
6454 : :
6455 : :
6456 : : window_clause:
6457 : : WINDOW window_definition_list
6458 : : |
6459 : : ;
6460 : :
6461 : :
6462 : : window_definition_list:
6463 : : window_definition
6464 : : | window_definition_list ',' window_definition
6465 : : ;
6466 : :
6467 : :
6468 : : window_definition:
6469 : : ColId AS window_specification
6470 : : ;
6471 : :
6472 : :
6473 : : over_clause:
6474 : : OVER window_specification
6475 : : | OVER ColId
6476 : : |
6477 : : ;
6478 : :
6479 : :
6480 : : window_specification:
6481 : : '(' opt_existing_window_name opt_partition_clause opt_sort_clause opt_frame_clause ')'
6482 : : ;
6483 : :
6484 : :
6485 : : opt_existing_window_name:
6486 : : ColId
6487 : : | %prec Op
6488 : : ;
6489 : :
6490 : :
6491 : : opt_partition_clause:
6492 : : PARTITION BY expr_list
6493 : : |
6494 : : ;
6495 : :
6496 : :
6497 : : opt_frame_clause:
6498 : : RANGE frame_extent opt_window_exclusion_clause
6499 : : | ROWS frame_extent opt_window_exclusion_clause
6500 : : | GROUPS frame_extent opt_window_exclusion_clause
6501 : : |
6502 : : ;
6503 : :
6504 : :
6505 : : frame_extent:
6506 : : frame_bound
6507 : : | BETWEEN frame_bound AND frame_bound
6508 : : ;
6509 : :
6510 : :
6511 : : frame_bound:
6512 : : UNBOUNDED PRECEDING
6513 : : | UNBOUNDED FOLLOWING
6514 : : | CURRENT_P ROW
6515 : : | a_expr PRECEDING
6516 : : | a_expr FOLLOWING
6517 : : ;
6518 : :
6519 : :
6520 : : opt_window_exclusion_clause:
6521 : : EXCLUDE CURRENT_P ROW
6522 : : | EXCLUDE GROUP_P
6523 : : | EXCLUDE TIES
6524 : : | EXCLUDE NO OTHERS
6525 : : |
6526 : : ;
6527 : :
6528 : :
6529 : : row:
6530 : : ROW '(' expr_list ')'
6531 : : | ROW '(' ')'
6532 : : | '(' expr_list ',' a_expr ')'
6533 : : ;
6534 : :
6535 : :
6536 : : explicit_row:
6537 : : ROW '(' expr_list ')'
6538 : : | ROW '(' ')'
6539 : : ;
6540 : :
6541 : :
6542 : : implicit_row:
6543 : : '(' expr_list ',' a_expr ')'
6544 : : ;
6545 : :
6546 : :
6547 : : sub_type:
6548 : : ANY
6549 : : | SOME
6550 : : | ALL
6551 : : ;
6552 : :
6553 : :
6554 : : all_Op:
6555 : : Op
6556 : : | MathOp
6557 : : ;
6558 : :
6559 : :
6560 : : MathOp:
6561 : : '+'
6562 : : | '-'
6563 : : | '*'
6564 : : | '/'
6565 : : | '%'
6566 : : | '^'
6567 : : | '<'
6568 : : | '>'
6569 : : | '='
6570 : : | LESS_EQUALS
6571 : : | GREATER_EQUALS
6572 : : | NOT_EQUALS
6573 : : ;
6574 : :
6575 : :
6576 : : qual_Op:
6577 : : Op
6578 : : | OPERATOR '(' any_operator ')'
6579 : : ;
6580 : :
6581 : :
6582 : : qual_all_Op:
6583 : : all_Op
6584 : : | OPERATOR '(' any_operator ')'
6585 : : ;
6586 : :
6587 : :
6588 : : subquery_Op:
6589 : : all_Op
6590 : : | OPERATOR '(' any_operator ')'
6591 : : | LIKE
6592 : : | NOT_LA LIKE
6593 : : | ILIKE
6594 : : | NOT_LA ILIKE
6595 : : ;
6596 : :
6597 : :
6598 : : expr_list:
6599 : : a_expr
6600 : : | expr_list ',' a_expr
6601 : : ;
6602 : :
6603 : :
6604 : : func_arg_list:
6605 : : func_arg_expr
6606 : : | func_arg_list ',' func_arg_expr
6607 : : ;
6608 : :
6609 : :
6610 : : func_arg_expr:
6611 : : a_expr
6612 : : | param_name COLON_EQUALS a_expr
6613 : : | param_name EQUALS_GREATER a_expr
6614 : : ;
6615 : :
6616 : :
6617 : : func_arg_list_opt:
6618 : : func_arg_list
6619 : : |
6620 : : ;
6621 : :
6622 : :
6623 : : type_list:
6624 : : Typename
6625 : : | type_list ',' Typename
6626 : : ;
6627 : :
6628 : :
6629 : : array_expr:
6630 : : '[' expr_list ']'
6631 : : | '[' array_expr_list ']'
6632 : : | '[' ']'
6633 : : ;
6634 : :
6635 : :
6636 : : array_expr_list:
6637 : : array_expr
6638 : : | array_expr_list ',' array_expr
6639 : : ;
6640 : :
6641 : :
6642 : : extract_list:
6643 : : extract_arg FROM a_expr
6644 : : ;
6645 : :
6646 : :
6647 : : extract_arg:
6648 : : ecpg_ident
6649 : : | YEAR_P
6650 : : | MONTH_P
6651 : : | DAY_P
6652 : : | HOUR_P
6653 : : | MINUTE_P
6654 : : | SECOND_P
6655 : : | ecpg_sconst
6656 : : ;
6657 : :
6658 : :
6659 : : unicode_normal_form:
6660 : : NFC
6661 : : | NFD
6662 : : | NFKC
6663 : : | NFKD
6664 : : ;
6665 : :
6666 : :
6667 : : overlay_list:
6668 : : a_expr PLACING a_expr FROM a_expr FOR a_expr
6669 : : | a_expr PLACING a_expr FROM a_expr
6670 : : ;
6671 : :
6672 : :
6673 : : position_list:
6674 : : b_expr IN_P b_expr
6675 : : ;
6676 : :
6677 : :
6678 : : substr_list:
6679 : : a_expr FROM a_expr FOR a_expr
6680 : : | a_expr FOR a_expr FROM a_expr
6681 : : | a_expr FROM a_expr
6682 : : | a_expr FOR a_expr
6683 : : | a_expr SIMILAR a_expr ESCAPE a_expr
6684 : : ;
6685 : :
6686 : :
6687 : : trim_list:
6688 : : a_expr FROM expr_list
6689 : : | FROM expr_list
6690 : : | expr_list
6691 : : ;
6692 : :
6693 : :
6694 : : case_expr:
6695 : : CASE case_arg when_clause_list case_default END_P
6696 : : ;
6697 : :
6698 : :
6699 : : when_clause_list:
6700 : : when_clause
6701 : : | when_clause_list when_clause
6702 : : ;
6703 : :
6704 : :
6705 : : when_clause:
6706 : : WHEN a_expr THEN a_expr
6707 : : ;
6708 : :
6709 : :
6710 : : case_default:
6711 : : ELSE a_expr
6712 : : |
6713 : : ;
6714 : :
6715 : :
6716 : : case_arg:
6717 : : a_expr
6718 : : |
6719 : : ;
6720 : :
6721 : :
6722 : : columnref:
6723 : : ColId
6724 : : | ColId indirection
6725 : : ;
6726 : :
6727 : :
6728 : : indirection_el:
6729 : : '.' attr_name
6730 : : | '.' '*'
6731 : : | '[' a_expr ']'
6732 : : | '[' opt_slice_bound ':' opt_slice_bound ']'
6733 : : ;
6734 : :
6735 : :
6736 : : opt_slice_bound:
6737 : : a_expr
6738 : : |
6739 : : ;
6740 : :
6741 : :
6742 : : indirection:
6743 : : indirection_el
6744 : : | indirection indirection_el
6745 : : ;
6746 : :
6747 : :
6748 : : opt_indirection:
6749 : :
6750 : : | opt_indirection indirection_el
6751 : : ;
6752 : :
6753 : :
6754 : : opt_asymmetric:
6755 : : ASYMMETRIC
6756 : : |
6757 : : ;
6758 : :
6759 : :
6760 : : json_passing_clause_opt:
6761 : : PASSING json_arguments
6762 : : |
6763 : : ;
6764 : :
6765 : :
6766 : : json_arguments:
6767 : : json_argument
6768 : : | json_arguments ',' json_argument
6769 : : ;
6770 : :
6771 : :
6772 : : json_argument:
6773 : : json_value_expr AS ColLabel
6774 : : ;
6775 : :
6776 : :
6777 : : json_wrapper_behavior:
6778 : : WITHOUT WRAPPER
6779 : : | WITHOUT ARRAY WRAPPER
6780 : : | WITH WRAPPER
6781 : : | WITH ARRAY WRAPPER
6782 : : | WITH CONDITIONAL ARRAY WRAPPER
6783 : : | WITH UNCONDITIONAL ARRAY WRAPPER
6784 : : | WITH CONDITIONAL WRAPPER
6785 : : | WITH UNCONDITIONAL WRAPPER
6786 : : |
6787 : : ;
6788 : :
6789 : :
6790 : : json_behavior:
6791 : : DEFAULT a_expr
6792 : : | json_behavior_type
6793 : : ;
6794 : :
6795 : :
6796 : : json_behavior_type:
6797 : : ERROR_P
6798 : : | NULL_P
6799 : : | TRUE_P
6800 : : | FALSE_P
6801 : : | UNKNOWN
6802 : : | EMPTY_P ARRAY
6803 : : | EMPTY_P OBJECT_P
6804 : : | EMPTY_P
6805 : : ;
6806 : :
6807 : :
6808 : : json_behavior_clause_opt:
6809 : : json_behavior ON EMPTY_P
6810 : : | json_behavior ON ERROR_P
6811 : : | json_behavior ON EMPTY_P json_behavior ON ERROR_P
6812 : : |
6813 : : ;
6814 : :
6815 : :
6816 : : json_on_error_clause_opt:
6817 : : json_behavior ON ERROR_P
6818 : : |
6819 : : ;
6820 : :
6821 : :
6822 : : json_value_expr:
6823 : : a_expr json_format_clause_opt
6824 : : ;
6825 : :
6826 : :
6827 : : json_format_clause:
6828 : : FORMAT_LA JSON ENCODING name
6829 : : | FORMAT_LA JSON
6830 : : ;
6831 : :
6832 : :
6833 : : json_format_clause_opt:
6834 : : json_format_clause
6835 : : |
6836 : : ;
6837 : :
6838 : :
6839 : : json_quotes_clause_opt:
6840 : : KEEP QUOTES ON SCALAR STRING_P
6841 : : | KEEP QUOTES
6842 : : | OMIT QUOTES ON SCALAR STRING_P
6843 : : | OMIT QUOTES
6844 : : |
6845 : : ;
6846 : :
6847 : :
6848 : : json_returning_clause_opt:
6849 : : RETURNING Typename json_format_clause_opt
6850 : : |
6851 : : ;
6852 : :
6853 : :
6854 : : json_predicate_type_constraint:
6855 : : JSON %prec UNBOUNDED
6856 : : | JSON VALUE_P
6857 : : | JSON ARRAY
6858 : : | JSON OBJECT_P
6859 : : | JSON SCALAR
6860 : : ;
6861 : :
6862 : :
6863 : : json_key_uniqueness_constraint_opt:
6864 : : WITH UNIQUE KEYS
6865 : : | WITH UNIQUE %prec UNBOUNDED
6866 : : | WITHOUT UNIQUE KEYS
6867 : : | WITHOUT UNIQUE %prec UNBOUNDED
6868 : : | %prec UNBOUNDED
6869 : : ;
6870 : :
6871 : :
6872 : : json_name_and_value_list:
6873 : : json_name_and_value
6874 : : | json_name_and_value_list ',' json_name_and_value
6875 : : ;
6876 : :
6877 : :
6878 : : json_name_and_value:
6879 : : c_expr VALUE_P json_value_expr
6880 : : | a_expr ':' json_value_expr
6881 : : ;
6882 : :
6883 : :
6884 : : json_object_constructor_null_clause_opt:
6885 : : NULL_P ON NULL_P
6886 : : | ABSENT ON NULL_P
6887 : : |
6888 : : ;
6889 : :
6890 : :
6891 : : json_array_constructor_null_clause_opt:
6892 : : NULL_P ON NULL_P
6893 : : | ABSENT ON NULL_P
6894 : : |
6895 : : ;
6896 : :
6897 : :
6898 : : json_value_expr_list:
6899 : : json_value_expr
6900 : : | json_value_expr_list ',' json_value_expr
6901 : : ;
6902 : :
6903 : :
6904 : : json_aggregate_func:
6905 : : JSON_OBJECTAGG '(' json_name_and_value json_object_constructor_null_clause_opt json_key_uniqueness_constraint_opt json_returning_clause_opt ')'
6906 : : | JSON_ARRAYAGG '(' json_value_expr json_array_aggregate_order_by_clause_opt json_array_constructor_null_clause_opt json_returning_clause_opt ')'
6907 : : ;
6908 : :
6909 : :
6910 : : json_array_aggregate_order_by_clause_opt:
6911 : : ORDER BY sortby_list
6912 : : |
6913 : : ;
6914 : :
6915 : :
6916 : : opt_target_list:
6917 : : target_list
6918 : : |
6919 : : ;
6920 : :
6921 : :
6922 : : target_list:
6923 : : target_el
6924 : : | target_list ',' target_el
6925 : : ;
6926 : :
6927 : :
6928 : : target_el:
6929 : : a_expr AS ColLabel
6930 : : | a_expr BareColLabel
6931 : : | a_expr
6932 : : | '*'
6933 : : ;
6934 : :
6935 : :
6936 : : qualified_name_list:
6937 : : qualified_name
6938 : : | qualified_name_list ',' qualified_name
6939 : : ;
6940 : :
6941 : :
6942 : : qualified_name:
6943 : : ColId
6944 : : | ColId indirection
6945 : : ;
6946 : :
6947 : :
6948 : : name_list:
6949 : : name
6950 : : | name_list ',' name
6951 : : ;
6952 : :
6953 : :
6954 : : name:
6955 : : ColId
6956 : : ;
6957 : :
6958 : :
6959 : : attr_name:
6960 : : ColLabel
6961 : : ;
6962 : :
6963 : :
6964 : : file_name:
6965 : : ecpg_sconst
6966 : : ;
6967 : :
6968 : :
6969 : : func_name:
6970 : : type_function_name
6971 : : | ColId indirection
6972 : : ;
6973 : :
6974 : :
6975 : : AexprConst:
6976 : : Iconst
6977 : : | ecpg_fconst
6978 : : | ecpg_sconst
6979 : : | ecpg_bconst
6980 : : | ecpg_xconst
6981 : : | func_name ecpg_sconst
6982 : : | func_name '(' func_arg_list opt_sort_clause ')' ecpg_sconst
6983 : : | ConstTypename ecpg_sconst
6984 : : | ConstInterval ecpg_sconst opt_interval
6985 : : | ConstInterval '(' Iconst ')' ecpg_sconst
6986 : : | TRUE_P
6987 : : | FALSE_P
6988 : : | NULL_P
6989 : : | civar
6990 : : | civarind
6991 : : ;
6992 : :
6993 : :
6994 : : Iconst:
6995 : : ICONST
6996 : : ;
6997 : :
6998 : :
6999 : : SignedIconst:
7000 : : Iconst
7001 : : | civar
7002 : : | '+' Iconst
7003 : : | '-' Iconst
7004 : : ;
7005 : :
7006 : :
7007 : : RoleId:
7008 : : RoleSpec
7009 : : ;
7010 : :
7011 : :
7012 : : RoleSpec:
7013 : : NonReservedWord
7014 : : | CURRENT_ROLE
7015 : : | CURRENT_USER
7016 : : | SESSION_USER
7017 : : ;
7018 : :
7019 : :
7020 : : role_list:
7021 : : RoleSpec
7022 : : | role_list ',' RoleSpec
7023 : : ;
7024 : :
7025 : :
7026 : : NonReservedWord:
7027 : : ecpg_ident
7028 : : | unreserved_keyword
7029 : : | col_name_keyword
7030 : : | type_func_name_keyword
7031 : : ;
7032 : :
7033 : :
7034 : : BareColLabel:
7035 : : ecpg_ident
7036 : : | bare_label_keyword
7037 : : ;
7038 : :
7039 : :
7040 : : unreserved_keyword:
7041 : : ABORT_P
7042 : : | ABSENT
7043 : : | ABSOLUTE_P
7044 : : | ACCESS
7045 : : | ACTION
7046 : : | ADD_P
7047 : : | ADMIN
7048 : : | AFTER
7049 : : | AGGREGATE
7050 : : | ALSO
7051 : : | ALTER
7052 : : | ALWAYS
7053 : : | ASENSITIVE
7054 : : | ASSERTION
7055 : : | ASSIGNMENT
7056 : : | AT
7057 : : | ATOMIC
7058 : : | ATTACH
7059 : : | ATTRIBUTE
7060 : : | BACKWARD
7061 : : | BEFORE
7062 : : | BEGIN_P
7063 : : | BREADTH
7064 : : | BY
7065 : : | CACHE
7066 : : | CALL
7067 : : | CALLED
7068 : : | CASCADE
7069 : : | CASCADED
7070 : : | CATALOG_P
7071 : : | CHAIN
7072 : : | CHARACTERISTICS
7073 : : | CHECKPOINT
7074 : : | CLASS
7075 : : | CLOSE
7076 : : | CLUSTER
7077 : : | COLUMNS
7078 : : | COMMENT
7079 : : | COMMENTS
7080 : : | COMMIT
7081 : : | COMMITTED
7082 : : | COMPRESSION
7083 : : | CONDITIONAL
7084 : : | CONFIGURATION
7085 : : | CONFLICT
7086 : : | CONSTRAINTS
7087 : : | CONTENT_P
7088 : : | CONTINUE_P
7089 : : | CONVERSION_P
7090 : : | COPY
7091 : : | COST
7092 : : | CSV
7093 : : | CUBE
7094 : : | CURSOR
7095 : : | CYCLE
7096 : : | DATA_P
7097 : : | DATABASE
7098 : : | DEALLOCATE
7099 : : | DECLARE
7100 : : | DEFAULTS
7101 : : | DEFERRED
7102 : : | DEFINER
7103 : : | DELETE_P
7104 : : | DELIMITER
7105 : : | DELIMITERS
7106 : : | DEPENDS
7107 : : | DEPTH
7108 : : | DETACH
7109 : : | DICTIONARY
7110 : : | DISABLE_P
7111 : : | DISCARD
7112 : : | DOCUMENT_P
7113 : : | DOMAIN_P
7114 : : | DOUBLE_P
7115 : : | DROP
7116 : : | EACH
7117 : : | EMPTY_P
7118 : : | ENABLE_P
7119 : : | ENCODING
7120 : : | ENCRYPTED
7121 : : | ENFORCED
7122 : : | ENUM_P
7123 : : | ERROR_P
7124 : : | ESCAPE
7125 : : | EVENT
7126 : : | EXCLUDE
7127 : : | EXCLUDING
7128 : : | EXCLUSIVE
7129 : : | EXECUTE
7130 : : | EXPLAIN
7131 : : | EXPRESSION
7132 : : | EXTENSION
7133 : : | EXTERNAL
7134 : : | FAMILY
7135 : : | FILTER
7136 : : | FINALIZE
7137 : : | FIRST_P
7138 : : | FOLLOWING
7139 : : | FORCE
7140 : : | FORMAT
7141 : : | FORWARD
7142 : : | FUNCTION
7143 : : | FUNCTIONS
7144 : : | GENERATED
7145 : : | GLOBAL
7146 : : | GRANTED
7147 : : | GROUPS
7148 : : | HANDLER
7149 : : | HEADER_P
7150 : : | HOLD
7151 : : | IDENTITY_P
7152 : : | IF_P
7153 : : | IGNORE_P
7154 : : | IMMEDIATE
7155 : : | IMMUTABLE
7156 : : | IMPLICIT_P
7157 : : | IMPORT_P
7158 : : | INCLUDE
7159 : : | INCLUDING
7160 : : | INCREMENT
7161 : : | INDENT
7162 : : | INDEX
7163 : : | INDEXES
7164 : : | INHERIT
7165 : : | INHERITS
7166 : : | INLINE_P
7167 : : | INSENSITIVE
7168 : : | INSERT
7169 : : | INSTEAD
7170 : : | INVOKER
7171 : : | ISOLATION
7172 : : | KEEP
7173 : : | KEY
7174 : : | KEYS
7175 : : | LABEL
7176 : : | LANGUAGE
7177 : : | LARGE_P
7178 : : | LAST_P
7179 : : | LEAKPROOF
7180 : : | LEVEL
7181 : : | LISTEN
7182 : : | LOAD
7183 : : | LOCAL
7184 : : | LOCATION
7185 : : | LOCK_P
7186 : : | LOCKED
7187 : : | LOGGED
7188 : : | LSN_P
7189 : : | MAPPING
7190 : : | MATCH
7191 : : | MATCHED
7192 : : | MATERIALIZED
7193 : : | MAXVALUE
7194 : : | MERGE
7195 : : | METHOD
7196 : : | MINVALUE
7197 : : | MODE
7198 : : | MOVE
7199 : : | NAME_P
7200 : : | NAMES
7201 : : | NESTED
7202 : : | NEW
7203 : : | NEXT
7204 : : | NFC
7205 : : | NFD
7206 : : | NFKC
7207 : : | NFKD
7208 : : | NO
7209 : : | NORMALIZED
7210 : : | NOTHING
7211 : : | NOTIFY
7212 : : | NOWAIT
7213 : : | NULLS_P
7214 : : | OBJECT_P
7215 : : | OBJECTS_P
7216 : : | OF
7217 : : | OFF
7218 : : | OIDS
7219 : : | OLD
7220 : : | OMIT
7221 : : | OPERATOR
7222 : : | OPTION
7223 : : | OPTIONS
7224 : : | ORDINALITY
7225 : : | OTHERS
7226 : : | OVER
7227 : : | OVERRIDING
7228 : : | OWNED
7229 : : | OWNER
7230 : : | PARALLEL
7231 : : | PARAMETER
7232 : : | PARSER
7233 : : | PARTIAL
7234 : : | PARTITION
7235 : : | PASSING
7236 : : | PASSWORD
7237 : : | PATH
7238 : : | PERIOD
7239 : : | PLAN
7240 : : | PLANS
7241 : : | POLICY
7242 : : | PRECEDING
7243 : : | PREPARE
7244 : : | PREPARED
7245 : : | PRESERVE
7246 : : | PRIOR
7247 : : | PRIVILEGES
7248 : : | PROCEDURAL
7249 : : | PROCEDURE
7250 : : | PROCEDURES
7251 : : | PROGRAM
7252 : : | PUBLICATION
7253 : : | QUOTE
7254 : : | QUOTES
7255 : : | RANGE
7256 : : | READ
7257 : : | REASSIGN
7258 : : | RECURSIVE
7259 : : | REF_P
7260 : : | REFERENCING
7261 : : | REFRESH
7262 : : | REINDEX
7263 : : | RELATIVE_P
7264 : : | RELEASE
7265 : : | RENAME
7266 : : | REPACK
7267 : : | REPEATABLE
7268 : : | REPLACE
7269 : : | REPLICA
7270 : : | RESET
7271 : : | RESPECT_P
7272 : : | RESTART
7273 : : | RESTRICT
7274 : : | RETURN
7275 : : | RETURNS
7276 : : | REVOKE
7277 : : | ROLE
7278 : : | ROLLBACK
7279 : : | ROLLUP
7280 : : | ROUTINE
7281 : : | ROUTINES
7282 : : | ROWS
7283 : : | RULE
7284 : : | SAVEPOINT
7285 : : | SCALAR
7286 : : | SCHEMA
7287 : : | SCHEMAS
7288 : : | SCROLL
7289 : : | SEARCH
7290 : : | SECURITY
7291 : : | SEQUENCE
7292 : : | SEQUENCES
7293 : : | SERIALIZABLE
7294 : : | SERVER
7295 : : | SESSION
7296 : : | SET
7297 : : | SETS
7298 : : | SHARE
7299 : : | SHOW
7300 : : | SIMPLE
7301 : : | SKIP
7302 : : | SNAPSHOT
7303 : : | SOURCE
7304 : : | SQL_P
7305 : : | STABLE
7306 : : | STANDALONE_P
7307 : : | START
7308 : : | STATEMENT
7309 : : | STATISTICS
7310 : : | STDIN
7311 : : | STDOUT
7312 : : | STORAGE
7313 : : | STORED
7314 : : | STRICT_P
7315 : : | STRING_P
7316 : : | STRIP_P
7317 : : | SUBSCRIPTION
7318 : : | SUPPORT
7319 : : | SYSID
7320 : : | SYSTEM_P
7321 : : | TABLES
7322 : : | TABLESPACE
7323 : : | TARGET
7324 : : | TEMP
7325 : : | TEMPLATE
7326 : : | TEMPORARY
7327 : : | TEXT_P
7328 : : | TIES
7329 : : | TRANSACTION
7330 : : | TRANSFORM
7331 : : | TRIGGER
7332 : : | TRUNCATE
7333 : : | TRUSTED
7334 : : | TYPE_P
7335 : : | TYPES_P
7336 : : | UESCAPE
7337 : : | UNBOUNDED
7338 : : | UNCOMMITTED
7339 : : | UNCONDITIONAL
7340 : : | UNENCRYPTED
7341 : : | UNKNOWN
7342 : : | UNLISTEN
7343 : : | UNLOGGED
7344 : : | UNTIL
7345 : : | UPDATE
7346 : : | VACUUM
7347 : : | VALID
7348 : : | VALIDATE
7349 : : | VALIDATOR
7350 : : | VALUE_P
7351 : : | VARYING
7352 : : | VERSION_P
7353 : : | VIEW
7354 : : | VIEWS
7355 : : | VIRTUAL
7356 : : | VOLATILE
7357 : : | WAIT
7358 : : | WHITESPACE_P
7359 : : | WITHIN
7360 : : | WITHOUT
7361 : : | WORK
7362 : : | WRAPPER
7363 : : | WRITE
7364 : : | XML_P
7365 : : | YES_P
7366 : : | ZONE
7367 : : ;
7368 : :
7369 : :
7370 : : col_name_keyword:
7371 : : BETWEEN
7372 : : | BIGINT
7373 : : | BIT
7374 : : | BOOLEAN_P
7375 : : | CHARACTER
7376 : : | COALESCE
7377 : : | DEC
7378 : : | DECIMAL_P
7379 : : | EXISTS
7380 : : | EXTRACT
7381 : : | FLOAT_P
7382 : : | GREATEST
7383 : : | GROUPING
7384 : : | INOUT
7385 : : | INTEGER
7386 : : | INTERVAL
7387 : : | JSON
7388 : : | JSON_ARRAY
7389 : : | JSON_ARRAYAGG
7390 : : | JSON_EXISTS
7391 : : | JSON_OBJECT
7392 : : | JSON_OBJECTAGG
7393 : : | JSON_QUERY
7394 : : | JSON_SCALAR
7395 : : | JSON_SERIALIZE
7396 : : | JSON_TABLE
7397 : : | JSON_VALUE
7398 : : | LEAST
7399 : : | MERGE_ACTION
7400 : : | NATIONAL
7401 : : | NCHAR
7402 : : | NONE
7403 : : | NORMALIZE
7404 : : | NULLIF
7405 : : | NUMERIC
7406 : : | OUT_P
7407 : : | OVERLAY
7408 : : | POSITION
7409 : : | PRECISION
7410 : : | REAL
7411 : : | ROW
7412 : : | SETOF
7413 : : | SMALLINT
7414 : : | SUBSTRING
7415 : : | TIME
7416 : : | TIMESTAMP
7417 : : | TREAT
7418 : : | TRIM
7419 : : | VARCHAR
7420 : : | XMLATTRIBUTES
7421 : : | XMLCONCAT
7422 : : | XMLELEMENT
7423 : : | XMLEXISTS
7424 : : | XMLFOREST
7425 : : | XMLNAMESPACES
7426 : : | XMLPARSE
7427 : : | XMLPI
7428 : : | XMLROOT
7429 : : | XMLSERIALIZE
7430 : : | XMLTABLE
7431 : : ;
7432 : :
7433 : :
7434 : : type_func_name_keyword:
7435 : : AUTHORIZATION
7436 : : | BINARY
7437 : : | COLLATION
7438 : : | CONCURRENTLY
7439 : : | CROSS
7440 : : | CURRENT_SCHEMA
7441 : : | FREEZE
7442 : : | FULL
7443 : : | ILIKE
7444 : : | INNER_P
7445 : : | IS
7446 : : | ISNULL
7447 : : | JOIN
7448 : : | LEFT
7449 : : | LIKE
7450 : : | NATURAL
7451 : : | NOTNULL
7452 : : | OUTER_P
7453 : : | OVERLAPS
7454 : : | RIGHT
7455 : : | SIMILAR
7456 : : | TABLESAMPLE
7457 : : | VERBOSE
7458 : : ;
7459 : :
7460 : :
7461 : : reserved_keyword:
7462 : : ALL
7463 : : | ANALYSE
7464 : : | ANALYZE
7465 : : | AND
7466 : : | ANY
7467 : : | ARRAY
7468 : : | AS
7469 : : | ASC
7470 : : | ASYMMETRIC
7471 : : | BOTH
7472 : : | CASE
7473 : : | CAST
7474 : : | CHECK
7475 : : | COLLATE
7476 : : | COLUMN
7477 : : | CONSTRAINT
7478 : : | CREATE
7479 : : | CURRENT_CATALOG
7480 : : | CURRENT_DATE
7481 : : | CURRENT_ROLE
7482 : : | CURRENT_TIME
7483 : : | CURRENT_TIMESTAMP
7484 : : | CURRENT_USER
7485 : : | DEFAULT
7486 : : | DEFERRABLE
7487 : : | DESC
7488 : : | DISTINCT
7489 : : | DO
7490 : : | ELSE
7491 : : | END_P
7492 : : | EXCEPT
7493 : : | FALSE_P
7494 : : | FETCH
7495 : : | FOR
7496 : : | FOREIGN
7497 : : | FROM
7498 : : | GRANT
7499 : : | GROUP_P
7500 : : | HAVING
7501 : : | IN_P
7502 : : | INITIALLY
7503 : : | INTERSECT
7504 : : | INTO
7505 : : | LATERAL_P
7506 : : | LEADING
7507 : : | LIMIT
7508 : : | LOCALTIME
7509 : : | LOCALTIMESTAMP
7510 : : | NOT
7511 : : | NULL_P
7512 : : | OFFSET
7513 : : | ON
7514 : : | ONLY
7515 : : | OR
7516 : : | ORDER
7517 : : | PLACING
7518 : : | PRIMARY
7519 : : | REFERENCES
7520 : : | RETURNING
7521 : : | SELECT
7522 : : | SESSION_USER
7523 : : | SOME
7524 : : | SYMMETRIC
7525 : : | SYSTEM_USER
7526 : : | TABLE
7527 : : | THEN
7528 : : | TRAILING
7529 : : | TRUE_P
7530 : : | UNIQUE
7531 : : | USER
7532 : : | USING
7533 : : | VARIADIC
7534 : : | WHEN
7535 : : | WHERE
7536 : : | WINDOW
7537 : : | WITH
7538 : : ;
7539 : :
7540 : :
7541 : : bare_label_keyword:
7542 : : ABORT_P
7543 : : | ABSENT
7544 : : | ABSOLUTE_P
7545 : : | ACCESS
7546 : : | ACTION
7547 : : | ADD_P
7548 : : | ADMIN
7549 : : | AFTER
7550 : : | AGGREGATE
7551 : : | ALL
7552 : : | ALSO
7553 : : | ALTER
7554 : : | ALWAYS
7555 : : | ANALYSE
7556 : : | ANALYZE
7557 : : | AND
7558 : : | ANY
7559 : : | ASC
7560 : : | ASENSITIVE
7561 : : | ASSERTION
7562 : : | ASSIGNMENT
7563 : : | ASYMMETRIC
7564 : : | AT
7565 : : | ATOMIC
7566 : : | ATTACH
7567 : : | ATTRIBUTE
7568 : : | AUTHORIZATION
7569 : : | BACKWARD
7570 : : | BEFORE
7571 : : | BEGIN_P
7572 : : | BETWEEN
7573 : : | BIGINT
7574 : : | BINARY
7575 : : | BIT
7576 : : | BOOLEAN_P
7577 : : | BOTH
7578 : : | BREADTH
7579 : : | BY
7580 : : | CACHE
7581 : : | CALL
7582 : : | CALLED
7583 : : | CASCADE
7584 : : | CASCADED
7585 : : | CASE
7586 : : | CAST
7587 : : | CATALOG_P
7588 : : | CHAIN
7589 : : | CHARACTERISTICS
7590 : : | CHECK
7591 : : | CHECKPOINT
7592 : : | CLASS
7593 : : | CLOSE
7594 : : | CLUSTER
7595 : : | COALESCE
7596 : : | COLLATE
7597 : : | COLLATION
7598 : : | COLUMN
7599 : : | COLUMNS
7600 : : | COMMENT
7601 : : | COMMENTS
7602 : : | COMMIT
7603 : : | COMMITTED
7604 : : | COMPRESSION
7605 : : | CONCURRENTLY
7606 : : | CONDITIONAL
7607 : : | CONFIGURATION
7608 : : | CONFLICT
7609 : : | CONNECTION
7610 : : | CONSTRAINT
7611 : : | CONSTRAINTS
7612 : : | CONTENT_P
7613 : : | CONTINUE_P
7614 : : | CONVERSION_P
7615 : : | COPY
7616 : : | COST
7617 : : | CROSS
7618 : : | CSV
7619 : : | CUBE
7620 : : | CURRENT_P
7621 : : | CURRENT_CATALOG
7622 : : | CURRENT_DATE
7623 : : | CURRENT_ROLE
7624 : : | CURRENT_SCHEMA
7625 : : | CURRENT_TIME
7626 : : | CURRENT_TIMESTAMP
7627 : : | CURRENT_USER
7628 : : | CURSOR
7629 : : | CYCLE
7630 : : | DATA_P
7631 : : | DATABASE
7632 : : | DEALLOCATE
7633 : : | DEC
7634 : : | DECIMAL_P
7635 : : | DECLARE
7636 : : | DEFAULT
7637 : : | DEFAULTS
7638 : : | DEFERRABLE
7639 : : | DEFERRED
7640 : : | DEFINER
7641 : : | DELETE_P
7642 : : | DELIMITER
7643 : : | DELIMITERS
7644 : : | DEPENDS
7645 : : | DEPTH
7646 : : | DESC
7647 : : | DETACH
7648 : : | DICTIONARY
7649 : : | DISABLE_P
7650 : : | DISCARD
7651 : : | DISTINCT
7652 : : | DO
7653 : : | DOCUMENT_P
7654 : : | DOMAIN_P
7655 : : | DOUBLE_P
7656 : : | DROP
7657 : : | EACH
7658 : : | ELSE
7659 : : | EMPTY_P
7660 : : | ENABLE_P
7661 : : | ENCODING
7662 : : | ENCRYPTED
7663 : : | END_P
7664 : : | ENFORCED
7665 : : | ENUM_P
7666 : : | ERROR_P
7667 : : | ESCAPE
7668 : : | EVENT
7669 : : | EXCLUDE
7670 : : | EXCLUDING
7671 : : | EXCLUSIVE
7672 : : | EXECUTE
7673 : : | EXISTS
7674 : : | EXPLAIN
7675 : : | EXPRESSION
7676 : : | EXTENSION
7677 : : | EXTERNAL
7678 : : | EXTRACT
7679 : : | FALSE_P
7680 : : | FAMILY
7681 : : | FINALIZE
7682 : : | FIRST_P
7683 : : | FLOAT_P
7684 : : | FOLLOWING
7685 : : | FORCE
7686 : : | FOREIGN
7687 : : | FORMAT
7688 : : | FORWARD
7689 : : | FREEZE
7690 : : | FULL
7691 : : | FUNCTION
7692 : : | FUNCTIONS
7693 : : | GENERATED
7694 : : | GLOBAL
7695 : : | GRANTED
7696 : : | GREATEST
7697 : : | GROUPING
7698 : : | GROUPS
7699 : : | HANDLER
7700 : : | HEADER_P
7701 : : | HOLD
7702 : : | IDENTITY_P
7703 : : | IF_P
7704 : : | ILIKE
7705 : : | IMMEDIATE
7706 : : | IMMUTABLE
7707 : : | IMPLICIT_P
7708 : : | IMPORT_P
7709 : : | IN_P
7710 : : | INCLUDE
7711 : : | INCLUDING
7712 : : | INCREMENT
7713 : : | INDENT
7714 : : | INDEX
7715 : : | INDEXES
7716 : : | INHERIT
7717 : : | INHERITS
7718 : : | INITIALLY
7719 : : | INLINE_P
7720 : : | INNER_P
7721 : : | INOUT
7722 : : | INPUT_P
7723 : : | INSENSITIVE
7724 : : | INSERT
7725 : : | INSTEAD
7726 : : | INT_P
7727 : : | INTEGER
7728 : : | INTERVAL
7729 : : | INVOKER
7730 : : | IS
7731 : : | ISOLATION
7732 : : | JOIN
7733 : : | JSON
7734 : : | JSON_ARRAY
7735 : : | JSON_ARRAYAGG
7736 : : | JSON_EXISTS
7737 : : | JSON_OBJECT
7738 : : | JSON_OBJECTAGG
7739 : : | JSON_QUERY
7740 : : | JSON_SCALAR
7741 : : | JSON_SERIALIZE
7742 : : | JSON_TABLE
7743 : : | JSON_VALUE
7744 : : | KEEP
7745 : : | KEY
7746 : : | KEYS
7747 : : | LABEL
7748 : : | LANGUAGE
7749 : : | LARGE_P
7750 : : | LAST_P
7751 : : | LATERAL_P
7752 : : | LEADING
7753 : : | LEAKPROOF
7754 : : | LEAST
7755 : : | LEFT
7756 : : | LEVEL
7757 : : | LIKE
7758 : : | LISTEN
7759 : : | LOAD
7760 : : | LOCAL
7761 : : | LOCALTIME
7762 : : | LOCALTIMESTAMP
7763 : : | LOCATION
7764 : : | LOCK_P
7765 : : | LOCKED
7766 : : | LOGGED
7767 : : | LSN_P
7768 : : | MAPPING
7769 : : | MATCH
7770 : : | MATCHED
7771 : : | MATERIALIZED
7772 : : | MAXVALUE
7773 : : | MERGE
7774 : : | MERGE_ACTION
7775 : : | METHOD
7776 : : | MINVALUE
7777 : : | MODE
7778 : : | MOVE
7779 : : | NAME_P
7780 : : | NAMES
7781 : : | NATIONAL
7782 : : | NATURAL
7783 : : | NCHAR
7784 : : | NESTED
7785 : : | NEW
7786 : : | NEXT
7787 : : | NFC
7788 : : | NFD
7789 : : | NFKC
7790 : : | NFKD
7791 : : | NO
7792 : : | NONE
7793 : : | NORMALIZE
7794 : : | NORMALIZED
7795 : : | NOT
7796 : : | NOTHING
7797 : : | NOTIFY
7798 : : | NOWAIT
7799 : : | NULL_P
7800 : : | NULLIF
7801 : : | NULLS_P
7802 : : | NUMERIC
7803 : : | OBJECT_P
7804 : : | OBJECTS_P
7805 : : | OF
7806 : : | OFF
7807 : : | OIDS
7808 : : | OLD
7809 : : | OMIT
7810 : : | ONLY
7811 : : | OPERATOR
7812 : : | OPTION
7813 : : | OPTIONS
7814 : : | OR
7815 : : | ORDINALITY
7816 : : | OTHERS
7817 : : | OUT_P
7818 : : | OUTER_P
7819 : : | OVERLAY
7820 : : | OVERRIDING
7821 : : | OWNED
7822 : : | OWNER
7823 : : | PARALLEL
7824 : : | PARAMETER
7825 : : | PARSER
7826 : : | PARTIAL
7827 : : | PARTITION
7828 : : | PASSING
7829 : : | PASSWORD
7830 : : | PATH
7831 : : | PERIOD
7832 : : | PLACING
7833 : : | PLAN
7834 : : | PLANS
7835 : : | POLICY
7836 : : | POSITION
7837 : : | PRECEDING
7838 : : | PREPARE
7839 : : | PREPARED
7840 : : | PRESERVE
7841 : : | PRIMARY
7842 : : | PRIOR
7843 : : | PRIVILEGES
7844 : : | PROCEDURAL
7845 : : | PROCEDURE
7846 : : | PROCEDURES
7847 : : | PROGRAM
7848 : : | PUBLICATION
7849 : : | QUOTE
7850 : : | QUOTES
7851 : : | RANGE
7852 : : | READ
7853 : : | REAL
7854 : : | REASSIGN
7855 : : | RECURSIVE
7856 : : | REF_P
7857 : : | REFERENCES
7858 : : | REFERENCING
7859 : : | REFRESH
7860 : : | REINDEX
7861 : : | RELATIVE_P
7862 : : | RELEASE
7863 : : | RENAME
7864 : : | REPACK
7865 : : | REPEATABLE
7866 : : | REPLACE
7867 : : | REPLICA
7868 : : | RESET
7869 : : | RESTART
7870 : : | RESTRICT
7871 : : | RETURN
7872 : : | RETURNS
7873 : : | REVOKE
7874 : : | RIGHT
7875 : : | ROLE
7876 : : | ROLLBACK
7877 : : | ROLLUP
7878 : : | ROUTINE
7879 : : | ROUTINES
7880 : : | ROW
7881 : : | ROWS
7882 : : | RULE
7883 : : | SAVEPOINT
7884 : : | SCALAR
7885 : : | SCHEMA
7886 : : | SCHEMAS
7887 : : | SCROLL
7888 : : | SEARCH
7889 : : | SECURITY
7890 : : | SELECT
7891 : : | SEQUENCE
7892 : : | SEQUENCES
7893 : : | SERIALIZABLE
7894 : : | SERVER
7895 : : | SESSION
7896 : : | SESSION_USER
7897 : : | SET
7898 : : | SETOF
7899 : : | SETS
7900 : : | SHARE
7901 : : | SHOW
7902 : : | SIMILAR
7903 : : | SIMPLE
7904 : : | SKIP
7905 : : | SMALLINT
7906 : : | SNAPSHOT
7907 : : | SOME
7908 : : | SOURCE
7909 : : | SQL_P
7910 : : | STABLE
7911 : : | STANDALONE_P
7912 : : | START
7913 : : | STATEMENT
7914 : : | STATISTICS
7915 : : | STDIN
7916 : : | STDOUT
7917 : : | STORAGE
7918 : : | STORED
7919 : : | STRICT_P
7920 : : | STRING_P
7921 : : | STRIP_P
7922 : : | SUBSCRIPTION
7923 : : | SUBSTRING
7924 : : | SUPPORT
7925 : : | SYMMETRIC
7926 : : | SYSID
7927 : : | SYSTEM_P
7928 : : | SYSTEM_USER
7929 : : | TABLE
7930 : : | TABLES
7931 : : | TABLESAMPLE
7932 : : | TABLESPACE
7933 : : | TARGET
7934 : : | TEMP
7935 : : | TEMPLATE
7936 : : | TEMPORARY
7937 : : | TEXT_P
7938 : : | THEN
7939 : : | TIES
7940 : : | TIME
7941 : : | TIMESTAMP
7942 : : | TRAILING
7943 : : | TRANSACTION
7944 : : | TRANSFORM
7945 : : | TREAT
7946 : : | TRIGGER
7947 : : | TRIM
7948 : : | TRUE_P
7949 : : | TRUNCATE
7950 : : | TRUSTED
7951 : : | TYPE_P
7952 : : | TYPES_P
7953 : : | UESCAPE
7954 : : | UNBOUNDED
7955 : : | UNCOMMITTED
7956 : : | UNCONDITIONAL
7957 : : | UNENCRYPTED
7958 : : | UNIQUE
7959 : : | UNKNOWN
7960 : : | UNLISTEN
7961 : : | UNLOGGED
7962 : : | UNTIL
7963 : : | UPDATE
7964 : : | USER
7965 : : | USING
7966 : : | VACUUM
7967 : : | VALID
7968 : : | VALIDATE
7969 : : | VALIDATOR
7970 : : | VALUE_P
7971 : : | VALUES
7972 : : | VARCHAR
7973 : : | VARIADIC
7974 : : | VERBOSE
7975 : : | VERSION_P
7976 : : | VIEW
7977 : : | VIEWS
7978 : : | VIRTUAL
7979 : : | VOLATILE
7980 : : | WAIT
7981 : : | WHEN
7982 : : | WHITESPACE_P
7983 : : | WORK
7984 : : | WRAPPER
7985 : : | WRITE
7986 : : | XML_P
7987 : : | XMLATTRIBUTES
7988 : : | XMLCONCAT
7989 : : | XMLELEMENT
7990 : : | XMLEXISTS
7991 : : | XMLFOREST
7992 : : | XMLNAMESPACES
7993 : : | XMLPARSE
7994 : : | XMLPI
7995 : : | XMLROOT
7996 : : | XMLSERIALIZE
7997 : : | XMLTABLE
7998 : : | YES_P
7999 : : | ZONE
8000 : : ;
8001 : :
8002 : :
8003 : : /* trailer */
8004 : : /* src/interfaces/ecpg/preproc/ecpg.trailer */
8005 : :
8006 : : statements: /* EMPTY */
8007 : : | statements statement
8008 : : {
8009 : : /* Reclaim local storage used while processing statement */
8010 : 24317 : reclaim_local_storage();
8011 : : /* Clean up now-dangling location pointer */
8012 : 24317 : @$ = "";
8013 : : }
8014 : : ;
8015 : :
8016 : : statement: ecpgstart at toplevel_stmt ';'
8017 : : {
8018 [ + - ]: 109 : if (connection)
8019 : 109 : free(connection);
8020 : 109 : connection = NULL;
8021 : : }
8022 : : | ecpgstart toplevel_stmt ';'
8023 : : {
8024 [ + + ]: 1113 : if (connection)
8025 : 13 : free(connection);
8026 : 1113 : connection = NULL;
8027 : : }
8028 : : | ecpgstart ECPGVarDeclaration
8029 : : {
8030 : 24 : fprintf(base_yyout, "%s", @$);
8031 : 24 : output_line_number();
8032 : : }
8033 : : | ECPGDeclaration
8034 : : | c_thing
8035 : : {
8036 : 21612 : fprintf(base_yyout, "%s", @$);
8037 : : }
8038 : : | CPP_LINE
8039 : : {
8040 : 728 : fprintf(base_yyout, "%s", @$);
8041 : : }
8042 : : | '{'
8043 : : {
8044 : 333 : braces_open++;
8045 : 333 : fputs("{", base_yyout);
8046 : : }
8047 : : | '}'
8048 : : {
8049 [ + - ]: 332 : if (braces_open > 0)
8050 : : {
8051 : 332 : remove_typedefs(braces_open);
8052 : 332 : remove_variables(braces_open);
8053 [ + + ]: 332 : if (--braces_open == 0)
8054 : : {
8055 : 147 : free(current_function);
8056 : 147 : current_function = NULL;
8057 : : }
8058 : : }
8059 : 332 : fputs("}", base_yyout);
8060 : : }
8061 : : ;
8062 : :
8063 : : CreateAsStmt: CREATE OptTemp TABLE create_as_target AS
8064 : : {
8065 : 1 : FoundInto = 0;
8066 : : } SelectStmt opt_with_data
8067 : : {
8068 [ - + ]: 1 : if (FoundInto == 1)
8069 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE AS cannot specify INTO");
8070 : : }
8071 : : | CREATE OptTemp TABLE IF_P NOT EXISTS create_as_target AS
8072 : : {
8073 : 1 : FoundInto = 0;
8074 : : } SelectStmt opt_with_data
8075 : : {
8076 [ - + ]: 1 : if (FoundInto == 1)
8077 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE AS cannot specify INTO");
8078 : : }
8079 : : ;
8080 : :
8081 : : at: AT connection_object
8082 : : {
8083 [ - + ]: 109 : if (connection)
8084 : 0 : free(connection);
8085 : 109 : connection = mm_strdup(@2);
8086 : :
8087 : : /*
8088 : : * Do we have a variable as connection target? Remove the variable
8089 : : * from the variable list or else it will be used twice.
8090 : : */
8091 [ - + ]: 109 : if (argsinsert != NULL)
8092 : 0 : argsinsert = NULL;
8093 : : }
8094 : : ;
8095 : :
8096 : : /*
8097 : : * the exec sql connect statement: connect to the given database
8098 : : */
8099 : : ECPGConnect: SQL_CONNECT TO connection_target opt_connection_name opt_user
8100 : : {
8101 : 97 : @$ = cat_str(5, @3, ",", @5, ",", @4);
8102 : : }
8103 : : | SQL_CONNECT TO DEFAULT
8104 : : {
8105 : 0 : @$ = "NULL, NULL, NULL, \"DEFAULT\"";
8106 : : }
8107 : : /* also allow ORACLE syntax */
8108 : : | SQL_CONNECT ora_user
8109 : : {
8110 : 0 : @$ = cat_str(3, "NULL,", @2, ", NULL");
8111 : : }
8112 : : | DATABASE connection_target
8113 : : {
8114 : 0 : @$ = cat2_str(@2, ", NULL, NULL, NULL");
8115 : : }
8116 : : ;
8117 : :
8118 : : connection_target: opt_database_name opt_server opt_port
8119 : : {
8120 : : /* old style: dbname[@server][:port] */
8121 [ + + - + ]: 83 : if (strlen(@2) > 0 && *(@2) != '@')
8122 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "expected \"@\", found \"%s\"", @2);
8123 : :
8124 : : /* C strings need to be handled differently */
8125 [ + + ]: 83 : if (@1[0] == '\"')
8126 : 5 : @$ = @1;
8127 : : else
8128 : 78 : @$ = make3_str("\"", make3_str(@1, @2, @3), "\"");
8129 : : }
8130 : : | db_prefix ':' server opt_port '/' opt_database_name opt_options
8131 : : {
8132 : : /* new style: <tcp|unix>:postgresql://server[:port][/dbname] */
8133 [ + + - + ]: 9 : if (strncmp(@1, "unix:postgresql", strlen("unix:postgresql")) != 0 && strncmp(@1, "tcp:postgresql", strlen("tcp:postgresql")) != 0)
8134 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "only protocols \"tcp\" and \"unix\" and database type \"postgresql\" are supported");
8135 : :
8136 [ - + ]: 9 : if (strncmp(@3, "//", strlen("//")) != 0)
8137 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "expected \"://\", found \"%s\"", @3);
8138 : :
8139 [ + + ]: 9 : if (strncmp(@1, "unix", strlen("unix")) == 0 &&
8140 [ - + ]: 5 : strncmp(@3 + strlen("//"), "localhost", strlen("localhost")) != 0 &&
8141 [ # # ]: 0 : strncmp(@3 + strlen("//"), "127.0.0.1", strlen("127.0.0.1")) != 0)
8142 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "Unix-domain sockets only work on \"localhost\" but not on \"%s\"", @3 + strlen("//"));
8143 : :
8144 : 9 : @$ = make3_str(make3_str("\"", @1, ":"), @3, make3_str(make3_str(@4, "/", @6), @7, "\""));
8145 : : }
8146 : : | char_variable
8147 : : | ecpg_sconst
8148 : : {
8149 : : /*
8150 : : * We can only process double quoted strings not single quoted ones,
8151 : : * so we change the quotes. Note that the rule for ecpg_sconst adds
8152 : : * these single quotes.
8153 : : */
8154 : 2 : char *str = loc_strdup(@1);
8155 : :
8156 : 2 : str[0] = '\"';
8157 : 2 : str[strlen(str) - 1] = '\"';
8158 : 2 : @$ = str;
8159 : : }
8160 : : ;
8161 : :
8162 : : opt_database_name: name
8163 : : | /* EMPTY */
8164 : : ;
8165 : :
8166 : : db_prefix: ecpg_ident cvariable
8167 : : {
8168 [ - + - - ]: 9 : if (strcmp(@2, "postgresql") != 0 && strcmp(@2, "postgres") != 0)
8169 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "expected \"postgresql\", found \"%s\"", @2);
8170 : :
8171 [ + + - + ]: 9 : if (strcmp(@1, "tcp") != 0 && strcmp(@1, "unix") != 0)
8172 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "invalid connection type: %s", @1);
8173 : :
8174 : 9 : @$ = make3_str(@1, ":", @2);
8175 : : }
8176 : : ;
8177 : :
8178 : : server: Op server_name
8179 : : {
8180 [ + + - + ]: 11 : if (strcmp(@1, "@") != 0 && strcmp(@1, "//") != 0)
8181 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "expected \"@\" or \"://\", found \"%s\"", @1);
8182 : :
8183 : 11 : @$ = make2_str(@1, @2);
8184 : : }
8185 : : ;
8186 : :
8187 : : opt_server: server
8188 : : | /* EMPTY */
8189 : : ;
8190 : :
8191 : : server_name: ColId
8192 : : | ColId '.' server_name
8193 : : | IP
8194 : : ;
8195 : :
8196 : : opt_port: ':' Iconst
8197 : : {
8198 : 1 : @$ = make2_str(":", @2);
8199 : : }
8200 : : | /* EMPTY */
8201 : : ;
8202 : :
8203 : : opt_connection_name: AS connection_object
8204 : : {
8205 : 41 : @$ = @2;
8206 : : }
8207 : : | /* EMPTY */
8208 : : {
8209 : 56 : @$ = "NULL";
8210 : : }
8211 : : ;
8212 : :
8213 : : opt_user: USER ora_user
8214 : : {
8215 : 16 : @$ = @2;
8216 : : }
8217 : : | /* EMPTY */
8218 : : {
8219 : 81 : @$ = "NULL, NULL";
8220 : : }
8221 : : ;
8222 : :
8223 : : ora_user: user_name
8224 : : {
8225 : 3 : @$ = cat2_str(@1, ", NULL");
8226 : : }
8227 : : | user_name '/' user_name
8228 : : {
8229 : 5 : @$ = cat_str(3, @1, ",", @3);
8230 : : }
8231 : : | user_name SQL_IDENTIFIED BY user_name
8232 : : {
8233 : 5 : @$ = cat_str(3, @1, ",", @4);
8234 : : }
8235 : : | user_name USING user_name
8236 : : {
8237 : 3 : @$ = cat_str(3, @1, ",", @3);
8238 : : }
8239 : : ;
8240 : :
8241 : : user_name: RoleId
8242 : : {
8243 [ + + ]: 27 : if (@1[0] == '\"')
8244 : 3 : @$ = @1;
8245 : : else
8246 : 24 : @$ = make3_str("\"", @1, "\"");
8247 : : }
8248 : : | ecpg_sconst
8249 : : {
8250 [ # # ]: 0 : if (@1[0] == '\"')
8251 : 0 : @$ = @1;
8252 : : else
8253 : 0 : @$ = make3_str("\"", @1, "\"");
8254 : : }
8255 : : | civar
8256 : : {
8257 : 2 : enum ECPGttype type = argsinsert->variable->type->type;
8258 : :
8259 : : /* if array see what's inside */
8260 [ - + ]: 2 : if (type == ECPGt_array)
8261 : 0 : type = argsinsert->variable->type->u.element->type;
8262 : :
8263 : : /* handle varchars */
8264 [ - + ]: 2 : if (type == ECPGt_varchar)
8265 : 0 : @$ = make2_str(argsinsert->variable->name, ".arr");
8266 : : else
8267 : 2 : @$ = argsinsert->variable->name;
8268 : : }
8269 : : ;
8270 : :
8271 : : char_variable: cvariable
8272 : : {
8273 : : /* check if we have a string variable */
8274 : 131 : struct variable *p = find_variable(@1);
8275 : 131 : enum ECPGttype type = p->type->type;
8276 : :
8277 : : /* If we have just one character this is not a string */
8278 [ - + ]: 131 : if (atol(p->type->size) == 1)
8279 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
8280 : : else
8281 : : {
8282 : : /* if array see what's inside */
8283 [ - + ]: 131 : if (type == ECPGt_array)
8284 : 0 : type = p->type->u.element->type;
8285 : :
8286 [ + + - ]: 131 : switch (type)
8287 : : {
8288 : 121 : case ECPGt_char:
8289 : : case ECPGt_unsigned_char:
8290 : : case ECPGt_string:
8291 : 121 : @$ = @1;
8292 : 121 : break;
8293 : 10 : case ECPGt_varchar:
8294 : 10 : @$ = make2_str(@1, ".arr");
8295 : 10 : break;
8296 : 0 : default:
8297 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
8298 : 0 : @$ = @1;
8299 : 0 : break;
8300 : : }
8301 : : }
8302 : : }
8303 : : ;
8304 : :
8305 : : opt_options: Op connect_options
8306 : : {
8307 [ - + ]: 2 : if (strlen(@1) == 0)
8308 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "incomplete statement");
8309 : :
8310 [ - + ]: 2 : if (strcmp(@1, "?") != 0)
8311 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "unrecognized token \"%s\"", @1);
8312 : :
8313 : 2 : @$ = make2_str("?", @2);
8314 : : }
8315 : : | /* EMPTY */
8316 : : ;
8317 : :
8318 : : connect_options: ColId opt_opt_value
8319 : : {
8320 : 2 : @$ = make2_str(@1, @2);
8321 : : }
8322 : : | ColId opt_opt_value Op connect_options
8323 : : {
8324 [ - + ]: 1 : if (strlen(@3) == 0)
8325 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "incomplete statement");
8326 : :
8327 [ - + ]: 1 : if (strcmp(@3, "&") != 0)
8328 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "unrecognized token \"%s\"", @3);
8329 : :
8330 : 1 : @$ = make3_str(make2_str(@1, @2), @3, @4);
8331 : : }
8332 : : ;
8333 : :
8334 : : opt_opt_value: /* EMPTY */
8335 : : | '=' Iconst
8336 : : {
8337 : 2 : @$ = make2_str("=", @2);
8338 : : }
8339 : : | '=' ecpg_ident
8340 : : {
8341 : 1 : @$ = make2_str("=", @2);
8342 : : }
8343 : : | '=' civar
8344 : : {
8345 : 0 : @$ = make2_str("=", @2);
8346 : : }
8347 : : ;
8348 : :
8349 : : prepared_name: name
8350 : : {
8351 : 159 : size_t slen = strlen(@1);
8352 : :
8353 [ + + + - ]: 159 : if (@1[0] == '\"' && @1[slen - 1] == '\"') /* already quoted? */
8354 : 25 : @$ = @1;
8355 : : else /* not quoted => convert to lowercase */
8356 : : {
8357 : 134 : char *str = loc_alloc(slen + 3);
8358 : :
8359 : 134 : str[0] = '\"';
8360 [ + + ]: 855 : for (size_t i = 0; i < slen; i++)
8361 : 721 : str[i + 1] = tolower((unsigned char) @1[i]);
8362 : 134 : str[slen + 1] = '\"';
8363 : 134 : str[slen + 2] = '\0';
8364 : 134 : @$ = str;
8365 : : }
8366 : : }
8367 : : | char_variable
8368 : : ;
8369 : :
8370 : : /*
8371 : : * Declare Statement
8372 : : */
8373 : : ECPGDeclareStmt: DECLARE prepared_name STATEMENT
8374 : : {
8375 : : struct declared_list *ptr;
8376 : :
8377 : : /* Check whether the declared name has been defined or not */
8378 [ + + ]: 15 : for (ptr = g_declared_list; ptr != NULL; ptr = ptr->next)
8379 : : {
8380 [ - + ]: 10 : if (strcmp(@2, ptr->name) == 0)
8381 : : {
8382 : : /* re-definition is not allowed */
8383 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "name \"%s\" is already declared", ptr->name);
8384 : : }
8385 : : }
8386 : :
8387 : : /* Add a new declared name into the g_declared_list */
8388 : 5 : ptr = (struct declared_list *) mm_alloc(sizeof(struct declared_list));
8389 [ + - ]: 5 : if (ptr)
8390 : : {
8391 : : /* initial definition */
8392 : 5 : ptr->name = mm_strdup(@2);
8393 [ + + ]: 5 : if (connection)
8394 : 2 : ptr->connection = mm_strdup(connection);
8395 : : else
8396 : 3 : ptr->connection = NULL;
8397 : :
8398 : 5 : ptr->next = g_declared_list;
8399 : 5 : g_declared_list = ptr;
8400 : : }
8401 : :
8402 : 5 : @$ = cat_str(3, "/* declare ", @2, " as an SQL identifier */");
8403 : : }
8404 : : ;
8405 : :
8406 : : /*
8407 : : * Declare a prepared cursor. The syntax is different from the standard
8408 : : * declare statement, so we create a new rule.
8409 : : */
8410 : : ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name
8411 : : {
8412 : : struct cursor *ptr,
8413 : : *this;
8414 [ + + ]: 21 : const char *cursor_marker = @2[0] == ':' ? "$0" : @2;
8415 [ + + - + ]: 21 : int (*strcmp_fn) (const char *, const char *) = ((@2[0] == ':' || @2[0] == '"') ? strcmp : pg_strcasecmp);
8416 : 21 : struct variable *thisquery = (struct variable *) mm_alloc(sizeof(struct variable));
8417 : : char *comment;
8418 : : char *con;
8419 : :
8420 [ + + - + : 21 : if (INFORMIX_MODE && pg_strcasecmp(@2, "database") == 0)
- + ]
8421 : 0 : mmfatal(PARSE_ERROR, "\"database\" cannot be used as cursor name in INFORMIX mode");
8422 : :
8423 : 21 : check_declared_list(@7);
8424 [ + + ]: 21 : con = connection ? connection : "NULL";
8425 [ + + ]: 43 : for (ptr = cur; ptr != NULL; ptr = ptr->next)
8426 : : {
8427 [ - + ]: 22 : if (strcmp_fn(@2, ptr->name) == 0)
8428 : : {
8429 : : /* re-definition is a bug */
8430 [ # # ]: 0 : if (@2[0] == ':')
8431 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", @2 + 1);
8432 : : else
8433 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", @2);
8434 : : }
8435 : : }
8436 : :
8437 : 21 : this = (struct cursor *) mm_alloc(sizeof(struct cursor));
8438 : :
8439 : : /* initial definition */
8440 : 21 : this->next = cur;
8441 : 21 : this->name = mm_strdup(@2);
8442 [ + - ]: 21 : this->function = (current_function ? mm_strdup(current_function) : NULL);
8443 [ + + ]: 21 : this->connection = connection ? mm_strdup(connection) : NULL;
8444 : 21 : this->opened = false;
8445 : 21 : this->command = mm_strdup(cat_str(6, "declare", cursor_marker, @3, "cursor", @5, "for $1"));
8446 : 21 : this->argsresult = NULL;
8447 : 21 : this->argsresult_oos = NULL;
8448 : :
8449 : 21 : thisquery->type = &ecpg_query;
8450 : 21 : thisquery->brace_level = 0;
8451 : 21 : thisquery->next = NULL;
8452 : 21 : thisquery->name = (char *) mm_alloc(sizeof("ECPGprepared_statement(, , __LINE__)") + strlen(con) + strlen(@7));
8453 : 21 : sprintf(thisquery->name, "ECPGprepared_statement(%s, %s, __LINE__)", con, @7);
8454 : :
8455 : 21 : this->argsinsert = NULL;
8456 : 21 : this->argsinsert_oos = NULL;
8457 [ + + ]: 21 : if (@2[0] == ':')
8458 : : {
8459 : 3 : struct variable *var = find_variable(@2 + 1);
8460 : :
8461 : 3 : remove_variable_from_list(&argsinsert, var);
8462 : 3 : add_variable_to_head(&(this->argsinsert), var, &no_indicator);
8463 : : }
8464 : 21 : add_variable_to_head(&(this->argsinsert), thisquery, &no_indicator);
8465 : :
8466 : 21 : cur = this;
8467 : :
8468 : 21 : comment = cat_str(3, "/*", this->command, "*/");
8469 : :
8470 : 21 : @$ = cat_str(2, adjust_outofscope_cursor_vars(this),
8471 : : comment);
8472 : : }
8473 : : ;
8474 : :
8475 : : ECPGExecuteImmediateStmt: EXECUTE IMMEDIATE execstring
8476 : : {
8477 : : /*
8478 : : * execute immediate means prepare the statement and immediately
8479 : : * execute it
8480 : : */
8481 : 7 : @$ = @3;
8482 : : }
8483 : : ;
8484 : :
8485 : : /*
8486 : : * variable declaration outside exec sql declare block
8487 : : */
8488 : : ECPGVarDeclaration: single_vt_declaration;
8489 : :
8490 : : single_vt_declaration: type_declaration
8491 : : | var_declaration
8492 : : ;
8493 : :
8494 : : precision: NumericOnly
8495 : : ;
8496 : :
8497 : : opt_scale: ',' NumericOnly
8498 : : {
8499 : 1 : @$ = @2;
8500 : : }
8501 : : | /* EMPTY */
8502 : : ;
8503 : :
8504 : : ecpg_interval: opt_interval
8505 : : | YEAR_P TO MINUTE_P
8506 : : | YEAR_P TO SECOND_P
8507 : : | DAY_P TO DAY_P
8508 : : | MONTH_P TO MONTH_P
8509 : : ;
8510 : :
8511 : : /*
8512 : : * variable declaration inside exec sql declare block
8513 : : */
8514 : : ECPGDeclaration: sql_startdeclare
8515 : : {
8516 : 66 : fputs("/* exec sql begin declare section */", base_yyout);
8517 : : }
8518 : : var_type_declarations sql_enddeclare
8519 : : {
8520 : 66 : fprintf(base_yyout, "%s/* exec sql end declare section */", @3);
8521 : 66 : output_line_number();
8522 : : }
8523 : : ;
8524 : :
8525 : : sql_startdeclare: ecpgstart BEGIN_P DECLARE SQL_SECTION ';'
8526 : : {
8527 : : }
8528 : : ;
8529 : :
8530 : : sql_enddeclare: ecpgstart END_P DECLARE SQL_SECTION ';'
8531 : : {
8532 : : }
8533 : : ;
8534 : :
8535 : : var_type_declarations: /* EMPTY */
8536 : : | vt_declarations
8537 : : ;
8538 : :
8539 : : vt_declarations: single_vt_declaration
8540 : : | CPP_LINE
8541 : : | vt_declarations single_vt_declaration
8542 : : | vt_declarations CPP_LINE
8543 : : ;
8544 : :
8545 : : variable_declarations: var_declaration
8546 : : | variable_declarations var_declaration
8547 : : ;
8548 : :
8549 : : type_declaration: S_TYPEDEF
8550 : : {
8551 : : /* reset this variable so we see if there was */
8552 : : /* an initializer specified */
8553 : 9 : initializer = 0;
8554 : : }
8555 : : var_type opt_pointer ECPGColLabel opt_array_bounds ';'
8556 : : {
8557 : 9 : add_typedef(@5, $6.index1, $6.index2, $3.type_enum, $3.type_dimension, $3.type_index, initializer, *@4 ? 1 : 0);
8558 : :
8559 [ - + ]: 9 : fprintf(base_yyout, "typedef %s %s %s %s;\n", $3.type_str, *@4 ? "*" : "", @5, $6.str);
8560 : 9 : output_line_number();
8561 : 9 : @$ = "";
8562 : : }
8563 : : ;
8564 : :
8565 : : var_declaration:
8566 : : storage_declaration var_type
8567 : : {
8568 : 3 : actual_type[struct_level].type_storage = loc_strdup(@1);
8569 : 3 : actual_type[struct_level].type_enum = $2.type_enum;
8570 : 3 : actual_type[struct_level].type_str = $2.type_str;
8571 : 3 : actual_type[struct_level].type_dimension = $2.type_dimension;
8572 : 3 : actual_type[struct_level].type_index = $2.type_index;
8573 : 3 : actual_type[struct_level].type_sizeof = $2.type_sizeof;
8574 : :
8575 : 3 : actual_startline[struct_level] = hashline_number();
8576 : : }
8577 : : variable_list ';'
8578 : : {
8579 : 3 : @$ = cat_str(5, actual_startline[struct_level], @1, $2.type_str, @4, ";\n");
8580 : : }
8581 : : | var_type
8582 : : {
8583 : 304 : actual_type[struct_level].type_storage = loc_strdup("");
8584 : 304 : actual_type[struct_level].type_enum = $1.type_enum;
8585 : 304 : actual_type[struct_level].type_str = $1.type_str;
8586 : 304 : actual_type[struct_level].type_dimension = $1.type_dimension;
8587 : 304 : actual_type[struct_level].type_index = $1.type_index;
8588 : 304 : actual_type[struct_level].type_sizeof = $1.type_sizeof;
8589 : :
8590 : 304 : actual_startline[struct_level] = hashline_number();
8591 : : }
8592 : : variable_list ';'
8593 : : {
8594 : 304 : @$ = cat_str(4, actual_startline[struct_level], $1.type_str, @3, ";\n");
8595 : : }
8596 : : | struct_union_type_with_symbol ';'
8597 : : ;
8598 : :
8599 : : opt_bit_field: ':' Iconst
8600 : : | /* EMPTY */
8601 : : ;
8602 : :
8603 : : storage_declaration: storage_clause storage_modifier
8604 : : | storage_clause
8605 : : | storage_modifier
8606 : : ;
8607 : :
8608 : : storage_clause: S_EXTERN
8609 : : | S_STATIC
8610 : : | S_REGISTER
8611 : : | S_AUTO
8612 : : ;
8613 : :
8614 : : storage_modifier: S_CONST
8615 : : | S_VOLATILE
8616 : : ;
8617 : :
8618 : : var_type: simple_type
8619 : : {
8620 : 236 : $$.type_enum = $1;
8621 : 236 : $$.type_str = loc_strdup(ecpg_type_name($1));
8622 : 236 : $$.type_dimension = "-1";
8623 : 236 : $$.type_index = "-1";
8624 : 236 : $$.type_sizeof = NULL;
8625 : : }
8626 : : | struct_union_type
8627 : : {
8628 : 18 : $$.type_str = loc_strdup(@1);
8629 : 18 : $$.type_dimension = "-1";
8630 : 18 : $$.type_index = "-1";
8631 : :
8632 [ + + ]: 18 : if (strncmp(@1, "struct", sizeof("struct") - 1) == 0)
8633 : : {
8634 : 16 : $$.type_enum = ECPGt_struct;
8635 : 16 : $$.type_sizeof = ECPGstruct_sizeof;
8636 : : }
8637 : : else
8638 : : {
8639 : 2 : $$.type_enum = ECPGt_union;
8640 : 2 : $$.type_sizeof = NULL;
8641 : : }
8642 : : }
8643 : : | enum_type
8644 : : {
8645 : 0 : $$.type_str = loc_strdup(@1);
8646 : 0 : $$.type_enum = ECPGt_int;
8647 : 0 : $$.type_dimension = "-1";
8648 : 0 : $$.type_index = "-1";
8649 : 0 : $$.type_sizeof = NULL;
8650 : : }
8651 : : | NUMERIC '(' precision opt_scale ')'
8652 : : {
8653 : 0 : $$.type_enum = ECPGt_numeric;
8654 : 0 : $$.type_str = "numeric";
8655 : 0 : $$.type_dimension = "-1";
8656 : 0 : $$.type_index = "-1";
8657 : 0 : $$.type_sizeof = NULL;
8658 : : }
8659 : : | DECIMAL_P '(' precision opt_scale ')'
8660 : : {
8661 : 0 : $$.type_enum = ECPGt_decimal;
8662 : 0 : $$.type_str = "decimal";
8663 : 0 : $$.type_dimension = "-1";
8664 : 0 : $$.type_index = "-1";
8665 : 0 : $$.type_sizeof = NULL;
8666 : : }
8667 : : | IDENT '(' precision opt_scale ')'
8668 : : {
8669 : : /*
8670 : : * In C parsing mode, NUMERIC and DECIMAL are not keywords, so they
8671 : : * will show up here as a plain identifier, and we need this duplicate
8672 : : * code to recognize them.
8673 : : */
8674 [ + - ]: 1 : if (strcmp(@1, "numeric") == 0)
8675 : : {
8676 : 1 : $$.type_enum = ECPGt_numeric;
8677 : 1 : $$.type_str = "numeric";
8678 : : }
8679 [ # # ]: 0 : else if (strcmp(@1, "decimal") == 0)
8680 : : {
8681 : 0 : $$.type_enum = ECPGt_decimal;
8682 : 0 : $$.type_str = "decimal";
8683 : : }
8684 : : else
8685 : : {
8686 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "only data types numeric and decimal have precision/scale argument");
8687 : 0 : $$.type_enum = ECPGt_numeric;
8688 : 0 : $$.type_str = "numeric";
8689 : : }
8690 : :
8691 : 1 : $$.type_dimension = "-1";
8692 : 1 : $$.type_index = "-1";
8693 : 1 : $$.type_sizeof = NULL;
8694 : : }
8695 : : | VARCHAR
8696 : : {
8697 : 14 : $$.type_enum = ECPGt_varchar;
8698 : 14 : $$.type_str = ""; /* "varchar"; */
8699 : 14 : $$.type_dimension = "-1";
8700 : 14 : $$.type_index = "-1";
8701 : 14 : $$.type_sizeof = NULL;
8702 : : }
8703 : : | FLOAT_P
8704 : : {
8705 : : /* Note: DOUBLE is handled in simple_type */
8706 : 3 : $$.type_enum = ECPGt_float;
8707 : 3 : $$.type_str = "float";
8708 : 3 : $$.type_dimension = "-1";
8709 : 3 : $$.type_index = "-1";
8710 : 3 : $$.type_sizeof = NULL;
8711 : : }
8712 : : | NUMERIC
8713 : : {
8714 : 0 : $$.type_enum = ECPGt_numeric;
8715 : 0 : $$.type_str = "numeric";
8716 : 0 : $$.type_dimension = "-1";
8717 : 0 : $$.type_index = "-1";
8718 : 0 : $$.type_sizeof = NULL;
8719 : : }
8720 : : | DECIMAL_P
8721 : : {
8722 : 2 : $$.type_enum = ECPGt_decimal;
8723 : 2 : $$.type_str = "decimal";
8724 : 2 : $$.type_dimension = "-1";
8725 : 2 : $$.type_index = "-1";
8726 : 2 : $$.type_sizeof = NULL;
8727 : : }
8728 : : | TIMESTAMP
8729 : : {
8730 : 1 : $$.type_enum = ECPGt_timestamp;
8731 : 1 : $$.type_str = "timestamp";
8732 : 1 : $$.type_dimension = "-1";
8733 : 1 : $$.type_index = "-1";
8734 : 1 : $$.type_sizeof = NULL;
8735 : : }
8736 : : | STRING_P
8737 : : {
8738 [ - + - - ]: 1 : if (INFORMIX_MODE)
8739 : : {
8740 : : /* In Informix mode, "string" is automatically a typedef */
8741 : 1 : $$.type_enum = ECPGt_string;
8742 : 1 : $$.type_str = "char";
8743 : 1 : $$.type_dimension = "-1";
8744 : 1 : $$.type_index = "-1";
8745 : 1 : $$.type_sizeof = NULL;
8746 : : }
8747 : : else
8748 : : {
8749 : : /* Otherwise, legal only if user typedef'ed it */
8750 : 0 : struct typedefs *this = get_typedef("string", false);
8751 : :
8752 [ # # # # ]: 0 : $$.type_str = (this->type->type_enum == ECPGt_varchar || this->type->type_enum == ECPGt_bytea) ? mm_strdup("") : mm_strdup(this->name);
8753 : 0 : $$.type_enum = this->type->type_enum;
8754 : 0 : $$.type_dimension = this->type->type_dimension;
8755 : 0 : $$.type_index = this->type->type_index;
8756 [ # # # # ]: 0 : if (this->type->type_sizeof && strlen(this->type->type_sizeof) != 0)
8757 : 0 : $$.type_sizeof = this->type->type_sizeof;
8758 : : else
8759 : 0 : $$.type_sizeof = cat_str(3, "sizeof(", this->name, ")");
8760 : :
8761 : 0 : ECPGfree_struct_member(struct_member_list[struct_level]);
8762 : 0 : struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
8763 : : }
8764 : : }
8765 : : | INTERVAL ecpg_interval
8766 : : {
8767 : 0 : $$.type_enum = ECPGt_interval;
8768 : 0 : $$.type_str = "interval";
8769 : 0 : $$.type_dimension = "-1";
8770 : 0 : $$.type_index = "-1";
8771 : 0 : $$.type_sizeof = NULL;
8772 : : }
8773 : : | IDENT ecpg_interval
8774 : : {
8775 : : /*
8776 : : * In C parsing mode, the above SQL type names are not keywords, so
8777 : : * they will show up here as a plain identifier, and we need this
8778 : : * duplicate code to recognize them.
8779 : : *
8780 : : * Note that we also handle the type names bytea, date, and datetime
8781 : : * here, but not above because those are not currently SQL keywords.
8782 : : * If they ever become so, they must gain duplicate productions above.
8783 : : */
8784 [ - + - - : 53 : if (strlen(@2) != 0 && strcmp(@1, "datetime") != 0 && strcmp(@1, "interval") != 0)
- - ]
8785 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "interval specification not allowed here");
8786 : :
8787 [ - + ]: 53 : if (strcmp(@1, "varchar") == 0)
8788 : : {
8789 : 0 : $$.type_enum = ECPGt_varchar;
8790 : 0 : $$.type_str = ""; /* "varchar"; */
8791 : 0 : $$.type_dimension = "-1";
8792 : 0 : $$.type_index = "-1";
8793 : 0 : $$.type_sizeof = NULL;
8794 : : }
8795 [ + + ]: 53 : else if (strcmp(@1, "bytea") == 0)
8796 : : {
8797 : 4 : $$.type_enum = ECPGt_bytea;
8798 : 4 : $$.type_str = "";
8799 : 4 : $$.type_dimension = "-1";
8800 : 4 : $$.type_index = "-1";
8801 : 4 : $$.type_sizeof = NULL;
8802 : : }
8803 [ - + ]: 49 : else if (strcmp(@1, "float") == 0)
8804 : : {
8805 : 0 : $$.type_enum = ECPGt_float;
8806 : 0 : $$.type_str = "float";
8807 : 0 : $$.type_dimension = "-1";
8808 : 0 : $$.type_index = "-1";
8809 : 0 : $$.type_sizeof = NULL;
8810 : : }
8811 [ + + ]: 49 : else if (strcmp(@1, "double") == 0)
8812 : : {
8813 : 6 : $$.type_enum = ECPGt_double;
8814 : 6 : $$.type_str = "double";
8815 : 6 : $$.type_dimension = "-1";
8816 : 6 : $$.type_index = "-1";
8817 : 6 : $$.type_sizeof = NULL;
8818 : : }
8819 [ + + ]: 43 : else if (strcmp(@1, "numeric") == 0)
8820 : : {
8821 : 2 : $$.type_enum = ECPGt_numeric;
8822 : 2 : $$.type_str = "numeric";
8823 : 2 : $$.type_dimension = "-1";
8824 : 2 : $$.type_index = "-1";
8825 : 2 : $$.type_sizeof = NULL;
8826 : : }
8827 [ - + ]: 41 : else if (strcmp(@1, "decimal") == 0)
8828 : : {
8829 : 0 : $$.type_enum = ECPGt_decimal;
8830 : 0 : $$.type_str = "decimal";
8831 : 0 : $$.type_dimension = "-1";
8832 : 0 : $$.type_index = "-1";
8833 : 0 : $$.type_sizeof = NULL;
8834 : : }
8835 [ + + ]: 41 : else if (strcmp(@1, "date") == 0)
8836 : : {
8837 : 5 : $$.type_enum = ECPGt_date;
8838 : 5 : $$.type_str = "date";
8839 : 5 : $$.type_dimension = "-1";
8840 : 5 : $$.type_index = "-1";
8841 : 5 : $$.type_sizeof = NULL;
8842 : : }
8843 [ + + ]: 36 : else if (strcmp(@1, "timestamp") == 0)
8844 : : {
8845 : 6 : $$.type_enum = ECPGt_timestamp;
8846 : 6 : $$.type_str = "timestamp";
8847 : 6 : $$.type_dimension = "-1";
8848 : 6 : $$.type_index = "-1";
8849 : 6 : $$.type_sizeof = NULL;
8850 : : }
8851 [ + + ]: 30 : else if (strcmp(@1, "interval") == 0)
8852 : : {
8853 : 4 : $$.type_enum = ECPGt_interval;
8854 : 4 : $$.type_str = "interval";
8855 : 4 : $$.type_dimension = "-1";
8856 : 4 : $$.type_index = "-1";
8857 : 4 : $$.type_sizeof = NULL;
8858 : : }
8859 [ - + ]: 26 : else if (strcmp(@1, "datetime") == 0)
8860 : : {
8861 : 0 : $$.type_enum = ECPGt_timestamp;
8862 : 0 : $$.type_str = "timestamp";
8863 : 0 : $$.type_dimension = "-1";
8864 : 0 : $$.type_index = "-1";
8865 : 0 : $$.type_sizeof = NULL;
8866 : : }
8867 [ + + + - : 26 : else if ((strcmp(@1, "string") == 0) && INFORMIX_MODE)
- + ]
8868 : : {
8869 : 0 : $$.type_enum = ECPGt_string;
8870 : 0 : $$.type_str = "char";
8871 : 0 : $$.type_dimension = "-1";
8872 : 0 : $$.type_index = "-1";
8873 : 0 : $$.type_sizeof = NULL;
8874 : : }
8875 : : else
8876 : : {
8877 : : /* Otherwise, it must be a user-defined typedef name */
8878 : 26 : struct typedefs *this = get_typedef(@1, false);
8879 : :
8880 [ + + + - ]: 26 : $$.type_str = (this->type->type_enum == ECPGt_varchar || this->type->type_enum == ECPGt_bytea) ? "" : this->name;
8881 : 26 : $$.type_enum = this->type->type_enum;
8882 : 26 : $$.type_dimension = this->type->type_dimension;
8883 : 26 : $$.type_index = this->type->type_index;
8884 [ + + + + ]: 26 : if (this->type->type_sizeof && strlen(this->type->type_sizeof) != 0)
8885 : 4 : $$.type_sizeof = this->type->type_sizeof;
8886 : : else
8887 : 22 : $$.type_sizeof = cat_str(3, "sizeof(", this->name, ")");
8888 : :
8889 : 26 : ECPGfree_struct_member(struct_member_list[struct_level]);
8890 : 26 : struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
8891 : : }
8892 : : }
8893 : : | s_struct_union_symbol
8894 : : {
8895 : : /* this is for named structs/unions */
8896 : : char *name;
8897 : : struct typedefs *this;
8898 [ + + - + : 6 : bool forward = (forward_name != NULL && strcmp($1.symbol, forward_name) == 0 && strcmp($1.su, "struct") == 0);
- - ]
8899 : :
8900 : 6 : name = cat2_str($1.su, $1.symbol);
8901 : : /* Do we have a forward definition? */
8902 [ + - ]: 6 : if (!forward)
8903 : : {
8904 : : /* No */
8905 : :
8906 : 6 : this = get_typedef(name, false);
8907 : 6 : $$.type_str = this->name;
8908 : 6 : $$.type_enum = this->type->type_enum;
8909 : 6 : $$.type_dimension = this->type->type_dimension;
8910 : 6 : $$.type_index = this->type->type_index;
8911 : 6 : $$.type_sizeof = this->type->type_sizeof;
8912 : 6 : ECPGfree_struct_member(struct_member_list[struct_level]);
8913 : 6 : struct_member_list[struct_level] = ECPGstruct_member_dup(this->struct_member_list);
8914 : : }
8915 : : else
8916 : : {
8917 : 0 : $$.type_str = name;
8918 : 0 : $$.type_enum = ECPGt_long;
8919 : 0 : $$.type_dimension = "-1";
8920 : 0 : $$.type_index = "-1";
8921 : 0 : $$.type_sizeof = "";
8922 : 0 : ECPGfree_struct_member(struct_member_list[struct_level]);
8923 : 0 : struct_member_list[struct_level] = NULL;
8924 : : }
8925 : : }
8926 : : ;
8927 : :
8928 : : enum_type: ENUM_P symbol enum_definition
8929 : : | ENUM_P enum_definition
8930 : : | ENUM_P symbol
8931 : : ;
8932 : :
8933 : : enum_definition: '{' c_list '}'
8934 : : ;
8935 : :
8936 : : struct_union_type_with_symbol: s_struct_union_symbol
8937 : : {
8938 : 16 : ECPGfree_struct_member(struct_member_list[struct_level]);
8939 : 16 : struct_member_list[struct_level++] = NULL;
8940 [ - + ]: 16 : if (struct_level >= STRUCT_DEPTH)
8941 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "too many levels in nested structure/union definition");
8942 : 16 : forward_name = mm_strdup($1.symbol);
8943 : : }
8944 : : '{' variable_declarations '}'
8945 : : {
8946 : : struct typedefs *ptr,
8947 : : *this;
8948 : : struct this_type su_type;
8949 : :
8950 : 16 : ECPGfree_struct_member(struct_member_list[struct_level]);
8951 : 16 : struct_member_list[struct_level] = NULL;
8952 : 16 : struct_level--;
8953 [ + - ]: 16 : if (strcmp($1.su, "struct") == 0)
8954 : 16 : su_type.type_enum = ECPGt_struct;
8955 : : else
8956 : 0 : su_type.type_enum = ECPGt_union;
8957 : 16 : su_type.type_str = cat2_str($1.su, $1.symbol);
8958 : 16 : free(forward_name);
8959 : 16 : forward_name = NULL;
8960 : :
8961 : : /*
8962 : : * This is essentially a typedef but needs the keyword struct/union as
8963 : : * well. So we create the typedef for each struct definition with
8964 : : * symbol
8965 : : */
8966 [ + + ]: 80 : for (ptr = types; ptr != NULL; ptr = ptr->next)
8967 : : {
8968 [ - + ]: 64 : if (strcmp(su_type.type_str, ptr->name) == 0)
8969 : : /* re-definition is a bug */
8970 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", su_type.type_str);
8971 : : }
8972 : :
8973 : 16 : this = (struct typedefs *) mm_alloc(sizeof(struct typedefs));
8974 : :
8975 : : /* initial definition */
8976 : 16 : this->next = types;
8977 : 16 : this->name = mm_strdup(su_type.type_str);
8978 : 16 : this->brace_level = braces_open;
8979 : 16 : this->type = (struct this_type *) mm_alloc(sizeof(struct this_type));
8980 : 16 : this->type->type_storage = NULL;
8981 : 16 : this->type->type_enum = su_type.type_enum;
8982 : 16 : this->type->type_str = mm_strdup(su_type.type_str);
8983 : 16 : this->type->type_dimension = mm_strdup("-1"); /* dimension of array */
8984 : 16 : this->type->type_index = mm_strdup("-1"); /* length of string */
8985 [ + - ]: 16 : this->type->type_sizeof = ECPGstruct_sizeof ? mm_strdup(ECPGstruct_sizeof) : NULL;
8986 : 16 : this->struct_member_list = ECPGstruct_member_dup(struct_member_list[struct_level]);
8987 : :
8988 : 16 : types = this;
8989 : 16 : @$ = cat_str(4, su_type.type_str, "{", @4, "}");
8990 : : }
8991 : : ;
8992 : :
8993 : : struct_union_type: struct_union_type_with_symbol
8994 : : | s_struct_union
8995 : : {
8996 : 9 : ECPGfree_struct_member(struct_member_list[struct_level]);
8997 : 9 : struct_member_list[struct_level++] = NULL;
8998 [ - + ]: 9 : if (struct_level >= STRUCT_DEPTH)
8999 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "too many levels in nested structure/union definition");
9000 : : }
9001 : : '{' variable_declarations '}'
9002 : : {
9003 : 9 : ECPGfree_struct_member(struct_member_list[struct_level]);
9004 : 9 : struct_member_list[struct_level] = NULL;
9005 : 9 : struct_level--;
9006 : 9 : @$ = cat_str(4, @1, "{", @4, "}");
9007 : : }
9008 : : ;
9009 : :
9010 : : s_struct_union_symbol: SQL_STRUCT symbol
9011 : : {
9012 : 22 : $$.su = "struct";
9013 : 22 : $$.symbol = @2;
9014 : 22 : free(ECPGstruct_sizeof);
9015 : 22 : ECPGstruct_sizeof = mm_strdup(cat_str(3, "sizeof(",
9016 : : cat2_str($$.su, $$.symbol),
9017 : : ")"));
9018 : : }
9019 : : | UNION symbol
9020 : : {
9021 : 0 : $$.su = "union";
9022 : 0 : $$.symbol = @2;
9023 : : }
9024 : : ;
9025 : :
9026 : : s_struct_union: SQL_STRUCT
9027 : : {
9028 : 7 : free(ECPGstruct_sizeof);
9029 : 7 : ECPGstruct_sizeof = mm_strdup(""); /* This must not be NULL to
9030 : : * distinguish from simple types. */
9031 : 7 : @$ = "struct";
9032 : : }
9033 : : | UNION
9034 : : {
9035 : 2 : @$ = "union";
9036 : : }
9037 : : ;
9038 : :
9039 : : simple_type: unsigned_type
9040 : 236 : | opt_signed signed_type { $$ = $2; }
9041 : : ;
9042 : :
9043 : 0 : unsigned_type: SQL_UNSIGNED SQL_SHORT { $$ = ECPGt_unsigned_short; }
9044 : 0 : | SQL_UNSIGNED SQL_SHORT INT_P { $$ = ECPGt_unsigned_short; }
9045 : 0 : | SQL_UNSIGNED { $$ = ECPGt_unsigned_int; }
9046 : 0 : | SQL_UNSIGNED INT_P { $$ = ECPGt_unsigned_int; }
9047 : 0 : | SQL_UNSIGNED SQL_LONG { $$ = ECPGt_unsigned_long; }
9048 : 0 : | SQL_UNSIGNED SQL_LONG INT_P { $$ = ECPGt_unsigned_long; }
9049 : 0 : | SQL_UNSIGNED SQL_LONG SQL_LONG { $$ = ECPGt_unsigned_long_long; }
9050 : 0 : | SQL_UNSIGNED SQL_LONG SQL_LONG INT_P { $$ = ECPGt_unsigned_long_long; }
9051 : 0 : | SQL_UNSIGNED CHAR_P { $$ = ECPGt_unsigned_char; }
9052 : : ;
9053 : :
9054 : 14 : signed_type: SQL_SHORT { $$ = ECPGt_short; }
9055 : 0 : | SQL_SHORT INT_P { $$ = ECPGt_short; }
9056 : 107 : | INT_P { $$ = ECPGt_int; }
9057 : 6 : | SQL_LONG { $$ = ECPGt_long; }
9058 : 0 : | SQL_LONG INT_P { $$ = ECPGt_long; }
9059 : 0 : | SQL_LONG SQL_LONG { $$ = ECPGt_long_long; }
9060 : 0 : | SQL_LONG SQL_LONG INT_P { $$ = ECPGt_long_long; }
9061 : 4 : | SQL_BOOL { $$ = ECPGt_bool; }
9062 : 104 : | CHAR_P { $$ = ECPGt_char; }
9063 : 1 : | DOUBLE_P { $$ = ECPGt_double; }
9064 : : ;
9065 : :
9066 : : opt_signed: SQL_SIGNED
9067 : : | /* EMPTY */
9068 : : ;
9069 : :
9070 : : variable_list: variable
9071 : : | variable_list ',' variable
9072 : : {
9073 [ + + - + ]: 61 : if (actual_type[struct_level].type_enum == ECPGt_varchar || actual_type[struct_level].type_enum == ECPGt_bytea)
9074 : 2 : @$ = cat_str(4, @1, ";", actual_type[struct_level].type_storage, @3);
9075 : : else
9076 : 59 : @$ = cat_str(3, @1, ",", @3);
9077 : : }
9078 : : ;
9079 : :
9080 : : variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initializer
9081 : : {
9082 : : struct ECPGtype *type;
9083 : 368 : const char *dimension = $3.index1; /* dimension of array */
9084 : 368 : const char *length = $3.index2; /* length of string */
9085 : : char *dim_str;
9086 : : char vcn[32];
9087 : : int *varlen_type_counter;
9088 : : char *struct_name;
9089 : :
9090 : 368 : adjust_array(actual_type[struct_level].type_enum,
9091 : : &dimension, &length,
9092 : 368 : actual_type[struct_level].type_dimension,
9093 : 368 : actual_type[struct_level].type_index,
9094 : 368 : strlen(@1), false);
9095 [ + + + + ]: 368 : switch (actual_type[struct_level].type_enum)
9096 : : {
9097 : 28 : case ECPGt_struct:
9098 : : case ECPGt_union:
9099 [ + + ]: 28 : if (atoi(dimension) < 0)
9100 : 13 : 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);
9101 : : else
9102 : 15 : 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);
9103 : :
9104 : 28 : @$ = cat_str(5, @1, @2, $3.str, @4, @5);
9105 : 28 : break;
9106 : :
9107 : 20 : case ECPGt_varchar:
9108 : : case ECPGt_bytea:
9109 [ + + ]: 20 : if (actual_type[struct_level].type_enum == ECPGt_varchar)
9110 : : {
9111 : 16 : varlen_type_counter = &varchar_counter;
9112 : 16 : struct_name = " struct varchar_";
9113 : : }
9114 : : else
9115 : : {
9116 : 4 : varlen_type_counter = &bytea_counter;
9117 : 4 : struct_name = " struct bytea_";
9118 : : }
9119 [ + + ]: 20 : if (atoi(dimension) < 0)
9120 : 15 : type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, *varlen_type_counter);
9121 : : else
9122 : 5 : type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, *varlen_type_counter), dimension);
9123 : :
9124 [ + + + + ]: 20 : if (strcmp(dimension, "0") == 0 || abs(atoi(dimension)) == 1)
9125 : 16 : dim_str = "";
9126 : : else
9127 : 4 : dim_str = cat_str(3, "[", dimension, "]");
9128 : :
9129 : : /*
9130 : : * cannot check for atoi <= 0 because a defined constant will
9131 : : * yield 0 here as well
9132 : : */
9133 [ + - - + ]: 20 : if (atoi(length) < 0 || strcmp(length, "0") == 0)
9134 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "pointers to varchar are not implemented");
9135 : :
9136 : : /*
9137 : : * make sure varchar struct name is unique by adding a unique
9138 : : * counter to its definition
9139 : : */
9140 : 20 : snprintf(vcn, sizeof(vcn), "%d", *varlen_type_counter);
9141 [ + + ]: 20 : if (strcmp(dimension, "0") == 0)
9142 : 1 : @$ = cat_str(7, make2_str(struct_name, vcn), " { int len; char arr[", length, "]; } *", @2, @4, @5);
9143 : : else
9144 : 19 : @$ = cat_str(8, make2_str(struct_name, vcn), " { int len; char arr[", length, "]; } ", @2, dim_str, @4, @5);
9145 : 20 : (*varlen_type_counter)++;
9146 : 20 : break;
9147 : :
9148 : 124 : case ECPGt_char:
9149 : : case ECPGt_unsigned_char:
9150 : : case ECPGt_string:
9151 [ + + ]: 124 : if (atoi(dimension) == -1)
9152 : : {
9153 : 109 : int i = strlen(@5);
9154 : :
9155 [ + + + - ]: 109 : if (atoi(length) == -1 && i > 0) /* char <var>[] =
9156 : : * "string" */
9157 : : {
9158 : : /*
9159 : : * if we have an initializer but no string size set,
9160 : : * let's use the initializer's length
9161 : : */
9162 : 2 : char *buf = loc_alloc(32);
9163 : :
9164 : 2 : snprintf(buf, 32, "sizeof(%s)", @5 + 2);
9165 : 2 : length = buf;
9166 : : }
9167 : 109 : type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0);
9168 : : }
9169 : : else
9170 : 15 : type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, 0), dimension);
9171 : :
9172 : 124 : @$ = cat_str(5, @1, @2, $3.str, @4, @5);
9173 : 124 : break;
9174 : :
9175 : 196 : default:
9176 [ + + ]: 196 : if (atoi(dimension) < 0)
9177 : 157 : type = ECPGmake_simple_type(actual_type[struct_level].type_enum, "1", 0);
9178 : : else
9179 : 39 : type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, "1", 0), dimension);
9180 : :
9181 : 196 : @$ = cat_str(5, @1, @2, $3.str, @4, @5);
9182 : 196 : break;
9183 : : }
9184 : :
9185 [ + + ]: 368 : if (struct_level == 0)
9186 : 312 : new_variable(@2, type, braces_open);
9187 : : else
9188 : 56 : ECPGmake_struct_member(@2, type, &(struct_member_list[struct_level - 1]));
9189 : : }
9190 : : ;
9191 : :
9192 : : opt_initializer: /* EMPTY */
9193 : : | '=' c_term
9194 : : {
9195 : 115 : initializer = 1;
9196 : : }
9197 : : ;
9198 : :
9199 : : opt_pointer: /* EMPTY */
9200 : : | '*'
9201 : : | '*' '*'
9202 : : {
9203 : 8 : @$ = "**";
9204 : : }
9205 : : ;
9206 : :
9207 : : /*
9208 : : * We try to simulate the correct DECLARE syntax here so we get dynamic SQL
9209 : : */
9210 : : ECPGDeclare: DECLARE STATEMENT ecpg_ident
9211 : : {
9212 : : /* this is only supported for compatibility */
9213 : 0 : @$ = cat_str(3, "/* declare statement", @3, "*/");
9214 : : }
9215 : : ;
9216 : : /*
9217 : : * the exec sql disconnect statement: disconnect from the given database
9218 : : */
9219 : : ECPGDisconnect: SQL_DISCONNECT dis_name
9220 : : {
9221 : 88 : @$ = @2;
9222 : : }
9223 : : ;
9224 : :
9225 : : dis_name: connection_object
9226 : : | CURRENT_P
9227 : : {
9228 : 3 : @$ = "\"CURRENT\"";
9229 : : }
9230 : : | ALL
9231 : : {
9232 : 15 : @$ = "\"ALL\"";
9233 : : }
9234 : : | /* EMPTY */
9235 : : {
9236 : 45 : @$ = "\"CURRENT\"";
9237 : : }
9238 : : ;
9239 : :
9240 : : connection_object: name
9241 : : {
9242 : 159 : @$ = make3_str("\"", @1, "\"");
9243 : : }
9244 : : | DEFAULT
9245 : : {
9246 : 3 : @$ = "\"DEFAULT\"";
9247 : : }
9248 : : | char_variable
9249 : : ;
9250 : :
9251 : : execstring: char_variable
9252 : : | CSTRING
9253 : : {
9254 : 7 : @$ = make3_str("\"", @1, "\"");
9255 : : }
9256 : : ;
9257 : :
9258 : : /*
9259 : : * the exec sql free command to deallocate a previously
9260 : : * prepared statement
9261 : : */
9262 : : ECPGFree: SQL_FREE cursor_name
9263 : : {
9264 : 1 : @$ = @2;
9265 : : }
9266 : : | SQL_FREE ALL
9267 : : {
9268 : 0 : @$ = "all";
9269 : : }
9270 : : ;
9271 : :
9272 : : /*
9273 : : * open is an open cursor, at the moment this has to be removed
9274 : : */
9275 : : ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using
9276 : : {
9277 [ + + ]: 39 : if (@2[0] == ':')
9278 : 5 : remove_variable_from_list(&argsinsert, find_variable(@2 + 1));
9279 : 39 : @$ = @2;
9280 : : }
9281 : : ;
9282 : :
9283 : : opt_ecpg_using: /* EMPTY */
9284 : : | ecpg_using
9285 : : ;
9286 : :
9287 : : ecpg_using: USING using_list
9288 : : {
9289 : 14 : @$ = "";
9290 : : }
9291 : : | using_descriptor
9292 : : ;
9293 : :
9294 : : using_descriptor: USING SQL_P SQL_DESCRIPTOR quoted_ident_stringvar
9295 : : {
9296 : 12 : add_variable_to_head(&argsinsert, descriptor_variable(@4, 0), &no_indicator);
9297 : 12 : @$ = "";
9298 : : }
9299 : : | USING SQL_DESCRIPTOR name
9300 : : {
9301 : 9 : add_variable_to_head(&argsinsert, sqlda_variable(@3), &no_indicator);
9302 : 9 : @$ = "";
9303 : : }
9304 : : ;
9305 : :
9306 : : into_descriptor: INTO SQL_P SQL_DESCRIPTOR quoted_ident_stringvar
9307 : : {
9308 : 12 : add_variable_to_head(&argsresult, descriptor_variable(@4, 1), &no_indicator);
9309 : 12 : @$ = "";
9310 : : }
9311 : : | INTO SQL_DESCRIPTOR name
9312 : : {
9313 : 12 : add_variable_to_head(&argsresult, sqlda_variable(@3), &no_indicator);
9314 : 12 : @$ = "";
9315 : : }
9316 : : ;
9317 : :
9318 : : into_sqlda: INTO name
9319 : : {
9320 : 4 : add_variable_to_head(&argsresult, sqlda_variable(@2), &no_indicator);
9321 : 4 : @$ = "";
9322 : : }
9323 : : ;
9324 : :
9325 : : using_list: UsingValue | UsingValue ',' using_list
9326 : : ;
9327 : :
9328 : : UsingValue: UsingConst
9329 : : {
9330 : : char length[32];
9331 : :
9332 : 4 : snprintf(length, sizeof(length), "%zu", strlen(@1));
9333 : 4 : add_variable_to_head(&argsinsert, new_variable(@1, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
9334 : : }
9335 : : | civar
9336 : : {
9337 : 17 : @$ = "";
9338 : : }
9339 : : | civarind
9340 : : {
9341 : 0 : @$ = "";
9342 : : }
9343 : : ;
9344 : :
9345 : : UsingConst: Iconst
9346 : : | '+' Iconst
9347 : : | '-' Iconst
9348 : : | ecpg_fconst
9349 : : | '+' ecpg_fconst
9350 : : | '-' ecpg_fconst
9351 : : | ecpg_sconst
9352 : : | ecpg_bconst
9353 : : | ecpg_xconst
9354 : : ;
9355 : :
9356 : : /*
9357 : : * We accept DESCRIBE [OUTPUT] but do nothing with DESCRIBE INPUT so far.
9358 : : */
9359 : : ECPGDescribe: SQL_DESCRIBE INPUT_P prepared_name using_descriptor
9360 : : {
9361 : 0 : $$.input = 1;
9362 : 0 : $$.stmt_name = @3;
9363 : : }
9364 : : | SQL_DESCRIBE opt_output prepared_name using_descriptor
9365 : : {
9366 : : struct variable *var;
9367 : :
9368 : 8 : var = argsinsert->variable;
9369 : 8 : remove_variable_from_list(&argsinsert, var);
9370 : 8 : add_variable_to_head(&argsresult, var, &no_indicator);
9371 : :
9372 : 8 : $$.input = 0;
9373 : 8 : $$.stmt_name = @3;
9374 : : }
9375 : : | SQL_DESCRIBE opt_output prepared_name into_descriptor
9376 : : {
9377 : 9 : $$.input = 0;
9378 : 9 : $$.stmt_name = @3;
9379 : : }
9380 : : | SQL_DESCRIBE INPUT_P prepared_name into_sqlda
9381 : : {
9382 : 0 : $$.input = 1;
9383 : 0 : $$.stmt_name = @3;
9384 : : }
9385 : : | SQL_DESCRIBE opt_output prepared_name into_sqlda
9386 : : {
9387 : 4 : $$.input = 0;
9388 : 4 : $$.stmt_name = @3;
9389 : : }
9390 : : ;
9391 : :
9392 : : opt_output: SQL_OUTPUT
9393 : : | /* EMPTY */
9394 : : ;
9395 : :
9396 : : /*
9397 : : * dynamic SQL: descriptor based access
9398 : : * originally written by Christof Petig <christof.petig@wtal.de>
9399 : : * and Peter Eisentraut <peter.eisentraut@credativ.de>
9400 : : */
9401 : :
9402 : : /*
9403 : : * allocate a descriptor
9404 : : */
9405 : : ECPGAllocateDescr: SQL_ALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
9406 : : {
9407 : 20 : add_descriptor(@3, connection);
9408 : 20 : @$ = @3;
9409 : : }
9410 : : ;
9411 : :
9412 : :
9413 : : /*
9414 : : * deallocate a descriptor
9415 : : */
9416 : : ECPGDeallocateDescr: DEALLOCATE SQL_DESCRIPTOR quoted_ident_stringvar
9417 : : {
9418 : 16 : drop_descriptor(@3, connection);
9419 : 16 : @$ = @3;
9420 : : }
9421 : : ;
9422 : :
9423 : : /*
9424 : : * manipulate a descriptor header
9425 : : */
9426 : :
9427 : : ECPGGetDescriptorHeader: SQL_GET SQL_DESCRIPTOR quoted_ident_stringvar ECPGGetDescHeaderItem
9428 : : {
9429 : 11 : @$ = @3;
9430 : : }
9431 : : ;
9432 : :
9433 : : ECPGGetDescHeaderItem: cvariable '=' desc_header_item
9434 : : {
9435 : 11 : push_assignment(@1, $3);
9436 : : }
9437 : : ;
9438 : :
9439 : : ECPGSetDescriptorHeader: SET SQL_DESCRIPTOR quoted_ident_stringvar ECPGSetDescHeaderItem
9440 : : {
9441 : 1 : @$ = @3;
9442 : : }
9443 : : ;
9444 : :
9445 : : ECPGSetDescHeaderItem: desc_header_item '=' IntConstVar
9446 : : {
9447 : 1 : push_assignment(@3, $1);
9448 : : }
9449 : : ;
9450 : :
9451 : : IntConstVar: Iconst
9452 : : {
9453 : : char length[32];
9454 : :
9455 : 33 : snprintf(length, sizeof(length), "%zu", strlen(@1));
9456 : 33 : new_variable(@1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
9457 : : }
9458 : : | cvariable
9459 : : ;
9460 : :
9461 : : desc_header_item: SQL_COUNT
9462 : : {
9463 : 12 : $$ = ECPGd_count;
9464 : : }
9465 : : ;
9466 : :
9467 : : /*
9468 : : * manipulate a descriptor
9469 : : */
9470 : :
9471 : : ECPGGetDescriptor: SQL_GET SQL_DESCRIPTOR quoted_ident_stringvar VALUE_P IntConstVar ECPGGetDescItems
9472 : : {
9473 : 32 : $$.str = @5;
9474 : 32 : $$.name = @3;
9475 : : }
9476 : : ;
9477 : :
9478 : : ECPGGetDescItems: ECPGGetDescItem
9479 : : | ECPGGetDescItems ',' ECPGGetDescItem
9480 : : ;
9481 : :
9482 : : ECPGGetDescItem: cvariable '=' descriptor_item
9483 : : {
9484 : 52 : push_assignment(@1, $3);
9485 : : }
9486 : : ;
9487 : :
9488 : : ECPGSetDescriptor: SET SQL_DESCRIPTOR quoted_ident_stringvar VALUE_P IntConstVar ECPGSetDescItems
9489 : : {
9490 : 13 : $$.str = @5;
9491 : 13 : $$.name = @3;
9492 : : }
9493 : : ;
9494 : :
9495 : : ECPGSetDescItems: ECPGSetDescItem
9496 : : | ECPGSetDescItems ',' ECPGSetDescItem
9497 : : ;
9498 : :
9499 : : ECPGSetDescItem: descriptor_item '=' AllConstVar
9500 : : {
9501 : 17 : push_assignment(@3, $1);
9502 : : }
9503 : : ;
9504 : :
9505 : : AllConstVar: ecpg_fconst
9506 : : {
9507 : : char length[32];
9508 : :
9509 : 0 : snprintf(length, sizeof(length), "%zu", strlen(@1));
9510 : 0 : new_variable(@1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
9511 : : }
9512 : : | IntConstVar
9513 : : | '-' ecpg_fconst
9514 : : {
9515 : : char length[32];
9516 : 0 : char *var = cat2_str("-", @2);
9517 : :
9518 : 0 : snprintf(length, sizeof(length), "%zu", strlen(var));
9519 : 0 : new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
9520 : 0 : @$ = var;
9521 : : }
9522 : : | '-' Iconst
9523 : : {
9524 : : char length[32];
9525 : 0 : char *var = cat2_str("-", @2);
9526 : :
9527 : 0 : snprintf(length, sizeof(length), "%zu", strlen(var));
9528 : 0 : new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
9529 : 0 : @$ = var;
9530 : : }
9531 : : | ecpg_sconst
9532 : : {
9533 : : char length[32];
9534 : : char *var;
9535 : :
9536 : : /* Strip single quotes from ecpg_sconst */
9537 : 1 : var = loc_strdup(@1 + 1);
9538 : 1 : var[strlen(var) - 1] = '\0';
9539 : 1 : snprintf(length, sizeof(length), "%zu", strlen(var));
9540 : 1 : new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
9541 : 1 : @$ = var;
9542 : : }
9543 : : ;
9544 : :
9545 : 0 : descriptor_item: SQL_CARDINALITY { $$ = ECPGd_cardinality; }
9546 : 34 : | DATA_P { $$ = ECPGd_data; }
9547 : 2 : | SQL_DATETIME_INTERVAL_CODE { $$ = ECPGd_di_code; }
9548 : 0 : | SQL_DATETIME_INTERVAL_PRECISION { $$ = ECPGd_di_precision; }
9549 : 17 : | SQL_INDICATOR { $$ = ECPGd_indicator; }
9550 : 0 : | SQL_KEY_MEMBER { $$ = ECPGd_key_member; }
9551 : 2 : | SQL_LENGTH { $$ = ECPGd_length; }
9552 : 9 : | NAME_P { $$ = ECPGd_name; }
9553 : 0 : | SQL_NULLABLE { $$ = ECPGd_nullable; }
9554 : 1 : | SQL_OCTET_LENGTH { $$ = ECPGd_octet; }
9555 : 1 : | PRECISION { $$ = ECPGd_precision; }
9556 : 0 : | SQL_RETURNED_LENGTH { $$ = ECPGd_length; }
9557 : 1 : | SQL_RETURNED_OCTET_LENGTH { $$ = ECPGd_ret_octet; }
9558 : 1 : | SQL_SCALE { $$ = ECPGd_scale; }
9559 : 1 : | TYPE_P { $$ = ECPGd_type; }
9560 : : ;
9561 : :
9562 : : /*
9563 : : * set/reset the automatic transaction mode, this needs a different handling
9564 : : * as the other set commands
9565 : : */
9566 : : ECPGSetAutocommit: SET SQL_AUTOCOMMIT '=' on_off
9567 : : {
9568 : 4 : @$ = @4;
9569 : : }
9570 : : | SET SQL_AUTOCOMMIT TO on_off
9571 : : {
9572 : 9 : @$ = @4;
9573 : : }
9574 : : ;
9575 : :
9576 : : on_off: ON
9577 : : | OFF
9578 : : ;
9579 : :
9580 : : /*
9581 : : * set the actual connection, this needs a different handling as the other
9582 : : * set commands
9583 : : */
9584 : : ECPGSetConnection: SET CONNECTION TO connection_object
9585 : : {
9586 : 2 : @$ = @4;
9587 : : }
9588 : : | SET CONNECTION '=' connection_object
9589 : : {
9590 : 0 : @$ = @4;
9591 : : }
9592 : : | SET CONNECTION connection_object
9593 : : {
9594 : 1 : @$ = @3;
9595 : : }
9596 : : ;
9597 : :
9598 : : /*
9599 : : * define a new type for embedded SQL
9600 : : */
9601 : : ECPGTypedef: TYPE_P
9602 : : {
9603 : : /* reset this variable so we see if there was */
9604 : : /* an initializer specified */
9605 : 16 : initializer = 0;
9606 : : }
9607 : : ECPGColLabel IS var_type opt_array_bounds opt_reference
9608 : : {
9609 : 16 : add_typedef(@3, $6.index1, $6.index2, $5.type_enum, $5.type_dimension, $5.type_index, initializer, *@7 ? 1 : 0);
9610 : :
9611 [ + + ]: 16 : if (auto_create_c == false)
9612 : 10 : @$ = cat_str(7, "/* exec sql type", @3, "is", $5.type_str, $6.str, @7, "*/");
9613 : : else
9614 [ - + ]: 6 : @$ = cat_str(6, "typedef ", $5.type_str, *@7 ? "*" : "", @3, $6.str, ";");
9615 : : }
9616 : : ;
9617 : :
9618 : : opt_reference: SQL_REFERENCE
9619 : : | /* EMPTY */
9620 : : ;
9621 : :
9622 : : /*
9623 : : * define the type of one variable for embedded SQL
9624 : : */
9625 : : ECPGVar: SQL_VAR
9626 : : {
9627 : : /* reset this variable so we see if there was */
9628 : : /* an initializer specified */
9629 : 3 : initializer = 0;
9630 : : }
9631 : : ColLabel IS var_type opt_array_bounds opt_reference
9632 : : {
9633 : 3 : struct variable *p = find_variable(@3);
9634 : 3 : const char *dimension = $6.index1;
9635 : 3 : const char *length = $6.index2;
9636 : : struct ECPGtype *type;
9637 : :
9638 [ + - ]: 3 : if (($5.type_enum == ECPGt_struct ||
9639 [ - + ]: 3 : $5.type_enum == ECPGt_union) &&
9640 [ # # ]: 0 : initializer == 1)
9641 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in EXEC SQL VAR command");
9642 : : else
9643 : : {
9644 : 3 : adjust_array($5.type_enum, &dimension, &length,
9645 : 3 : $5.type_dimension, $5.type_index, *@7 ? 1 : 0, false);
9646 : :
9647 [ - + - + ]: 3 : switch ($5.type_enum)
9648 : : {
9649 : 0 : case ECPGt_struct:
9650 : : case ECPGt_union:
9651 [ # # ]: 0 : if (atoi(dimension) < 0)
9652 : 0 : type = ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof);
9653 : : else
9654 : 0 : type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof), dimension);
9655 : 0 : break;
9656 : :
9657 : 1 : case ECPGt_varchar:
9658 : : case ECPGt_bytea:
9659 [ + - ]: 1 : if (atoi(dimension) == -1)
9660 : 1 : type = ECPGmake_simple_type($5.type_enum, length, 0);
9661 : : else
9662 : 0 : type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
9663 : 1 : break;
9664 : :
9665 : 0 : case ECPGt_char:
9666 : : case ECPGt_unsigned_char:
9667 : : case ECPGt_string:
9668 [ # # ]: 0 : if (atoi(dimension) == -1)
9669 : 0 : type = ECPGmake_simple_type($5.type_enum, length, 0);
9670 : : else
9671 : 0 : type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, length, 0), dimension);
9672 : 0 : break;
9673 : :
9674 : 2 : default:
9675 [ - + ]: 2 : if (atoi(length) >= 0)
9676 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
9677 : :
9678 [ + - ]: 2 : if (atoi(dimension) < 0)
9679 : 2 : type = ECPGmake_simple_type($5.type_enum, "1", 0);
9680 : : else
9681 : 0 : type = ECPGmake_array_type(ECPGmake_simple_type($5.type_enum, "1", 0), dimension);
9682 : 2 : break;
9683 : : }
9684 : :
9685 : 3 : ECPGfree_type(p->type);
9686 : 3 : p->type = type;
9687 : : }
9688 : :
9689 : 3 : @$ = cat_str(7, "/* exec sql var", @3, "is", $5.type_str, $6.str, @7, "*/");
9690 : : }
9691 : : ;
9692 : :
9693 : : /*
9694 : : * whenever statement: decide what to do in case of error/no data found
9695 : : * according to SQL standards we lack: SQLSTATE, CONSTRAINT and SQLEXCEPTION
9696 : : */
9697 : : ECPGWhenever: SQL_WHENEVER SQL_SQLERROR action
9698 : : {
9699 : 62 : when_error.code = $3.code;
9700 : 62 : free(when_error.command);
9701 [ + + ]: 62 : when_error.command = $3.command ? mm_strdup($3.command) : NULL;
9702 : 62 : @$ = cat_str(3, "/* exec sql whenever sqlerror ", $3.str, "; */");
9703 : : }
9704 : : | SQL_WHENEVER NOT SQL_FOUND action
9705 : : {
9706 : 26 : when_nf.code = $4.code;
9707 : 26 : free(when_nf.command);
9708 [ - + ]: 26 : when_nf.command = $4.command ? mm_strdup($4.command) : NULL;
9709 : 26 : @$ = cat_str(3, "/* exec sql whenever not found ", $4.str, "; */");
9710 : : }
9711 : : | SQL_WHENEVER SQL_SQLWARNING action
9712 : : {
9713 : 13 : when_warn.code = $3.code;
9714 : 13 : free(when_warn.command);
9715 [ + + ]: 13 : when_warn.command = $3.command ? mm_strdup($3.command) : NULL;
9716 : 13 : @$ = cat_str(3, "/* exec sql whenever sql_warning ", $3.str, "; */");
9717 : : }
9718 : : ;
9719 : :
9720 : : action: CONTINUE_P
9721 : : {
9722 : 10 : $$.code = W_NOTHING;
9723 : 10 : $$.command = NULL;
9724 : 10 : $$.str = "continue";
9725 : : }
9726 : : | SQL_SQLPRINT
9727 : : {
9728 : 43 : $$.code = W_SQLPRINT;
9729 : 43 : $$.command = NULL;
9730 : 43 : $$.str = "sqlprint";
9731 : : }
9732 : : | SQL_STOP
9733 : : {
9734 : 15 : $$.code = W_STOP;
9735 : 15 : $$.command = NULL;
9736 : 15 : $$.str = "stop";
9737 : : }
9738 : : | SQL_GOTO name
9739 : : {
9740 : 1 : $$.code = W_GOTO;
9741 : 1 : $$.command = loc_strdup(@2);
9742 : 1 : $$.str = cat2_str("goto ", @2);
9743 : : }
9744 : : | SQL_GO TO name
9745 : : {
9746 : 0 : $$.code = W_GOTO;
9747 : 0 : $$.command = loc_strdup(@3);
9748 : 0 : $$.str = cat2_str("goto ", @3);
9749 : : }
9750 : : | DO name '(' c_args ')'
9751 : : {
9752 : 18 : $$.code = W_DO;
9753 : 18 : $$.command = cat_str(4, @2, "(", @4, ")");
9754 : 18 : $$.str = cat2_str("do", $$.command);
9755 : : }
9756 : : | DO SQL_BREAK
9757 : : {
9758 : 12 : $$.code = W_BREAK;
9759 : 12 : $$.command = NULL;
9760 : 12 : $$.str = "break";
9761 : : }
9762 : : | DO CONTINUE_P
9763 : : {
9764 : 1 : $$.code = W_CONTINUE;
9765 : 1 : $$.command = NULL;
9766 : 1 : $$.str = "continue";
9767 : : }
9768 : : | CALL name '(' c_args ')'
9769 : : {
9770 : 1 : $$.code = W_DO;
9771 : 1 : $$.command = cat_str(4, @2, "(", @4, ")");
9772 : 1 : $$.str = cat2_str("call", $$.command);
9773 : : }
9774 : : | CALL name
9775 : : {
9776 : 0 : $$.code = W_DO;
9777 : 0 : $$.command = cat2_str(@2, "()");
9778 : 0 : $$.str = cat2_str("call", $$.command);
9779 : : }
9780 : : ;
9781 : :
9782 : : /* some other stuff for ecpg */
9783 : :
9784 : : /* additional unreserved keywords */
9785 : : ECPGKeywords: ECPGKeywords_vanames
9786 : : | ECPGKeywords_rest
9787 : : ;
9788 : :
9789 : : ECPGKeywords_vanames: SQL_BREAK
9790 : : | SQL_CARDINALITY
9791 : : | SQL_COUNT
9792 : : | SQL_DATETIME_INTERVAL_CODE
9793 : : | SQL_DATETIME_INTERVAL_PRECISION
9794 : : | SQL_FOUND
9795 : : | SQL_GO
9796 : : | SQL_GOTO
9797 : : | SQL_IDENTIFIED
9798 : : | SQL_INDICATOR
9799 : : | SQL_KEY_MEMBER
9800 : : | SQL_LENGTH
9801 : : | SQL_NULLABLE
9802 : : | SQL_OCTET_LENGTH
9803 : : | SQL_RETURNED_LENGTH
9804 : : | SQL_RETURNED_OCTET_LENGTH
9805 : : | SQL_SCALE
9806 : : | SQL_SECTION
9807 : : | SQL_SQLERROR
9808 : : | SQL_SQLPRINT
9809 : : | SQL_SQLWARNING
9810 : : | SQL_STOP
9811 : : ;
9812 : :
9813 : : ECPGKeywords_rest: SQL_CONNECT
9814 : : | SQL_DESCRIBE
9815 : : | SQL_DISCONNECT
9816 : : | SQL_OPEN
9817 : : | SQL_VAR
9818 : : | SQL_WHENEVER
9819 : : ;
9820 : :
9821 : : /* additional keywords that can be SQL type names (but not ECPGColLabels) */
9822 : : ECPGTypeName: SQL_BOOL
9823 : : | SQL_LONG
9824 : : | SQL_OUTPUT
9825 : : | SQL_SHORT
9826 : : | SQL_STRUCT
9827 : : | SQL_SIGNED
9828 : : | SQL_UNSIGNED
9829 : : ;
9830 : :
9831 : : symbol: ColLabel
9832 : : ;
9833 : :
9834 : : ECPGColId: ecpg_ident
9835 : : | unreserved_keyword
9836 : : | col_name_keyword
9837 : : | ECPGunreserved_interval
9838 : : | ECPGKeywords
9839 : : | ECPGCKeywords
9840 : : | CHAR_P
9841 : : | VALUES
9842 : : ;
9843 : :
9844 : : /*
9845 : : * Name classification hierarchy.
9846 : : *
9847 : : * These productions should match those in the core grammar, except that
9848 : : * we use all_unreserved_keyword instead of unreserved_keyword, and
9849 : : * where possible include ECPG keywords as well as core keywords.
9850 : : */
9851 : :
9852 : : /* Column identifier --- names that can be column, table, etc names.
9853 : : */
9854 : : ColId: ecpg_ident
9855 : : | all_unreserved_keyword
9856 : : | col_name_keyword
9857 : : | ECPGKeywords
9858 : : | ECPGCKeywords
9859 : : | CHAR_P
9860 : : | VALUES
9861 : : ;
9862 : :
9863 : : /* Type/function identifier --- names that can be type or function names.
9864 : : */
9865 : : type_function_name: ecpg_ident
9866 : : | all_unreserved_keyword
9867 : : | type_func_name_keyword
9868 : : | ECPGKeywords
9869 : : | ECPGCKeywords
9870 : : | ECPGTypeName
9871 : : ;
9872 : :
9873 : : /* Column label --- allowed labels in "AS" clauses.
9874 : : * This presently includes *all* Postgres keywords.
9875 : : */
9876 : : ColLabel: ECPGColLabel
9877 : : | ECPGTypeName
9878 : : | CHAR_P
9879 : : | CURRENT_P
9880 : : | INPUT_P
9881 : : | INT_P
9882 : : | TO
9883 : : | UNION
9884 : : | VALUES
9885 : : | ECPGCKeywords
9886 : : | ECPGunreserved_interval
9887 : : ;
9888 : :
9889 : : ECPGColLabel: ecpg_ident
9890 : : | unreserved_keyword
9891 : : | col_name_keyword
9892 : : | type_func_name_keyword
9893 : : | reserved_keyword
9894 : : | ECPGKeywords_vanames
9895 : : | ECPGKeywords_rest
9896 : : | CONNECTION
9897 : : ;
9898 : :
9899 : : ECPGCKeywords: S_AUTO
9900 : : | S_CONST
9901 : : | S_EXTERN
9902 : : | S_REGISTER
9903 : : | S_STATIC
9904 : : | S_TYPEDEF
9905 : : | S_VOLATILE
9906 : : ;
9907 : :
9908 : : /* "Unreserved" keywords --- available for use as any kind of name.
9909 : : */
9910 : :
9911 : : /*
9912 : : * The following symbols must be excluded from ECPGColLabel and directly
9913 : : * included into ColLabel to enable C variables to get names from ECPGColLabel:
9914 : : * DAY_P, HOUR_P, MINUTE_P, MONTH_P, SECOND_P, YEAR_P.
9915 : : *
9916 : : * We also have to exclude CONNECTION, CURRENT, and INPUT for various reasons.
9917 : : * CONNECTION can be added back in all_unreserved_keyword, but CURRENT and
9918 : : * INPUT are reserved for ecpg purposes.
9919 : : *
9920 : : * The mentioned exclusions are done by $replace_line settings in parse.pl.
9921 : : */
9922 : : all_unreserved_keyword: unreserved_keyword
9923 : : | ECPGunreserved_interval
9924 : : | CONNECTION
9925 : : ;
9926 : :
9927 : : ECPGunreserved_interval: DAY_P
9928 : : | HOUR_P
9929 : : | MINUTE_P
9930 : : | MONTH_P
9931 : : | SECOND_P
9932 : : | YEAR_P
9933 : : ;
9934 : :
9935 : : into_list: coutputvariable | into_list ',' coutputvariable
9936 : : ;
9937 : :
9938 : : ecpgstart: SQL_START
9939 : : {
9940 : 1379 : reset_variables();
9941 : 1379 : pacounter = 1;
9942 : 1379 : @$ = "";
9943 : : }
9944 : : ;
9945 : :
9946 : : c_args: /* EMPTY */
9947 : : | c_list
9948 : : ;
9949 : :
9950 : : coutputvariable: cvariable indicator
9951 : : {
9952 : 28 : add_variable_to_head(&argsresult, find_variable(@1), find_variable(@2));
9953 : : }
9954 : : | cvariable
9955 : : {
9956 : 229 : add_variable_to_head(&argsresult, find_variable(@1), &no_indicator);
9957 : : }
9958 : : ;
9959 : :
9960 : :
9961 : : civarind: cvariable indicator
9962 : : {
9963 [ - + ]: 3 : if (find_variable(@2)->type->type == ECPGt_array)
9964 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "arrays of indicators are not allowed on input");
9965 : :
9966 : 3 : add_variable_to_head(&argsinsert, find_variable(@1), find_variable(@2));
9967 : 3 : @$ = create_questionmarks(@1, false);
9968 : : }
9969 : : ;
9970 : :
9971 : : char_civar: char_variable
9972 : : {
9973 : 45 : char *var = loc_strdup(@1);
9974 : 45 : char *ptr = strstr(var, ".arr");
9975 : :
9976 [ + + ]: 45 : if (ptr) /* varchar, we need the struct name here, not
9977 : : * the struct element */
9978 : 10 : *ptr = '\0';
9979 : 45 : add_variable_to_head(&argsinsert, find_variable(var), &no_indicator);
9980 : 45 : @$ = var;
9981 : : }
9982 : : ;
9983 : :
9984 : : civar: cvariable
9985 : : {
9986 : 128 : add_variable_to_head(&argsinsert, find_variable(@1), &no_indicator);
9987 : 128 : @$ = create_questionmarks(@1, false);
9988 : : }
9989 : : ;
9990 : :
9991 : : indicator: cvariable
9992 : : {
9993 : 31 : check_indicator((find_variable(@1))->type);
9994 : : }
9995 : : | SQL_INDICATOR cvariable
9996 : : {
9997 : 0 : check_indicator((find_variable(@2))->type);
9998 : 0 : @$ = @2;
9999 : : }
10000 : : | SQL_INDICATOR name
10001 : : {
10002 : 0 : check_indicator((find_variable(@2))->type);
10003 : 0 : @$ = @2;
10004 : : }
10005 : : ;
10006 : :
10007 : : cvariable: CVARIABLE
10008 : : {
10009 : : /*
10010 : : * As long as multidimensional arrays are not implemented we have to
10011 : : * check for those here
10012 : : */
10013 : 651 : const char *ptr = @1;
10014 : 651 : int brace_open = 0,
10015 : 651 : brace = false;
10016 : :
10017 [ + + ]: 4200 : for (; *ptr; ptr++)
10018 : : {
10019 [ + + - + ]: 3549 : switch (*ptr)
10020 : : {
10021 : 50 : case '[':
10022 [ - + ]: 50 : if (brace)
10023 : 0 : mmfatal(PARSE_ERROR, "multidimensional arrays for simple data types are not supported");
10024 : 50 : brace_open++;
10025 : 50 : break;
10026 : 50 : case ']':
10027 : 50 : brace_open--;
10028 [ + - ]: 50 : if (brace_open == 0)
10029 : 50 : brace = true;
10030 : 50 : break;
10031 : 0 : case '\t':
10032 : : case ' ':
10033 : 0 : break;
10034 : 3449 : default:
10035 [ + + ]: 3449 : if (brace_open == 0)
10036 : 3399 : brace = false;
10037 : 3449 : break;
10038 : : }
10039 : : }
10040 : : }
10041 : : ;
10042 : :
10043 : : ecpg_param: PARAM
10044 : : ;
10045 : :
10046 : : ecpg_bconst: BCONST
10047 : : ;
10048 : :
10049 : : ecpg_fconst: FCONST
10050 : : ;
10051 : :
10052 : : ecpg_sconst: SCONST
10053 : : ;
10054 : :
10055 : : ecpg_xconst: XCONST
10056 : : ;
10057 : :
10058 : : ecpg_ident: IDENT
10059 : : | CSTRING
10060 : : {
10061 : 1182 : @$ = make3_str("\"", @1, "\"");
10062 : : }
10063 : : ;
10064 : :
10065 : : quoted_ident_stringvar: name
10066 : : {
10067 : 113 : @$ = make3_str("\"", @1, "\"");
10068 : : }
10069 : : | char_variable
10070 : : {
10071 : 4 : @$ = make3_str("(", @1, ")");
10072 : : }
10073 : : ;
10074 : :
10075 : : /*
10076 : : * C stuff
10077 : : */
10078 : :
10079 : : c_stuff_item: c_anything
10080 : : | '(' ')'
10081 : : {
10082 : 0 : @$ = "()";
10083 : : }
10084 : : | '(' c_stuff ')'
10085 : : ;
10086 : :
10087 : : c_stuff: c_stuff_item
10088 : : | c_stuff c_stuff_item
10089 : : ;
10090 : :
10091 : : c_list: c_term
10092 : : | c_list ',' c_term
10093 : : ;
10094 : :
10095 : : c_term: c_stuff
10096 : : | '{' c_list '}'
10097 : : ;
10098 : :
10099 : : c_thing: c_anything
10100 : : | '('
10101 : : | ')'
10102 : : | ','
10103 : : | ';'
10104 : : ;
10105 : :
10106 : : /*
10107 : : * Note: NULL_P is treated specially to force it to be output in upper case,
10108 : : * since it's likely meant as a reference to the standard C macro NULL.
10109 : : */
10110 : : c_anything: ecpg_ident
10111 : : | Iconst
10112 : : | ecpg_fconst
10113 : : | ecpg_sconst
10114 : : | '*'
10115 : : | '+'
10116 : : | '-'
10117 : : | '/'
10118 : : | '%'
10119 : 2 : | NULL_P { @$ = "NULL"; }
10120 : : | S_ADD
10121 : : | S_AND
10122 : : | S_ANYTHING
10123 : : | S_AUTO
10124 : : | S_CONST
10125 : : | S_DEC
10126 : : | S_DIV
10127 : : | S_DOTPOINT
10128 : : | S_EQUAL
10129 : : | S_EXTERN
10130 : : | S_INC
10131 : : | S_LSHIFT
10132 : : | S_MEMBER
10133 : : | S_MEMPOINT
10134 : : | S_MOD
10135 : : | S_MUL
10136 : : | S_NEQUAL
10137 : : | S_OR
10138 : : | S_REGISTER
10139 : : | S_RSHIFT
10140 : : | S_STATIC
10141 : : | S_SUB
10142 : : | S_TYPEDEF
10143 : : | S_VOLATILE
10144 : : | SQL_BOOL
10145 : : | ENUM_P
10146 : : | HOUR_P
10147 : : | INT_P
10148 : : | SQL_LONG
10149 : : | MINUTE_P
10150 : : | MONTH_P
10151 : : | SECOND_P
10152 : : | SQL_SHORT
10153 : : | SQL_SIGNED
10154 : : | SQL_STRUCT
10155 : : | SQL_UNSIGNED
10156 : : | YEAR_P
10157 : : | CHAR_P
10158 : : | FLOAT_P
10159 : : | TO
10160 : : | UNION
10161 : : | VARCHAR
10162 : : | '['
10163 : : | ']'
10164 : : | '='
10165 : : | ':'
10166 : : ;
10167 : :
10168 : : DeallocateStmt: DEALLOCATE prepared_name
10169 : : {
10170 : 18 : check_declared_list(@2);
10171 : 18 : @$ = @2;
10172 : : }
10173 : : | DEALLOCATE PREPARE prepared_name
10174 : : {
10175 : 19 : check_declared_list(@3);
10176 : 19 : @$ = @3;
10177 : : }
10178 : : | DEALLOCATE ALL
10179 : : {
10180 : 3 : @$ = "all";
10181 : : }
10182 : : | DEALLOCATE PREPARE ALL
10183 : : {
10184 : 0 : @$ = "all";
10185 : : }
10186 : : ;
10187 : :
10188 : : Iresult: Iconst
10189 : : | '(' Iresult ')'
10190 : : | Iresult '+' Iresult
10191 : : | Iresult '-' Iresult
10192 : : | Iresult '*' Iresult
10193 : : | Iresult '/' Iresult
10194 : : | Iresult '%' Iresult
10195 : : | ecpg_sconst
10196 : : | ColId
10197 : : | ColId '(' var_type ')'
10198 : : {
10199 [ # # ]: 0 : if (pg_strcasecmp(@1, "sizeof") != 0)
10200 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition");
10201 : : else
10202 : 0 : @$ = cat_str(4, @1, "(", $3.type_str, ")");
10203 : : }
10204 : : ;
10205 : :
10206 : : execute_rest: /* EMPTY */
10207 : : | ecpg_using opt_ecpg_into
10208 : : | ecpg_into ecpg_using
10209 : : | ecpg_into
10210 : : ;
10211 : :
10212 : : ecpg_into: INTO into_list
10213 : : {
10214 : : /* always suppress this from the constructed string */
10215 : 146 : @$ = "";
10216 : : }
10217 : : | into_descriptor
10218 : : ;
10219 : :
10220 : : opt_ecpg_into: /* EMPTY */
10221 : : | ecpg_into
10222 : : ;
10223 : :
10224 : : ecpg_fetch_into: ecpg_into
10225 : : | using_descriptor
10226 : : {
10227 : : struct variable *var;
10228 : :
10229 : 1 : var = argsinsert->variable;
10230 : 1 : remove_variable_from_list(&argsinsert, var);
10231 : 1 : add_variable_to_head(&argsresult, var, &no_indicator);
10232 : : }
10233 : : ;
10234 : :
10235 : : opt_ecpg_fetch_into: /* EMPTY */
10236 : : | ecpg_fetch_into
10237 : : ;
10238 : :
10239 : : %%
10240 : :
10241 : : void
10242 : 0 : base_yyerror(const char *error)
10243 : : {
10244 : : /* translator: %s is typically the translation of "syntax error" */
10245 : 0 : mmerror(PARSE_ERROR, ET_ERROR, "%s at or near \"%s\"",
10246 [ # # ]: 0 : _(error), token_start ? token_start : base_yytext);
10247 : 0 : }
10248 : :
10249 : : void
10250 : 0 : parser_init(void)
10251 : : {
10252 : : /*
10253 : : * This function is empty. It only exists for compatibility with the
10254 : : * backend parser right now.
10255 : : */
10256 : 0 : }
|