2 * Copyright 2008 Search Solution Corporation
3 * Copyright 2016 CUBRID Corporation
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 * csql_grammar.y - SQL grammar file
25 %{/*%CODE_REQUIRES_START%*/
26 #include "json_table_def.h"
30 * The default YYLTYPE structure is extended so that locations can hold
33 typedef struct YYLTYPE
40 int buffer_pos; /* position in the buffer being parsed */
43 #define YYLTYPE_IS_DECLARED 1
80 void csql_yyerror_explicit (int line, int column);
81 void csql_yyerror (const char *s);
83 extern int g_msg[1024];
85 extern int yybuffer_pos;
89 #define YYMAXDEPTH 1000000
91 /* #define PARSER_DEBUG */
103 #include "chartype.h"
105 #include "parser_message.h"
106 #include "language_support.h"
107 #include "unicode_support.h"
108 #include "environment_variable.h"
110 #include "transaction_cl.h"
111 #include "csql_grammar_scan.h"
112 #include "system_parameter.h"
113 #define JP_MAXNAME 256
115 #define snprintf _sprintf_p
117 #include "memory_alloc.h"
119 #include "storage_common.h"
121 #if defined (SUPPRESS_STRLEN_WARNING)
122 #define strlen(s1) ((int) strlen(s1))
123 #endif /* defined (SUPPRESS_STRLEN_WARNING) */
125 /* Bit mask to be used to check constraints of a column.
126 * COLUMN_CONSTRAINT_SHARED_DEFAULT_AI is special-purpose mask
127 * to identify duplication of SHARED, DEFAULT and AUTO_INCREMENT.
129 #define COLUMN_CONSTRAINT_UNIQUE (0x01)
130 #define COLUMN_CONSTRAINT_PRIMARY_KEY (0x02)
131 #define COLUMN_CONSTRAINT_NULL (0x04)
132 #define COLUMN_CONSTRAINT_OTHERS (0x08)
133 #define COLUMN_CONSTRAINT_SHARED (0x10)
134 #define COLUMN_CONSTRAINT_DEFAULT (0x20)
135 #define COLUMN_CONSTRAINT_AUTO_INCREMENT (0x40)
136 #define COLUMN_CONSTRAINT_SHARED_DEFAULT_AI (0x70)
137 #define COLUMN_CONSTRAINT_COMMENT (0x80)
138 #define COLUMN_CONSTRAINT_ON_UPDATE (0x100)
141 #define DBG_PRINT printf("rule matched at line: %d\n", __LINE__);
142 #define PRINT_(a) printf(a)
143 #define PRINT_1(a, b) printf(a, b)
144 #define PRINT_2(a, b, c) printf(a, b, c)
148 #define PRINT_1(a, b)
149 #define PRINT_2(a, b, c)
152 #define STACK_SIZE 128
154 typedef struct function_map FUNCTION_MAP;
162 static FUNCTION_MAP functions[] = {
165 {"addtime", PT_ADDTIME},
170 {"bit_count", PT_BIT_COUNT},
171 {"bit_to_blob", PT_BIT_TO_BLOB},
172 {"blob_from_file", PT_BLOB_FROM_FILE},
173 {"blob_length", PT_BLOB_LENGTH},
174 {"blob_to_bit", PT_BLOB_TO_BIT},
176 {"ceiling", PT_CEIL},
177 {"char_length", PT_CHAR_LENGTH},
178 {"char_to_blob", PT_CHAR_TO_BLOB},
179 {"char_to_clob", PT_CHAR_TO_CLOB},
180 {"character_length", PT_CHAR_LENGTH},
181 {"clob_from_file", PT_CLOB_FROM_FILE},
182 {"clob_length", PT_CLOB_LENGTH},
183 {"concat", PT_CONCAT},
184 {"concat_ws", PT_CONCAT_WS},
187 {"cume_dist", PT_CUME_DIST},
188 {"curtime", PT_CURRENT_TIME},
189 {"curdate", PT_CURRENT_DATE},
190 {"utc_time", PT_UTC_TIME},
191 {"utc_date", PT_UTC_DATE},
192 {"datediff", PT_DATEDIFF},
193 {"timediff",PT_TIMEDIFF},
194 {"date_format", PT_DATE_FORMAT},
195 {"dayofmonth", PT_DAYOFMONTH},
196 {"dayofyear", PT_DAYOFYEAR},
197 {"decode", PT_DECODE},
199 {"degrees", PT_DEGREES},
201 {"drandom", PT_DRANDOM},
202 {"exec_stats", PT_EXEC_STATS},
206 {"from_days", PT_FROMDAYS},
207 {"greatest", PT_GREATEST},
208 {"groupby_num", PT_GROUPBY_NUM},
210 {"index_cardinality", PT_INDEX_CARDINALITY},
211 {"inst_num", PT_INST_NUM},
213 {"instrb", PT_INSTR},
214 {"last_day", PT_LAST_DAY},
215 {"length", PT_CHAR_LENGTH},
216 {"lengthb", PT_CHAR_LENGTH},
218 {"like_match_lower_bound", PT_LIKE_LOWER_BOUND},
219 {"like_match_upper_bound", PT_LIKE_UPPER_BOUND},
220 {"list_dbs", PT_LIST_DBS},
221 {"locate", PT_LOCATE},
228 {"makedate", PT_MAKEDATE},
229 {"maketime", PT_MAKETIME},
231 {"months_between", PT_MONTHS_BETWEEN},
232 {"new_time", PT_NEW_TIME},
233 {"format", PT_FORMAT},
234 {"now", PT_CURRENT_DATETIME},
237 {"orderby_num", PT_ORDERBY_NUM},
238 {"percent_rank", PT_PERCENT_RANK},
242 {"radians", PT_RADIANS},
244 {"random", PT_RANDOM},
245 {"repeat", PT_REPEAT},
247 {"reverse", PT_REVERSE},
248 {"disk_size", PT_DISK_SIZE},
250 {"row_count", PT_ROW_COUNT},
251 {"last_insert_id", PT_LAST_INSERT_ID},
254 {"sec_to_time", PT_SECTOTIME},
255 {"serial_current_value", PT_CURRENT_VALUE},
256 {"serial_next_value", PT_NEXT_VALUE},
260 {"strcmp", PT_STRCMP},
261 {"substr", PT_SUBSTRING},
262 {"substring_index", PT_SUBSTRING_INDEX},
263 {"find_in_set", PT_FINDINSET},
266 * temporarily block aes_encrypt and aes_decrypt functions until binary string charset is available.
268 * {"aes_encrypt", PT_AES_ENCRYPT},
269 * {"aes_decrypt", PT_AES_DECRYPT},
271 {"sha1", PT_SHA_ONE},
272 {"sha2", PT_SHA_TWO},
273 {"substrb", PT_SUBSTRING},
275 {"time_format", PT_TIME_FORMAT},
276 {"to_char", PT_TO_CHAR},
277 {"to_date", PT_TO_DATE},
278 {"to_datetime", PT_TO_DATETIME},
279 {"to_days", PT_TODAYS},
280 {"time_to_sec", PT_TIMETOSEC},
281 {"to_number", PT_TO_NUMBER},
282 {"to_time", PT_TO_TIME},
283 {"to_timestamp", PT_TO_TIMESTAMP},
285 {"tz_offset", PT_TZ_OFFSET},
286 {"unix_timestamp", PT_UNIX_TIMESTAMP},
287 {"typeof", PT_TYPEOF},
288 {"from_unixtime", PT_FROM_UNIXTIME},
289 {"from_tz", PT_FROM_TZ},
290 {"weekday", PT_WEEKDAY},
291 {"dayofweek", PT_DAYOFWEEK},
292 {"version", PT_VERSION},
293 {"quarter", PT_QUARTERF},
298 {"inet_aton", PT_INET_ATON},
299 {"inet_ntoa", PT_INET_NTOA},
300 {"coercibility", PT_COERCIBILITY},
301 {"width_bucket", PT_WIDTH_BUCKET},
302 {"trace_stats", PT_TRACE_STATS},
303 {"str_to_date", PT_STR_TO_DATE},
304 {"to_base64", PT_TO_BASE64},
305 {"from_base64", PT_FROM_BASE64},
306 {"sys_guid", PT_SYS_GUID},
308 {"to_datetime_tz", PT_TO_DATETIME_TZ},
309 {"to_timestamp_tz", PT_TO_TIMESTAMP_TZ},
310 {"utc_timestamp", PT_UTC_TIMESTAMP},
312 {"schema_def", PT_SCHEMA_DEF},
313 {"conv_tz", PT_CONV_TZ},
317 static int parser_groupby_exception = 0;
322 /* xxxnum_check: 0 not allowed, no compatibility check
323 1 allowed, compatibility check (search_condition)
324 2 allowed, no compatibility check (select_list) */
325 static int parser_instnum_check = 0;
326 static int parser_groupbynum_check = 0;
327 static int parser_orderbynum_check = 0;
328 static int parser_within_join_condition = 0;
330 /* xxx_check: 0 not allowed
332 static int parser_sysconnectbypath_check = 0;
333 static int parser_prior_check = 0;
334 static int parser_connectbyroot_check = 0;
335 static int parser_serial_check = 1;
336 static int parser_pseudocolumn_check = 1;
337 static int parser_subquery_check = 1;
338 static int parser_hostvar_check = 1;
340 /* check Oracle style outer-join operator: '(+)' */
341 static bool parser_found_Oracle_outer = false;
343 /* check sys_date, sys_time, sys_timestamp, sys_datetime local_transaction_id */
344 static bool parser_si_datetime = false;
345 static bool parser_si_tran_id = false;
347 /* check the condition that the statment is not able to be prepared */
348 static bool parser_cannot_prepare = false;
350 /* check the condition that the result of a query is not able to be cached */
351 static bool parser_cannot_cache = false;
353 /* check if INCR is used legally */
354 static int parser_select_level = -1;
356 /* handle inner increment exprs in select list */
357 static PT_NODE *parser_hidden_incr_list = NULL;
359 /* for opt_over_analytic_partition_by */
360 static bool is_analytic_function = false;
362 #define PT_EMPTY INT_MAX
365 #define TO_NUMBER(a) ((UINTPTR)(a))
366 #define FROM_NUMBER(a) ((PT_NODE*)(UINTPTR)(a))
369 #define SET_CONTAINER_2(a, i, j) a.c1 = i, a.c2 = j
370 #define SET_CONTAINER_3(a, i, j, k) a.c1 = i, a.c2 = j, a.c3 = k
371 #define SET_CONTAINER_4(a, i, j, k, l) a.c1 = i, a.c2 = j, a.c3 = k, a.c4 = l
373 #define CONTAINER_AT_0(a) (a).c1
374 #define CONTAINER_AT_1(a) (a).c2
375 #define CONTAINER_AT_2(a) (a).c3
376 #define CONTAINER_AT_3(a) (a).c4
377 #define CONTAINER_AT_4(a) (a).c5
378 #define CONTAINER_AT_5(a) (a).c6
379 #define CONTAINER_AT_6(a) (a).c7
380 #define CONTAINER_AT_7(a) (a).c8
381 #define CONTAINER_AT_8(a) (a).c9
382 #define CONTAINER_AT_9(a) (a).c10
384 #define YEN_SIGN_TEXT "(\0xa1\0xef)"
385 #define DOLLAR_SIGN_TEXT "$"
386 #define WON_SIGN_TEXT "\\"
387 #define TURKISH_LIRA_TEXT "TL"
388 #define BRITISH_POUND_TEXT "GBP"
389 #define CAMBODIAN_RIEL_TEXT "KHR"
390 #define CHINESE_RENMINBI_TEXT "CNY"
391 #define INDIAN_RUPEE_TEXT "INR"
392 #define RUSSIAN_RUBLE_TEXT "RUB"
393 #define AUSTRALIAN_DOLLAR_TEXT "AUD"
394 #define CANADIAN_DOLLAR_TEXT "CAD"
395 #define BRASILIAN_REAL_TEXT "BRL"
396 #define ROMANIAN_LEU_TEXT "RON"
397 #define EURO_TEXT "EUR"
398 #define SWISS_FRANC_TEXT "CHF"
399 #define DANISH_KRONE_TEXT "DKK"
400 #define NORWEGIAN_KRONE_TEXT "NOK"
401 #define BULGARIAN_LEV_TEXT "BGN"
402 #define VIETNAMESE_DONG_TEXT "VND"
403 #define CZECH_KORUNA_TEXT "CZK"
404 #define POLISH_ZLOTY_TEXT "PLN"
405 #define SWEDISH_KRONA_TEXT "SEK"
406 #define CROATIAN_KUNA_TEXT "HRK"
407 #define SERBIAN_DINAR_TEXT "RSD"
409 #define PARSER_SAVE_ERR_CONTEXT(node, context) \
410 if ((node) && (node)->buffer_pos == -1) \
412 (node)->buffer_pos = context; \
425 FUNCTION_MAP *keyword_offset (const char *name);
427 static PT_NODE *parser_make_expr_with_func (PARSER_CONTEXT * parser, FUNC_TYPE func_code, PT_NODE * args_list);
428 static PT_NODE *parser_make_func_with_arg_count (PARSER_CONTEXT * parser, FUNC_TYPE func_code, PT_NODE * args_list,
429 size_t min_args, size_t max_args);
430 static PT_NODE *parser_make_func_with_arg_count_mod2 (PARSER_CONTEXT * parser, FUNC_TYPE func_code, PT_NODE * args_list,
431 size_t min_args, size_t max_args, size_t mod2);
432 static PT_NODE *parser_make_link (PT_NODE * list, PT_NODE * node);
433 static PT_NODE *parser_make_link_or (PT_NODE * list, PT_NODE * node);
437 static void parser_save_and_set_cannot_cache (bool value);
438 static void parser_restore_cannot_cache (void);
440 static void parser_save_and_set_si_datetime (int value);
441 static void parser_restore_si_datetime (void);
443 static void parser_save_and_set_si_tran_id (int value);
444 static void parser_restore_si_tran_id (void);
446 static void parser_save_and_set_cannot_prepare (bool value);
447 static void parser_restore_cannot_prepare (void);
449 static void parser_save_and_set_wjc (int value);
450 static void parser_restore_wjc (void);
452 static void parser_save_and_set_ic (int value);
453 static void parser_restore_ic (void);
455 static void parser_save_and_set_gc (int value);
456 static void parser_restore_gc (void);
458 static void parser_save_and_set_oc (int value);
459 static void parser_restore_oc (void);
461 static void parser_save_and_set_sysc (int value);
462 static void parser_restore_sysc (void);
464 static void parser_save_and_set_prc (int value);
465 static void parser_restore_prc (void);
467 static void parser_save_and_set_cbrc (int value);
468 static void parser_restore_cbrc (void);
470 static void parser_save_and_set_serc (int value);
471 static void parser_restore_serc (void);
473 static void parser_save_and_set_pseudoc (int value);
474 static void parser_restore_pseudoc (void);
476 static void parser_save_and_set_sqc (int value);
477 static void parser_restore_sqc (void);
479 static void parser_save_and_set_hvar (int value);
480 static void parser_restore_hvar (void);
482 static void parser_save_found_Oracle_outer (void);
483 static void parser_restore_found_Oracle_outer (void);
485 static void parser_save_alter_node (PT_NODE * node);
486 static PT_NODE *parser_get_alter_node (void);
488 static void parser_save_attr_def_one (PT_NODE * node);
489 static PT_NODE *parser_get_attr_def_one (void);
491 static void parser_push_orderby_node (PT_NODE * node);
492 static PT_NODE *parser_top_orderby_node (void);
493 static PT_NODE *parser_pop_orderby_node (void);
495 static void parser_push_select_stmt_node (PT_NODE * node);
496 static PT_NODE *parser_top_select_stmt_node (void);
497 static PT_NODE *parser_pop_select_stmt_node (void);
498 static bool parser_is_select_stmt_node_empty (void);
500 static void parser_push_hint_node (PT_NODE * node);
501 static PT_NODE *parser_top_hint_node (void);
502 static PT_NODE *parser_pop_hint_node (void);
503 static bool parser_is_hint_node_empty (void);
505 static void parser_push_join_type (int v);
506 static int parser_top_join_type (void);
507 static int parser_pop_join_type (void);
509 static void parser_save_is_reverse (bool v);
510 static bool parser_get_is_reverse (void);
512 static void parser_initialize_parser_context (void);
513 static PT_NODE *parser_make_date_lang (int arg_cnt, PT_NODE * arg3);
514 static PT_NODE *parser_make_number_lang (const int argc);
515 static void parser_remove_dummy_select (PT_NODE ** node);
516 static int parser_count_list (PT_NODE * list);
517 static int parser_count_prefix_columns (PT_NODE * list, int * arg_count);
519 static void resolve_alias_in_expr_node (PT_NODE * node, PT_NODE * list);
520 static void resolve_alias_in_name_node (PT_NODE ** node, PT_NODE * list);
521 static char * pt_check_identifier (PARSER_CONTEXT *parser, PT_NODE *p,
522 const char *str, const int str_size);
523 static PT_NODE * pt_create_char_string_literal (PARSER_CONTEXT *parser,
524 const PT_TYPE_ENUM char_type,
526 const INTL_CODESET codeset);
527 static PT_NODE * pt_create_date_value (PARSER_CONTEXT *parser,
528 const PT_TYPE_ENUM type,
530 static PT_NODE * pt_create_json_value (PARSER_CONTEXT *parser,
532 static void pt_jt_append_column_or_nested_node (PT_NODE * jt_node, PT_NODE * jt_col_or_nested);
533 static void pt_value_set_charset_coll (PARSER_CONTEXT *parser,
535 const int codeset_id,
536 const int collation_id, bool force);
537 static void pt_value_set_collation_info (PARSER_CONTEXT *parser,
540 static void pt_value_set_monetary (PARSER_CONTEXT *parser, PT_NODE *node,
541 const char *str, const char *txt, DB_CURRENCY type);
542 static PT_NODE * pt_create_paren_expr_list (PT_NODE * exp);
543 static PT_MISC_TYPE parser_attr_type;
545 static bool allow_attribute_ordering;
547 int parse_one_statement (int state);
548 static PT_NODE *pt_set_collation_modifier (PARSER_CONTEXT *parser,
549 PT_NODE *node, PT_NODE *coll_node);
552 #define push_msg(a) _push_msg(a, __LINE__)
554 void _push_msg (int code, int line);
557 char *g_query_string;
558 int g_query_string_len;
559 int g_original_buffer_len;
563 * The behavior of location propagation when a rule is matched must
564 * take into account the context information. The left-side symbol in a rule
565 * will have the same context information as the last symbol from its
568 #define YYLLOC_DEFAULT(Current, Rhs, N) \
572 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
573 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
574 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
575 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
576 (Current).buffer_pos = YYRHSLOC (Rhs, N).buffer_pos; \
580 (Current).first_line = (Current).last_line = \
581 YYRHSLOC (Rhs, 0).last_line; \
582 (Current).first_column = (Current).last_column = \
583 YYRHSLOC (Rhs, 0).last_column; \
584 (Current).buffer_pos = YYRHSLOC (Rhs, 0).buffer_pos; \
589 * YY_LOCATION_PRINT -- Print the location on the stream.
590 * This macro was not mandated originally: define only if we know
591 * we won't break user code: when these are the locations we know.
594 #define YY_LOCATION_PRINT(File, Loc) \
595 fprintf (File, "%d.%d-%d.%d", \
596 (Loc).first_line, (Loc).first_column, \
597 (Loc).last_line, (Loc).last_column)
601 %initial-action {yybuffer_pos = 0;}
604 %define parse.error verbose
617 struct json_table_column_behavior jtcb;
621 /* define rule type (number) */
623 %type <boolean> opt_reverse
624 %type <boolean> opt_unique
625 %type <boolean> opt_cascade_constraints
626 %type <number> opt_replace
627 %type <number> opt_of_inner_left_right
628 %type <number> opt_class_type
629 %type <number> opt_of_attr_column_method
630 %type <number> opt_class
631 %type <number> isolation_level_name
632 %type <number> opt_status
633 %type <number> trigger_status
634 %type <number> trigger_time
635 %type <number> opt_trigger_action_time
636 %type <number> event_type
637 %type <number> opt_of_data_type_cursor
638 %type <number> all_distinct
639 %type <number> of_avg_max_etc
640 %type <number> of_leading_trailing_both
641 %type <number> datetime_field
642 %type <boolean> opt_invisible
643 %type <number> opt_paren_plus
644 %type <number> opt_with_fullscan
645 %type <number> opt_with_online
646 %type <number> comp_op
647 %type <number> opt_of_all_some_any
648 %type <number> set_op
649 %type <number> char_bit_type
650 %type <number> opt_internal_external
651 %type <number> opt_identity
652 %type <number> set_type
653 %type <number> opt_of_container
654 %type <number> of_container
655 %type <number> opt_with_levels_clause
656 %type <number> of_class_table_type
657 %type <number> opt_with_grant_option
658 %type <number> opt_sp_in_out
659 %type <number> opt_in_out
660 %type <number> like_op
661 %type <number> rlike_op
662 %type <number> null_op
665 %type <number> between_op
666 %type <number> opt_varying
667 %type <number> nested_set
668 %type <number> opt_asc_or_desc
669 %type <number> opt_with_rollup
670 %type <number> opt_table_type
671 %type <number> opt_or_replace
672 %type <number> column_constraint_and_comment_def
673 %type <number> constraint_list_and_column_comment
674 %type <number> opt_constraint_list_and_opt_column_comment
675 %type <number> opt_full
676 %type <number> of_analytic
677 %type <number> of_analytic_first_last
678 %type <number> of_analytic_nth_value
679 %type <number> of_analytic_lead_lag
680 %type <number> of_percentile
681 %type <number> of_analytic_no_args
682 %type <number> of_cume_dist_percent_rank_function
683 %type <number> negative_prec_cast_type
684 %type <number> opt_nulls_first_or_last
685 %type <number> query_trace_spec
686 %type <number> opt_trace_output_format
687 %type <number> opt_if_not_exists
688 %type <number> opt_if_exists
689 %type <number> opt_recursive
690 %type <number> show_type
691 %type <number> show_type_of_like
692 %type <number> show_type_of_where
693 %type <number> show_type_arg1
694 %type <number> show_type_arg1_opt
695 %type <number> show_type_arg_named
696 %type <number> show_type_id_dot_id
697 %type <number> kill_type
698 %type <number> procedure_or_function
699 %type <boolean> opt_analytic_from_last
700 %type <boolean> opt_analytic_ignore_nulls
701 %type <number> opt_encrypt_algorithm
704 /* define rule type (node) */
708 %type <node> create_stmt
709 %type <node> set_stmt
710 %type <node> get_stmt
711 %type <node> auth_stmt
712 %type <node> transaction_stmt
713 %type <node> alter_stmt
714 %type <node> alter_clause_list
715 %type <node> rename_stmt
716 %type <node> rename_class_list
717 %type <node> rename_class_pair
718 %type <node> drop_stmt
719 %type <node> opt_index_column_name_list
720 %type <node> index_column_name_list
721 %type <node> update_statistics_stmt
722 %type <node> only_class_name_list
723 %type <node> opt_level_spec
724 %type <node> char_string_literal_list
725 %type <node> table_spec_list
726 %type <node> join_table_spec
727 %type <node> table_spec
728 %type <node> original_table_spec
729 %type <node> join_condition
730 %type <node> class_spec_list
731 %type <node> class_spec
732 %type <node> only_all_class_spec_list
733 %type <node> meta_class_spec
734 %type <node> only_all_class_spec
735 %type <node> class_name
736 %type <node> class_name_list
737 %type <node> opt_identifier
738 %type <node> normal_or_class_attr_list_with_commas
739 %type <node> normal_or_class_attr
740 %type <node> normal_column_or_class_attribute
741 %type <node> query_number_list
742 %type <node> insert_or_replace_stmt
743 %type <node> insert_set_stmt
744 %type <node> replace_set_stmt
745 %type <node> insert_set_stmt_header
746 %type <node> insert_expression
747 %type <node> opt_attr_list
748 %type <node> opt_path_attr_list
749 %type <node> into_clause_opt
750 %type <node> insert_value_clause
751 %type <node> insert_value_clause_list
752 %type <node> insert_stmt_value_clause
753 %type <node> select_or_subquery_without_values_query_no_with_clause
754 %type <node> csql_query_without_values_query_no_with_clause
755 %type <node> select_expression_without_values_query_no_with_clause
756 %type <node> csql_query_without_subquery_and_with_clause
757 %type <node> select_expression_without_subquery
758 %type <node> select_or_values_query
759 %type <node> subquery_without_subquery_and_with_clause
760 %type <node> select_or_nested_values_query
761 %type <node> csql_query_without_values_and_single_subquery
762 %type <node> select_expression_without_values_and_single_subquery
763 %type <node> insert_expression_value_clause
764 %type <node> insert_value_list
765 %type <node> insert_value
766 %type <node> update_stmt
767 %type <node> of_class_spec_meta_class_spec
768 %type <node> opt_as_identifier
769 %type <node> update_assignment_list
770 %type <node> update_assignment
771 %type <node> paren_path_expression_set
772 %type <node> path_expression_list
773 %type <node> delete_stmt
774 %type <node> author_cmd_list
775 %type <node> authorized_cmd
776 %type <node> opt_password
777 %type <node> opt_groups
778 %type <node> opt_members
779 %type <node> call_stmt
780 %type <node> opt_class_or_normal_attr_def_list
781 %type <node> opt_method_def_list
782 %type <node> opt_method_files
783 %type <node> opt_inherit_resolution_list
784 %type <node> opt_partition_clause
785 %type <node> opt_paren_view_attr_def_list
786 %type <node> opt_as_query_list
787 %type <node> opt_group_concat_separator
788 %type <node> opt_agg_order_by
789 %type <node> query_list
790 %type <node> inherit_resolution_list
791 %type <node> inherit_resolution
792 %type <node> opt_table_option_list
793 %type <node> table_option_list
794 %type <node> table_option
795 %type <node> opt_subtable_clause
796 %type <node> opt_constraint_id
797 %type <node> opt_constraint_opt_id
798 %type <node> of_unique_foreign_check
799 %type <node> unique_constraint
800 %type <node> foreign_key_constraint
801 %type <node> opt_paren_attr_list
802 %type <node> check_constraint
803 %type <node> method_def_list
804 %type <node> method_def
805 %type <node> opt_method_def_arg_list
806 %type <node> arg_type_list
807 %type <node> inout_data_type
808 %type <node> opt_function_identifier
809 %type <node> opt_class_attr_def_list
810 %type <node> class_or_normal_attr_def_list
811 %type <node> view_attr_def_list
812 %type <node> attr_def_comment_list
813 %type <node> attr_def_comment
814 %type <node> attr_def_list
815 %type <node> attr_def_list_with_commas
816 %type <node> attr_def
817 %type <node> attr_constraint_def
818 %type <node> attr_index_def
819 %type <node> attr_def_one
820 %type <node> view_attr_def
821 %type <node> transaction_mode_list
822 %type <node> transaction_mode
823 %type <node> timeout_spec
824 %type <node> evaluate_stmt
825 %type <node> prepare_stmt
826 %type <node> execute_stmt
827 %type <node> opt_using
828 %type <node> execute_using_list;
829 %type <node> opt_priority
830 %type <node> opt_if_trigger_condition
831 %type <node> event_spec
832 %type <node> event_target
833 %type <node> trigger_condition
834 %type <node> trigger_action
835 %type <node> trigger_spec_list
836 %type <node> trace_spec
837 %type <node> depth_spec
838 %type <node> serial_start
839 %type <node> serial_increment
840 %type <node> opt_sp_param_list
841 %type <node> sp_param_list
842 %type <node> sp_param_def
843 %type <node> esql_query_stmt
844 %type <node> csql_query
845 %type <node> csql_query_select_has_no_with_clause
846 %type <node> csql_query_without_values_query
847 %type <node> select_expression_opt_with
848 %type <node> select_expression
849 %type <node> select_expression_without_values_query
850 %type <node> table_op
851 %type <node> select_or_subquery
852 %type <node> select_or_subquery_without_values_query
853 %type <node> select_stmt
854 %type <node> opt_with_clause
855 %type <node> opt_select_param_list
856 %type <node> opt_from_clause
857 %type <node> select_list
858 %type <node> alias_enabled_expression_list_top
859 %type <node> alias_enabled_expression_list
860 %type <node> alias_enabled_expression_
861 %type <node> expression_list
862 %type <node> to_param_list
863 %type <node> to_param
864 %type <node> from_param
865 %type <node> host_param_input
866 %type <node> host_param_output
868 %type <node> opt_where_clause
869 %type <node> startwith_clause
870 %type <node> connectby_clause
871 %type <node> opt_groupby_clause
872 %type <node> group_spec_list
873 %type <node> group_spec
874 %type <node> opt_having_clause
875 %type <node> index_name
876 %type <node> index_name_keylimit
877 %type <node> opt_using_index_clause
878 %type <node> index_name_list
879 %type <node> index_name_keylimit_list
880 %type <node> opt_with_increment_clause
881 %type <node> opt_update_orderby_clause
882 %type <node> opt_orderby_clause
883 %type <node> sort_spec_list
884 %type <node> expression_
885 %type <node> normal_expression
886 %type <node> expression_strcat
887 %type <node> expression_add_sub
888 %type <node> expression_bitshift
889 %type <node> expression_bitand
890 %type <node> expression_bitor
895 %type <node> primary_w_collate
897 %type <node> case_expr
898 %type <node> opt_else_expr
899 %type <node> simple_when_clause_list
900 %type <node> simple_when_clause
901 %type <node> searched_when_clause_list
902 %type <node> searched_when_clause
903 %type <node> extract_expr
904 %type <node> opt_expression_list
905 %type <node> table_set_function_call
906 %type <node> search_condition
907 %type <node> boolean_term
908 %type <node> boolean_term_is
909 %type <node> boolean_term_xor
910 %type <node> boolean_factor
911 %type <node> predicate
912 %type <node> predicate_expression
913 %type <node> predicate_expr_sub
914 %type <node> range_list
916 %type <node> subquery
917 %type <node> path_expression
918 %type <node> data_type_list
919 %type <node> opt_prec_1
920 %type <node> opt_padding
921 %type <node> signed_literal_
922 %type <node> literal_
923 %type <node> literal_w_o_param
924 %type <node> constant_set
925 %type <node> file_path_name
926 %type <node> identifier_list
927 %type <node> opt_bracketed_identifier_list
928 %type <node> index_column_identifier_list
929 %type <node> identifier
930 %type <node> index_column_identifier
931 %type <node> string_literal_or_input_hv
932 %type <node> escape_literal
933 %type <node> char_string_literal
934 %type <node> char_string
935 %type <node> bit_string_literal
936 %type <node> bit_string
937 %type <node> unsigned_integer
938 %type <node> unsigned_int32
939 %type <node> unsigned_real
940 %type <node> monetary_literal
941 %type <node> date_or_time_literal
942 %type <node> json_literal
943 %type <node> partition_clause
944 %type <node> partition_def_list
945 %type <node> partition_def
946 %type <node> signed_literal_list
947 %type <node> insert_name_clause
948 %type <node> replace_name_clause
949 %type <node> insert_name_clause_header
950 %type <node> opt_for_search_condition
951 %type <node> path_header
952 %type <node> path_id_list
954 %type <node> simple_path_id
955 %type <node> simple_path_id_list
956 %type <node> generic_function
957 %type <node> opt_on_target
958 %type <node> generic_function_id
959 %type <node> pred_lhs
960 %type <node> pseudo_column
961 %type <node> reserved_func
962 %type <node> sort_spec
963 %type <node> trigger_priority
964 %type <node> class_or_normal_attr_def
965 %type <node> on_class_list
966 %type <node> from_id_list
967 %type <node> to_id_list
968 %type <node> only_class_name
969 %type <node> grant_head
970 %type <node> grant_cmd
971 %type <node> revoke_cmd
972 %type <node> opt_from_table_spec_list
973 %type <node> method_file_list
974 %type <node> incr_arg_name_list__inc
975 %type <node> incr_arg_name__inc
976 %type <node> incr_arg_name_list__dec
977 %type <node> incr_arg_name__dec
978 %type <node> search_condition_query
979 %type <node> search_condition_expression
980 %type <node> opt_select_limit_clause
981 %type <node> limit_options
982 %type <node> opt_upd_del_limit_clause
983 %type <node> truncate_stmt
985 %type <node> on_duplicate_key_update
986 %type <node> opt_attr_ordering_info
987 %type <node> show_stmt
988 %type <node> session_variable;
989 %type <node> session_variable_assignment_list
990 %type <node> session_variable_assignment
991 %type <node> session_variable_definition
992 %type <node> session_variable_expression
993 %type <node> session_variable_list
994 %type <node> opt_analytic_partition_by
995 %type <node> opt_over_analytic_partition_by
996 %type <node> opt_analytic_order_by
997 %type <node> opt_table_spec_index_hint
998 %type <node> opt_table_spec_index_hint_list
999 %type <node> merge_stmt
1000 %type <node> merge_update_insert_clause
1001 %type <node> merge_update_clause
1002 %type <node> merge_insert_clause
1003 %type <node> opt_merge_delete_clause
1004 %type <node> delete_name
1005 %type <node> delete_name_list
1006 %type <node> collation_spec
1007 %type <node> charset_spec
1008 %type <node> class_comment_spec
1009 %type <node> class_encrypt_spec
1010 %type <node> opt_vclass_comment_spec
1011 %type <node> comment_value
1012 %type <node> opt_comment_spec
1013 %type <node> opt_collation
1014 %type <node> opt_charset
1015 %type <node> opt_using_charset
1016 %type <node> values_query
1017 %type <node> values_expression
1018 %type <node> values_expr_item
1019 %type <node> opt_partition_spec
1020 %type <node> opt_for_update_clause
1021 %type <node> of_or_where
1022 %type <node> named_arg
1023 %type <node> named_args
1024 %type <node> opt_arg_value
1025 %type <node> arg_value
1026 %type <node> arg_value_list
1027 %type <node> kill_stmt
1028 %type <node> vacuum_stmt
1029 %type <node> opt_owner_clause
1030 %type <node> cte_definition_list
1031 %type <node> cte_definition
1032 %type <node> cte_query_list
1033 %type <node> limit_expr
1034 %type <node> limit_term
1035 %type <node> limit_factor
1036 %type <node> json_table_rule
1037 %type <node> json_table_node_rule
1038 %type <node> json_table_column_rule
1039 %type <node> json_table_column_list_rule
1042 /* define rule type (cptr) */
1044 %type <cptr> uint_text
1045 %type <cptr> of_integer_real_literal
1046 %type <cptr> integer_text
1047 %type <cptr> json_schema
1050 /* define rule type (container) */
1052 %type <c10> opt_serial_option_list
1053 %type <c10> serial_option_list
1055 %type <c4> isolation_level_spec
1056 %type <c4> opt_constraint_attr_list
1057 %type <c4> constraint_attr_list
1058 %type <c4> constraint_attr
1060 %type <c3> ref_rule_list
1061 %type <c3> opt_ref_rule_list
1062 %type <c3> of_serial_option
1063 %type <c3> delete_from_using
1064 %type <c3> trigger_status_or_priority_or_change_owner
1066 %type <c2> extended_table_spec_list
1067 %type <c2> opt_startwith_connectby_clause
1068 %type <c2> opt_of_where_cursor
1069 %type <c2> opt_data_type
1070 %type <c2> opt_create_as_clause
1071 %type <c2> create_as_clause
1072 %type <c2> serial_min
1073 %type <c2> serial_max
1074 %type <c2> of_cached_num
1075 %type <c2> of_cycle_nocycle
1076 %type <c2> data_type
1077 %type <c2> primitive_type
1078 %type <c2> opt_prec_2
1079 %type <c2> in_pred_operand
1080 %type <c2> opt_as_identifier_attr_name
1081 %type <c2> insert_assignment_list
1082 %type <c2> expression_queue
1083 %type <c2> of_cast_data_type
1086 /* define rule type (json_table_column_behavior) */
1088 %type <jtcb> json_table_column_behavior_rule
1089 %type <jtcb> json_table_on_error_rule_optional
1090 %type <jtcb> json_table_on_empty_rule_optional
1124 %token BITSHIFT_LEFT
1125 %token BITSHIFT_RIGHT
1147 %token COMP_NULLSAFE_EQ
1149 %token CONNECT_BY_ISCYCLE
1150 %token CONNECT_BY_ISLEAF
1151 %token CONNECT_BY_ROOT
1157 %token CORRESPONDING
1163 %token CURRENT_DATETIME
1165 %token CURRENT_TIMESTAMP
1177 %token DAY_MILLISECOND
1242 %token HOUR_MILLISECOND
1281 %token LOCAL_TRANSACTION_ID
1283 %token LOCALTIMESTAMP
1294 %token MINUTE_MILLISECOND
1295 %token MINUTE_SECOND
1356 %token REGEXP_REPLACE
1357 %token REGEXP_SUBSTR
1381 %token SECOND_MILLISECOND
1389 %token SESSION_TIMEZONE
1418 %token SYS_CONNECT_BY_PATH
1422 %token SYS_TIMESTAMP
1432 %token TIMEZONE_HOUR
1433 %token TIMEZONE_MINUTE
1447 %token UNTERMINATED_STRING
1448 %token UNTERMINATED_IDENTIFIER
1481 %token TURKISH_LIRA_SIGN
1482 %token BRITISH_POUND_SIGN
1483 %token CAMBODIAN_RIEL_SIGN
1484 %token CHINESE_RENMINBI_SIGN
1485 %token INDIAN_RUPEE_SIGN
1486 %token RUSSIAN_RUBLE_SIGN
1487 %token AUSTRALIAN_DOLLAR_SIGN
1488 %token CANADIAN_DOLLAR_SIGN
1489 %token BRASILIAN_REAL_SIGN
1490 %token ROMANIAN_LEU_SIGN
1492 %token SWISS_FRANC_SIGN
1493 %token DANISH_KRONE_SIGN
1494 %token NORWEGIAN_KRONE_SIGN
1495 %token BULGARIAN_LEV_SIGN
1496 %token VIETNAMESE_DONG_SIGN
1497 %token CZECH_KORUNA_SIGN
1498 %token POLISH_ZLOTY_SIGN
1499 %token SWEDISH_KRONA_SIGN
1500 %token CROATIAN_KUNA_SIGN
1501 %token SERBIAN_DINAR_SIGN
1505 %token DOUBLE_RIGHT_ARROW
1512 %token <cptr> ACCESS
1513 %token <cptr> ACTIVE
1514 %token <cptr> ADDDATE
1515 %token <cptr> ANALYZE
1516 %token <cptr> ARCHIVE
1517 %token <cptr> AUTO_INCREMENT
1518 %token <cptr> BIT_AND
1519 %token <cptr> BIT_OR
1520 %token <cptr> BIT_XOR
1521 %token <cptr> BUFFER
1523 %token <cptr> CAPACITY
1524 %token <cptr> CHARACTER_SET_
1525 %token <cptr> CHARSET
1527 %token <cptr> CLOB_TO_CHAR
1529 %token <cptr> COLLATION
1530 %token <cptr> COLUMNS
1531 %token <cptr> COMMENT
1532 %token <cptr> COMMITTED
1534 %token <cptr> CRITICAL
1535 %token <cptr> CUME_DIST
1536 %token <cptr> DATE_ADD
1537 %token <cptr> DATE_SUB
1538 %token <cptr> DECREMENT
1539 %token <cptr> DENSE_RANK
1540 %token <cptr> DONT_REUSE_OID
1542 %token <cptr> EXPLAIN
1543 %token <cptr> FIRST_VALUE
1544 %token <cptr> FULLSCAN
1545 %token <cptr> GE_INF_
1546 %token <cptr> GE_LE_
1547 %token <cptr> GE_LT_
1548 %token <cptr> GRANTS
1549 %token <cptr> GROUP_CONCAT
1550 %token <cptr> GROUPS
1551 %token <cptr> GT_INF_
1552 %token <cptr> GT_LE_
1553 %token <cptr> GT_LT_
1555 %token <cptr> HEADER
1557 %token <cptr> IFNULL
1558 %token <cptr> INACTIVE
1559 %token <cptr> INCREMENT
1560 %token <cptr> INDEXES
1561 %token <cptr> INDEX_PREFIX
1562 %token <cptr> INF_LE_
1563 %token <cptr> INF_LT_
1564 %token <cptr> INFINITE_
1565 %token <cptr> INSTANCES
1566 %token <cptr> INVALIDATE
1567 %token <cptr> INVISIBLE
1568 %token <cptr> ISNULL
1572 %token <cptr> JSON_ARRAYAGG
1573 %token <cptr> JSON_ARRAY_LEX
1574 %token <cptr> JSON_ARRAY_APPEND
1575 %token <cptr> JSON_ARRAY_INSERT
1576 %token <cptr> JSON_CONTAINS
1577 %token <cptr> JSON_CONTAINS_PATH
1578 %token <cptr> JSON_DEPTH
1579 %token <cptr> JSON_EXTRACT
1580 %token <cptr> JSON_GET_ALL_PATHS
1581 %token <cptr> JSON_INSERT
1582 %token <cptr> JSON_KEYS
1583 %token <cptr> JSON_LENGTH
1584 %token <cptr> JSON_MERGE
1585 %token <cptr> JSON_MERGE_PATCH
1586 %token <cptr> JSON_MERGE_PRESERVE
1587 %token <cptr> JSON_OBJECTAGG
1588 %token <cptr> JSON_OBJECT_LEX
1589 %token <cptr> JSON_PRETTY
1590 %token <cptr> JSON_QUOTE
1591 %token <cptr> JSON_REMOVE
1592 %token <cptr> JSON_REPLACE
1593 %token <cptr> JSON_SEARCH
1594 %token <cptr> JSON_SET
1595 %token <cptr> JSON_TABLE
1596 %token <cptr> JSON_TYPE
1597 %token <cptr> JSON_UNQUOTE
1598 %token <cptr> JSON_VALID
1601 %token <cptr> LAST_VALUE
1606 %token <cptr> MAXIMUM
1607 %token <cptr> MAXVALUE
1608 %token <cptr> MEDIAN
1609 %token <cptr> MEMBERS
1610 %token <cptr> MINVALUE
1612 %token <cptr> NOCYCLE
1613 %token <cptr> NOCACHE
1614 %token <cptr> NOMAXVALUE
1615 %token <cptr> NOMINVALUE
1617 %token <cptr> NTH_VALUE
1620 %token <cptr> OFFSET
1625 %token <cptr> PARTITIONING
1626 %token <cptr> PARTITIONS
1627 %token <cptr> PASSWORD
1628 %token <cptr> PERCENT_RANK
1629 %token <cptr> PERCENTILE_CONT
1630 %token <cptr> PERCENTILE_DISC
1632 %token <cptr> PRIORITY
1633 %token <cptr> QUARTER
1634 %token <cptr> QUEUES
1635 %token <cptr> RANGE_
1637 %token <cptr> REJECT_
1638 %token <cptr> REMOVE
1639 %token <cptr> REORGANIZE
1640 %token <cptr> REPEATABLE
1641 %token <cptr> RESPECT
1642 %token <cptr> RETAIN
1643 %token <cptr> REUSE_OID
1644 %token <cptr> REVERSE
1645 %token <cptr> DISK_SIZE
1646 %token <cptr> ROW_NUMBER
1647 %token <cptr> SECTIONS
1648 %token <cptr> SEPARATOR
1649 %token <cptr> SERIAL
1653 %token <cptr> SLOTTED
1654 %token <cptr> STABILITY
1655 %token <cptr> START_
1656 %token <cptr> STATEMENT
1657 %token <cptr> STATUS
1658 %token <cptr> STDDEV
1659 %token <cptr> STDDEV_POP
1660 %token <cptr> STDDEV_SAMP
1661 %token <cptr> STR_TO_DATE
1662 %token <cptr> SUBDATE
1663 %token <cptr> SYSTEM
1664 %token <cptr> TABLES
1667 %token <cptr> THREADS
1668 %token <cptr> TIMEOUT
1671 %token <cptr> TRIGGERS
1673 %token <cptr> UNCOMMITTED
1674 %token <cptr> VAR_POP
1675 %token <cptr> VAR_SAMP
1676 %token <cptr> VARIANCE
1677 %token <cptr> VISIBLE
1678 %token <cptr> VOLUME
1680 %token <cptr> WITHIN
1681 %token <cptr> WORKSPACE
1682 %token <cptr> TIMEZONES
1685 %token <cptr> IdName
1686 %token <cptr> BracketDelimitedIdName
1687 %token <cptr> BacktickDelimitedIdName
1688 %token <cptr> DelimitedIdName
1689 %token <cptr> UNSIGNED_INTEGER
1690 %token <cptr> UNSIGNED_REAL
1691 %token <cptr> CHAR_STRING
1692 %token <cptr> NCHAR_STRING
1693 %token <cptr> BIT_STRING
1694 %token <cptr> HEX_STRING
1695 %token <cptr> CPP_STYLE_HINT
1696 %token <cptr> C_STYLE_HINT
1697 %token <cptr> SQL_STYLE_HINT
1698 %token <cptr> BINARY_STRING
1699 %token <cptr> EUCKR_STRING
1700 %token <cptr> ISO_STRING
1701 %token <cptr> UTF8_STRING
1713 : stmt_list stmt %dprec 1
1718 if (parser_statement_OK)
1720 this_parser->statement_number++;
1724 parser_statement_OK = 1;
1727 pt_push (this_parser, $2);
1730 printf ("node: %s\n", parser_print_tree (this_parser, $2));
1740 if (parser_statement_OK)
1742 this_parser->statement_number++;
1746 parser_statement_OK = 1;
1749 pt_push (this_parser, $1);
1752 printf ("node: %s\n", parser_print_tree (this_parser, $1));
1766 if (this_parser->original_buffer)
1768 int pos = @$.buffer_pos;
1769 int stmt_n = this_parser->statement_number;
1771 if (g_original_buffer_len == 0)
1773 g_original_buffer_len = strlen (this_parser->original_buffer);
1776 /* below assert & defence code is for yybuffer_pos mismatch
1777 * (like unput in lexer and do not modify yybuffer_pos)
1779 assert (pos <= g_original_buffer_len);
1781 if (pos > g_original_buffer_len)
1783 pos = g_original_buffer_len;
1786 g_query_string = (char*) (this_parser->original_buffer + pos);
1788 while (char_isspace (*g_query_string))
1797 parser_initialize_parser_context ();
1799 parser_statement_OK = 1;
1800 parser_instnum_check = 0;
1801 parser_groupbynum_check = 0;
1802 parser_orderbynum_check = 0;
1804 parser_sysconnectbypath_check = 0;
1805 parser_prior_check = 0;
1806 parser_connectbyroot_check = 0;
1807 parser_serial_check = 1;
1808 parser_subquery_check = 1;
1809 parser_pseudocolumn_check = 1;
1810 parser_hostvar_check = 1;
1812 parser_select_level = -1;
1814 parser_within_join_condition = 0;
1815 parser_found_Oracle_outer = false;
1817 parser_save_and_set_si_datetime (false);
1818 parser_save_and_set_si_tran_id (false);
1819 parser_save_and_set_cannot_prepare (false);
1821 parser_attr_type = PT_NORMAL;
1822 allow_attribute_ordering = false;
1823 parser_hidden_incr_list = NULL;
1831 printf ("Good!!!\n");
1836 csql_yyerror (NULL);
1839 /* set query length of last statement (but do it every time)
1840 * Not last statement's length will be updated later.
1842 if (this_parser->original_buffer)
1844 int pos = @$.buffer_pos;
1847 if (g_original_buffer_len == 0)
1849 g_original_buffer_len = strlen (this_parser->original_buffer);
1852 /* below assert & defence code is for yybuffer_pos mismatch
1853 * (like unput in lexer and do not modify yybuffer_pos)
1855 assert (pos <= g_original_buffer_len);
1857 if (pos > g_original_buffer_len)
1859 pos = g_original_buffer_len;
1864 const char *curr_ptr = this_parser->original_buffer + pos;
1865 int len = (int) (curr_ptr - g_query_string);
1866 node->sql_user_text_len = len;
1867 g_query_string_len = len;
1878 node->flag.si_datetime = (parser_si_datetime == true) ? 1 : 0;
1879 node->flag.si_tran_id = (parser_si_tran_id == true) ? 1 : 0;
1880 node->flag.cannot_prepare = (parser_cannot_prepare == true) ? 1 : 0;
1883 parser_restore_si_datetime ();
1884 parser_restore_si_tran_id ();
1885 parser_restore_cannot_prepare ();
1888 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
1905 | update_statistics_stmt
1914 PT_NODE *with_clause = $1;
1916 if (stmt && with_clause)
1918 stmt->info.query.with = with_clause;
1928 | insert_or_replace_stmt
1933 PT_NODE *with_clause = $1;
1935 if (stmt && with_clause)
1937 stmt->info.update.with = with_clause;
1944 PT_NODE *with_clause = $1;
1946 if (stmt && with_clause)
1948 stmt->info.delete_.with = with_clause;
1970 | DATA_TYPE___ data_type
1973 PT_NODE *dt, *set_dt;
1976 typ = (PT_TYPE_ENUM) TO_NUMBER (CONTAINER_AT_0 ($2));
1977 dt = CONTAINER_AT_1 ($2);
1981 dt = parser_new_node (this_parser, PT_DATA_TYPE);
1984 dt->type_enum = typ;
1985 dt->data_type = NULL;
1990 if ((typ == PT_TYPE_SET) ||
1991 (typ == PT_TYPE_MULTISET) || (typ == PT_TYPE_SEQUENCE))
1993 set_dt = parser_new_node (this_parser, PT_DATA_TYPE);
1996 set_dt->type_enum = typ;
1997 set_dt->data_type = dt;
2003 if (PT_HAS_COLLATION (typ))
2005 dt->info.data_type.units = LANG_SYS_CODESET;
2006 dt->info.data_type.collation_id = LANG_SYS_COLLATION;
2010 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2014 { push_msg(MSGCAT_SYNTAX_INVALID_ATTACH); }
2019 PT_NODE *node = parser_new_node (this_parser, PT_2PC_ATTACH);
2023 node->info.attach.trans_id = $3->info.value.data_value.i;
2027 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2031 { push_msg(MSGCAT_SYNTAX_INVALID_PREPARE); }
2032 opt_to COMMIT unsigned_integer
2036 PT_NODE *node = parser_new_node (this_parser, PT_PREPARE_TO_COMMIT);
2040 node->info.prepare_to_commit.trans_id = $5->info.value.data_value.i;
2044 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2048 { push_msg(MSGCAT_SYNTAX_INVALID_EXECUTE); }
2049 DEFERRED TRIGGER trigger_spec_list
2053 PT_NODE *node = parser_new_node (this_parser, PT_EXECUTE_TRIGGER);
2057 node->info.execute_trigger.trigger_spec_list = $5;
2061 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2065 { push_msg(MSGCAT_SYNTAX_INVALID_SCOPE); }
2066 trigger_action opt_from_table_spec_list
2070 PT_NODE *node = parser_new_node (this_parser, PT_SCOPE);
2074 node->info.scope.stmt = $3;
2075 node->info.scope.from = $4;
2079 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2086 { push_msg(MSGCAT_SYNTAX_INVALID_SET_TIMEZONE); }
2090 PT_NODE *node = parser_new_node (this_parser, PT_SET_TIMEZONE);
2093 node->info.set_timezone.timezone_node = $4;
2097 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2101 { push_msg(MSGCAT_SYNTAX_INVALID_SET_TIMEZONE); }
2105 PT_NODE *node = parser_new_node (this_parser, PT_SET_TIMEZONE);
2108 node->info.set_timezone.timezone_node = $5;
2112 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2118 opt_from_table_spec_list
2121 | FROM ON_ table_spec_list
2128 { push_msg(MSGCAT_SYNTAX_INVALID_SET_OPT_LEVEL); }
2129 LEVEL opt_of_to_eq opt_level_spec
2133 PT_NODE *node = parser_new_node (this_parser, PT_SET_OPT_LVL);
2136 node->info.set_opt_lvl.option = PT_OPT_LVL;
2137 node->info.set_opt_lvl.val = $6;
2141 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2145 { push_msg(MSGCAT_SYNTAX_INVALID_SET_OPT_COST); }
2146 COST opt_of char_string_literal opt_of_to_eq literal_
2150 PT_NODE *node = parser_new_node (this_parser, PT_SET_OPT_LVL);
2153 node->info.set_opt_lvl.option = PT_OPT_COST;
2156 node->info.set_opt_lvl.val = $6;
2160 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2164 { push_msg(MSGCAT_SYNTAX_INVALID_SET_SYS_PARAM); }
2165 SYSTEM PARAMETERS char_string_literal_list
2169 PT_NODE *node = parser_new_node (this_parser, PT_SET_SYS_PARAMS);
2171 node->info.set_sys_params.val = $5;
2173 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2177 { push_msg(MSGCAT_SYNTAX_INVALID_SET_TRAN); }
2178 TRANSACTION transaction_mode_list
2182 PT_NODE *node = parser_new_node (this_parser, PT_SET_XACTION);
2186 node->info.set_xaction.xaction_modes = $4;
2190 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2194 { push_msg(MSGCAT_SYNTAX_INVALID_SET_TRIGGER_TRACE); }
2199 PT_NODE *node = parser_new_node (this_parser, PT_SET_TRIGGER);
2203 node->info.set_trigger.option = PT_TRIGGER_TRACE;
2204 node->info.set_trigger.val = $5;
2208 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2212 { push_msg(MSGCAT_SYNTAX_INVALID_SET_TRIGGER_DEPTH); }
2213 opt_maximum DEPTH depth_spec
2217 PT_NODE *node = parser_new_node (this_parser, PT_SET_TRIGGER);
2221 node->info.set_trigger.option = PT_TRIGGER_DEPTH;
2222 node->info.set_trigger.val = $6;
2226 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2229 | SET session_variable_assignment_list
2233 parser_new_node (this_parser, PT_SET_SESSION_VARIABLES);
2236 node->info.set_variables.assignments = $2;
2239 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2245 PT_NODE *node = NULL;
2246 PT_NODE *charset_node = NULL;
2248 charset_node = parser_new_node (this_parser, PT_VALUE);
2252 charset_node->type_enum = PT_TYPE_CHAR;
2253 charset_node->info.value.string_type = ' ';
2254 charset_node->info.value.data_value.str =
2255 pt_append_bytes (this_parser, NULL, "binary", strlen ("binary"));
2256 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, charset_node);
2259 node = parser_new_node (this_parser, PT_SET_NAMES);
2262 node->info.set_names.charset_node = charset_node;
2263 node->info.set_names.collation_node = NULL;
2266 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2270 { push_msg(MSGCAT_SYNTAX_INVALID_SET_NAMES); }
2271 NAMES char_string_literal
2276 PT_NODE *node = parser_new_node (this_parser, PT_SET_NAMES);
2279 node->info.set_names.charset_node = $4;
2280 node->info.set_names.collation_node = $5;
2284 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2288 { push_msg(MSGCAT_SYNTAX_INVALID_SET_NAMES); }
2294 PT_NODE *node = NULL;
2295 PT_NODE *charset_node = NULL;
2297 charset_node = parser_new_node (this_parser, PT_VALUE);
2301 charset_node->type_enum = PT_TYPE_CHAR;
2302 charset_node->info.value.string_type = ' ';
2303 charset_node->info.value.data_value.str =
2304 pt_append_bytes (this_parser, NULL, $4, strlen ($4));
2305 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, charset_node);
2308 node = parser_new_node (this_parser, PT_SET_NAMES);
2311 node->info.set_names.charset_node = charset_node;
2312 node->info.set_names.collation_node = $5;
2315 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2318 | SET TRACE query_trace_spec opt_trace_output_format
2321 PT_NODE *node = parser_new_node (this_parser, PT_QUERY_TRACE);
2325 node->info.trace.on_off = $3;
2326 node->info.trace.format = $4;
2345 opt_trace_output_format
2348 $$ = PT_TRACE_FORMAT_TEXT;
2352 $$ = PT_TRACE_FORMAT_TEXT;
2356 $$ = PT_TRACE_FORMAT_JSON;
2360 session_variable_assignment_list
2361 : session_variable_assignment_list ',' session_variable_assignment
2364 $$ = parser_make_link ($1, $3);
2365 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2369 | session_variable_assignment
2373 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2378 session_variable_assignment
2379 : session_variable '=' expression_
2383 parser_make_expression (this_parser, PT_DEFINE_VARIABLE, $1, $3, NULL);
2384 expr->flag.do_not_fold = 1;
2386 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2389 | session_variable_definition
2393 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2398 session_variable_definition
2399 : session_variable VAR_ASSIGN expression_
2403 parser_make_expression (this_parser, PT_DEFINE_VARIABLE, $1, $3, NULL);
2404 expr->flag.do_not_fold = 1;
2406 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2411 session_variable_expression
2415 PT_NODE *expr = NULL;
2416 expr = parser_make_expression (this_parser, PT_EVALUATE_VARIABLE, $1, NULL,
2418 expr->flag.do_not_fold = 1;
2420 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2425 session_variable_list
2426 : session_variable_list ',' session_variable
2429 $$ = parser_make_link ($1, $3);
2430 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2437 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2446 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
2449 if (node != NULL && id != NULL)
2451 node->type_enum = PT_TYPE_CHAR;
2452 node->info.value.string_type = ' ';
2453 node->info.value.data_value.str =
2454 pt_append_bytes (this_parser, NULL,
2455 id->info.name.original,
2456 strlen (id->info.name.original));
2457 node->info.value.text = (const char *) node->info.value.data_value.str->bytes;
2461 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2468 { push_msg(MSGCAT_SYNTAX_INVALID_GET_STAT); }
2469 STATISTICS char_string_literal OF class_name into_clause_opt
2473 PT_NODE *node = parser_new_node (this_parser, PT_GET_STATS);
2476 node->info.get_stats.into_var = $7;
2477 node->info.get_stats.class_ = $6;
2478 node->info.get_stats.args = $4;
2481 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2485 { push_msg(MSGCAT_SYNTAX_INVALID_GET_OPT_LEVEL); }
2486 LEVEL into_clause_opt
2490 PT_NODE *node = parser_new_node (this_parser, PT_GET_OPT_LVL);
2493 node->info.get_opt_lvl.into_var = $5;
2494 node->info.get_opt_lvl.option = PT_OPT_LVL;
2495 node->info.get_opt_lvl.args = NULL;
2498 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2502 { push_msg(MSGCAT_SYNTAX_INVALID_GET_OPT_COST); }
2503 COST opt_of char_string_literal into_clause_opt
2507 PT_NODE *node = parser_new_node (this_parser, PT_GET_OPT_LVL);
2510 node->info.get_opt_lvl.into_var = $7;
2511 node->info.get_opt_lvl.option = PT_OPT_COST;
2512 node->info.get_opt_lvl.args = $6;
2515 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2519 { push_msg(MSGCAT_SYNTAX_INVALID_GET_TRAN_ISOL); }
2520 ISOLATION LEVEL into_clause_opt
2524 PT_NODE *node = parser_new_node (this_parser, PT_GET_XACTION);
2528 node->info.get_xaction.into_var = $6;
2529 node->info.get_xaction.option = PT_ISOLATION_LEVEL;
2533 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2537 { push_msg(MSGCAT_SYNTAX_INVALID_GET_TRAN_LOCK); }
2538 LOCK_ TIMEOUT into_clause_opt
2542 PT_NODE *node = parser_new_node (this_parser, PT_GET_XACTION);
2546 node->info.get_xaction.into_var = $6;
2547 node->info.get_xaction.option = PT_LOCK_TIMEOUT;
2551 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2555 { push_msg(MSGCAT_SYNTAX_INVALID_GET_TRIGGER_TRACE); }
2556 TRACE into_clause_opt
2560 PT_NODE *node = parser_new_node (this_parser, PT_GET_TRIGGER);
2564 node->info.get_trigger.into_var = $5;
2565 node->info.get_trigger.option = PT_TRIGGER_TRACE;
2569 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2573 { push_msg(MSGCAT_SYNTAX_INVALID_GET_TRIGGER_DEPTH); }
2574 opt_maximum DEPTH into_clause_opt
2578 PT_NODE *node = parser_new_node (this_parser, PT_GET_TRIGGER);
2582 node->info.get_trigger.into_var = $6;
2583 node->info.get_trigger.option = PT_TRIGGER_DEPTH;
2587 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2598 PT_NODE* qc = parser_new_node(this_parser, PT_CREATE_ENTITY);
2599 parser_push_hint_node(qc);
2601 opt_hint_list /* 3 */
2602 of_class_table_type /* 4 */
2603 opt_if_not_exists /* 5 */
2605 opt_subtable_clause /* 7 */
2606 opt_class_attr_def_list /* 8 */
2607 opt_class_or_normal_attr_def_list /* 9 */
2608 opt_table_option_list /* 10 */
2609 opt_method_def_list /* 11 */
2610 opt_method_files /* 12 */
2611 opt_inherit_resolution_list /* 13 */
2612 opt_partition_clause /* 14 */
2613 opt_create_as_clause /* 15 */
2616 PT_NODE *qc = parser_pop_hint_node ();
2617 PARSER_SAVE_ERR_CONTEXT (qc, @$.buffer_pos)
2619 if (CONTAINER_AT_1 ($15) != NULL)
2621 if ($7 != NULL || $8 != NULL || $11 != NULL
2622 || $12 != NULL || $13 != NULL)
2624 PT_ERRORf (this_parser, qc, "check syntax at %s",
2625 parser_print_tree (this_parser, qc));
2631 qc->info.create_entity.if_not_exists = $5;
2632 qc->info.create_entity.entity_name = $6;
2633 qc->info.create_entity.entity_type = (PT_MISC_TYPE) $4;
2634 qc->info.create_entity.supclass_list = $7;
2635 qc->info.create_entity.class_attr_def_list = $8;
2636 qc->info.create_entity.attr_def_list = $9;
2637 qc->info.create_entity.table_option_list = $10;
2638 qc->info.create_entity.method_def_list = $11;
2639 qc->info.create_entity.method_file_list = $12;
2640 qc->info.create_entity.resolution_list = $13;
2641 qc->info.create_entity.partition_info = $14;
2642 if (CONTAINER_AT_1 ($15) != NULL)
2644 qc->info.create_entity.create_select_action = TO_NUMBER(CONTAINER_AT_0 ($15));
2645 qc->info.create_entity.create_select = CONTAINER_AT_1 ($15);
2648 pt_gather_constraints (this_parser, qc);
2655 opt_or_replace /* 2 */
2656 of_view_vclass /* 3 */
2658 opt_subtable_clause /* 5 */
2659 opt_class_attr_def_list /* 6 */
2660 opt_paren_view_attr_def_list /* 7 */
2661 opt_method_def_list /* 8 */
2662 opt_method_files /* 9 */
2663 opt_inherit_resolution_list /* 10 */
2664 opt_as_query_list /* 11 */
2665 opt_with_levels_clause /* 12 */
2666 opt_vclass_comment_spec /* 13 */
2669 PT_NODE *qc = parser_new_node (this_parser, PT_CREATE_ENTITY);
2673 qc->info.create_entity.or_replace = $2;
2675 qc->info.create_entity.entity_name = $4;
2676 qc->info.create_entity.entity_type = PT_VCLASS;
2678 qc->info.create_entity.supclass_list = $5;
2679 qc->info.create_entity.class_attr_def_list = $6;
2680 qc->info.create_entity.attr_def_list = $7;
2681 qc->info.create_entity.method_def_list = $8;
2682 qc->info.create_entity.method_file_list = $9;
2683 qc->info.create_entity.resolution_list = $10;
2684 qc->info.create_entity.as_query_list = $11;
2685 qc->info.create_entity.with_check_option = $12;
2686 qc->info.create_entity.vclass_comment = $13;
2688 pt_gather_constraints (this_parser, qc);
2693 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2698 PT_NODE* node = parser_new_node (this_parser, PT_CREATE_INDEX);
2699 parser_push_hint_node (node);
2700 push_msg (MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
2702 opt_hint_list /* 3 */
2706 { pop_msg(); } /* 7 */
2709 only_class_name /* 10 */
2710 index_column_name_list /* 11 */
2711 opt_where_clause /* 12 */
2712 opt_comment_spec /* 13 */
2713 opt_with_online /* 14 */
2714 opt_invisible /* 15 */
2717 PT_NODE *node = parser_pop_hint_node ();
2718 PT_NODE *ocs = parser_new_node(this_parser, PT_SPEC);
2719 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
2723 /* Currently, not allowed unique with filter/function index.
2724 However, may be introduced later, if it will be usefull.
2725 Unique filter/function index code is removed from
2726 grammar module only. It is kept yet in the others modules.
2727 This will allow us to easily support this feature later by
2728 adding in grammar only. If no need such feature,
2729 filter/function code must be removed from all modules. */
2730 PT_ERRORm (this_parser, node,
2731 MSGCAT_SET_PARSER_SYNTAX,
2732 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
2736 PT_NODE *col, *temp;
2737 int arg_count = 0, prefix_col_count = 0;
2739 ocs->info.spec.entity_name = $10;
2740 ocs->info.spec.only_all = PT_ONLY;
2741 ocs->info.spec.meta_class = PT_CLASS;
2743 PARSER_SAVE_ERR_CONTEXT (ocs, @10.buffer_pos)
2745 node->info.index.indexed_class = ocs;
2746 node->info.index.reverse = $4;
2747 node->info.index.unique = $5;
2748 node->info.index.index_name = $8;
2749 if (node->info.index.index_name)
2751 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
2755 if (node->info.index.unique)
2757 for (temp = col; temp != NULL; temp = temp->next)
2759 if (temp->info.sort_spec.expr->node_type == PT_EXPR)
2761 /* Currently, not allowed unique with
2762 filter/function index. However, may be
2763 introduced later, if it will be usefull.
2764 Unique filter/function index code is removed
2765 from grammar module only. It is kept yet in
2766 the others modules. This will allow us to
2767 easily support this feature later by adding in
2768 grammar only. If no need such feature,
2769 filter/function code must be removed from all
2771 PT_ERRORm (this_parser, node,
2772 MSGCAT_SET_PARSER_SYNTAX,
2773 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
2779 parser_count_prefix_columns (col, &arg_count);
2781 if (prefix_col_count > 1 ||
2782 (prefix_col_count == 1 && arg_count > 1))
2784 PT_ERRORm (this_parser, node,
2785 MSGCAT_SET_PARSER_SEMANTIC,
2786 MSGCAT_SEMANTIC_MULTICOL_PREFIX_INDX_NOT_ALLOWED);
2790 if (arg_count == 1 && (prefix_col_count == 1
2791 || col->info.sort_spec.expr->node_type == PT_FUNCTION))
2793 PT_NODE *expr = col->info.sort_spec.expr;
2794 PT_NODE *arg_list = expr->info.function.arg_list;
2795 if ((arg_list != NULL)
2796 && (arg_list->next == NULL)
2797 && (arg_list->node_type == PT_VALUE))
2799 if (node->info.index.reverse
2800 || node->info.index.unique)
2802 PT_ERRORm (this_parser, node,
2803 MSGCAT_SET_PARSER_SYNTAX,
2804 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
2808 PT_NODE *p = parser_new_node (this_parser,
2812 p->info.name.original =
2813 expr->info.function.generic_name;
2815 node->info.index.prefix_length =
2816 expr->info.function.arg_list;
2817 col->info.sort_spec.expr = p;
2822 PT_ERRORmf (this_parser, col->info.sort_spec.expr,
2823 MSGCAT_SET_PARSER_SEMANTIC,
2824 MSGCAT_SEMANTIC_FUNCTION_CANNOT_BE_USED_FOR_INDEX,
2825 fcode_get_lowercase_name (col->info.sort_spec.expr->info.function.
2830 node->info.index.where = $12;
2831 node->info.index.column_names = col;
2832 node->info.index.comment = $13;
2834 int with_online_ret = $14; // 0 for normal, 1 for online no parallel,
2835 // thread_count + 1 for parallel
2836 bool is_online = with_online_ret > 0;
2837 bool is_invisible = $15;
2839 if (is_online && is_invisible)
2841 /* We do not allow invisible and online index at the same time. */
2842 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
2843 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
2845 node->info.index.index_status = SM_NORMAL_INDEX;
2848 /* Invisible index. */
2849 node->info.index.index_status = SM_INVISIBLE_INDEX;
2854 node->info.index.index_status = SM_ONLINE_INDEX_BUILDING_IN_PROGRESS;
2855 node->info.index.ib_threads = with_online_ret - 1;
2862 { push_msg(MSGCAT_SYNTAX_INVALID_CREATE_USER); }
2872 PT_NODE *node = parser_new_node (this_parser, PT_CREATE_USER);
2876 node->info.create_user.user_name = $4;
2877 node->info.create_user.password = $5;
2878 node->info.create_user.groups = $6;
2879 node->info.create_user.members = $7;
2880 node->info.create_user.comment = $8;
2884 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2888 { push_msg(MSGCAT_SYNTAX_INVALID_CREATE_TRIGGER); } /* 2 */
2892 opt_priority /* 6 */
2893 trigger_time /* 7 */
2894 { pop_msg(); } /* 8 */
2896 opt_if_trigger_condition /* 10 */
2898 opt_trigger_action_time /* 12 */
2899 trigger_action /* 13 */
2900 opt_comment_spec /* 14 */
2903 PT_NODE *node = parser_new_node (this_parser, PT_CREATE_TRIGGER);
2907 node->info.create_trigger.trigger_name = $4;
2908 node->info.create_trigger.trigger_status = $5;
2909 node->info.create_trigger.trigger_priority = $6;
2910 node->info.create_trigger.condition_time = $7;
2911 node->info.create_trigger.trigger_event = $9;
2912 node->info.create_trigger.trigger_reference = NULL;
2913 node->info.create_trigger.trigger_condition = $10;
2914 node->info.create_trigger.action_time = $12;
2915 node->info.create_trigger.trigger_action = $13;
2916 node->info.create_trigger.comment = $14;
2920 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2924 { push_msg(MSGCAT_SYNTAX_INVALID_CREATE_SERIAL); } /* 2 */
2926 { pop_msg(); } /* 4 */
2928 opt_serial_option_list /* 6 */
2929 opt_comment_spec /* 7 */
2932 PT_NODE *node = parser_new_node (this_parser, PT_CREATE_SERIAL);
2936 node->info.serial.serial_name = $5;
2947 * 8: cached_num_val,
2951 node->info.serial.start_val = CONTAINER_AT_0($6);
2952 node->info.serial.increment_val = CONTAINER_AT_1($6);
2953 node->info.serial.max_val = CONTAINER_AT_2 ($6);
2954 node->info.serial.no_max = (int) TO_NUMBER (CONTAINER_AT_3 ($6));
2955 node->info.serial.min_val = CONTAINER_AT_4 ($6);
2956 node->info.serial.no_min = (int) TO_NUMBER (CONTAINER_AT_5 ($6));
2957 node->info.serial.cyclic = (int) TO_NUMBER (CONTAINER_AT_6 ($6));
2958 node->info.serial.no_cyclic = (int) TO_NUMBER (CONTAINER_AT_7 ($6));
2959 node->info.serial.cached_num_val = CONTAINER_AT_8 ($6);
2960 node->info.serial.no_cache = (int) TO_NUMBER (CONTAINER_AT_9 ($6));
2961 node->info.serial.comment = $7;
2965 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2969 opt_or_replace /* 2 */
2970 { push_msg(MSGCAT_SYNTAX_INVALID_CREATE_PROCEDURE); } /* 3 */
2972 identifier '(' opt_sp_param_list ')' /* 5, 6, 7, 8 */
2973 opt_of_is_as LANGUAGE JAVA /* 9, 10, 11 */
2974 NAME char_string_literal /* 12, 13 */
2975 opt_comment_spec /* 14 */
2979 PT_NODE *node = parser_new_node (this_parser, PT_CREATE_STORED_PROCEDURE);
2982 node->info.sp.or_replace = $2;
2983 node->info.sp.name = $5;
2984 node->info.sp.type = PT_SP_PROCEDURE;
2985 node->info.sp.param_list = $7;
2986 node->info.sp.ret_type = PT_TYPE_NONE;
2987 node->info.sp.java_method = $13;
2988 node->info.sp.comment = $14;
2992 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
2996 opt_or_replace /* 2 */
2997 { push_msg(MSGCAT_SYNTAX_INVALID_CREATE_FUNCTION); } /* 3 */
2999 identifier '(' opt_sp_param_list ')' /* 5, 6, 7, 8 */
3000 RETURN opt_of_data_type_cursor /* 9, 10 */
3001 opt_of_is_as LANGUAGE JAVA /* 11, 12, 13 */
3002 NAME char_string_literal /* 14, 15 */
3003 opt_comment_spec /* 16 */
3007 PT_NODE *node = parser_new_node (this_parser, PT_CREATE_STORED_PROCEDURE);
3010 node->info.sp.or_replace = $2;
3011 node->info.sp.name = $5;
3012 node->info.sp.type = PT_SP_FUNCTION;
3013 node->info.sp.param_list = $7;
3014 node->info.sp.ret_type = $10;
3015 node->info.sp.java_method = $15;
3016 node->info.sp.comment = $16;
3020 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3026 push_msg (MSGCAT_SYNTAX_INVALID_CREATE);
3027 csql_yyerror_explicit (@2.first_line, @2.first_column);
3032 PT_NODE* qc = parser_new_node(this_parser, PT_CREATE_ENTITY);
3033 parser_push_hint_node(qc);
3035 opt_hint_list /* 3 */
3036 of_class_table_type /* 4 */
3037 opt_if_not_exists /* 5 */
3043 PT_NODE *qc = parser_pop_hint_node ();
3047 qc->info.create_entity.if_not_exists = $5;
3048 qc->info.create_entity.entity_name = $6;
3049 qc->info.create_entity.entity_type = PT_CLASS;
3050 qc->info.create_entity.create_like = $8;
3054 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3059 PT_NODE* qc = parser_new_node(this_parser, PT_CREATE_ENTITY);
3060 parser_push_hint_node(qc);
3062 opt_hint_list /* 3 */
3063 of_class_table_type /* 4 */
3064 opt_if_not_exists /* 5 */
3072 PT_NODE *qc = parser_pop_hint_node ();
3076 qc->info.create_entity.if_not_exists = $5;
3077 qc->info.create_entity.entity_name = $6;
3078 qc->info.create_entity.entity_type = PT_CLASS;
3079 qc->info.create_entity.create_like = $9;
3083 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3088 opt_serial_option_list
3092 memset(&ctn, 0x00, sizeof(container_10));
3095 | serial_option_list
3102 : serial_option_list of_serial_option
3118 * 9: cached_num_val,
3122 container_10 ctn = $1;
3124 PT_NODE* node = pt_top(this_parser);
3125 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
3127 switch(TO_NUMBER (CONTAINER_AT_0($2)))
3132 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
3133 MSGCAT_SEMANTIC_SERIAL_DUPLICATE_ATTR, "start");
3136 ctn.c1 = CONTAINER_AT_1($2);
3142 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
3143 MSGCAT_SEMANTIC_SERIAL_DUPLICATE_ATTR, "increment");
3146 ctn.c2 = CONTAINER_AT_1($2);
3150 if (ctn.c3 != NULL || TO_NUMBER(ctn.c4) != 0)
3152 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
3153 MSGCAT_SEMANTIC_SERIAL_DUPLICATE_ATTR, "max");
3156 ctn.c3 = CONTAINER_AT_1($2);
3157 ctn.c4 = CONTAINER_AT_2($2);
3161 if (ctn.c5 != NULL || TO_NUMBER(ctn.c6) != 0)
3163 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
3164 MSGCAT_SEMANTIC_SERIAL_DUPLICATE_ATTR, "min");
3167 ctn.c5 = CONTAINER_AT_1($2);
3168 ctn.c6 = CONTAINER_AT_2($2);
3172 if (TO_NUMBER(ctn.c7) != 0 || TO_NUMBER(ctn.c8) != 0)
3174 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
3175 MSGCAT_SEMANTIC_SERIAL_DUPLICATE_ATTR, "cycle");
3178 ctn.c7 = CONTAINER_AT_1($2);
3179 ctn.c8 = CONTAINER_AT_2($2);
3183 if (TO_NUMBER(ctn.c9) != 0 || TO_NUMBER(ctn.c10) != 0)
3185 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
3186 MSGCAT_SEMANTIC_SERIAL_DUPLICATE_ATTR, "cache");
3189 ctn.c9 = CONTAINER_AT_1($2);
3190 ctn.c10 = CONTAINER_AT_2($2);
3213 * 9: cached_num_val,
3218 memset(&ctn, 0x00, sizeof(container_10));
3220 switch(TO_NUMBER (CONTAINER_AT_0($1)))
3223 ctn.c1 = CONTAINER_AT_1($1);
3227 ctn.c2 = CONTAINER_AT_1($1);
3231 ctn.c3 = CONTAINER_AT_1($1);
3232 ctn.c4 = CONTAINER_AT_2($1);
3236 ctn.c5 = CONTAINER_AT_1($1);
3237 ctn.c6 = CONTAINER_AT_2($1);
3241 ctn.c7 = CONTAINER_AT_1($1);
3242 ctn.c8 = CONTAINER_AT_2($1);
3246 ctn.c9 = CONTAINER_AT_1($1);
3247 ctn.c10 = CONTAINER_AT_2($1);
3260 SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_START), $1, NULL);
3266 SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_INC), $1, NULL);
3272 SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_MIN), CONTAINER_AT_0($1), CONTAINER_AT_1($1));
3278 SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_MAX), CONTAINER_AT_0($1), CONTAINER_AT_1($1));
3284 SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_CYCLE), CONTAINER_AT_0($1), CONTAINER_AT_1($1));
3290 SET_CONTAINER_3(ctn, FROM_NUMBER(SERIAL_CACHE), CONTAINER_AT_0($1), CONTAINER_AT_1($1));
3300 $$ = PT_CREATE_SELECT_NO_ACTION;
3306 $$ = PT_CREATE_SELECT_REPLACE;
3314 PT_NODE* node = parser_new_node(this_parser, PT_ALTER);
3315 parser_push_hint_node(node);
3317 opt_hint_list /* 3 */
3318 opt_class_type /* 4 */
3319 only_class_name /* 5 */
3322 PT_NODE *node = parser_pop_hint_node ();
3323 int entity_type = ($4 == PT_EMPTY ? PT_MISC_DUMMY : $4);
3327 node->info.alter.entity_type = entity_type;
3328 node->info.alter.entity_name = $5;
3331 parser_save_alter_node (node);
3334 alter_clause_cubrid_specific
3337 PT_NODE *node = parser_get_alter_node ();
3341 pt_gather_constraints (this_parser, node);
3344 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3349 PT_NODE* node = parser_new_node(this_parser, PT_ALTER);
3350 parser_push_hint_node(node);
3352 opt_hint_list /* 3 */
3353 opt_class_type /* 4 */
3354 only_class_name /* 5 */
3355 alter_clause_list /* 6 */ %dprec 2
3358 PT_NODE *node = NULL;
3359 int entity_type = ($4 == PT_EMPTY ? PT_MISC_DUMMY : $4);
3361 for (node = $6; node != NULL; node = node->next)
3363 node->info.alter.entity_type = entity_type;
3364 node->info.alter.entity_name = parser_copy_tree (this_parser, $5);
3365 pt_gather_constraints (this_parser, node);
3366 if (node->info.alter.code == PT_RENAME_ENTITY)
3368 node->info.alter.alter_clause.rename.element_type = entity_type;
3369 /* We can get the original name from info.alter.entity_name */
3370 node->info.alter.alter_clause.rename.old_name = NULL;
3374 if (node->info.alter.code == PT_ADD_ATTR_MTHD)
3376 PT_NODE *p = node->info.alter.create_index;
3379 node->info.alter.code = PT_ADD_INDEX_CLAUSE;
3381 /* add the table spec to each ALTER TABLE ADD INDEX
3382 * clause in the ALTER statement */
3385 PT_NODE *ocs = parser_new_node(this_parser, PT_SPEC);
3389 ocs->info.spec.entity_name = parser_copy_tree(this_parser, $5);
3390 ocs->info.spec.only_all = PT_ONLY;
3391 ocs->info.spec.meta_class = PT_CLASS;
3393 p->info.index.indexed_class = ocs;
3404 parser_free_tree (this_parser, $5);
3407 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3417 PT_NODE *node = parser_new_node (this_parser, PT_ALTER_USER);
3421 node->info.alter_user.user_name = $3;
3422 node->info.alter_user.password = $4;
3423 node->info.alter_user.comment = $5;
3424 if (node->info.alter_user.password == NULL
3425 && node->info.alter_user.comment == NULL)
3427 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
3428 MSGCAT_SYNTAX_INVALID_ALTER);
3433 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3439 trigger_status_or_priority_or_change_owner
3440 opt_comment_spec /* 5 */
3443 PT_NODE *node = parser_new_node (this_parser, PT_ALTER_TRIGGER);
3445 PT_NODE *list = parser_new_node (this_parser, PT_TRIGGER_SPEC_LIST);
3448 list->info.trigger_spec_list.trigger_name_list = $3;
3453 node->info.alter_trigger.trigger_spec_list = list;
3454 node->info.alter_trigger.trigger_status = TO_NUMBER (CONTAINER_AT_0 ($4));
3455 node->info.alter_trigger.trigger_priority = CONTAINER_AT_1 ($4);
3456 node->info.alter_trigger.trigger_owner = CONTAINER_AT_2 ($4);
3457 node->info.alter_trigger.comment = $5;
3461 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3467 COMMENT comment_value /* 4, 5 */
3470 PT_NODE *node = parser_new_node (this_parser, PT_ALTER_TRIGGER);
3472 PT_NODE *list = parser_new_node (this_parser, PT_TRIGGER_SPEC_LIST);
3475 list->info.trigger_spec_list.trigger_name_list = $3;
3480 node->info.alter_trigger.trigger_spec_list = list;
3481 node->info.alter_trigger.comment = $5;
3485 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3491 opt_serial_option_list /* 4 */
3492 opt_comment_spec /* 5 */
3503 * 8: cached_num_val,
3507 PT_NODE *serial_name = $3;
3508 PT_NODE *start_val = CONTAINER_AT_0 ($4);
3509 PT_NODE *increment_val = CONTAINER_AT_1 ($4);
3510 PT_NODE *max_val = CONTAINER_AT_2 ($4);
3511 int no_max = (int) TO_NUMBER (CONTAINER_AT_3 ($4));
3512 PT_NODE *min_val = CONTAINER_AT_4 ($4);
3513 int no_min = (int) TO_NUMBER (CONTAINER_AT_5 ($4));
3514 int cyclic = (int) TO_NUMBER (CONTAINER_AT_6 ($4));
3515 int no_cyclic = (int) TO_NUMBER (CONTAINER_AT_7 ($4));
3516 PT_NODE *cached_num_val = CONTAINER_AT_8 ($4);
3517 int no_cache = (int) TO_NUMBER (CONTAINER_AT_9 ($4));
3518 PT_NODE *comment = $5;
3520 PT_NODE *node = parser_new_node (this_parser, PT_ALTER_SERIAL);
3523 node->info.serial.serial_name = serial_name;
3524 node->info.serial.increment_val = increment_val;
3525 node->info.serial.start_val = start_val;
3526 node->info.serial.max_val = max_val;
3527 node->info.serial.no_max = no_max;
3528 node->info.serial.min_val = min_val;
3529 node->info.serial.no_min = no_min;
3530 node->info.serial.cyclic = cyclic;
3531 node->info.serial.no_cyclic = no_cyclic;
3532 node->info.serial.cached_num_val = cached_num_val;
3533 node->info.serial.no_cache = no_cache;
3534 node->info.serial.comment = comment;
3538 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3540 if (!start_val && !increment_val && !max_val && !min_val
3541 && cyclic == 0 && no_max == 0 && no_min == 0
3542 && no_cyclic == 0 && !cached_num_val && no_cache == 0
3545 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
3546 MSGCAT_SEMANTIC_SERIAL_ALTER_NO_OPTION, 0);
3552 PT_NODE* node = parser_new_node(this_parser, PT_ALTER_INDEX);
3553 parser_push_hint_node(node);
3555 opt_hint_list /* 3 */
3561 only_class_name /* 9 */
3562 opt_index_column_name_list /* 10 */
3563 opt_where_clause /* 11 */
3564 opt_comment_spec /* 12 */
3568 PT_NODE *node = parser_pop_hint_node ();
3569 PT_NODE *ocs = parser_new_node(this_parser, PT_SPEC);
3573 /* Currently, not allowed unique with filter/function index.
3574 However, may be introduced later, if it will be usefull.
3575 Unique filter/function index code is removed from
3576 grammar module only. It is kept yet in the others modules.
3577 This will allow us to easily support this feature later by
3578 adding in grammar only. If no need such feature,
3579 filter/function code must be removed from all modules. */
3580 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
3581 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
3585 PT_NODE *col, *temp;
3586 node->info.index.code = PT_REBUILD_INDEX;
3587 node->info.index.reverse = $4;
3588 node->info.index.unique = $5;
3589 node->info.index.index_name = $7;
3590 if (node->info.index.index_name)
3592 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
3595 ocs->info.spec.entity_name = $9;
3596 ocs->info.spec.only_all = PT_ONLY;
3597 ocs->info.spec.meta_class = PT_CLASS;
3599 node->info.index.indexed_class = ocs;
3601 if (node->info.index.unique)
3603 for (temp = col; temp != NULL; temp = temp->next)
3605 if (temp->info.sort_spec.expr->node_type == PT_EXPR)
3607 /* Currently, not allowed unique with
3608 filter/function index. However, may be
3609 introduced later, if it will be usefull.
3610 Unique filter/function index code is removed
3611 from grammar module only. It is kept yet in
3612 the others modules. This will allow us to
3613 easily support this feature later by adding in
3614 grammar only. If no need such feature,
3615 filter/function code must be removed from all
3617 PT_ERRORm (this_parser, node,
3618 MSGCAT_SET_PARSER_SYNTAX,
3619 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
3624 node->info.index.column_names = col;
3625 node->info.index.where = $11;
3626 node->info.index.comment = $12;
3629 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3638 COMMENT comment_value /* 6, 7 */
3640 PT_NODE* node = parser_new_node(this_parser, PT_ALTER_INDEX);
3644 node->info.index.code = PT_CHANGE_INDEX_COMMENT;
3645 node->info.index.index_name = $3;
3646 node->info.index.comment = $7;
3648 if (node->info.index.index_name)
3650 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
3655 PT_NODE *ocs = parser_new_node(this_parser, PT_SPEC);
3656 ocs->info.spec.entity_name = $5;
3657 ocs->info.spec.only_all = PT_ONLY;
3658 ocs->info.spec.meta_class = PT_CLASS;
3660 node->info.index.indexed_class = ocs;
3665 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3675 PT_NODE* node = parser_new_node(this_parser, PT_ALTER_INDEX);
3679 node->info.index.code = PT_CHANGE_INDEX_STATUS;
3680 node->info.index.index_name = $3;
3681 node->info.index.index_status = SM_INVISIBLE_INDEX;
3683 if (node->info.index.index_name)
3685 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
3690 PT_NODE *ocs = parser_new_node(this_parser, PT_SPEC);
3691 ocs->info.spec.entity_name = $5;
3692 ocs->info.spec.only_all = PT_ONLY;
3693 ocs->info.spec.meta_class = PT_CLASS;
3695 node->info.index.indexed_class = ocs;
3700 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3710 PT_NODE* node = parser_new_node(this_parser, PT_ALTER_INDEX);
3714 node->info.index.code = PT_CHANGE_INDEX_STATUS;
3715 node->info.index.index_name = $3;
3716 node->info.index.index_status = SM_NORMAL_INDEX;
3718 if (node->info.index.index_name)
3720 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
3725 PT_NODE *ocs = parser_new_node(this_parser, PT_SPEC);
3726 ocs->info.spec.entity_name = $5;
3727 ocs->info.spec.only_all = PT_ONLY;
3728 ocs->info.spec.meta_class = PT_CLASS;
3730 node->info.index.indexed_class = ocs;
3735 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3743 opt_vclass_comment_spec
3746 PT_NODE *node = parser_new_node (this_parser, PT_ALTER);
3749 node->info.alter.entity_type = PT_VCLASS;
3750 node->info.alter.entity_name = $3;
3751 node->info.alter.code = PT_RESET_QUERY;
3752 node->info.alter.alter_clause.query.query = $5;
3753 node->info.alter.alter_clause.query.query_no_list = NULL;
3754 node->info.alter.alter_clause.query.attr_def_list = NULL;
3755 node->info.alter.alter_clause.query.view_comment = $6;
3757 pt_gather_constraints (this_parser, node);
3760 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3766 class_comment_spec %dprec 1
3769 PT_NODE *node = parser_new_node (this_parser, PT_ALTER);
3772 node->info.alter.entity_type = PT_VCLASS;
3773 node->info.alter.entity_name = $3;
3774 node->info.alter.code = PT_CHANGE_TABLE_COMMENT;
3775 node->info.alter.alter_clause.comment.tbl_comment = $4;
3777 pt_gather_constraints (this_parser, node);
3780 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3784 procedure_or_function /* 2 */
3786 opt_owner_clause /* 4 */
3787 opt_comment_spec /* 5 */
3790 PT_NODE *node = parser_new_node (this_parser, PT_ALTER_STORED_PROCEDURE);
3794 node->info.sp.name = $3;
3795 node->info.sp.type = ($2 == 1) ? PT_SP_PROCEDURE : PT_SP_FUNCTION;
3796 node->info.sp.ret_type = PT_TYPE_NONE;
3797 node->info.sp.owner = $4;
3798 node->info.sp.comment = $5;
3799 if ($4 == NULL && $5 == NULL)
3801 PT_ERRORm (this_parser, node,
3802 MSGCAT_SET_PARSER_SYNTAX,
3803 MSGCAT_SYNTAX_INVALID_ALTER);
3808 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3819 : alter_clause_list ',' prepare_alter_node alter_clause_for_alter_list
3822 $$ = parser_make_link ($1, parser_get_alter_node ());
3823 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3826 | /* The first node in the list is the one that was pushed for hints. */
3829 PT_NODE *node = parser_pop_hint_node ();
3830 parser_save_alter_node (node);
3832 alter_clause_for_alter_list
3835 $$ = parser_get_alter_node ();
3836 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3845 PT_NODE *node = parser_new_node (this_parser, PT_ALTER);
3846 parser_save_alter_node (node);
3859 : RENAME opt_class_type rename_class_list
3862 PT_NODE *node = NULL;
3863 int entity_type = ($2 == PT_EMPTY ? PT_CLASS : $2);
3865 for (node = $3; node != NULL; node = node->next)
3867 node->info.rename.entity_type = entity_type;
3871 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3874 | RENAME TRIGGER class_name AS class_name
3877 PT_NODE *node = parser_new_node (this_parser, PT_RENAME_TRIGGER);
3881 node->info.rename_trigger.new_name = $5;
3882 node->info.rename_trigger.old_name = $3;
3886 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3892 : rename_class_list ',' rename_class_pair
3895 $$ = parser_make_link ($1, $3);
3896 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3903 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3909 : only_class_name as_or_to only_class_name
3912 PT_NODE *node = parser_new_node (this_parser, PT_RENAME);
3915 node->info.rename.old_name = $1;
3916 node->info.rename.new_name = $3;
3917 node->info.rename.entity_type = PT_CLASS;
3921 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3926 procedure_or_function
3944 | OWNER TO identifier
3954 : TRUNCATE opt_table_type class_spec
3957 PT_NODE *node = parser_new_node (this_parser, PT_TRUNCATE);
3960 node->info.truncate.spec = $3;
3964 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
3973 PT_NODE *node = parser_new_node (this_parser, PT_DO);
3976 PT_NODE *expr = $2, *subq = NULL;
3978 if (expr && PT_IS_QUERY_NODE_TYPE (expr->node_type))
3980 expr->info.query.flag.single_tuple = 1;
3982 if ((subq = pt_get_subquery_list (expr)) && subq->next)
3984 /* illegal multi-column subquery */
3985 PT_ERRORm (this_parser, expr, MSGCAT_SET_PARSER_SEMANTIC,
3986 MSGCAT_SEMANTIC_NOT_SINGLE_COL);
3990 node->info.do_.expr = expr;
3994 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4000 : DROP opt_class_type opt_if_exists class_spec_list opt_cascade_constraints
4003 PT_NODE *node = parser_new_node (this_parser, PT_DROP);
4006 node->info.drop.if_exists = ($3 == 1);
4007 node->info.drop.spec_list = $4;
4008 node->info.drop.is_cascade_constraints = $5;
4011 node->info.drop.entity_type = PT_MISC_DUMMY;
4013 node->info.drop.entity_type = $2;
4017 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4022 PT_NODE* node = parser_new_node(this_parser, PT_DROP_INDEX);
4023 parser_push_hint_node(node);
4025 opt_hint_list /* 3 */
4031 only_class_name /* 9 */
4032 opt_index_column_name_list /* 10 */
4035 PT_NODE *node = parser_pop_hint_node ();
4036 PT_NODE *ocs = parser_new_node(this_parser, PT_SPEC);
4040 PT_NODE *col, *temp;
4041 node->info.index.reverse = $4;
4042 node->info.index.unique = $5;
4043 node->info.index.index_name = $7;
4044 if (node->info.index.index_name)
4046 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
4049 ocs->info.spec.entity_name = $9;
4050 ocs->info.spec.only_all = PT_ONLY;
4051 ocs->info.spec.meta_class = PT_CLASS;
4052 PARSER_SAVE_ERR_CONTEXT (ocs, @9.buffer_pos)
4053 node->info.index.indexed_class = ocs;
4056 if (node->info.index.unique)
4058 for (temp = col; temp != NULL; temp = temp->next)
4060 if (temp->info.sort_spec.expr->node_type == PT_EXPR)
4062 /* Currently, not allowed unique with
4063 filter/function index. However, may be
4064 introduced later, if it will be usefull.
4065 Unique filter/function index code is removed
4066 from grammar module only. It is kept yet in
4067 the others modules. This will allow us to
4068 easily support this feature later by adding in
4069 grammar only. If no need such feature,
4070 filter/function code must be removed from all
4072 PT_ERRORm (this_parser, node,
4073 MSGCAT_SET_PARSER_SYNTAX,
4074 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
4078 node->info.index.column_names = col;
4081 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4085 | DROP USER identifier
4088 PT_NODE *node = parser_new_node (this_parser, PT_DROP_USER);
4092 node->info.drop_user.user_name = $3;
4096 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4099 | DROP TRIGGER identifier_list
4102 PT_NODE *node = parser_new_node (this_parser, PT_DROP_TRIGGER);
4104 PT_NODE *list = parser_new_node (this_parser, PT_TRIGGER_SPEC_LIST);
4107 list->info.trigger_spec_list.trigger_name_list = $3;
4112 node->info.drop_trigger.trigger_spec_list = list;
4116 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4119 | DROP DEFERRED TRIGGER trigger_spec_list
4122 PT_NODE *node = parser_new_node (this_parser, PT_REMOVE_TRIGGER);
4126 node->info.remove_trigger.trigger_spec_list = $4;
4130 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4133 | DROP VARIABLE_ identifier_list
4136 PT_NODE *node = parser_new_node (this_parser, PT_DROP_VARIABLE);
4138 node->info.drop_variable.var_names = $3;
4140 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4143 | DROP SERIAL opt_if_exists identifier
4146 PT_NODE *node = parser_new_node (this_parser, PT_DROP_SERIAL);
4149 node->info.serial.if_exists = $3;
4150 node->info.serial.serial_name = $4;
4153 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4156 | DROP PROCEDURE identifier_list
4159 PT_NODE *node = parser_new_node (this_parser, PT_DROP_STORED_PROCEDURE);
4163 node->info.sp.name = $3;
4164 node->info.sp.type = PT_SP_PROCEDURE;
4169 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4172 | DROP FUNCTION identifier_list
4175 PT_NODE *node = parser_new_node (this_parser, PT_DROP_STORED_PROCEDURE);
4179 node->info.sp.name = $3;
4180 node->info.sp.type = PT_SP_FUNCTION;
4185 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4188 | deallocate_or_drop PREPARE identifier
4191 PT_NODE *node = parser_new_node (this_parser, PT_DEALLOCATE_PREPARE);
4195 node->info.prepare.name = $3;
4200 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4203 | deallocate_or_drop VARIABLE_ session_variable_list
4207 parser_new_node (this_parser, PT_DROP_SESSION_VARIABLES);
4210 node->info.prepare.name = $3;
4213 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4227 parser_save_is_reverse (false);
4234 parser_save_is_reverse (true);
4255 opt_index_column_name_list
4262 | index_column_name_list
4266 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4271 index_column_name_list
4272 : '(' sort_spec_list ')'
4274 if (parser_get_is_reverse())
4277 for (node = $2; node != NULL; node = node->next)
4279 node->info.sort_spec.asc_or_desc = PT_DESC;
4284 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4289 update_statistics_stmt
4290 : UPDATE STATISTICS ON_ only_class_name_list opt_with_fullscan
4293 PT_NODE *ups = parser_new_node (this_parser, PT_UPDATE_STATS);
4296 ups->info.update_stats.class_list = $4;
4297 ups->info.update_stats.all_classes = 0;
4298 ups->info.update_stats.with_fullscan = $5;
4301 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4304 | UPDATE STATISTICS ON_ ALL CLASSES opt_with_fullscan
4307 PT_NODE *ups = parser_new_node (this_parser, PT_UPDATE_STATS);
4310 ups->info.update_stats.class_list = NULL;
4311 ups->info.update_stats.all_classes = 1;
4312 ups->info.update_stats.with_fullscan = $6;
4315 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4318 | UPDATE STATISTICS ON_ CATALOG CLASSES opt_with_fullscan
4321 PT_NODE *ups = parser_new_node (this_parser, PT_UPDATE_STATS);
4324 ups->info.update_stats.class_list = NULL;
4325 ups->info.update_stats.all_classes = -1;
4326 ups->info.update_stats.with_fullscan = $6;
4329 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4334 only_class_name_list
4335 : only_class_name_list ',' only_class_name
4338 $$ = parser_make_link ($1, $3);
4339 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4346 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4390 $$ = 1; // thread count is 0
4393 | WITH ONLINE PARALLEL unsigned_integer
4395 const int MIN_COUNT = 1;
4396 const int MAX_COUNT = 16;
4397 int thread_count = $4->info.value.data_value.i;
4398 if (thread_count < MIN_COUNT || thread_count > MAX_COUNT)
4400 // todo - might be better to have a node here
4401 pt_cat_error (this_parser, NULL, MSGCAT_SET_PARSER_SYNTAX,
4402 MSGCAT_SYNTAX_INVALID_PARALLEL_ARGUMENT, MIN_COUNT, MAX_COUNT);
4404 $$ = thread_count + 1;
4418 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
4420 val->info.value.data_value.i = -1;
4422 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4428 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
4430 val->info.value.data_value.i = 0;
4432 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4439 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4446 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4453 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4458 char_string_literal_list
4459 : char_string_literal_list ',' char_string_literal
4462 $$ = parser_make_link ($1, $3);
4463 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4466 | char_string_literal
4470 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4476 : table_spec_list ',' table_spec
4479 $$ = parser_make_link ($1, $3);
4480 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4487 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4492 extended_table_spec_list
4493 : extended_table_spec_list ',' table_spec
4497 PT_NODE *n1 = CONTAINER_AT_0 ($1);
4499 int number = (int) TO_NUMBER (CONTAINER_AT_1 ($1));
4500 SET_CONTAINER_2 (ctn, parser_make_link (n1, n2), FROM_NUMBER (number));
4504 | extended_table_spec_list join_table_spec
4508 PT_NODE *n1 = CONTAINER_AT_0 ($1);
4510 SET_CONTAINER_2 (ctn, parser_make_link (n1, n2), FROM_NUMBER (1));
4514 | '(' extended_table_spec_list join_table_spec ')'
4518 PT_NODE *n1 = CONTAINER_AT_0 ($2);
4520 SET_CONTAINER_2 (ctn, parser_make_link (n1, n2), FROM_NUMBER (1));
4528 SET_CONTAINER_2 (ctn, $1, FROM_NUMBER (0));
4535 : CROSS JOIN table_spec
4540 sopt->info.spec.join_type = PT_JOIN_CROSS;
4542 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4545 | opt_of_inner_left_right JOIN table_spec join_condition
4549 bool natural = false;
4553 /* Not exists ON condition, if it is outer join, report error */
4554 if ($1 == PT_JOIN_LEFT_OUTER
4555 || $1 == PT_JOIN_RIGHT_OUTER
4556 || $1 == PT_JOIN_FULL_OUTER)
4558 PT_ERRORm(this_parser, sopt,
4559 MSGCAT_SET_PARSER_SYNTAX,
4560 MSGCAT_SYNTAX_OUTER_JOIN_REQUIRES_JOIN_COND);
4565 sopt->info.spec.natural = natural;
4566 sopt->info.spec.join_type = $1;
4567 sopt->info.spec.on_cond = $4;
4570 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4571 parser_restore_pseudoc ();
4574 | NATURAL opt_of_inner_left_right JOIN table_spec
4578 bool natural = true;
4582 sopt->info.spec.natural = natural;
4583 sopt->info.spec.join_type = $2;
4584 sopt->info.spec.on_cond = NULL;
4587 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4594 parser_save_and_set_pseudoc (0);
4595 $$ = NULL; /* just return NULL */
4599 parser_save_and_set_pseudoc (0);
4600 parser_save_and_set_wjc (1);
4601 parser_save_and_set_ic (1);
4605 PT_NODE *condition = $3;
4606 bool instnum_flag = false;
4608 parser_restore_wjc ();
4609 parser_restore_ic ();
4611 (void) parser_walk_tree (this_parser, condition,
4612 pt_check_instnum_pre, NULL,
4613 pt_check_instnum_post, &instnum_flag);
4616 PT_ERRORmf(this_parser, condition, MSGCAT_SET_PARSER_SEMANTIC,
4617 MSGCAT_SEMANTIC_EXPR_NOT_ALLOWED_IN_JOIN_COND,
4618 "INST_NUM()/ROWNUM");
4622 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4628 opt_of_inner_left_right
4644 $$ = PT_JOIN_LEFT_OUTER;
4650 $$ = PT_JOIN_RIGHT_OUTER;
4661 : '(' table_spec ')' %dprec 1
4665 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4668 | original_table_spec %dprec 2
4672 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4677 : class_spec opt_as_identifier_attr_name opt_table_spec_index_hint_list
4679 PT_NODE *range_var = NULL;
4683 PT_NODE *stmt = parser_is_hint_node_empty () ? NULL : parser_pop_hint_node ();
4687 if (stmt->node_type == PT_MERGE
4688 && ent->info.spec.only_all != PT_ONLY)
4690 PT_ERRORm (this_parser, ent,
4691 MSGCAT_SET_PARSER_SEMANTIC,
4692 MSGCAT_SEMANTIC_MERGE_HIERARCHY_NOT_ALLOWED);
4696 range_var = CONTAINER_AT_0 ($2);
4697 if (range_var != NULL)
4699 if (ent->info.spec.range_var != NULL)
4701 parser_free_tree (this_parser,
4702 ent->info.spec.range_var);
4704 ent->info.spec.range_var = CONTAINER_AT_0 ($2);
4706 ent->info.spec.as_attr_list = CONTAINER_AT_1 ($2);
4710 PT_NODE *hint = NULL, *alias = NULL;
4711 const char *qualifier_name = NULL;
4714 alias = CONTAINER_AT_0 ($2);
4717 qualifier_name = alias->info.name.original;
4719 else if (ent->info.spec.entity_name != NULL)
4721 qualifier_name = ent->info.spec.entity_name->info.name.original;
4724 /* Resolve table spec index hint names */
4726 while (hint && qualifier_name)
4728 hint->info.name.resolved =
4729 pt_append_string (this_parser, NULL, qualifier_name);
4734 /* This is an index hint inside a table_spec. Copy index
4735 name list to USING INDEX clause */
4738 /* copy to using_index */
4739 switch (stmt->node_type)
4742 stmt->info.query.q.select.using_index =
4743 parser_make_link ($3, stmt->info.query.q.select.using_index);
4747 stmt->info.delete_.using_index =
4748 parser_make_link ($3, stmt->info.delete_.using_index);
4752 stmt->info.update.using_index =
4753 parser_make_link ($3, stmt->info.update.using_index);
4757 /* if index hint has been specified in
4758 * table_spec clause and statement is not
4759 * SELECT, UPDATE or DELETE raise error
4761 PT_ERRORm (this_parser, ent,
4762 MSGCAT_SET_PARSER_SYNTAX,
4763 MSGCAT_SYNTAX_INVALID_INDEX_HINT);
4771 /* push back node */
4772 parser_push_hint_node (stmt);
4777 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4780 | meta_class_spec opt_as_identifier_attr_name
4786 PT_NODE *stmt = parser_pop_hint_node ();
4787 if (stmt && (stmt->node_type == PT_DELETE || stmt->node_type == PT_UPDATE
4788 || stmt->node_type == PT_MERGE))
4791 if (sel && sel->node_type == PT_SELECT)
4793 PT_SELECT_INFO_CLEAR_FLAG (sel, PT_SELECT_INFO_DUMMY);
4796 parser_push_hint_node (stmt);
4798 ent->info.spec.range_var = CONTAINER_AT_0 ($2);
4799 ent->info.spec.as_attr_list = CONTAINER_AT_1 ($2);
4801 parser_remove_dummy_select (&ent);
4804 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4807 | subquery opt_as_identifier_attr_name
4810 PT_NODE *ent = parser_new_node (this_parser, PT_SPEC);
4813 PT_NODE *stmt = parser_pop_hint_node ();
4814 if (stmt && (stmt->node_type == PT_DELETE || stmt->node_type == PT_UPDATE
4815 || stmt->node_type == PT_MERGE))
4818 if (sel && sel->node_type == PT_SELECT)
4820 PT_SELECT_INFO_CLEAR_FLAG (sel, PT_SELECT_INFO_DUMMY);
4823 parser_push_hint_node (stmt);
4825 ent->info.spec.derived_table = $1;
4826 ent->info.spec.derived_table_type = PT_IS_SUBQUERY;
4828 ent->info.spec.range_var = CONTAINER_AT_0 ($2);
4829 ent->info.spec.as_attr_list = CONTAINER_AT_1 ($2);
4831 parser_remove_dummy_select (&ent);
4834 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4837 | TABLE '(' expression_ ')' opt_as_identifier_attr_name
4840 PT_NODE *ent = parser_new_node (this_parser, PT_SPEC);
4843 ent->info.spec.derived_table = $3;
4844 ent->info.spec.derived_table_type = PT_IS_SET_EXPR;
4846 ent->info.spec.range_var = CONTAINER_AT_0 ($5);
4847 ent->info.spec.as_attr_list = CONTAINER_AT_1 ($5);
4849 parser_remove_dummy_select (&ent);
4852 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4855 | JSON_TABLE json_table_rule opt_as identifier
4857 PT_NODE *ent = parser_new_node (this_parser, PT_SPEC);
4860 ent->info.spec.derived_table = $2; // json_table_rule
4861 ent->info.spec.derived_table_type = PT_DERIVED_JSON_TABLE;
4862 ent->info.spec.range_var = $4; // identifier
4865 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4870 opt_table_spec_index_hint
4871 : USE index_or_key '(' identifier_list ')'
4877 list->info.name.meta_class = PT_INDEX_NAME;
4882 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4885 | FORCE index_or_key '(' identifier_list ')'
4891 list->info.name.meta_class = PT_INDEX_NAME;
4892 list->etc = (void *) PT_IDX_HINT_FORCE;
4897 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4900 | IGNORE_ index_or_key '(' identifier_list ')'
4906 list->info.name.meta_class = PT_INDEX_NAME;
4907 list->etc = (void *) PT_IDX_HINT_IGNORE;
4912 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4917 opt_table_spec_index_hint_list
4922 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4925 | opt_table_spec_index_hint_list ',' opt_table_spec_index_hint
4928 $$ = parser_make_link($1, $3);
4929 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos);
4932 | opt_table_spec_index_hint
4936 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos);
4941 opt_as_identifier_attr_name
4946 SET_CONTAINER_2 (ctn, NULL, NULL);
4950 | opt_as identifier '(' identifier_list ')'
4954 SET_CONTAINER_2 (ctn, $2, $4);
4962 SET_CONTAINER_2 (ctn, $2, NULL);
4974 : class_spec_list ',' class_spec
4977 $$ = parser_make_link ($1, $3);
4978 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4985 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4991 : only_all_class_spec
4995 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
4998 | '(' only_all_class_spec_list ')'
5002 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5007 only_all_class_spec_list
5008 : only_all_class_spec_list ',' only_all_class_spec
5011 PT_NODE *result = parser_make_link ($1, $3);
5012 PT_NODE *p = parser_new_node (this_parser, PT_SPEC);
5014 p->info.spec.entity_name = result;
5016 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5019 | only_all_class_spec
5023 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5029 : CLASS only_class_name
5032 PT_NODE *ocs = parser_new_node (this_parser, PT_SPEC);
5035 ocs->info.spec.entity_name = $2;
5036 ocs->info.spec.only_all = PT_ONLY;
5037 ocs->info.spec.meta_class = PT_CLASS;
5041 ocs->info.spec.meta_class = PT_META_CLASS;
5043 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5049 : only_class_name opt_partition_spec
5052 PT_NODE *ocs = parser_new_node (this_parser, PT_SPEC);
5055 ocs->info.spec.entity_name = $1;
5056 ocs->info.spec.only_all = PT_ONLY;
5057 ocs->info.spec.meta_class = PT_CLASS;
5060 ocs->info.spec.partition = $2;
5065 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5068 | ALL class_name '(' EXCEPT class_spec_list ')'
5071 PT_NODE *acs = parser_new_node (this_parser, PT_SPEC);
5074 acs->info.spec.entity_name = $2;
5075 acs->info.spec.only_all = PT_ALL;
5076 acs->info.spec.meta_class = PT_CLASS;
5078 acs->info.spec.except_list = $5;
5081 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5087 PT_NODE *acs = parser_new_node (this_parser, PT_SPEC);
5090 acs->info.spec.entity_name = $2;
5091 acs->info.spec.only_all = PT_ALL;
5092 acs->info.spec.meta_class = PT_CLASS;
5096 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5102 : identifier DOT identifier
5105 PT_NODE *user_node = $1;
5106 PT_NODE *name_node = $3;
5108 if (name_node != NULL && user_node != NULL)
5110 name_node->info.name.resolved = pt_append_string (this_parser, NULL,
5111 user_node->info.name.original);
5113 if (user_node != NULL)
5115 parser_free_tree (this_parser, user_node);
5119 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5126 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5132 : class_name_list ',' class_name
5135 $$ = parser_make_link($1, $3);
5136 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5143 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5153 | PARTITION '(' identifier ')'
5156 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5214 opt_cascade_constraints
5221 | CASCADE CONSTRAINTS
5229 alter_clause_for_alter_list
5230 : ADD alter_add_clause_for_alter_list
5231 | DROP alter_drop_clause_for_alter_list
5232 | DROP alter_drop_clause_mysql_specific
5233 | RENAME alter_rename_clause_mysql_specific
5234 | RENAME alter_rename_clause_allow_multiple opt_resolution_list_for_alter
5235 | ALTER alter_column_clause_mysql_specific
5236 | alter_partition_clause_for_alter_list
5237 | alter_auto_increment_mysql_specific
5238 | MODIFY alter_modify_clause_for_alter_list
5239 | CHANGE alter_change_clause_for_alter_list
5240 | OWNER TO identifier
5242 PT_NODE *alt = parser_get_alter_node();
5246 alt->info.alter.code = PT_CHANGE_OWNER;
5247 alt->info.alter.alter_clause.user.user_name = $3;
5250 | charset_spec opt_collation
5252 PT_NODE *node = parser_get_alter_node();
5253 PT_NODE *cs_node, *coll_node;
5254 int charset, coll_id;
5261 node->info.alter.alter_clause.collation.charset = -1;
5262 node->info.alter.alter_clause.collation.collation_id = -1;
5265 if (pt_check_grammar_charset_collation (this_parser, cs_node,
5266 coll_node, &charset, &coll_id) == NO_ERROR)
5270 node->info.alter.code = PT_CHANGE_COLLATION;
5271 node->info.alter.alter_clause.collation.charset = charset;
5275 node->info.alter.alter_clause.collation.collation_id = coll_id;
5282 PT_NODE *node = parser_get_alter_node();
5284 int charset, coll_id;
5290 node->info.alter.alter_clause.collation.charset = -1;
5291 node->info.alter.alter_clause.collation.collation_id = -1;
5294 if (pt_check_grammar_charset_collation (this_parser, NULL,
5295 coll_node, &charset, &coll_id) == NO_ERROR)
5299 node->info.alter.code = PT_CHANGE_COLLATION;
5300 node->info.alter.alter_clause.collation.collation_id = coll_id;
5304 | class_comment_spec
5306 PT_NODE *alter_node = parser_get_alter_node();
5308 if (alter_node != NULL && alter_node->info.alter.code != PT_CHANGE_COLUMN_COMMENT)
5310 alter_node->info.alter.code = PT_CHANGE_TABLE_COMMENT;
5311 alter_node->info.alter.alter_clause.comment.tbl_comment = $1;
5316 alter_clause_cubrid_specific
5317 : ADD alter_add_clause_cubrid_specific opt_resolution_list_for_alter
5318 | DROP alter_drop_clause_cubrid_specific opt_resolution_list_for_alter
5319 | RENAME alter_rename_clause_cubrid_specific opt_resolution_list_for_alter
5320 | CHANGE alter_change_clause_cubrid_specific
5321 | ADD alter_add_clause_for_alter_list resolution_list_for_alter
5322 | DROP alter_drop_clause_for_alter_list resolution_list_for_alter
5323 | inherit_resolution_list
5326 PT_NODE *alt = parser_get_alter_node ();
5330 alt->info.alter.code = PT_RENAME_RESOLUTION;
5331 alt->info.alter.super.resolution_list = $1;
5337 opt_resolution_list_for_alter
5339 | resolution_list_for_alter
5342 resolution_list_for_alter
5343 : inherit_resolution_list
5346 PT_NODE *alt = parser_get_alter_node ();
5350 alt->info.alter.super.resolution_list = $1;
5356 alter_rename_clause_mysql_specific
5357 : opt_to only_class_name
5360 PT_NODE *node = parser_get_alter_node ();
5364 node->info.alter.code = PT_RENAME_ENTITY;
5365 node->info.alter.alter_clause.rename.new_name = $2;
5371 alter_auto_increment_mysql_specific
5372 : AUTO_INCREMENT '=' UNSIGNED_INTEGER
5374 PT_NODE *node = parser_get_alter_node ();
5375 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
5381 val->info.value.data_value.str =
5382 pt_append_bytes (this_parser, NULL, $3,
5384 val->type_enum = PT_TYPE_NUMERIC;
5385 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, val);
5388 node->info.alter.code = PT_CHANGE_AUTO_INCREMENT;
5389 node->info.alter.alter_clause.auto_increment.start_value = val;
5395 alter_rename_clause_allow_multiple
5396 : opt_of_attr_column_method opt_class identifier as_or_to identifier
5399 PT_NODE *node = parser_get_alter_node ();
5400 PT_MISC_TYPE etyp = $1;
5404 node->info.alter.code = PT_RENAME_ATTR_MTHD;
5406 if (etyp == PT_EMPTY)
5407 etyp = PT_ATTRIBUTE;
5409 node->info.alter.alter_clause.rename.element_type = etyp;
5411 node->info.alter.alter_clause.rename.meta = PT_META_ATTR;
5413 node->info.alter.alter_clause.rename.meta = PT_NORMAL;
5415 node->info.alter.alter_clause.rename.new_name = $5;
5416 node->info.alter.alter_clause.rename.old_name = $3;
5422 alter_rename_clause_cubrid_specific
5423 : FUNCTION opt_identifier OF opt_class identifier AS identifier
5426 PT_NODE *node = parser_get_alter_node ();
5430 node->info.alter.code = PT_RENAME_ATTR_MTHD;
5431 node->info.alter.alter_clause.rename.element_type = PT_FUNCTION_RENAME;
5433 node->info.alter.alter_clause.rename.meta = PT_META_ATTR;
5435 node->info.alter.alter_clause.rename.meta = PT_NORMAL;
5437 node->info.alter.alter_clause.rename.new_name = $7;
5438 node->info.alter.alter_clause.rename.mthd_name = $5;
5439 node->info.alter.alter_clause.rename.old_name = $2;
5443 | File file_path_name AS file_path_name
5446 PT_NODE *node = parser_get_alter_node ();
5450 node->info.alter.code = PT_RENAME_ATTR_MTHD;
5451 node->info.alter.alter_clause.rename.element_type = PT_FILE_RENAME;
5452 node->info.alter.alter_clause.rename.new_name = $4;
5453 node->info.alter.alter_clause.rename.old_name = $2;
5459 opt_of_attr_column_method
5511 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5516 alter_add_clause_for_alter_list
5517 : PARTITION add_partition_clause
5519 { parser_attr_type = PT_META_ATTR; }
5520 '(' attr_def_list ')'
5521 { parser_attr_type = PT_NORMAL; }
5524 PT_NODE *node = parser_get_alter_node ();
5527 node->info.alter.code = PT_ADD_ATTR_MTHD;
5528 node->info.alter.alter_clause.attr_mthd.attr_def_list = $5;
5533 { parser_attr_type = PT_META_ATTR; }
5535 { parser_attr_type = PT_NORMAL; }
5538 PT_NODE *node = parser_get_alter_node ();
5541 node->info.alter.code = PT_ADD_ATTR_MTHD;
5542 node->info.alter.alter_clause.attr_mthd.attr_def_list = $4;
5546 | opt_of_column_attribute
5547 { allow_attribute_ordering = true; }
5548 '(' attr_def_list ')'
5549 { allow_attribute_ordering = false; }
5552 PT_NODE *node = parser_get_alter_node ();
5555 node->info.alter.code = PT_ADD_ATTR_MTHD;
5556 node->info.alter.alter_clause.attr_mthd.attr_def_list = $4;
5560 | opt_of_column_attribute
5561 { allow_attribute_ordering = true; }
5563 { allow_attribute_ordering = false; }
5566 PT_NODE *node = parser_get_alter_node ();
5569 node->info.alter.code = PT_ADD_ATTR_MTHD;
5570 node->info.alter.alter_clause.attr_mthd.attr_def_list = $3;
5576 alter_add_clause_cubrid_specific
5577 : File method_file_list
5580 PT_NODE *node = parser_get_alter_node ();
5584 node->info.alter.code = PT_ADD_ATTR_MTHD;
5585 node->info.alter.alter_clause.attr_mthd.mthd_file_list = $2;
5589 | METHOD method_def_list
5592 PT_NODE *node = parser_get_alter_node ();
5595 node->info.alter.code = PT_ADD_ATTR_MTHD;
5596 node->info.alter.alter_clause.attr_mthd.mthd_def_list = $2;
5600 | METHOD method_def_list File method_file_list
5603 PT_NODE *node = parser_get_alter_node ();
5607 node->info.alter.code = PT_ADD_ATTR_MTHD;
5608 node->info.alter.alter_clause.attr_mthd.mthd_file_list = $4;
5609 node->info.alter.alter_clause.attr_mthd.mthd_def_list = $2;
5613 | SUPERCLASS only_class_name_list
5616 PT_NODE *node = parser_get_alter_node ();
5620 node->info.alter.code = PT_ADD_SUPCLASS;
5621 node->info.alter.super.sup_class_list = $2;
5625 | QUERY csql_query opt_vclass_comment_spec
5628 PT_NODE *node = parser_get_alter_node ();
5632 node->info.alter.code = PT_ADD_QUERY;
5633 node->info.alter.alter_clause.query.query = $2;
5634 node->info.alter.alter_clause.query.view_comment = $3;
5639 { parser_attr_type = PT_META_ATTR; }
5640 attr_def_list_with_commas
5641 { parser_attr_type = PT_NORMAL; }
5644 PT_NODE *node = parser_get_alter_node ();
5647 node->info.alter.code = PT_ADD_ATTR_MTHD;
5648 node->info.alter.alter_clause.attr_mthd.attr_def_list = $4;
5652 | opt_of_column_attribute attr_def_list_with_commas
5655 PT_NODE *node = parser_get_alter_node ();
5658 node->info.alter.code = PT_ADD_ATTR_MTHD;
5659 node->info.alter.alter_clause.attr_mthd.attr_def_list = $2;
5665 opt_of_column_attribute
5671 add_partition_clause
5672 : PARTITIONS literal_w_o_param
5675 PT_NODE *node = parser_get_alter_node ();
5676 node->info.alter.code = PT_ADD_HASHPARTITION;
5677 node->info.alter.alter_clause.partition.size = $2;
5680 | '(' partition_def_list ')'
5683 PT_NODE *node = parser_get_alter_node ();
5684 node->info.alter.code = PT_ADD_PARTITION;
5685 node->info.alter.alter_clause.partition.parts = $2;
5690 alter_drop_clause_mysql_specific
5691 : opt_reverse opt_unique index_or_key identifier
5694 PT_NODE *node = parser_get_alter_node ();
5698 node->info.alter.code = PT_DROP_INDEX_CLAUSE;
5699 node->info.alter.alter_clause.index.reverse = $1;
5700 node->info.alter.alter_clause.index.unique = $2;
5701 node->info.alter.constraint_list = $4;
5708 PT_NODE *node = parser_get_alter_node ();
5712 node->info.alter.code = PT_DROP_PRIMARY_CLAUSE;
5716 | FOREIGN KEY identifier
5719 PT_NODE *node = parser_get_alter_node ();
5723 node->info.alter.code = PT_DROP_FK_CLAUSE;
5724 node->info.alter.constraint_list = $3;
5730 alter_drop_clause_for_alter_list
5731 : opt_of_attr_column_method normal_or_class_attr
5734 PT_NODE *node = parser_get_alter_node ();
5738 node->info.alter.code = PT_DROP_ATTR_MTHD;
5739 node->info.alter.alter_clause.attr_mthd.attr_mthd_name_list = $2;
5743 | CONSTRAINT identifier
5746 PT_NODE *node = parser_get_alter_node ();
5750 node->info.alter.code = PT_DROP_CONSTRAINT;
5751 node->info.alter.constraint_list = $2;
5755 | PARTITION identifier_list
5758 PT_NODE *node = parser_get_alter_node ();
5762 node->info.alter.code = PT_DROP_PARTITION;
5763 node->info.alter.alter_clause.partition.name_list = $2;
5769 alter_drop_clause_cubrid_specific
5770 : opt_of_attr_column_method normal_or_class_attr_list_with_commas
5773 PT_NODE *node = parser_get_alter_node ();
5777 node->info.alter.code = PT_DROP_ATTR_MTHD;
5778 node->info.alter.alter_clause.attr_mthd.attr_mthd_name_list = $2;
5782 | File method_file_list
5785 PT_NODE *node = parser_get_alter_node ();
5789 node->info.alter.code = PT_DROP_ATTR_MTHD;
5790 node->info.alter.alter_clause.attr_mthd.mthd_file_list = $2;
5794 | SUPERCLASS only_class_name_list
5797 PT_NODE *node = parser_get_alter_node ();
5801 node->info.alter.code = PT_DROP_SUPCLASS;
5802 node->info.alter.super.sup_class_list = $2;
5806 | QUERY query_number_list
5809 PT_NODE *node = parser_get_alter_node ();
5813 node->info.alter.code = PT_DROP_QUERY;
5814 node->info.alter.alter_clause.query.query_no_list = $2;
5821 PT_NODE *node = parser_get_alter_node ();
5825 node->info.alter.code = PT_DROP_QUERY;
5826 node->info.alter.alter_clause.query.query_no_list = NULL;
5832 normal_or_class_attr_list_with_commas
5833 : normal_or_class_attr_list_with_commas ',' normal_or_class_attr
5836 $$ = parser_make_link ($1, $3);
5837 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5840 | normal_or_class_attr ',' normal_or_class_attr
5843 $$ = parser_make_link ($1, $3);
5844 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5849 alter_modify_clause_for_alter_list
5850 : opt_of_column_attribute
5851 { allow_attribute_ordering = true; }
5853 { allow_attribute_ordering = false; }
5856 PT_NODE *node = parser_get_alter_node ();
5860 node->info.alter.code = PT_CHANGE_ATTR;
5861 node->info.alter.alter_clause.attr_mthd.attr_def_list = $3;
5862 /* no name change for MODIFY */
5867 { allow_attribute_ordering = true; }
5869 { allow_attribute_ordering = false; }
5872 PT_NODE *node = parser_get_alter_node ();
5876 node->info.alter.code = PT_CHANGE_ATTR;
5877 node->info.alter.alter_clause.attr_mthd.attr_def_list = $4;
5878 /* no name change for MODIFY */
5880 node->info.alter.alter_clause.attr_mthd.attr_def_list->
5881 info.attr_def.attr_type = PT_META_ATTR;
5887 alter_change_clause_for_alter_list
5888 : normal_column_or_class_attribute
5889 { allow_attribute_ordering = true; }
5891 { allow_attribute_ordering = false; }
5894 PT_NODE *node = parser_get_alter_node ();
5898 PT_NODE *att = NULL;
5900 node->info.alter.code = PT_CHANGE_ATTR;
5901 node->info.alter.alter_clause.attr_mthd.attr_def_list = $3;
5902 node->info.alter.alter_clause.attr_mthd.attr_old_name = $1;
5904 att = node->info.alter.alter_clause.attr_mthd.attr_def_list;
5905 att->info.attr_def.attr_type =
5906 node->info.alter.alter_clause.attr_mthd.attr_old_name->info.name.meta_class;
5912 alter_change_clause_cubrid_specific
5913 : METHOD method_def_list
5916 PT_NODE *node = parser_get_alter_node ();
5920 node->info.alter.code = PT_MODIFY_ATTR_MTHD;
5921 node->info.alter.alter_clause.attr_mthd.mthd_def_list = $2;
5925 | QUERY unsigned_integer csql_query opt_vclass_comment_spec
5928 PT_NODE *node = parser_get_alter_node ();
5932 node->info.alter.code = PT_MODIFY_QUERY;
5933 node->info.alter.alter_clause.query.query = $3;
5934 node->info.alter.alter_clause.query.query_no_list = $2;
5935 node->info.alter.alter_clause.query.view_comment = $4;
5939 | QUERY csql_query opt_vclass_comment_spec
5942 PT_NODE *node = parser_get_alter_node ();
5946 node->info.alter.code = PT_MODIFY_QUERY;
5947 node->info.alter.alter_clause.query.query = $2;
5948 node->info.alter.alter_clause.query.query_no_list = NULL;
5949 node->info.alter.alter_clause.query.view_comment = $3;
5953 | File file_path_name AS file_path_name
5956 PT_NODE *node = parser_get_alter_node ();
5960 node->info.alter.code = PT_RENAME_ATTR_MTHD;
5961 node->info.alter.alter_clause.rename.element_type = PT_FILE_RENAME;
5962 node->info.alter.alter_clause.rename.new_name = $4;
5963 node->info.alter.alter_clause.rename.old_name = $2;
5969 normal_or_class_attr
5970 : opt_class identifier
5974 $2->info.name.meta_class = PT_META_ATTR;
5976 $2->info.name.meta_class = PT_NORMAL;
5979 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5985 : query_number_list ',' unsigned_integer
5988 $$ = parser_make_link ($1, $3);
5989 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
5996 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6001 alter_column_clause_mysql_specific
6002 : normal_column_or_class_attribute SET DEFAULT expression_
6005 PT_NODE *alter_node = parser_get_alter_node ();
6009 PT_NODE *node = parser_new_node (this_parser, PT_DATA_DEFAULT);
6014 node->info.data_default.default_value = $4;
6015 node->info.data_default.shared = PT_DEFAULT;
6016 PARSER_SAVE_ERR_CONTEXT (node, @4.buffer_pos)
6018 def = node->info.data_default.default_value;
6019 if (def && def->node_type == PT_EXPR)
6021 if (def->info.expr.op == PT_TO_CHAR)
6023 if (def->info.expr.arg3)
6026 bool has_user_lang = false;
6027 assert (def->info.expr.arg3->node_type == PT_VALUE);
6028 (void) lang_get_lang_id_from_flag (def->info.expr.arg3->info.value.data_value.i, &dummy, &has_user_lang);
6031 PT_ERROR (this_parser, def->info.expr.arg3, "do not allow lang format in default to_char");
6035 if (def->info.expr.arg1 && def->info.expr.arg1->node_type == PT_EXPR)
6037 def = def->info.expr.arg1;
6041 switch (def->info.expr.op)
6044 node->info.data_default.default_expr_type = DB_DEFAULT_SYSTIME;
6047 node->info.data_default.default_expr_type = DB_DEFAULT_SYSDATE;
6049 case PT_SYS_DATETIME:
6050 node->info.data_default.default_expr_type = DB_DEFAULT_SYSDATETIME;
6052 case PT_SYS_TIMESTAMP:
6053 node->info.data_default.default_expr_type = DB_DEFAULT_SYSTIMESTAMP;
6055 case PT_CURRENT_TIME:
6056 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTTIME;
6058 case PT_CURRENT_DATE:
6059 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTDATE;
6061 case PT_CURRENT_DATETIME:
6062 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTDATETIME;
6064 case PT_CURRENT_TIMESTAMP:
6065 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTTIMESTAMP;
6068 node->info.data_default.default_expr_type = DB_DEFAULT_USER;
6070 case PT_CURRENT_USER:
6071 node->info.data_default.default_expr_type = DB_DEFAULT_CURR_USER;
6073 case PT_UNIX_TIMESTAMP:
6074 node->info.data_default.default_expr_type = DB_DEFAULT_UNIX_TIMESTAMP;
6077 node->info.data_default.default_expr_type = DB_DEFAULT_NONE;
6083 node->info.data_default.default_expr_type = DB_DEFAULT_NONE;
6087 alter_node->info.alter.code = PT_ALTER_DEFAULT;
6088 alter_node->info.alter.alter_clause.ch_attr_def.attr_name_list = $1;
6089 alter_node->info.alter.alter_clause.ch_attr_def.data_default_list = node;
6095 normal_column_or_class_attribute
6096 : opt_of_column_attribute identifier
6099 PT_NODE * node = $2;
6102 node->info.name.meta_class = PT_NORMAL;
6105 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6108 | CLASS ATTRIBUTE identifier
6111 PT_NODE * node = $3;
6114 node->info.name.meta_class = PT_META_ATTR;
6117 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6122 insert_or_replace_stmt
6123 : insert_name_clause insert_stmt_value_clause on_duplicate_key_update
6130 ins->info.insert.odku_assignments = $3;
6131 ins->info.insert.value_clauses = $2;
6135 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6138 | insert_name_clause insert_stmt_value_clause into_clause_opt
6145 ins->info.insert.value_clauses = $2;
6146 ins->info.insert.into_var = $3;
6150 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6153 | replace_name_clause insert_stmt_value_clause into_clause_opt
6160 ins->info.insert.value_clauses = $2;
6161 ins->info.insert.into_var = $3;
6165 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6168 | insert_set_stmt on_duplicate_key_update
6174 ins->info.insert.odku_assignments = $2;
6178 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6181 | insert_set_stmt into_clause_opt
6188 ins->info.insert.into_var = $2;
6192 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6195 | replace_set_stmt into_clause_opt
6202 ins->info.insert.into_var = $2;
6206 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6212 : insert_stmt_keyword
6213 insert_set_stmt_header
6216 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6221 : replace_stmt_keyword
6222 insert_set_stmt_header
6225 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6232 PT_NODE* ins = parser_new_node (this_parser, PT_INSERT);
6233 parser_push_hint_node (ins);
6237 replace_stmt_keyword
6240 PT_NODE* ins = parser_new_node (this_parser, PT_INSERT);
6243 ins->info.insert.do_replace = true;
6245 parser_push_hint_node (ins);
6249 insert_set_stmt_header
6254 insert_assignment_list
6257 PT_NODE *ins = parser_pop_hint_node ();
6258 PT_NODE *ocs = parser_new_node (this_parser, PT_SPEC);
6259 PT_NODE *nls = pt_node_list (this_parser, PT_IS_VALUE, CONTAINER_AT_1 ($5));
6263 ocs->info.spec.entity_name = $3;
6264 ocs->info.spec.only_all = PT_ONLY;
6265 ocs->info.spec.meta_class = PT_CLASS;
6270 ins->info.insert.spec = ocs;
6271 ins->info.insert.attr_list = CONTAINER_AT_0 ($5);
6272 ins->info.insert.value_clauses = nls;
6276 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6281 insert_assignment_list
6282 : insert_assignment_list ',' identifier '=' expression_
6285 parser_make_link (CONTAINER_AT_0 ($1), $3);
6286 parser_make_link (CONTAINER_AT_1 ($1), $5);
6291 | insert_assignment_list ',' identifier '=' DEFAULT
6293 PT_NODE *arg = parser_copy_tree (this_parser, $3);
6297 pt_set_fill_default_in_path_expression (arg);
6299 parser_make_link (CONTAINER_AT_0 ($1), $3);
6300 parser_make_link (CONTAINER_AT_1 ($1),
6301 parser_make_expression (this_parser, PT_DEFAULTF, arg, NULL, NULL));
6306 | identifier '=' expression_
6310 SET_CONTAINER_2 (ctn, $1, $3);
6315 | identifier '=' DEFAULT
6319 PT_NODE *arg = parser_copy_tree (this_parser, $1);
6323 pt_set_fill_default_in_path_expression (arg);
6325 SET_CONTAINER_2 (ctn, $1,
6326 parser_make_expression (this_parser, PT_DEFAULTF, arg, NULL, NULL));
6333 on_duplicate_key_update
6334 : ON_ DUPLICATE_ KEY UPDATE
6335 update_assignment_list
6339 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6345 : insert_name_clause insert_expression_value_clause
6352 ins->info.insert.value_clauses = $2;
6356 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6359 | '(' insert_name_clause insert_expression_value_clause into_clause_opt ')'
6366 ins->info.insert.value_clauses = $3;
6367 ins->info.insert.into_var = $4;
6371 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6377 : insert_stmt_keyword
6378 insert_name_clause_header
6381 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6386 : replace_stmt_keyword
6387 insert_name_clause_header
6390 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6394 insert_name_clause_header
6402 PT_NODE *ins = parser_pop_hint_node ();
6403 PT_NODE *ocs = parser_new_node (this_parser, PT_SPEC);
6407 ocs->info.spec.entity_name = $3;
6408 ocs->info.spec.only_all = PT_ONLY;
6409 ocs->info.spec.meta_class = PT_CLASS;
6412 ocs->info.spec.partition = $4;
6418 ins->info.insert.spec = ocs;
6419 ins->info.insert.attr_list = $5;
6423 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6441 | '(' identifier_list ')'
6445 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6463 | '(' simple_path_id_list ')'
6467 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6472 insert_stmt_value_clause
6473 : insert_expression_value_clause
6477 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6481 csql_query_without_values_and_single_subquery
6484 PT_NODE *with_clause = $1;
6485 PT_NODE *select_node = $2;
6486 select_node->info.query.with = with_clause;
6487 PT_NODE *nls = pt_node_list (this_parser, PT_IS_SUBQUERY, select_node);
6490 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6493 | '(' opt_with_clause
6494 csql_query_without_values_query_no_with_clause ')'
6496 PT_NODE *with_clause = $2;
6497 PT_NODE *select_node = $3;
6498 select_node->info.query.with = with_clause;
6499 PT_NODE *nls = pt_node_list (this_parser, PT_IS_SUBQUERY, select_node);
6502 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6507 insert_expression_value_clause
6508 : of_value_values insert_value_clause_list
6512 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6515 | DEFAULT opt_values
6518 PT_NODE *nls = pt_node_list (this_parser, PT_IS_DEFAULT_VALUE, NULL);
6520 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6551 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6558 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6563 insert_value_clause_list
6564 : insert_value_clause_list ',' insert_value_clause
6567 $$ = parser_make_link ($1, $3);
6568 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6571 | insert_value_clause
6575 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6581 : '(' insert_value_list ')'
6584 PT_NODE *nls = pt_node_list (this_parser, PT_IS_VALUE, $2);
6586 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6592 PT_NODE *nls = NULL;
6594 if (prm_get_integer_value (PRM_ID_COMPAT_MODE) == COMPAT_MYSQL)
6596 nls = pt_node_list (this_parser, PT_IS_DEFAULT_VALUE, NULL);
6600 nls = pt_node_list (this_parser, PT_IS_VALUE, NULL);
6604 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6607 | DEFAULT opt_values
6610 PT_NODE *nls = pt_node_list (this_parser, PT_IS_DEFAULT_VALUE, NULL);
6612 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6618 : insert_value_list ',' insert_value
6621 $$ = parser_make_link ($1, $3);
6622 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6629 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6639 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6646 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6652 /* The argument will be filled in later, when the
6653 corresponding column name is known.
6654 See fill_in_insert_default_function_arguments(). */
6655 $$ = parser_make_expression (this_parser, PT_DEFAULTF, NULL, NULL, NULL);
6656 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6667 const bool is_full_syntax = ($2 == 1);
6668 const int like_where_syntax = 0; /* neither LIKE nor WHERE */
6669 PT_NODE *node = NULL;
6671 node = pt_make_query_show_table (this_parser, is_full_syntax, like_where_syntax, NULL);
6674 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6684 const bool is_full_syntax = ($2 == 1);
6685 const int like_where_syntax = 1; /* is LIKE */
6686 PT_NODE *node = NULL;
6687 PT_NODE *like_rhs = $5;
6689 node = pt_make_query_show_table (this_parser, is_full_syntax, like_where_syntax, like_rhs);
6692 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6702 const bool is_full_syntax = ($2 == 1);
6703 const int like_where_syntax = 2; /* is WHERE */
6704 PT_NODE *node = NULL;
6705 PT_NODE *where_cond = $5;
6707 node = pt_make_query_show_table (this_parser, is_full_syntax, like_where_syntax, where_cond);
6710 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6720 const bool is_full_syntax = ($2 == 1);
6721 const int like_where_syntax = 0; /* neither LIKE nor WHERE */
6722 PT_NODE *node = NULL;
6723 PT_NODE *original_cls_id = $5;
6725 node = pt_make_query_show_columns (this_parser, original_cls_id,
6726 like_where_syntax, NULL, is_full_syntax);
6729 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6741 const bool is_full_syntax = ($2 == 1);
6742 const int like_where_syntax = 1; /* is LIKE */
6743 PT_NODE *node = NULL;
6744 PT_NODE *original_cls_id = $5;
6745 PT_NODE *like_rhs = $7;
6747 node = pt_make_query_show_columns (this_parser, original_cls_id,
6748 like_where_syntax, like_rhs, is_full_syntax);
6751 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6763 const bool is_full_syntax = ($2 == 1);
6764 const int like_where_syntax = 2; /* is WHERE */
6765 PT_NODE *node = NULL;
6766 PT_NODE *original_cls_id = $5;
6767 PT_NODE *where_cond = $7;
6769 node = pt_make_query_show_columns (this_parser, original_cls_id,
6770 like_where_syntax, where_cond, is_full_syntax);
6773 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6776 | of_describe_desc_explain
6780 PT_NODE *node = NULL;
6781 PT_NODE *original_cls_id = $2;
6783 node = pt_make_query_show_columns (this_parser, original_cls_id,
6787 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6790 | of_describe_desc_explain
6795 PT_NODE *node = NULL;
6796 PT_NODE *original_cls_id = $2;
6799 node = pt_make_query_describe_w_identifier (this_parser, original_cls_id, attr);
6802 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6805 | of_describe_desc_explain
6810 int like_where_syntax = 0;
6811 PT_NODE *node = NULL;
6812 PT_NODE *original_cls_id = $2;
6813 PT_NODE *like_rhs = $3;
6815 if (like_rhs != NULL)
6817 like_where_syntax = 1; /* is LIKE */
6819 node = pt_make_query_show_columns (this_parser, original_cls_id,
6820 like_where_syntax, like_rhs, 0);
6823 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6830 PT_NODE *node = NULL;
6832 node = pt_make_query_show_collation (this_parser, 0, NULL);
6835 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6844 const int like_where_syntax = 1; /* is LIKE */
6845 PT_NODE *node = NULL;
6846 PT_NODE *like_rhs = $4;
6848 node = pt_make_query_show_collation (this_parser,
6853 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6861 const int like_where_syntax = 2; /* is WHERE */
6862 PT_NODE *node = NULL;
6863 PT_NODE *where_cond = $4;
6865 node = pt_make_query_show_collation (this_parser,
6870 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6879 PT_NODE *node = NULL;
6880 node = pt_make_query_show_create_table (this_parser, $4);
6883 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6892 PT_NODE *node = NULL;
6893 PT_NODE *view_id = $4;
6895 node = pt_make_query_show_create_view (this_parser, view_id);
6898 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6907 PT_NODE *node = NULL;
6908 PT_NODE *user_id = $4;
6910 assert (user_id != NULL);
6911 assert (user_id->node_type == PT_NAME);
6913 node = pt_make_query_show_grants (this_parser, user_id->info.name.original);
6916 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6921 opt_for_current_user
6924 PT_NODE *node = NULL;
6926 node = pt_make_query_show_grants_curr_usr (this_parser);
6929 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6933 of_index_indexes_keys
6938 PT_NODE *node = NULL;
6939 PT_NODE *table_id = $4;
6941 node = pt_make_query_show_index (this_parser, table_id);
6944 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6946 | SHOW EXEC STATISTICS ALL
6948 PT_NODE *node = NULL;
6950 node = pt_make_query_show_exec_stats_all (this_parser);
6953 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6956 | SHOW EXEC STATISTICS
6958 PT_NODE *node = NULL;
6960 node = pt_make_query_show_exec_stats (this_parser);
6963 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6968 PT_NODE *node = NULL;
6970 node = pt_make_query_show_trace (this_parser);
6978 PT_NODE *node = pt_make_query_showstmt (this_parser, type, NULL, 0, NULL);
6981 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6984 | SHOW show_type_of_like LIKE expression_
6987 const int like_where_syntax = 1; /* is LIKE */
6989 PT_NODE *like_rhs = $4;
6990 PT_NODE *node = pt_make_query_showstmt (this_parser, type, NULL,
6991 like_where_syntax, like_rhs);
6994 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
6997 | SHOW show_type_of_where WHERE search_condition
6999 const int like_where_syntax = 2; /* is WHERE */
7001 PT_NODE *where_cond = $4;
7002 PT_NODE *node = pt_make_query_showstmt (this_parser, type, NULL,
7003 like_where_syntax, where_cond);
7006 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7009 | SHOW show_type_arg1 OF arg_value
7013 PT_NODE *node = pt_make_query_showstmt (this_parser, type, args, 0, NULL);
7016 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7019 | SHOW show_type_arg1_opt opt_arg_value
7021 PT_NODE *node = NULL;
7025 node = pt_make_query_showstmt (this_parser, type, args, 0, NULL);
7028 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7031 | SHOW show_type_arg_named of_or_where named_args
7033 PT_NODE *node = NULL;
7037 node = pt_make_query_showstmt (this_parser, type, args, 0, NULL);
7040 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7043 | SHOW show_type_id_dot_id OF identifier DOT identifier
7046 PT_NODE *node, *args = $4;
7049 node = pt_make_query_showstmt (this_parser, type, args, 0, NULL);
7052 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7058 : KILL arg_value_list
7060 PT_NODE *node = parser_new_node (this_parser, PT_KILL_STMT);
7064 node->info.killstmt.tran_id_list = $2;
7068 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7071 | KILL kill_type arg_value_list
7074 PT_NODE *node = parser_new_node (this_parser, PT_KILL_STMT);
7078 node->info.killstmt.tran_id_list = $3;
7079 node->info.killstmt.kill_type = type;
7083 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7091 $$ = SHOWSTMT_ACCESS_STATUS;
7095 $$ = SHOWSTMT_GLOBAL_CRITICAL_SECTIONS;
7099 $$ = SHOWSTMT_JOB_QUEUES;
7101 | PAGE BUFFER STATUS
7103 $$ = SHOWSTMT_PAGE_BUFFER_STATUS;
7107 $$ = SHOWSTMT_TIMEZONES;
7111 $$ = SHOWSTMT_FULL_TIMEZONES;
7113 | TRANSACTION TABLES
7115 $$ = SHOWSTMT_TRAN_TABLES;
7119 $$ = SHOWSTMT_TRAN_TABLES;
7123 $$ = SHOWSTMT_THREADS;
7130 $$ = SHOWSTMT_ACCESS_STATUS;
7134 $$ = SHOWSTMT_TIMEZONES;
7138 $$ = SHOWSTMT_FULL_TIMEZONES;
7145 $$ = SHOWSTMT_ACCESS_STATUS;
7149 $$ = SHOWSTMT_TIMEZONES;
7153 $$ = SHOWSTMT_FULL_TIMEZONES;
7155 | TRANSACTION TABLES
7157 $$ = SHOWSTMT_TRAN_TABLES;
7161 $$ = SHOWSTMT_TRAN_TABLES;
7165 $$ = SHOWSTMT_THREADS;
7172 $$ = SHOWSTMT_VOLUME_HEADER;
7174 | ARCHIVE LOG HEADER
7176 $$ = SHOWSTMT_ARCHIVE_LOG_HEADER;
7180 $$ = SHOWSTMT_HEAP_HEADER;
7184 $$ = SHOWSTMT_ALL_HEAP_HEADER;
7188 $$ = SHOWSTMT_HEAP_CAPACITY;
7192 $$ = SHOWSTMT_ALL_HEAP_CAPACITY;
7194 | ALL INDEXES HEADER
7196 $$ = SHOWSTMT_ALL_INDEXES_HEADER;
7198 | ALL INDEXES CAPACITY
7200 $$ = SHOWSTMT_ALL_INDEXES_CAPACITY;
7207 $$ = SHOWSTMT_ACTIVE_LOG_HEADER;
7212 : SLOTTED PAGE HEADER
7214 $$ = SHOWSTMT_SLOTTED_PAGE_HEADER;
7216 | SLOTTED PAGE SLOTS
7218 $$ = SHOWSTMT_SLOTTED_PAGE_SLOTS;
7225 $$ = SHOWSTMT_INDEX_HEADER;
7229 $$ = SHOWSTMT_INDEX_CAPACITY;
7236 $$ = KILLSTMT_QUERY;
7260 | named_args AND named_arg
7262 $$ = parser_make_link ($1, $3);
7267 : identifier '=' arg_value
7269 PT_NODE * node = parser_new_node (this_parser, PT_NAMED_ARG);
7270 node->info.named_arg.name = $1;
7271 node->info.named_arg.value = $3;
7279 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
7281 node->type_enum = PT_TYPE_NULL;
7292 : arg_value_list ',' arg_value
7295 $$ = parser_make_link ($1, $3);
7296 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7303 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7309 : char_string_literal
7343 opt_for_current_user
7346 | For CURRENT_USER '(' ')'
7349 of_describe_desc_explain
7355 of_index_indexes_keys
7364 PT_NODE* node = parser_new_node(this_parser, PT_UPDATE);
7365 parser_push_hint_node(node);
7373 PT_NODE * node = parser_pop_hint_node();
7374 parser_push_orderby_node (node);
7375 parser_push_hint_node (node);
7377 extended_table_spec_list
7379 update_assignment_list
7381 opt_using_index_clause
7382 opt_update_orderby_clause
7383 opt_upd_del_limit_clause
7386 PT_NODE *node = parser_pop_hint_node ();
7388 node->info.update.spec = CONTAINER_AT_0 ($3);
7389 node->info.update.assignment = $5;
7391 if (CONTAINER_AT_0 ($6))
7393 node->info.update.search_cond = CONTAINER_AT_1 ($6);
7397 node->info.update.cursor_name = CONTAINER_AT_1 ($6);
7400 node->info.update.using_index =
7401 (node->info.update.using_index ?
7402 parser_make_link (node->info.update.using_index, $7) : $7);
7404 /* set LIMIT node */
7405 node->info.update.limit = $9;
7406 node->info.update.rewrite_limit = 1;
7408 if (node->info.update.spec->next)
7410 /* Multi-table update */
7412 /* Multi-table update cannot have ORDER BY or LIMIT */
7413 if (node->info.update.order_by)
7415 PT_ERRORmf(this_parser, node->info.update.order_by,
7416 MSGCAT_SET_PARSER_SEMANTIC,
7417 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "ORDER BY");
7419 else if (node->info.update.limit)
7421 PT_ERRORmf(this_parser, node->info.update.limit,
7422 MSGCAT_SET_PARSER_SEMANTIC,
7423 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "LIMIT");
7428 /* Single-table update */
7430 if (node->info.update.limit
7431 && node->info.update.search_cond)
7433 /* For UPDATE statements that have LIMIT clause don't allow
7434 * inst_num in search condition
7436 bool instnum_flag = false;
7437 (void) parser_walk_tree (this_parser, node->info.update.search_cond,
7438 pt_check_instnum_pre, NULL,
7439 pt_check_instnum_post, &instnum_flag);
7442 PT_ERRORmf(this_parser, node->info.update.search_cond,
7443 MSGCAT_SET_PARSER_SEMANTIC,
7444 MSGCAT_SEMANTIC_NOT_ALLOWED_IN_LIMIT_CLAUSE, "INST_NUM()/ROWNUM");
7447 else if (node->info.update.limit
7448 && node->info.update.cursor_name)
7450 /* It makes no sense to allow LIMIT for UPDATE statements
7453 PT_ERRORmf(this_parser, node->info.update.search_cond,
7454 MSGCAT_SET_PARSER_SEMANTIC,
7455 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "LIMIT");
7457 else if (node->info.update.limit
7458 && node->info.update.orderby_for)
7460 bool ordbynum_flag = false;
7461 /* check for a ORDERBY_NUM it the orderby_for tree */
7462 (void) parser_walk_tree (this_parser, node->info.update.orderby_for,
7463 pt_check_orderbynum_pre, NULL,
7464 pt_check_orderbynum_post, &ordbynum_flag);
7468 PT_ERRORmf(this_parser, node->info.update.orderby_for,
7469 MSGCAT_SET_PARSER_SEMANTIC,
7470 MSGCAT_SEMANTIC_NOT_ALLOWED_IN_LIMIT_CLAUSE, "ORDERBY_NUM()");
7476 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7483 update_assignment_list
7486 PT_NODE *node = parser_pop_hint_node ();
7489 node->info.update.object_parameter = $3;
7490 node->info.update.assignment = $5;
7494 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7505 SET_CONTAINER_2 (ctn, 0, NULL);
7511 parser_save_and_set_ic(1);
7516 parser_restore_ic();
7522 SET_CONTAINER_2 (ctn, FROM_NUMBER (1), $3);
7526 | WHERE CURRENT OF identifier
7530 SET_CONTAINER_2 (ctn, FROM_NUMBER (0), $4);
7537 of_class_spec_meta_class_spec
7542 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7549 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7565 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7572 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7577 update_assignment_list
7578 : update_assignment_list ',' update_assignment
7581 $$ = parser_make_link ($1, $3);
7582 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7594 : path_expression '=' expression_
7597 $$ = parser_make_expression (this_parser, PT_ASSIGN, $1, $3, NULL);
7598 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7601 | simple_path_id '=' DEFAULT
7604 PT_NODE *node, *node_df = NULL;
7605 node = parser_copy_tree (this_parser, $1);
7608 pt_set_fill_default_in_path_expression (node);
7609 node_df = parser_make_expression (this_parser, PT_DEFAULTF, node, NULL, NULL);
7611 $$ = parser_make_expression (this_parser, PT_ASSIGN, $1, node_df, NULL);
7612 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7615 | paren_path_expression_set '=' primary_w_collate
7618 PT_NODE *exp = parser_make_expression (this_parser, PT_ASSIGN, $1, NULL, NULL);
7619 PT_NODE *arg1, *arg2, *list, *tmp;
7620 PT_NODE *e1, *e2 = NULL, *e1_next, *e2_next;
7621 bool is_subquery = false;
7625 /* primary is parentheses expr set value */
7626 if (arg2->node_type == PT_VALUE &&
7627 (arg2->type_enum == PT_TYPE_NULL || arg2->type_enum == PT_TYPE_EXPR_SET))
7630 /* flatten multi-column assignment expr */
7631 if (arg1->node_type == PT_EXPR)
7633 /* get elements and free set node */
7634 e1 = arg1->info.expr.arg1;
7635 arg1->info.expr.arg1 = NULL; /* cut-off link */
7636 parser_free_node (this_parser, exp); /* free exp, arg1 */
7638 if (arg2->type_enum == PT_TYPE_NULL)
7644 e2 = arg2->info.value.data_value.set;
7645 arg2->info.value.data_value.set = NULL; /* cut-off link */
7647 parser_free_node (this_parser, arg2);
7649 list = NULL; /* init */
7650 for (; e1; e1 = e1_next)
7654 if (arg2->type_enum == PT_TYPE_NULL)
7656 if ((e2 = parser_new_node (this_parser, PT_VALUE)) == NULL)
7658 e2->type_enum = PT_TYPE_NULL;
7659 e2->flag.is_added_by_parser = 1;
7669 tmp = parser_new_node (this_parser, PT_EXPR);
7672 tmp->info.expr.op = PT_ASSIGN;
7673 tmp->info.expr.arg1 = e1;
7674 tmp->info.expr.arg2 = e2;
7676 list = parser_make_link (tmp, list);
7681 PARSER_SAVE_ERR_CONTEXT (list, @$.buffer_pos)
7682 /* expression number check */
7685 PT_ERRORf (this_parser, list,
7686 "check syntax at %s, different number of elements in each expression.",
7687 pt_show_binopcode (PT_ASSIGN));
7694 /* something wrong */
7695 exp->info.expr.arg2 = arg2;
7697 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7702 if (pt_is_query (arg2))
7704 /* primary is subquery. go ahead */
7708 exp->info.expr.arg1 = arg1;
7709 exp->info.expr.arg2 = arg2;
7712 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7715 /* unknown error check */
7716 if (is_subquery == false)
7718 PT_ERRORf (this_parser, exp, "check syntax at %s",
7719 pt_show_binopcode (PT_ASSIGN));
7726 paren_path_expression_set
7727 : '(' path_expression_list ')'
7730 PT_NODE *p = parser_new_node (this_parser, PT_EXPR);
7734 p->info.expr.op = PT_PATH_EXPR_SET;
7735 p->info.expr.paren_type = 1;
7736 p->info.expr.arg1 = $2;
7740 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7745 path_expression_list
7746 : path_expression_list ',' path_expression
7749 $$ = parser_make_link ($1, $3);
7750 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7757 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7766 node->info.name.meta_class = PT_CLASS;
7771 | identifier DOT '*'
7775 node->info.name.meta_class = PT_CLASS;
7783 : delete_name_list ',' delete_name
7786 $$ = parser_make_link ($1, $3);
7798 : delete_name_list FROM extended_table_spec_list
7802 SET_CONTAINER_3(ctn, $1, CONTAINER_AT_0 ($3), CONTAINER_AT_1 ($3));
7807 | FROM delete_name_list USING extended_table_spec_list
7811 SET_CONTAINER_3(ctn, $2, CONTAINER_AT_0 ($4), CONTAINER_AT_1 ($4));
7820 SET_CONTAINER_3(ctn, NULL, $2, FROM_NUMBER(0));
7829 SET_CONTAINER_3(ctn, NULL, $1, FROM_NUMBER(0));
7839 PT_NODE* node = parser_new_node(this_parser, PT_DELETE);
7840 parser_push_hint_node(node);
7842 opt_hint_list /* $3 */
7843 delete_from_using /* $4 */
7844 opt_of_where_cursor /* $5 */
7845 opt_using_index_clause /* $6 */
7846 opt_upd_del_limit_clause /* $7 */
7849 PT_NODE *del = parser_pop_hint_node ();
7853 PT_NODE *node = NULL;
7854 del->info.delete_.target_classes = CONTAINER_AT_0 ($4);
7855 del->info.delete_.spec = CONTAINER_AT_1 ($4);
7857 pt_check_unique_names (this_parser,
7858 del->info.delete_.spec);
7860 if (TO_NUMBER (CONTAINER_AT_0 ($5)))
7862 del->info.delete_.search_cond = CONTAINER_AT_1 ($5);
7866 del->info.delete_.cursor_name = CONTAINER_AT_1 ($5);
7869 del->info.delete_.using_index =
7870 (del->info.delete_.using_index ?
7871 parser_make_link (del->info.delete_.using_index, $6) : $6);
7873 del->info.delete_.limit = $7;
7874 del->info.delete_.rewrite_limit = 1;
7876 /* In a multi-table case the LIMIT clauses is not allowed. */
7877 if (del->info.delete_.spec->next)
7879 if (del->info.delete_.limit)
7881 PT_ERRORmf(this_parser, del->info.delete_.limit,
7882 MSGCAT_SET_PARSER_SEMANTIC,
7883 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "LIMIT");
7888 /* if the delete is single-table no need to specify
7889 * the delete table. In this case add the name of supplied
7890 * spec to the target_classes list. */
7891 if (!del->info.delete_.target_classes)
7893 if (del->info.delete_.spec->info.spec.range_var)
7895 del->info.delete_.target_classes =
7896 parser_copy_tree(this_parser, del->info.delete_.spec->info.spec.range_var);
7900 del->info.delete_.target_classes =
7901 parser_copy_tree(this_parser, del->info.delete_.spec->info.spec.entity_name);
7905 /* set LIMIT node */
7906 if (del->info.delete_.limit && del->info.delete_.search_cond)
7908 /* For DELETE statements that have LIMIT clause don't
7909 * allow inst_num in search condition */
7910 bool instnum_flag = false;
7911 (void) parser_walk_tree (this_parser, del->info.delete_.search_cond,
7912 pt_check_instnum_pre, NULL,
7913 pt_check_instnum_post, &instnum_flag);
7916 PT_ERRORmf(this_parser, del->info.delete_.search_cond,
7917 MSGCAT_SET_PARSER_SEMANTIC,
7918 MSGCAT_SEMANTIC_NOT_ALLOWED_IN_LIMIT_CLAUSE, "INST_NUM()/ROWNUM");
7921 else if (del->info.delete_.limit && del->info.delete_.cursor_name)
7923 /* It makes no sense to allow LIMIT for DELETE statements
7924 * that use (Oracle style) cursor */
7925 PT_ERRORmf(this_parser, del->info.delete_.search_cond,
7926 MSGCAT_SET_PARSER_SEMANTIC,
7927 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "LIMIT");
7931 node = del->info.delete_.target_classes;
7934 PT_NAME_INFO_SET_FLAG(node, PT_NAME_ALLOW_REUSABLE_OID);
7939 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7947 PT_NODE *merge = parser_new_node (this_parser, PT_MERGE);
7948 parser_push_hint_node (merge);
7950 opt_hint_list /* $3 */
7956 search_condition /* $9 */
7957 merge_update_insert_clause /* $10 */
7960 PT_NODE *merge = parser_pop_hint_node ();
7963 merge->info.merge.into = $5;
7964 merge->info.merge.using_clause = $7;
7965 merge->info.merge.search_cond = $9;
7969 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
7974 merge_update_insert_clause
7975 : merge_update_clause
7978 | merge_insert_clause
7981 | merge_update_clause
7985 | merge_insert_clause
7992 : WHEN MATCHED THEN UPDATE SET
7993 update_assignment_list /* $6 */
7994 opt_where_clause /* $7 */
7995 opt_merge_delete_clause /* $8 */
7998 PT_NODE *merge = parser_top_hint_node ();
8001 merge->info.merge.update.assignment = $6;
8002 merge->info.merge.update.search_cond = $7;
8003 merge->info.merge.update.del_search_cond = $8;
8006 merge->info.merge.update.has_delete = true;
8014 : WHEN NOT MATCHED THEN INSERT
8015 opt_path_attr_list /* $6 */
8016 insert_expression_value_clause /* $7 */
8017 opt_where_clause /* $8 */
8020 PT_NODE *merge = parser_top_hint_node ();
8023 merge->info.merge.insert.attr_list = $6;
8024 merge->info.merge.insert.value_clauses = $7;
8025 merge->info.merge.insert.search_cond = $8;
8031 opt_merge_delete_clause
8038 | DELETE_ WHERE search_condition
8042 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8048 : grant_head opt_with_grant_option
8052 PT_MISC_TYPE w = PT_NO_GRANT_OPTION;
8054 w = PT_GRANT_OPTION;
8058 node->info.grant.grant_option = w;
8062 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8065 | revoke_cmd on_class_list from_id_list
8068 PT_NODE *node = parser_new_node (this_parser, PT_REVOKE);
8072 node->info.revoke.user_list = $3;
8073 node->info.revoke.spec_list = $2;
8074 node->info.revoke.auth_cmd_list = $1;
8078 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8081 | revoke_cmd from_id_list on_class_list
8084 PT_NODE *node = parser_new_node (this_parser, PT_REVOKE);
8088 node->info.revoke.user_list = $2;
8089 node->info.revoke.spec_list = $3;
8090 node->info.revoke.auth_cmd_list = $1;
8094 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8101 { push_msg(MSGCAT_SYNTAX_MISSING_AUTH_COMMAND_LIST); }
8109 { push_msg(MSGCAT_SYNTAX_MISSING_AUTH_COMMAND_LIST); }
8116 : grant_cmd on_class_list to_id_list
8119 PT_NODE *node = parser_new_node (this_parser, PT_GRANT);
8123 node->info.grant.user_list = $3;
8124 node->info.grant.spec_list = $2;
8125 node->info.grant.auth_cmd_list = $1;
8129 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8132 | grant_cmd to_id_list on_class_list
8135 PT_NODE *node = parser_new_node (this_parser, PT_GRANT);
8139 node->info.grant.user_list = $2;
8140 node->info.grant.spec_list = $3;
8141 node->info.grant.auth_cmd_list = $1;
8145 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8150 opt_with_grant_option
8167 { push_msg(MSGCAT_SYNTAX_MISSING_CLASS_SPEC_LIST); }
8175 { push_msg(MSGCAT_SYNTAX_MISSING_IDENTIFIER_LIST); }
8183 { push_msg(MSGCAT_SYNTAX_MISSING_IDENTIFIER_LIST); }
8190 : author_cmd_list ',' authorized_cmd
8193 $$ = parser_make_link ($1, $3);
8194 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8201 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8210 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8211 node->info.auth_cmd.auth_cmd = PT_SELECT_PRIV;
8212 node->info.auth_cmd.attr_mthd_list = NULL;
8214 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8220 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8224 node->info.auth_cmd.auth_cmd = PT_INSERT_PRIV;
8225 node->info.auth_cmd.attr_mthd_list = NULL;
8229 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8235 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8239 node->info.auth_cmd.auth_cmd = PT_INDEX_PRIV;
8240 node->info.auth_cmd.attr_mthd_list = NULL;
8244 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8250 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8254 node->info.auth_cmd.auth_cmd = PT_DELETE_PRIV;
8255 node->info.auth_cmd.attr_mthd_list = NULL;
8259 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8263 | UPDATE '(' identifier_list ')'
8266 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8267 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
8270 node->info.auth_cmd.auth_cmd = PT_UPDATE_PRIV;
8271 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
8272 MSGCAT_SYNTAX_ATTR_IN_PRIVILEGE,
8273 parser_print_tree_list (this_parser, $3));
8275 node->info.auth_cmd.attr_mthd_list = $3;
8284 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8288 node->info.auth_cmd.auth_cmd = PT_UPDATE_PRIV;
8289 node->info.auth_cmd.attr_mthd_list = NULL;
8293 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8299 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8303 node->info.auth_cmd.auth_cmd = PT_ALTER_PRIV;
8304 node->info.auth_cmd.attr_mthd_list = NULL;
8308 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8314 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8318 node->info.auth_cmd.auth_cmd = PT_ADD_PRIV;
8319 node->info.auth_cmd.attr_mthd_list = NULL;
8323 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8329 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8333 node->info.auth_cmd.auth_cmd = PT_DROP_PRIV;
8334 node->info.auth_cmd.attr_mthd_list = NULL;
8338 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8344 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8348 node->info.auth_cmd.auth_cmd = PT_EXECUTE_PRIV;
8349 node->info.auth_cmd.attr_mthd_list = NULL;
8353 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8359 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8363 node->info.auth_cmd.auth_cmd = PT_REFERENCES_PRIV;
8364 node->info.auth_cmd.attr_mthd_list = NULL;
8368 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8374 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8378 node->info.auth_cmd.auth_cmd = PT_ALL_PRIV;
8379 node->info.auth_cmd.attr_mthd_list = NULL;
8383 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8389 PT_NODE *node = parser_new_node (this_parser, PT_AUTH_CMD);
8393 node->info.auth_cmd.auth_cmd = PT_ALL_PRIV;
8394 node->info.auth_cmd.attr_mthd_list = NULL;
8398 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8411 { push_msg(MSGCAT_SYNTAX_INVALID_PASSWORD); }
8417 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8430 { push_msg(MSGCAT_SYNTAX_INVALID_GROUPS); }
8436 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8449 { push_msg(MSGCAT_SYNTAX_INVALID_MEMBERS); }
8455 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8461 : CALL generic_function into_clause_opt
8467 node->info.method_call.call_or_expr = PT_IS_CALL_STMT;
8468 node->info.method_call.to_return_var = $3;
8471 parser_cannot_prepare = true;
8472 parser_cannot_cache = true;
8475 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8480 opt_class_or_normal_attr_def_list
8487 | '(' class_or_normal_attr_def_list ')'
8491 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8503 | METHOD method_def_list
8507 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8519 | File method_file_list
8523 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8528 opt_inherit_resolution_list
8535 | inherit_resolution_list
8539 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8544 opt_table_option_list
8555 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8560 opt_partition_clause
8571 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8576 opt_create_as_clause
8581 SET_CONTAINER_2(ctn, NULL, NULL);
8658 opt_paren_view_attr_def_list
8665 | '(' view_attr_def_list ')'
8669 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8685 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8690 opt_with_levels_clause
8697 | WITH LOCAL CHECK OPTION
8703 | WITH CASCADED CHECK OPTION
8718 : query_list ',' csql_query
8721 $$ = parser_make_link ($1, $3);
8722 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8729 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8734 inherit_resolution_list
8735 : inherit_resolution_list ',' inherit_resolution
8738 $$ = parser_make_link ($1, $3);
8739 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8742 | INHERIT inherit_resolution
8746 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8752 : opt_class identifier OF identifier AS identifier
8755 PT_NODE *node = parser_new_node (this_parser, PT_RESOLUTION);
8759 PT_MISC_TYPE t = PT_NORMAL;
8763 node->info.resolution.of_sup_class_name = $4;
8764 node->info.resolution.attr_mthd_name = $2;
8765 node->info.resolution.attr_type = t;
8766 node->info.resolution.as_attr_mthd_name = $6;
8770 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8773 | opt_class identifier OF identifier
8776 PT_NODE *node = parser_new_node (this_parser, PT_RESOLUTION);
8780 PT_MISC_TYPE t = PT_NORMAL;
8784 node->info.resolution.of_sup_class_name = $4;
8785 node->info.resolution.attr_mthd_name = $2;
8786 node->info.resolution.attr_type = t;
8790 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8796 : table_option_list ',' table_option
8799 $$ = parser_make_link ($1, $3);
8800 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8803 | table_option_list table_option
8806 $$ = parser_make_link ($1, $2);
8807 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8814 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8823 $$ = pt_table_option (this_parser, PT_TABLE_OPTION_REUSE_OID, NULL);
8824 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8830 $$ = pt_table_option (this_parser, PT_TABLE_OPTION_DONT_REUSE_OID, NULL);
8831 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8834 | AUTO_INCREMENT '=' UNSIGNED_INTEGER
8837 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
8840 val->info.value.data_value.str =
8841 pt_append_bytes (this_parser, NULL, $3,
8843 val->type_enum = PT_TYPE_NUMERIC;
8844 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, val);
8847 $$ = pt_table_option (this_parser, PT_TABLE_OPTION_AUTO_INCREMENT, val);
8848 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8851 | class_encrypt_spec
8854 $$ = pt_table_option (this_parser, PT_TABLE_OPTION_ENCRYPT, $1);
8855 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8861 $$ = pt_table_option (this_parser, PT_TABLE_OPTION_CHARSET, $1);
8862 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8868 $$ = pt_table_option (this_parser, PT_TABLE_OPTION_COLLATION, $1);
8869 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8872 | class_comment_spec
8875 $$ = pt_table_option (this_parser, PT_TABLE_OPTION_COMMENT, $1);
8876 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8888 | UNDER only_class_name_list
8892 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8895 | AS SUBCLASS OF only_class_name_list
8899 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8911 | CONSTRAINT identifier
8915 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8920 opt_constraint_opt_id
8927 | CONSTRAINT opt_identifier
8931 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8936 of_unique_foreign_check
8941 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8944 | foreign_key_constraint
8948 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8955 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
8960 opt_constraint_attr_list
8965 SET_CONTAINER_4 (ctn, FROM_NUMBER (0), FROM_NUMBER (0), FROM_NUMBER (0),
8970 | constraint_attr_list
8978 constraint_attr_list
8979 : constraint_attr_list ',' constraint_attr
8982 container_4 ctn = $1;
8983 container_4 ctn_new = $3;
8985 if (TO_NUMBER (ctn_new.c1))
8987 ctn.c1 = ctn_new.c1;
8988 ctn.c2 = ctn_new.c2;
8991 if (TO_NUMBER (ctn_new.c3))
8993 ctn.c3 = ctn_new.c3;
8994 ctn.c4 = ctn_new.c4;
9009 : PRIMARY KEY opt_identifier '(' index_column_identifier_list ')'
9012 PT_NODE *node = parser_new_node (this_parser, PT_CONSTRAINT);
9016 node->info.constraint.type = PT_CONSTRAIN_PRIMARY_KEY;
9017 node->info.constraint.name = $3;
9018 node->info.constraint.un.unique.attrs = $5;
9022 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9025 | UNIQUE opt_of_index_key opt_identifier index_column_name_list
9028 PT_NODE *node = NULL;
9029 PT_NODE *sort_spec_cols = $4, *name_cols = NULL, *temp;
9031 for (temp = sort_spec_cols; temp != NULL; temp = temp->next)
9033 if (temp->info.sort_spec.expr->node_type == PT_EXPR)
9035 /* Currently, not allowed unique with filter/function
9036 index. However, may be introduced later, if it will be
9037 usefull. Unique filter/function index code is removed
9038 from grammar module only. It is kept yet in the others
9039 modules. This will allow us to easily support this
9040 feature later by adding in grammar only. If no need
9041 such feature, filter/function code must be removed
9042 from all modules. */
9043 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
9044 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
9047 name_cols = pt_sort_spec_list_to_name_node_list (this_parser, sort_spec_cols);
9050 /* create constraint node */
9051 node = parser_new_node (this_parser, PT_CONSTRAINT);
9052 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
9055 node->info.constraint.type = PT_CONSTRAIN_UNIQUE;
9056 node->info.constraint.name = $3;
9057 node->info.constraint.un.unique.attrs = name_cols;
9059 parser_free_tree (this_parser, sort_spec_cols);
9063 /* create index node */
9065 if (parser_count_list (sort_spec_cols) == 1
9066 && (sort_spec_cols->info.sort_spec.expr->node_type != PT_EXPR))
9068 /* unique index with prefix length not allowed */
9069 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
9070 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
9074 node = parser_new_node (this_parser, PT_CREATE_INDEX);
9075 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
9078 node->info.index.index_name = $3;
9079 if (node->info.index.index_name)
9081 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
9084 node->info.index.indexed_class = NULL;
9085 node->info.index.column_names = sort_spec_cols;
9086 node->info.index.unique = 1;
9087 node->info.index.index_status = SM_NORMAL_INDEX;
9097 foreign_key_constraint
9100 opt_identifier /* 3 */
9101 '(' index_column_identifier_list ')' /* 4, 5, 6 */
9104 opt_paren_attr_list /* 9 */
9105 opt_ref_rule_list /* 10 */
9108 PT_NODE *node = parser_new_node (this_parser, PT_CONSTRAINT);
9112 node->info.constraint.name = $3;
9113 node->info.constraint.type = PT_CONSTRAIN_FOREIGN_KEY;
9114 node->info.constraint.un.foreign_key.attrs = $5;
9116 node->info.constraint.un.foreign_key.referenced_attrs = $9;
9117 node->info.constraint.un.foreign_key.match_type = PT_MATCH_REGULAR;
9118 node->info.constraint.un.foreign_key.delete_action = TO_NUMBER (CONTAINER_AT_0 ($10)); /* delete_action */
9119 node->info.constraint.un.foreign_key.update_action = TO_NUMBER (CONTAINER_AT_1 ($10)); /* update_action */
9120 node->info.constraint.un.foreign_key.referenced_class = $8;
9124 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9129 index_column_identifier_list
9130 : index_column_identifier_list ',' index_column_identifier
9133 $$ = parser_make_link ($1, $3);
9134 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9137 | index_column_identifier
9141 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9146 index_column_identifier
9147 : identifier opt_asc_or_desc
9152 PT_NAME_INFO_SET_FLAG ($1, PT_NAME_INFO_DESC);
9155 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9188 | '(' identifier_list ')'
9192 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9202 SET_CONTAINER_3 (ctn, FROM_NUMBER (PT_RULE_RESTRICT),
9203 FROM_NUMBER (PT_RULE_RESTRICT), NULL);
9210 container_3 ctn = $1;
9212 ctn.c1 = FROM_NUMBER (PT_RULE_RESTRICT);
9214 ctn.c2 = FROM_NUMBER (PT_RULE_RESTRICT);
9221 : ref_rule_list ON_ DELETE_ CASCADE
9224 container_3 ctn = $1;
9227 push_msg (MSGCAT_SYNTAX_DUPLICATED_REF_RULE);
9228 csql_yyerror_explicit (@2.first_line, @2.first_column);
9231 ctn.c1 = FROM_NUMBER (PT_RULE_CASCADE);
9235 | ref_rule_list ON_ DELETE_ NO ACTION
9238 container_3 ctn = $1;
9241 push_msg (MSGCAT_SYNTAX_DUPLICATED_REF_RULE);
9242 csql_yyerror_explicit (@2.first_line, @2.first_column);
9245 ctn.c1 = FROM_NUMBER (PT_RULE_NO_ACTION);
9249 | ref_rule_list ON_ DELETE_ RESTRICT
9252 container_3 ctn = $1;
9255 push_msg (MSGCAT_SYNTAX_DUPLICATED_REF_RULE);
9256 csql_yyerror_explicit (@2.first_line, @2.first_column);
9259 ctn.c1 = FROM_NUMBER (PT_RULE_RESTRICT);
9263 | ref_rule_list ON_ DELETE_ SET Null
9266 container_3 ctn = $1;
9269 push_msg (MSGCAT_SYNTAX_DUPLICATED_REF_RULE);
9270 csql_yyerror_explicit (@2.first_line, @2.first_column);
9273 ctn.c1 = FROM_NUMBER (PT_RULE_SET_NULL);
9277 | ref_rule_list ON_ UPDATE NO ACTION
9280 container_3 ctn = $1;
9283 push_msg (MSGCAT_SYNTAX_DUPLICATED_REF_RULE);
9284 csql_yyerror_explicit (@2.first_line, @2.first_column);
9287 ctn.c2 = FROM_NUMBER (PT_RULE_NO_ACTION);
9291 | ref_rule_list ON_ UPDATE RESTRICT
9294 container_3 ctn = $1;
9297 push_msg (MSGCAT_SYNTAX_DUPLICATED_REF_RULE);
9298 csql_yyerror_explicit (@2.first_line, @2.first_column);
9301 ctn.c2 = FROM_NUMBER (PT_RULE_RESTRICT);
9305 | ref_rule_list ON_ UPDATE SET Null
9308 container_3 ctn = $1;
9311 push_msg (MSGCAT_SYNTAX_DUPLICATED_REF_RULE);
9312 csql_yyerror_explicit (@2.first_line, @2.first_column);
9315 ctn.c2 = FROM_NUMBER (PT_RULE_SET_NULL);
9319 | ON_ DELETE_ CASCADE
9323 SET_CONTAINER_3 (ctn, FROM_NUMBER (PT_RULE_CASCADE), NULL, NULL);
9327 | ON_ DELETE_ NO ACTION
9331 SET_CONTAINER_3 (ctn, FROM_NUMBER (PT_RULE_NO_ACTION), NULL, NULL);
9335 | ON_ DELETE_ RESTRICT
9339 SET_CONTAINER_3 (ctn, FROM_NUMBER (PT_RULE_RESTRICT), NULL, NULL);
9343 | ON_ DELETE_ SET Null
9347 SET_CONTAINER_3 (ctn, FROM_NUMBER (PT_RULE_SET_NULL), NULL, NULL);
9351 | ON_ UPDATE NO ACTION
9355 SET_CONTAINER_3 (ctn, NULL, FROM_NUMBER (PT_RULE_NO_ACTION), NULL);
9359 | ON_ UPDATE RESTRICT
9363 SET_CONTAINER_3 (ctn, NULL, FROM_NUMBER (PT_RULE_RESTRICT), NULL);
9367 | ON_ UPDATE SET Null
9371 SET_CONTAINER_3 (ctn, NULL, FROM_NUMBER (PT_RULE_SET_NULL), NULL);
9379 : CHECK '(' search_condition ')'
9382 PT_NODE *node = parser_new_node (this_parser, PT_CONSTRAINT);
9386 node->info.constraint.type = PT_CONSTRAIN_CHECK;
9387 node->info.constraint.un.check.expr = $3;
9391 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9397 /* bool_deferrable, deferrable value, bool_initially_deferred, initially_deferred value */
9403 ctn.c1 = FROM_NUMBER (1);
9404 ctn.c2 = FROM_NUMBER (0);
9405 ctn.c3 = FROM_NUMBER (0);
9406 ctn.c4 = FROM_NUMBER (0);
9414 ctn.c1 = FROM_NUMBER (1);
9415 ctn.c2 = FROM_NUMBER (1);
9416 ctn.c3 = FROM_NUMBER (0);
9417 ctn.c4 = FROM_NUMBER (0);
9421 | INITIALLY DEFERRED
9425 ctn.c1 = FROM_NUMBER (0);
9426 ctn.c2 = FROM_NUMBER (0);
9427 ctn.c3 = FROM_NUMBER (1);
9428 ctn.c4 = FROM_NUMBER (1);
9432 | INITIALLY IMMEDIATE
9436 ctn.c1 = FROM_NUMBER (0);
9437 ctn.c2 = FROM_NUMBER (0);
9438 ctn.c3 = FROM_NUMBER (1);
9439 ctn.c4 = FROM_NUMBER (0);
9446 : method_def_list ',' method_def
9449 $$ = parser_make_link ($1, $3);
9450 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9457 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9465 opt_method_def_arg_list
9467 opt_function_identifier
9470 PT_NODE *node = parser_new_node (this_parser, PT_METHOD_DEF);
9471 PT_MISC_TYPE t = PT_NORMAL;
9477 node->info.method_def.method_name = $2;
9478 node->info.method_def.mthd_type = t;
9479 node->info.method_def.method_args_list = $3;
9480 node->type_enum = TO_NUMBER (CONTAINER_AT_0 ($4));
9481 node->data_type = CONTAINER_AT_1 ($4);
9482 node->info.method_def.function_name = $5;
9485 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9490 opt_method_def_arg_list
9497 | '(' arg_type_list ')'
9501 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9513 : arg_type_list ',' inout_data_type
9516 $$ = parser_make_link ($1, $3);
9517 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9524 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9530 : opt_in_out data_type
9533 PT_NODE *at = parser_new_node (this_parser, PT_DATA_TYPE);
9537 at->type_enum = TO_NUMBER (CONTAINER_AT_0 ($2));
9538 at->data_type = CONTAINER_AT_1 ($2);
9539 at->info.data_type.inout = $1;
9543 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9553 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_NONE), NULL);
9565 opt_function_identifier
9572 | FUNCTION identifier
9576 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9582 : method_file_list ',' file_path_name
9585 $$ = parser_make_link ($1, $3);
9586 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9593 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9599 : char_string_literal
9602 PT_NODE *node = parser_new_node (this_parser, PT_FILE_PATH);
9604 node->info.file_path.string = $1;
9606 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9611 opt_class_attr_def_list
9620 { parser_attr_type = PT_META_ATTR; }
9621 '(' attr_def_list ')'
9622 { parser_attr_type = PT_NORMAL; }
9626 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9631 class_or_normal_attr_def_list
9632 : class_or_normal_attr_def_list ',' class_or_normal_attr_def
9635 $$ = parser_make_link ($1, $3);
9636 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9639 | class_or_normal_attr_def
9643 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9648 class_or_normal_attr_def
9649 : CLASS { parser_attr_type = PT_META_ATTR; } attr_def { parser_attr_type = PT_NORMAL; }
9653 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9660 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9666 : view_attr_def_list ',' view_attr_def
9669 $$ = parser_make_link ($1, $3);
9670 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9677 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9687 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9690 | identifier opt_comment_spec
9693 PT_NODE *node = parser_new_node (this_parser, PT_ATTR_DEF);
9697 node->data_type = NULL;
9698 node->info.attr_def.attr_name = $1;
9699 node->info.attr_def.comment = $2;
9700 node->info.attr_def.attr_type = PT_NORMAL;
9704 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9709 attr_def_list_with_commas
9710 : attr_def_list_with_commas ',' attr_def
9713 $$ = parser_make_link ($1, $3);
9714 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9717 | attr_def ',' attr_def
9720 $$ = parser_make_link ($1, $3);
9721 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9727 : attr_def_list ',' attr_def
9730 $$ = parser_make_link ($1, $3);
9731 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9738 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9744 : attr_constraint_def
9748 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9755 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9762 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9768 : opt_constraint_opt_id
9769 of_unique_foreign_check
9770 opt_constraint_attr_list
9775 PT_NODE *constraint = $2;
9779 if (constraint->node_type == PT_CONSTRAINT)
9781 /* If both the constraint name and the index name are
9782 given we ignore the constraint name because that is
9783 what MySQL does for UNIQUE constraints. */
9784 if (constraint->info.constraint.name == NULL)
9786 constraint->info.constraint.name = name;
9788 constraint->info.constraint.comment = $4;
9789 if (TO_NUMBER (CONTAINER_AT_0 ($3)))
9791 constraint->info.constraint.deferrable = (short)TO_NUMBER (CONTAINER_AT_1 ($3));
9793 if (TO_NUMBER (CONTAINER_AT_2 ($3)))
9795 constraint->info.constraint.initially_deferred =
9796 (short)TO_NUMBER (CONTAINER_AT_3 ($3));
9801 /* UNIQUE - constraint->node_type = PT_CREATE_INDEX */
9802 if (TO_NUMBER (CONTAINER_AT_0 ($3)) || TO_NUMBER (CONTAINER_AT_2 ($3)))
9804 PT_ERRORm (this_parser, constraint, MSGCAT_SET_PARSER_SYNTAX,
9805 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
9809 constraint->info.index.comment = $4;
9810 if (constraint->info.index.index_name == NULL)
9812 constraint->info.index.index_name = name;
9815 PT_ERRORm (this_parser, constraint,
9816 MSGCAT_SET_PARSER_SYNTAX,
9817 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
9825 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9831 : index_or_key /* 1 */
9833 index_column_name_list /* 3 */
9834 opt_where_clause /* 4 */
9835 opt_comment_spec /* 5 */
9836 opt_invisible /* 6 */
9838 int arg_count = 0, prefix_col_count = 0;
9839 PT_NODE* node = parser_new_node(this_parser,
9843 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
9844 node->info.index.index_name = $2;
9845 if (node->info.index.index_name)
9847 node->info.index.index_name->info.name.meta_class = PT_INDEX_NAME;
9849 node->info.index.indexed_class = NULL;
9850 node->info.index.where = $4;
9851 node->info.index.comment = $5;
9852 node->info.index.index_status = SM_NORMAL_INDEX;
9855 parser_count_prefix_columns (col, &arg_count);
9857 if (prefix_col_count > 1 ||
9858 (prefix_col_count == 1 && arg_count > 1))
9860 PT_ERRORm (this_parser, node,
9861 MSGCAT_SET_PARSER_SEMANTIC,
9862 MSGCAT_SEMANTIC_MULTICOL_PREFIX_INDX_NOT_ALLOWED);
9866 if (arg_count == 1 && (prefix_col_count == 1
9867 || col->info.sort_spec.expr->node_type == PT_FUNCTION))
9869 PT_NODE *expr = col->info.sort_spec.expr;
9870 PT_NODE *arg_list = expr->info.function.arg_list;
9871 if ((arg_list != NULL)
9872 && (arg_list->next == NULL)
9873 && (arg_list->node_type == PT_VALUE))
9875 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
9878 p->info.name.original = expr->info.function.generic_name;
9880 node->info.index.prefix_length =
9881 expr->info.function.arg_list;
9882 col->info.sort_spec.expr = p;
9886 PT_ERRORm (this_parser, node,
9887 MSGCAT_SET_PARSER_SYNTAX,
9888 MSGCAT_SYNTAX_INVALID_CREATE_INDEX);
9892 node->info.index.column_names = col;
9893 node->info.index.index_status = SM_NORMAL_INDEX;
9896 node->info.index.index_status = SM_INVISIBLE_INDEX;
9906 {{//attr_def_one : identifier
9910 PT_NODE *node = parser_new_node (this_parser, PT_ATTR_DEF);
9914 node->type_enum = typ = TO_NUMBER (CONTAINER_AT_0 ($2));
9915 node->data_type = dt = CONTAINER_AT_1 ($2);
9916 node->info.attr_def.attr_name = $1;
9917 if (typ == PT_TYPE_CHAR && dt)
9918 node->info.attr_def.size_constraint = dt->info.data_type.precision;
9919 if (typ == PT_TYPE_OBJECT && dt && dt->type_enum == PT_TYPE_VARCHAR)
9921 node->type_enum = dt->type_enum;
9922 PT_NAME_INFO_SET_FLAG (node->info.attr_def.attr_name,
9923 PT_NAME_INFO_EXTERNAL);
9927 parser_save_attr_def_one (node);
9930 opt_constraint_list_and_opt_column_comment
9931 opt_attr_ordering_info
9934 PT_NODE *node = parser_get_attr_def_one ();
9935 if (node != NULL && node->info.attr_def.attr_type != PT_SHARED)
9937 node->info.attr_def.attr_type = parser_attr_type;
9941 node->info.attr_def.ordering_info = $5;
9945 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
9950 opt_attr_ordering_info
9960 PT_NODE *ord = parser_new_node (this_parser, PT_ATTR_ORDERING);
9961 PARSER_SAVE_ERR_CONTEXT (ord, @$.buffer_pos)
9964 ord->info.attr_ordering.first = true;
9965 if (!allow_attribute_ordering)
9967 PT_ERRORmf(this_parser, ord,
9968 MSGCAT_SET_PARSER_SEMANTIC,
9969 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "FIRST");
9979 PT_NODE *ord = parser_new_node (this_parser, PT_ATTR_ORDERING);
9980 PARSER_SAVE_ERR_CONTEXT (ord, @$.buffer_pos)
9983 ord->info.attr_ordering.after = $2;
9984 if (!allow_attribute_ordering)
9986 PT_ERRORmf(this_parser, ord,
9987 MSGCAT_SET_PARSER_SEMANTIC,
9988 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "AFTER column");
9997 opt_constraint_list_and_opt_column_comment
10000 | constraint_list_and_column_comment
10004 constraint_list_and_column_comment
10005 : constraint_list_and_column_comment column_constraint_and_comment_def
10007 unsigned int mask = $1;
10008 unsigned int new_bit = $2;
10009 unsigned int merged = mask | new_bit;
10011 /* Check the constraints according to the following rules:
10012 * 1. A constraint should be specified once.
10013 * 2. Only one of SHARED, DEFAULT or AI can be specified.
10014 * 3. SHARED constraint cannot be defined with UNIQUE or PK constraint.
10016 if (((mask & new_bit) ^ new_bit) == 0)
10018 PT_ERROR (this_parser, pt_top(this_parser),
10019 "Multiple definitions exist for a constraint or comment");
10021 else if ((new_bit & COLUMN_CONSTRAINT_SHARED_DEFAULT_AI)
10022 && ((merged & COLUMN_CONSTRAINT_SHARED_DEFAULT_AI)
10023 ^ (new_bit & COLUMN_CONSTRAINT_SHARED_DEFAULT_AI)) != 0)
10025 PT_ERRORm (this_parser, pt_top(this_parser),
10026 MSGCAT_SET_PARSER_SEMANTIC,
10027 MSGCAT_SEMANTIC_INVALID_AUTO_INCREMENT_ON_DEFAULT_SHARED);
10029 else if ((merged & COLUMN_CONSTRAINT_SHARED)
10030 && ((merged & COLUMN_CONSTRAINT_UNIQUE)
10031 || (merged & COLUMN_CONSTRAINT_PRIMARY_KEY)))
10033 PT_ERROR (this_parser, pt_top(this_parser),
10034 "SHARED cannot be defined with PRIMARY KEY or UNIQUE constraint");
10039 | column_constraint_and_comment_def
10045 column_constraint_and_comment_def
10046 : column_unique_constraint_def
10048 $$ = COLUMN_CONSTRAINT_UNIQUE;
10050 | column_primary_constraint_def
10052 $$ = COLUMN_CONSTRAINT_PRIMARY_KEY;
10054 | column_null_constraint_def
10056 $$ = COLUMN_CONSTRAINT_NULL;
10058 | column_other_constraint_def
10060 $$ = COLUMN_CONSTRAINT_OTHERS;
10062 | column_shared_constraint_def
10064 $$ = COLUMN_CONSTRAINT_SHARED;
10066 | column_default_constraint_def
10068 $$ = COLUMN_CONSTRAINT_DEFAULT;
10070 | column_ai_constraint_def
10072 $$ = COLUMN_CONSTRAINT_AUTO_INCREMENT;
10074 | column_comment_def
10076 $$ = COLUMN_CONSTRAINT_COMMENT;
10078 | column_on_update_def
10080 $$ = COLUMN_CONSTRAINT_ON_UPDATE;
10084 column_unique_constraint_def
10085 : opt_constraint_id UNIQUE opt_key opt_constraint_attr_list
10088 PT_NODE *node = parser_get_attr_def_one ();
10089 PT_NODE *constrant_name = $1;
10090 PT_NODE *constraint = parser_new_node (this_parser, PT_CONSTRAINT);
10094 constraint->info.constraint.type = PT_CONSTRAIN_UNIQUE;
10095 constraint->info.constraint.un.unique.attrs
10096 = parser_copy_tree (this_parser, node->info.attr_def.attr_name);
10098 if (node->info.attr_def.attr_type == PT_SHARED)
10099 constraint->info.constraint.un.unique.attrs->info.name.meta_class
10103 constraint->info.constraint.un.unique.attrs->info.name.meta_class
10104 = parser_attr_type;
10106 constraint->info.constraint.name = $1;
10108 if (TO_NUMBER (CONTAINER_AT_0 ($4)))
10110 constraint->info.constraint.deferrable =
10111 (short)TO_NUMBER (CONTAINER_AT_1 ($4));
10114 if (TO_NUMBER (CONTAINER_AT_2 ($4)))
10116 constraint->info.constraint.initially_deferred =
10117 (short)TO_NUMBER (CONTAINER_AT_3 ($4));
10121 parser_make_link (node, constraint);
10126 column_primary_constraint_def
10127 : opt_constraint_id PRIMARY KEY opt_constraint_attr_list
10130 PT_NODE *node = parser_get_attr_def_one ();
10131 PT_NODE *constrant_name = $1;
10132 PT_NODE *constraint = parser_new_node (this_parser, PT_CONSTRAINT);
10136 constraint->info.constraint.type = PT_CONSTRAIN_PRIMARY_KEY;
10137 constraint->info.constraint.un.unique.attrs
10138 = parser_copy_tree (this_parser, node->info.attr_def.attr_name);
10140 constraint->info.constraint.name = $1;
10142 if (TO_NUMBER (CONTAINER_AT_0 ($4)))
10144 constraint->info.constraint.deferrable =
10145 (short)TO_NUMBER (CONTAINER_AT_1 ($4));
10148 if (TO_NUMBER (CONTAINER_AT_2 ($4)))
10150 constraint->info.constraint.initially_deferred =
10151 (short)TO_NUMBER (CONTAINER_AT_3 ($4));
10155 parser_make_link (node, constraint);
10160 column_null_constraint_def
10161 : opt_constraint_id Null opt_constraint_attr_list
10164 PT_NODE *node = parser_get_attr_def_one ();
10165 PT_NODE *constrant_name = $1;
10166 PT_NODE *constraint = parser_new_node (this_parser, PT_CONSTRAINT);
10168 /* to support null in ODBC-DDL, ignore it */
10171 constraint->info.constraint.type = PT_CONSTRAIN_NULL;
10172 constraint->info.constraint.name = $1;
10174 if (TO_NUMBER (CONTAINER_AT_0 ($3)))
10176 constraint->info.constraint.deferrable =
10177 (short)TO_NUMBER (CONTAINER_AT_1 ($3));
10180 if (TO_NUMBER (CONTAINER_AT_2 ($3)))
10182 constraint->info.constraint.initially_deferred =
10183 (short)TO_NUMBER (CONTAINER_AT_3 ($3));
10187 parser_make_link (node, constraint);
10190 | opt_constraint_id NOT Null opt_constraint_attr_list
10193 PT_NODE *node = parser_get_attr_def_one ();
10194 PT_NODE *constrant_name = $1;
10195 PT_NODE *constraint = parser_new_node (this_parser, PT_CONSTRAINT);
10200 constraint->info.constraint.type = PT_CONSTRAIN_NOT_NULL;
10201 constraint->info.constraint.un.not_null.attr
10202 = parser_copy_tree (this_parser, node->info.attr_def.attr_name);
10204 * This should probably be deferred until semantic
10205 * analysis time; leave it this way for now.
10207 node->info.attr_def.constrain_not_null = 1;
10209 constraint->info.constraint.name = $1;
10211 if (TO_NUMBER (CONTAINER_AT_0 ($4)))
10213 constraint->info.constraint.deferrable =
10214 (short)TO_NUMBER (CONTAINER_AT_1 ($4));
10217 if (TO_NUMBER (CONTAINER_AT_2 ($4)))
10219 constraint->info.constraint.initially_deferred =
10220 (short)TO_NUMBER (CONTAINER_AT_3 ($4));
10224 parser_make_link (node, constraint);
10229 column_other_constraint_def
10230 : opt_constraint_id CHECK '(' search_condition ')' opt_constraint_attr_list
10233 PT_NODE *node = parser_get_attr_def_one ();
10234 PT_NODE *constrant_name = $1;
10235 PT_NODE *constraint = parser_new_node (this_parser, PT_CONSTRAINT);
10239 constraint->info.constraint.type = PT_CONSTRAIN_CHECK;
10240 constraint->info.constraint.un.check.expr = $4;
10242 constraint->info.constraint.name = $1;
10244 if (TO_NUMBER (CONTAINER_AT_0 ($6)))
10246 constraint->info.constraint.deferrable =
10247 (short)TO_NUMBER (CONTAINER_AT_1 ($6));
10250 if (TO_NUMBER (CONTAINER_AT_2 ($6)))
10252 constraint->info.constraint.initially_deferred =
10253 (short)TO_NUMBER (CONTAINER_AT_3 ($6));
10257 parser_make_link (node, constraint);
10260 | opt_constraint_id /* 1 */
10261 opt_foreign_key /* 2 */
10264 opt_paren_attr_list /* 5 */
10265 opt_ref_rule_list /* 6 */
10266 opt_constraint_attr_list /* 7 */
10269 PT_NODE *node = parser_get_attr_def_one ();
10270 PT_NODE *constrant_name = $1;
10271 PT_NODE *constraint = parser_new_node (this_parser, PT_CONSTRAINT);
10275 constraint->info.constraint.un.foreign_key.referenced_attrs = $5;
10276 constraint->info.constraint.un.foreign_key.match_type = PT_MATCH_REGULAR;
10277 constraint->info.constraint.un.foreign_key.delete_action = TO_NUMBER (CONTAINER_AT_0 ($6)); /* delete_action */
10278 constraint->info.constraint.un.foreign_key.update_action = TO_NUMBER (CONTAINER_AT_1 ($6)); /* update_action */
10279 constraint->info.constraint.un.foreign_key.referenced_class = $4;
10284 constraint->info.constraint.type = PT_CONSTRAIN_FOREIGN_KEY;
10285 constraint->info.constraint.un.foreign_key.attrs
10286 = parser_copy_tree (this_parser, node->info.attr_def.attr_name);
10288 constraint->info.constraint.name = $1;
10290 if (TO_NUMBER (CONTAINER_AT_0 ($7)))
10292 constraint->info.constraint.deferrable =
10293 (short)TO_NUMBER (CONTAINER_AT_1 ($7));
10296 if (TO_NUMBER (CONTAINER_AT_2 ($7)))
10298 constraint->info.constraint.initially_deferred =
10299 (short)TO_NUMBER (CONTAINER_AT_3 ($7));
10303 parser_make_link (node, constraint);
10329 column_ai_constraint_def
10330 : AUTO_INCREMENT '(' integer_text ',' integer_text ')'
10333 PT_NODE *node = parser_get_attr_def_one ();
10334 PT_NODE *start_val = parser_new_node (this_parser, PT_VALUE);
10335 PT_NODE *increment_val = parser_new_node (this_parser, PT_VALUE);
10340 start_val->info.value.data_value.str =
10341 pt_append_bytes (this_parser, NULL, $3,
10343 start_val->type_enum = PT_TYPE_NUMERIC;
10344 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser,
10350 increment_val->info.value.data_value.str =
10351 pt_append_bytes (this_parser, NULL, $5,
10353 increment_val->type_enum = PT_TYPE_NUMERIC;
10354 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser,
10358 ai_node = parser_new_node (this_parser, PT_AUTO_INCREMENT);
10359 ai_node->info.auto_increment.start_val = start_val;
10360 ai_node->info.auto_increment.increment_val = increment_val;
10361 node->info.attr_def.auto_increment = ai_node;
10363 if (parser_attr_type == PT_META_ATTR)
10365 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
10366 MSGCAT_SEMANTIC_CLASS_ATT_CANT_BE_AUTOINC);
10373 PT_NODE *node = parser_get_attr_def_one ();
10375 PT_NODE *ai_node = parser_new_node (this_parser, PT_AUTO_INCREMENT);
10376 ai_node->info.auto_increment.start_val = NULL;
10377 ai_node->info.auto_increment.increment_val = NULL;
10378 node->info.attr_def.auto_increment = ai_node;
10380 if (parser_attr_type == PT_META_ATTR)
10382 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
10383 MSGCAT_SEMANTIC_CLASS_ATT_CANT_BE_AUTOINC);
10389 column_shared_constraint_def
10390 : SHARED expression_
10392 PT_NODE *attr_node;
10393 PT_NODE *node = parser_new_node (this_parser, PT_DATA_DEFAULT);
10397 node->info.data_default.default_value = $2;
10398 node->info.data_default.shared = PT_SHARED;
10399 PARSER_SAVE_ERR_CONTEXT (node, @2.buffer_pos)
10402 attr_node = parser_get_attr_def_one ();
10403 attr_node->info.attr_def.data_default = node;
10404 attr_node->info.attr_def.attr_type = PT_SHARED;
10409 column_on_update_def
10410 : ON_ UPDATE expression_
10412 DB_DEFAULT_EXPR_TYPE default_expr_type = DB_DEFAULT_NONE;
10413 PT_NODE *attr_node = parser_get_attr_def_one ();
10414 PT_NODE *on_update_default_value = $3;
10415 PARSER_SAVE_ERR_CONTEXT (attr_node, @3.buffer_pos)
10417 if (on_update_default_value && on_update_default_value->node_type == PT_EXPR)
10419 switch (on_update_default_value->info.expr.op)
10421 case PT_CURRENT_TIMESTAMP:
10422 default_expr_type = DB_DEFAULT_CURRENTTIMESTAMP;
10424 case PT_CURRENT_DATE:
10425 default_expr_type = DB_DEFAULT_CURRENTDATE;
10427 case PT_CURRENT_DATETIME:
10428 default_expr_type = DB_DEFAULT_CURRENTDATETIME;
10430 case PT_SYS_TIMESTAMP:
10431 default_expr_type = DB_DEFAULT_SYSTIMESTAMP;
10433 case PT_UNIX_TIMESTAMP:
10434 default_expr_type = DB_DEFAULT_UNIX_TIMESTAMP;
10437 default_expr_type = DB_DEFAULT_SYSDATE;
10439 case PT_SYS_DATETIME:
10440 default_expr_type = DB_DEFAULT_SYSDATETIME;
10443 default_expr_type = DB_DEFAULT_SYSTIME;
10446 PT_ERROR (this_parser, attr_node, "invalid expression type");
10452 PT_ERROR (this_parser, attr_node, "on update must be an expression");
10455 attr_node->info.attr_def.on_update = default_expr_type;
10460 column_default_constraint_def
10461 : DEFAULT expression_
10464 PT_NODE *attr_node;
10465 PT_NODE *node = parser_new_node (this_parser, PT_DATA_DEFAULT);
10470 node->info.data_default.default_value = $2;
10471 node->info.data_default.shared = PT_DEFAULT;
10472 PARSER_SAVE_ERR_CONTEXT (node, @2.buffer_pos)
10474 def = node->info.data_default.default_value;
10475 if (def && def->node_type == PT_EXPR)
10477 if (def->info.expr.op == PT_TO_CHAR)
10479 if (def->info.expr.arg3)
10481 bool has_user_lang = false;
10484 assert (def->info.expr.arg3->node_type == PT_VALUE);
10485 (void) lang_get_lang_id_from_flag (def->info.expr.arg3->info.value.data_value.i, &dummy, &has_user_lang);
10488 PT_ERROR (this_parser, def->info.expr.arg3, "do not allow lang format in default to_char");
10492 if (def->info.expr.arg1 && def->info.expr.arg1->node_type == PT_EXPR)
10494 def = def->info.expr.arg1;
10498 switch (def->info.expr.op)
10501 node->info.data_default.default_expr_type = DB_DEFAULT_SYSTIME;
10504 node->info.data_default.default_expr_type = DB_DEFAULT_SYSDATE;
10506 case PT_SYS_DATETIME:
10507 node->info.data_default.default_expr_type = DB_DEFAULT_SYSDATETIME;
10509 case PT_SYS_TIMESTAMP:
10510 node->info.data_default.default_expr_type = DB_DEFAULT_SYSTIMESTAMP;
10512 case PT_CURRENT_TIME:
10513 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTTIME;
10515 case PT_CURRENT_DATE:
10516 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTDATE;
10518 case PT_CURRENT_DATETIME:
10519 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTDATETIME;
10521 case PT_CURRENT_TIMESTAMP:
10522 node->info.data_default.default_expr_type = DB_DEFAULT_CURRENTTIMESTAMP;
10525 node->info.data_default.default_expr_type = DB_DEFAULT_USER;
10527 case PT_CURRENT_USER:
10528 node->info.data_default.default_expr_type = DB_DEFAULT_CURR_USER;
10530 case PT_UNIX_TIMESTAMP:
10531 node->info.data_default.default_expr_type = DB_DEFAULT_UNIX_TIMESTAMP;
10534 node->info.data_default.default_expr_type = DB_DEFAULT_NONE;
10540 node->info.data_default.default_expr_type = DB_DEFAULT_NONE;
10544 attr_node = parser_get_attr_def_one ();
10545 attr_node->info.attr_def.data_default = node;
10550 attr_def_comment_list
10551 : attr_def_comment_list ',' attr_def_comment
10554 $$ = parser_make_link ($1, $3);
10555 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos);
10562 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos);
10568 : identifier opt_equalsign comment_value
10571 PT_NODE *attr_node = parser_new_node (this_parser, PT_ATTR_DEF);
10575 attr_node->info.attr_def.attr_name = $1;
10576 attr_node->info.attr_def.comment = $3;
10577 attr_node->info.attr_def.attr_type = parser_attr_type;
10581 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos);
10587 : COMMENT comment_value
10590 PT_NODE *attr_node;
10591 attr_node = parser_get_attr_def_one ();
10592 attr_node->info.attr_def.comment = $2;
10597 transaction_mode_list
10598 : transaction_mode_list ',' transaction_mode %dprec 1
10601 $$ = parser_make_link ($1, $3);
10602 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10605 | transaction_mode %dprec 2
10609 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10615 : ISOLATION LEVEL isolation_level_spec ',' isolation_level_spec %dprec 1
10618 PT_NODE *tm = parser_new_node (this_parser, PT_ISOLATION_LVL);
10619 PT_NODE *is = parser_new_node (this_parser, PT_ISOLATION_LVL);
10620 int async_ws_or_error;
10624 PARSER_SAVE_ERR_CONTEXT (tm, @$.buffer_pos)
10625 async_ws_or_error = (int) TO_NUMBER (CONTAINER_AT_3 ($3));
10626 if (async_ws_or_error < 0)
10628 PT_ERRORm(this_parser, tm, MSGCAT_SET_PARSER_SYNTAX,
10629 MSGCAT_SYNTAX_READ_UNCOMMIT);
10630 async_ws_or_error = 0;
10632 tm->info.isolation_lvl.level = CONTAINER_AT_0 ($3);
10633 tm->info.isolation_lvl.schema = TO_NUMBER (CONTAINER_AT_1 ($3));
10634 tm->info.isolation_lvl.instances = TO_NUMBER (CONTAINER_AT_2 ($3));
10635 tm->info.isolation_lvl.async_ws = async_ws_or_error;
10638 async_ws_or_error = (int) TO_NUMBER (CONTAINER_AT_3 ($5));
10639 if (async_ws_or_error < 0)
10641 PT_ERRORm(this_parser, is, MSGCAT_SET_PARSER_SYNTAX,
10642 MSGCAT_SYNTAX_READ_UNCOMMIT);
10643 async_ws_or_error = 0;
10645 is->info.isolation_lvl.level = CONTAINER_AT_0 ($5);
10646 is->info.isolation_lvl.schema = TO_NUMBER (CONTAINER_AT_1 ($5));
10647 is->info.isolation_lvl.instances = TO_NUMBER (CONTAINER_AT_2 ($5));
10648 is->info.isolation_lvl.async_ws = async_ws_or_error;
10650 if (tm->info.isolation_lvl.async_ws)
10652 if (is->info.isolation_lvl.async_ws)
10654 /* async_ws, async_ws */
10658 /* async_ws, iso_lvl */
10659 tm->info.isolation_lvl.schema = is->info.isolation_lvl.schema;
10660 tm->info.isolation_lvl.instances =
10661 is->info.isolation_lvl.instances;
10662 tm->info.isolation_lvl.level = is->info.isolation_lvl.level;
10667 if (is->info.isolation_lvl.async_ws)
10669 /* iso_lvl, async_ws */
10670 tm->info.isolation_lvl.async_ws = 1;
10674 /* iso_lvl, iso_lvl */
10675 if (tm->info.isolation_lvl.level != NULL
10676 || is->info.isolation_lvl.level != NULL)
10677 PT_ERRORm (this_parser, tm, MSGCAT_SET_PARSER_SEMANTIC,
10678 MSGCAT_SEMANTIC_GT_1_ISOLATION_LVL);
10679 else if (tm->info.isolation_lvl.schema !=
10680 is->info.isolation_lvl.schema
10681 || tm->info.isolation_lvl.instances !=
10682 is->info.isolation_lvl.instances)
10683 PT_ERRORm (this_parser, tm, MSGCAT_SET_PARSER_SEMANTIC,
10684 MSGCAT_SEMANTIC_GT_1_ISOLATION_LVL);
10688 is->info.isolation_lvl.level = NULL;
10689 parser_free_node (this_parser, is);
10695 | ISOLATION LEVEL isolation_level_spec %dprec 2
10698 PT_NODE *tm = parser_new_node (this_parser, PT_ISOLATION_LVL);
10699 int async_ws_or_error = (int) TO_NUMBER (CONTAINER_AT_3 ($3));
10701 PARSER_SAVE_ERR_CONTEXT (tm, @$.buffer_pos)
10703 if (async_ws_or_error < 0)
10705 PT_ERRORm(this_parser, tm, MSGCAT_SET_PARSER_SYNTAX,
10706 MSGCAT_SYNTAX_READ_UNCOMMIT);
10707 async_ws_or_error = 0;
10712 tm->info.isolation_lvl.level = CONTAINER_AT_0 ($3);
10713 tm->info.isolation_lvl.schema = TO_NUMBER (CONTAINER_AT_1 ($3));
10714 tm->info.isolation_lvl.instances = TO_NUMBER (CONTAINER_AT_2 ($3));
10715 tm->info.isolation_lvl.async_ws = async_ws_or_error;
10721 | LOCK_ TIMEOUT timeout_spec
10724 PT_NODE *tm = parser_new_node (this_parser, PT_TIMEOUT);
10728 tm->info.timeout.val = $3;
10732 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10738 /* container order : level, schema, instances, async_ws */
10739 isolation_level_spec
10744 SET_CONTAINER_4 (ctn, $1, FROM_NUMBER (PT_NO_ISOLATION_LEVEL),
10745 FROM_NUMBER (PT_NO_ISOLATION_LEVEL), FROM_NUMBER (0));
10753 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (PT_NO_ISOLATION_LEVEL),
10754 FROM_NUMBER (PT_NO_ISOLATION_LEVEL), FROM_NUMBER (1));
10762 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (PT_SERIALIZABLE),
10763 FROM_NUMBER (PT_SERIALIZABLE), FROM_NUMBER (0));
10771 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (PT_NO_ISOLATION_LEVEL),
10772 FROM_NUMBER (PT_READ_COMMITTED), FROM_NUMBER (0));
10776 | isolation_level_name %dprec 1
10780 PT_MISC_TYPE schema = PT_REPEATABLE_READ;
10781 PT_MISC_TYPE level = 0;
10784 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (schema),
10785 FROM_NUMBER (level), FROM_NUMBER (0));
10789 | isolation_level_name of_schema_class %dprec 1
10793 PT_MISC_TYPE schema = 0;
10794 PT_MISC_TYPE level = 0;
10799 level = PT_NO_ISOLATION_LEVEL;
10801 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (schema), FROM_NUMBER (level),
10802 FROM_NUMBER (error));
10806 | isolation_level_name INSTANCES %dprec 1
10810 PT_MISC_TYPE schema = 0;
10811 PT_MISC_TYPE level = 0;
10813 schema = PT_NO_ISOLATION_LEVEL;
10816 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (schema), FROM_NUMBER (level),
10821 | isolation_level_name of_schema_class ',' isolation_level_name INSTANCES %dprec 10
10825 PT_MISC_TYPE schema = 0;
10826 PT_MISC_TYPE level = 0;
10832 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (schema), FROM_NUMBER (level),
10833 FROM_NUMBER (error));
10837 | isolation_level_name INSTANCES ',' isolation_level_name of_schema_class %dprec 10
10840 PT_MISC_TYPE schema = 0;
10841 PT_MISC_TYPE level = 0;
10847 SET_CONTAINER_4 (ctn, NULL, FROM_NUMBER (schema), FROM_NUMBER (level),
10848 FROM_NUMBER (error));
10859 isolation_level_name
10863 $$ = PT_REPEATABLE_READ;
10869 $$ = PT_READ_COMMITTED;
10878 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
10882 val->type_enum = PT_TYPE_INTEGER;
10883 val->info.value.data_value.i = -1;
10887 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10893 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
10897 val->type_enum = PT_TYPE_INTEGER;
10898 val->info.value.data_value.i = 0;
10902 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10909 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10916 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10923 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10930 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10937 : COMMIT opt_work RETAIN LOCK_
10940 PT_NODE *comm = parser_new_node (this_parser, PT_COMMIT_WORK);
10944 comm->info.commit_work.retain_lock = 1;
10948 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10954 PT_NODE *comm = parser_new_node (this_parser, PT_COMMIT_WORK);
10956 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10959 | ROLLBACK opt_work TO opt_savepoint expression_
10962 PT_NODE *roll = parser_new_node (this_parser, PT_ROLLBACK_WORK);
10966 roll->info.rollback_work.save_name = $5;
10970 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10973 | ROLLBACK opt_work
10976 PT_NODE *roll = parser_new_node (this_parser, PT_ROLLBACK_WORK);
10978 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
10981 | SAVEPOINT expression_
10984 PT_NODE *svpt = parser_new_node (this_parser, PT_SAVEPOINT);
10988 svpt->info.savepoint.save_name = $2;
10992 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11014 : EVALUATE expression_ into_clause_opt
11017 PT_NODE *node = parser_new_node (this_parser, PT_EVALUATE);
11021 node->info.evaluate.expression = $2;
11022 node->info.evaluate.into_var = $3;
11026 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11032 : PREPARE identifier FROM char_string
11035 PT_NODE *node = parser_new_node (this_parser, PT_PREPARE_STATEMENT);
11039 node->info.prepare.name = $2;
11040 node->info.prepare.statement = $4;
11044 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11050 : EXECUTE identifier opt_using
11053 PT_NODE *node = parser_new_node (this_parser, PT_EXECUTE_PREPARE);
11057 node->info.execute.name = $2;
11058 node->info.execute.using_list = $3;
11059 node->info.execute.into_list = NULL;
11060 node->info.execute.query = NULL;
11064 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11077 { parser_save_and_set_hvar (0); }
11079 { parser_restore_hvar (); }
11083 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11092 $$ = PT_MISC_DUMMY;
11129 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11135 : PRIORITY unsigned_real
11139 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11144 opt_if_trigger_condition
11151 | IF trigger_condition
11155 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11181 opt_trigger_action_time
11185 $$ = PT_MISC_DUMMY;
11206 PT_NODE *node = parser_new_node (this_parser, PT_EVENT_SPEC);
11210 node->info.event_spec.event_type = $1;
11214 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11217 | event_type event_target
11220 PT_NODE *node = parser_new_node (this_parser, PT_EVENT_SPEC);
11224 node->info.event_spec.event_type = $1;
11225 node->info.event_spec.event_target = $2;
11229 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11244 $$ = PT_EV_STMT_INSERT;
11253 | STATEMENT DELETE_
11256 $$ = PT_EV_STMT_DELETE;
11268 $$ = PT_EV_STMT_UPDATE;
11280 $$ = PT_EV_ROLLBACK;
11286 : ON_ identifier '(' identifier ')'
11289 PT_NODE *node = parser_new_node (this_parser, PT_EVENT_TARGET);
11293 node->info.event_target.class_name = $2;
11294 node->info.event_target.attribute = $4;
11298 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11304 PT_NODE *node = parser_new_node (this_parser, PT_EVENT_TARGET);
11308 node->info.event_target.class_name = $2;
11312 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11322 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11329 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11338 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11342 node->info.trigger_action.action_type = PT_REJECT;
11346 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11349 | INVALIDATE TRANSACTION
11352 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11356 node->info.trigger_action.action_type = PT_INVALIDATE_XACTION;
11360 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11363 | PRINT char_string_literal
11366 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11370 node->info.trigger_action.action_type = PT_PRINT;
11371 node->info.trigger_action.string = $2;
11375 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11381 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11385 node->info.trigger_action.action_type = PT_EXPRESSION;
11386 node->info.trigger_action.expression = $1;
11390 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11393 | insert_or_replace_stmt
11396 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11400 node->info.trigger_action.action_type = PT_EXPRESSION;
11401 node->info.trigger_action.expression = $1;
11405 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11411 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11415 node->info.trigger_action.action_type = PT_EXPRESSION;
11416 node->info.trigger_action.expression = $1;
11420 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11426 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11430 node->info.trigger_action.action_type = PT_EXPRESSION;
11431 node->info.trigger_action.expression = $1;
11435 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11441 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11445 node->info.trigger_action.action_type = PT_EXPRESSION;
11446 node->info.trigger_action.expression = $1;
11450 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11456 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_ACTION);
11460 node->info.trigger_action.action_type = PT_EXPRESSION;
11461 node->info.trigger_action.expression = $1;
11465 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11474 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_SPEC_LIST);
11478 node->info.trigger_spec_list.trigger_name_list = $1;
11482 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11488 PT_NODE *node = parser_new_node (this_parser, PT_TRIGGER_SPEC_LIST);
11492 node->info.trigger_spec_list.all_triggers = 1;
11496 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11501 trigger_status_or_priority_or_change_owner
11506 SET_CONTAINER_3 (ctn, FROM_NUMBER ($1), NULL, NULL);
11514 SET_CONTAINER_3 (ctn, FROM_NUMBER (PT_MISC_DUMMY), $1, NULL);
11518 | OWNER TO identifier
11522 SET_CONTAINER_3 (ctn, FROM_NUMBER (PT_MISC_DUMMY), NULL, $3);
11537 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
11541 node->info.value.data_value.i = -1;
11542 node->type_enum = PT_TYPE_INTEGER;
11546 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11552 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
11556 node->info.value.data_value.i = 0;
11557 node->type_enum = PT_TYPE_INTEGER;
11561 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11568 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11575 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11582 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11592 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11599 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11606 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11612 : START_ WITH integer_text
11615 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
11618 node->info.value.data_value.str =
11619 pt_append_bytes (this_parser, NULL, $3,
11621 node->type_enum = PT_TYPE_NUMERIC;
11622 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
11626 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11632 : INCREMENT BY integer_text
11635 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
11638 node->info.value.data_value.str =
11639 pt_append_bytes (this_parser, NULL, $3,
11641 node->type_enum = PT_TYPE_NUMERIC;
11642 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
11646 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11653 : MINVALUE integer_text
11657 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
11660 node->info.value.data_value.str =
11661 pt_append_bytes (this_parser, NULL, $2,
11663 node->type_enum = PT_TYPE_NUMERIC;
11664 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
11667 SET_CONTAINER_2 (ctn, node, FROM_NUMBER (0));
11675 SET_CONTAINER_2 (ctn, NULL, FROM_NUMBER (1));
11682 : MAXVALUE integer_text
11686 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
11689 node->info.value.data_value.str =
11690 pt_append_bytes (this_parser, NULL, $2,
11692 node->type_enum = PT_TYPE_NUMERIC;
11693 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
11696 SET_CONTAINER_2 (ctn, node, FROM_NUMBER (0));
11704 SET_CONTAINER_2 (ctn, NULL, FROM_NUMBER (1));
11715 SET_CONTAINER_2 (ctn, FROM_NUMBER (1), FROM_NUMBER (0));
11723 SET_CONTAINER_2 (ctn, FROM_NUMBER (0), FROM_NUMBER (1));
11730 : CACHE unsigned_int32
11734 SET_CONTAINER_2 (ctn, $2, FROM_NUMBER (0));
11741 SET_CONTAINER_2 (ctn, NULL, FROM_NUMBER (1));
11748 : opt_plus UNSIGNED_INTEGER
11754 | '-' UNSIGNED_INTEGER
11757 $$ = pt_append_string (this_parser, (char *) "-", $2);
11776 opt_of_data_type_cursor
11786 $$ = (int) TO_NUMBER (CONTAINER_AT_0 ($1));
11792 $$ = PT_TYPE_RESULTSET;
11814 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11820 : sp_param_list ',' sp_param_def
11823 $$ = parser_make_link ($1, $3);
11824 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11831 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11843 PT_NODE *node = parser_new_node (this_parser, PT_SP_PARAMETERS);
11847 node->type_enum = TO_NUMBER (CONTAINER_AT_0 ($3));
11848 node->data_type = CONTAINER_AT_1 ($3);
11849 node->info.sp_param.name = $1;
11850 node->info.sp_param.mode = $2;
11851 node->info.sp_param.comment = $4;
11855 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11864 PT_NODE *node = parser_new_node (this_parser, PT_SP_PARAMETERS);
11868 node->type_enum = PT_TYPE_RESULTSET;
11869 node->data_type = NULL;
11870 node->info.sp_param.name = $1;
11871 node->info.sp_param.mode = $2;
11872 node->info.sp_param.comment = $4;
11876 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11891 $$ = PT_INPUTOUTPUT;
11897 : { parser_select_level++; }
11898 csql_query_select_has_no_with_clause
11901 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11902 parser_select_level--;
11911 parser_save_and_set_cannot_cache (false);
11912 parser_save_and_set_ic (0);
11913 parser_save_and_set_gc (0);
11914 parser_save_and_set_oc (0);
11915 parser_save_and_set_wjc (0);
11916 parser_save_and_set_sysc (0);
11917 parser_save_and_set_prc (0);
11918 parser_save_and_set_cbrc (0);
11919 parser_save_and_set_serc (1);
11920 parser_save_and_set_sqc (1);
11921 parser_save_and_set_pseudoc (1);
11924 select_expression_opt_with
11927 PT_NODE *node = $2;
11928 parser_push_orderby_node (node);
11934 PT_NODE *node = parser_pop_orderby_node ();
11936 if (node && parser_cannot_cache)
11938 node->info.query.flag.reexecute = 1;
11939 node->info.query.flag.do_cache = 0;
11940 node->info.query.flag.do_not_cache = 1;
11943 parser_restore_cannot_cache ();
11944 parser_restore_ic ();
11945 parser_restore_gc ();
11946 parser_restore_oc ();
11947 parser_restore_wjc ();
11948 parser_restore_sysc ();
11949 parser_restore_prc ();
11950 parser_restore_cbrc ();
11951 parser_restore_serc ();
11952 parser_restore_sqc ();
11953 parser_restore_pseudoc ();
11955 if (parser_subquery_check == 0)
11956 PT_ERRORmf(this_parser, pt_top(this_parser),
11957 MSGCAT_SET_PARSER_SEMANTIC,
11958 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
11962 /* handle ORDER BY NULL */
11963 PT_NODE *order = node->info.query.order_by;
11964 if (order && order->info.sort_spec.expr
11965 && order->info.sort_spec.expr->node_type == PT_VALUE
11966 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
11968 if (!node->info.query.q.select.group_by)
11970 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
11971 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
11975 parser_free_tree (this_parser, node->info.query.order_by);
11976 node->info.query.order_by = NULL;
11981 parser_push_orderby_node (node);
11984 opt_select_limit_clause
11985 opt_for_update_clause
11988 PT_NODE *node = parser_pop_orderby_node ();
11990 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
11995 csql_query_select_has_no_with_clause
11999 parser_save_and_set_cannot_cache (false);
12000 parser_save_and_set_ic (0);
12001 parser_save_and_set_gc (0);
12002 parser_save_and_set_oc (0);
12003 parser_save_and_set_wjc (0);
12004 parser_save_and_set_sysc (0);
12005 parser_save_and_set_prc (0);
12006 parser_save_and_set_cbrc (0);
12007 parser_save_and_set_serc (1);
12008 parser_save_and_set_sqc (1);
12009 parser_save_and_set_pseudoc (1);
12015 PT_NODE *node = $2;
12016 parser_push_orderby_node (node);
12022 PT_NODE *node = parser_pop_orderby_node ();
12024 if (node && parser_cannot_cache)
12026 node->info.query.flag.reexecute = 1;
12027 node->info.query.flag.do_cache = 0;
12028 node->info.query.flag.do_not_cache = 1;
12031 parser_restore_cannot_cache ();
12032 parser_restore_ic ();
12033 parser_restore_gc ();
12034 parser_restore_oc ();
12035 parser_restore_wjc ();
12036 parser_restore_sysc ();
12037 parser_restore_prc ();
12038 parser_restore_cbrc ();
12039 parser_restore_serc ();
12040 parser_restore_sqc ();
12041 parser_restore_pseudoc ();
12043 if (parser_subquery_check == 0)
12044 PT_ERRORmf(this_parser, pt_top(this_parser),
12045 MSGCAT_SET_PARSER_SEMANTIC,
12046 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12050 /* handle ORDER BY NULL */
12051 PT_NODE *order = node->info.query.order_by;
12052 if (order && order->info.sort_spec.expr
12053 && order->info.sort_spec.expr->node_type == PT_VALUE
12054 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12056 if (!node->info.query.q.select.group_by)
12058 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12059 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12063 parser_free_tree (this_parser, node->info.query.order_by);
12064 node->info.query.order_by = NULL;
12069 parser_push_orderby_node (node);
12072 opt_select_limit_clause
12073 opt_for_update_clause
12076 PT_NODE *node = parser_pop_orderby_node ();
12078 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12083 csql_query_without_subquery_and_with_clause
12087 parser_save_and_set_cannot_cache (false);
12088 parser_save_and_set_ic (0);
12089 parser_save_and_set_gc (0);
12090 parser_save_and_set_oc (0);
12091 parser_save_and_set_wjc (0);
12092 parser_save_and_set_sysc (0);
12093 parser_save_and_set_prc (0);
12094 parser_save_and_set_cbrc (0);
12095 parser_save_and_set_serc (1);
12096 parser_save_and_set_sqc (1);
12097 parser_save_and_set_pseudoc (1);
12100 select_expression_without_subquery
12103 PT_NODE *node = $2;
12104 parser_push_orderby_node (node);
12110 PT_NODE *node = parser_pop_orderby_node ();
12112 if (node && parser_cannot_cache)
12114 node->info.query.flag.reexecute = 1;
12115 node->info.query.flag.do_cache = 0;
12116 node->info.query.flag.do_not_cache = 1;
12119 parser_restore_cannot_cache ();
12120 parser_restore_ic ();
12121 parser_restore_gc ();
12122 parser_restore_oc ();
12123 parser_restore_wjc ();
12124 parser_restore_sysc ();
12125 parser_restore_prc ();
12126 parser_restore_cbrc ();
12127 parser_restore_serc ();
12128 parser_restore_sqc ();
12129 parser_restore_pseudoc ();
12131 if (parser_subquery_check == 0)
12132 PT_ERRORmf(this_parser, pt_top(this_parser),
12133 MSGCAT_SET_PARSER_SEMANTIC,
12134 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12138 /* handle ORDER BY NULL */
12139 PT_NODE *order = node->info.query.order_by;
12140 if (order && order->info.sort_spec.expr
12141 && order->info.sort_spec.expr->node_type == PT_VALUE
12142 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12144 if (!node->info.query.q.select.group_by)
12146 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12147 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12151 parser_free_tree (this_parser, node->info.query.order_by);
12152 node->info.query.order_by = NULL;
12157 parser_push_orderby_node (node);
12160 opt_select_limit_clause
12161 opt_for_update_clause
12164 PT_NODE *node = parser_pop_orderby_node ();
12166 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12171 csql_query_without_values_query
12175 parser_save_and_set_cannot_cache (false);
12176 parser_save_and_set_ic (0);
12177 parser_save_and_set_gc (0);
12178 parser_save_and_set_oc (0);
12179 parser_save_and_set_wjc (0);
12180 parser_save_and_set_sysc (0);
12181 parser_save_and_set_prc (0);
12182 parser_save_and_set_cbrc (0);
12183 parser_save_and_set_serc (1);
12184 parser_save_and_set_sqc (1);
12185 parser_save_and_set_pseudoc (1);
12188 select_expression_without_values_query
12191 PT_NODE *node = $2;
12192 parser_push_orderby_node (node);
12198 PT_NODE *node = parser_pop_orderby_node ();
12200 if (node && parser_cannot_cache)
12202 node->info.query.flag.reexecute = 1;
12203 node->info.query.flag.do_cache = 0;
12204 node->info.query.flag.do_not_cache = 1;
12207 parser_restore_cannot_cache ();
12208 parser_restore_ic ();
12209 parser_restore_gc ();
12210 parser_restore_oc ();
12211 parser_restore_wjc ();
12212 parser_restore_sysc ();
12213 parser_restore_prc ();
12214 parser_restore_cbrc ();
12215 parser_restore_serc ();
12216 parser_restore_sqc ();
12217 parser_restore_pseudoc ();
12219 if (parser_subquery_check == 0)
12220 PT_ERRORmf(this_parser, pt_top(this_parser),
12221 MSGCAT_SET_PARSER_SEMANTIC,
12222 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12226 /* handle ORDER BY NULL */
12227 PT_NODE *order = node->info.query.order_by;
12228 if (order && order->info.sort_spec.expr
12229 && order->info.sort_spec.expr->node_type == PT_VALUE
12230 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12232 if (!node->info.query.q.select.group_by)
12234 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12235 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12239 parser_free_tree (this_parser, node->info.query.order_by);
12240 node->info.query.order_by = NULL;
12245 parser_push_orderby_node (node);
12248 opt_select_limit_clause
12249 opt_for_update_clause
12252 PT_NODE *node = parser_pop_orderby_node ();
12254 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12259 csql_query_without_values_query_no_with_clause
12263 parser_save_and_set_cannot_cache (false);
12264 parser_save_and_set_ic (0);
12265 parser_save_and_set_gc (0);
12266 parser_save_and_set_oc (0);
12267 parser_save_and_set_wjc (0);
12268 parser_save_and_set_sysc (0);
12269 parser_save_and_set_prc (0);
12270 parser_save_and_set_cbrc (0);
12271 parser_save_and_set_serc (1);
12272 parser_save_and_set_sqc (1);
12273 parser_save_and_set_pseudoc (1);
12276 select_expression_without_values_query_no_with_clause
12279 PT_NODE *node = $2;
12280 parser_push_orderby_node (node);
12286 PT_NODE *node = parser_pop_orderby_node ();
12288 if (node && parser_cannot_cache)
12290 node->info.query.flag.reexecute = 1;
12291 node->info.query.flag.do_cache = 0;
12292 node->info.query.flag.do_not_cache = 1;
12295 parser_restore_cannot_cache ();
12296 parser_restore_ic ();
12297 parser_restore_gc ();
12298 parser_restore_oc ();
12299 parser_restore_wjc ();
12300 parser_restore_sysc ();
12301 parser_restore_prc ();
12302 parser_restore_cbrc ();
12303 parser_restore_serc ();
12304 parser_restore_sqc ();
12305 parser_restore_pseudoc ();
12307 if (parser_subquery_check == 0)
12308 PT_ERRORmf(this_parser, pt_top(this_parser),
12309 MSGCAT_SET_PARSER_SEMANTIC,
12310 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12314 /* handle ORDER BY NULL */
12315 PT_NODE *order = node->info.query.order_by;
12316 if (order && order->info.sort_spec.expr
12317 && order->info.sort_spec.expr->node_type == PT_VALUE
12318 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12320 if (!node->info.query.q.select.group_by)
12322 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12323 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12327 parser_free_tree (this_parser, node->info.query.order_by);
12328 node->info.query.order_by = NULL;
12333 parser_push_orderby_node (node);
12336 opt_select_limit_clause
12337 opt_for_update_clause
12340 PT_NODE *node = parser_pop_orderby_node ();
12342 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12347 csql_query_without_values_and_single_subquery
12351 parser_save_and_set_cannot_cache (false);
12352 parser_save_and_set_ic (0);
12353 parser_save_and_set_gc (0);
12354 parser_save_and_set_oc (0);
12355 parser_save_and_set_wjc (0);
12356 parser_save_and_set_sysc (0);
12357 parser_save_and_set_prc (0);
12358 parser_save_and_set_cbrc (0);
12359 parser_save_and_set_serc (1);
12360 parser_save_and_set_sqc (1);
12361 parser_save_and_set_pseudoc (1);
12364 select_expression_without_values_and_single_subquery
12367 PT_NODE *node = $2;
12368 parser_push_orderby_node (node);
12374 PT_NODE *node = parser_pop_orderby_node ();
12376 if (node && parser_cannot_cache)
12378 node->info.query.flag.reexecute = 1;
12379 node->info.query.flag.do_cache = 0;
12380 node->info.query.flag.do_not_cache = 1;
12383 parser_restore_cannot_cache ();
12384 parser_restore_ic ();
12385 parser_restore_gc ();
12386 parser_restore_oc ();
12387 parser_restore_wjc ();
12388 parser_restore_sysc ();
12389 parser_restore_prc ();
12390 parser_restore_cbrc ();
12391 parser_restore_serc ();
12392 parser_restore_sqc ();
12393 parser_restore_pseudoc ();
12395 if (parser_subquery_check == 0)
12396 PT_ERRORmf (this_parser, pt_top(this_parser), MSGCAT_SET_PARSER_SEMANTIC,
12397 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12401 /* handle ORDER BY NULL */
12402 PT_NODE *order = node->info.query.order_by;
12403 if (order && order->info.sort_spec.expr
12404 && order->info.sort_spec.expr->node_type == PT_VALUE
12405 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12407 if (!node->info.query.q.select.group_by)
12409 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12410 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12414 parser_free_tree (this_parser, node->info.query.order_by);
12415 node->info.query.order_by = NULL;
12420 parser_push_orderby_node (node);
12423 opt_select_limit_clause
12424 opt_for_update_clause
12427 PT_NODE *node = parser_pop_orderby_node ();
12429 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12435 select_expression_opt_with
12440 PT_NODE *with_clause = $1;
12441 PT_NODE *stmt = $2;
12442 if (stmt && with_clause)
12444 stmt->info.query.with = with_clause;
12452 select_expression_without_subquery
12453 : select_expression_without_subquery
12455 PT_NODE *node = $1;
12456 parser_push_orderby_node (node);
12462 PT_NODE *node = parser_pop_orderby_node ();
12464 if (node && parser_cannot_cache)
12466 node->info.query.flag.reexecute = 1;
12467 node->info.query.flag.do_cache = 0;
12468 node->info.query.flag.do_not_cache = 1;
12472 if (parser_subquery_check == 0)
12473 PT_ERRORmf (this_parser, pt_top(this_parser), MSGCAT_SET_PARSER_SEMANTIC,
12474 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12478 PT_NODE *order = node->info.query.order_by;
12479 if (order && order->info.sort_spec.expr
12480 && order->info.sort_spec.expr->node_type == PT_VALUE
12481 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12483 if (!node->info.query.q.select.group_by)
12485 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12486 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12490 parser_free_tree (this_parser, node->info.query.order_by);
12491 node->info.query.order_by = NULL;
12496 parser_push_orderby_node (node);
12500 opt_select_limit_clause
12501 opt_for_update_clause
12504 PT_NODE *node = parser_pop_orderby_node ();
12506 PARSER_SAVE_ERR_CONTEXT ($<node>$, @$.buffer_pos)
12510 table_op select_or_values_query
12513 PT_NODE *stmt = $8;
12514 PT_NODE *arg1 = $1;
12518 stmt->info.query.id = (UINTPTR) stmt;
12519 stmt->info.query.q.union_.arg1 = $1;
12520 stmt->info.query.q.union_.arg2 = $9;
12521 stmt->flag.recompile = $1->flag.recompile | $9->flag.recompile;
12524 && arg1->info.query.is_subquery != PT_IS_SUBQUERY
12525 && arg1->info.query.order_by != NULL)
12527 PT_ERRORm (this_parser, stmt,
12528 MSGCAT_SET_PARSER_SYNTAX,
12529 MSGCAT_SYNTAX_INVALID_UNION_ORDERBY);
12535 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12538 | select_or_values_query
12541 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12547 : select_expression
12549 PT_NODE *node = $1;
12550 parser_push_orderby_node (node);
12555 PT_NODE *node = parser_pop_orderby_node ();
12557 if (node && parser_cannot_cache)
12559 node->info.query.flag.reexecute = 1;
12560 node->info.query.flag.do_cache = 0;
12561 node->info.query.flag.do_not_cache = 1;
12565 if (parser_subquery_check == 0)
12566 PT_ERRORmf (this_parser, pt_top(this_parser), MSGCAT_SET_PARSER_SEMANTIC,
12567 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12572 PT_NODE *order = node->info.query.order_by;
12573 if (order && order->info.sort_spec.expr
12574 && order->info.sort_spec.expr->node_type == PT_VALUE
12575 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12577 if (!node->info.query.q.select.group_by)
12579 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12580 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12584 parser_free_tree (this_parser, node->info.query.order_by);
12585 node->info.query.order_by = NULL;
12590 parser_push_orderby_node (node);
12593 opt_select_limit_clause
12594 opt_for_update_clause
12597 PT_NODE *node = parser_pop_orderby_node ();
12599 PARSER_SAVE_ERR_CONTEXT ($<node>$, @$.buffer_pos)
12602 table_op select_or_subquery
12605 PT_NODE *stmt = $8;
12606 PT_NODE *arg1 = $1;
12610 stmt->info.query.id = (UINTPTR) stmt;
12611 stmt->info.query.q.union_.arg1 = $1;
12612 stmt->info.query.q.union_.arg2 = $9;
12613 stmt->flag.recompile = $1->flag.recompile | $9->flag.recompile;
12616 && arg1->info.query.is_subquery != PT_IS_SUBQUERY
12617 && arg1->info.query.order_by != NULL)
12619 PT_ERRORm (this_parser, stmt, MSGCAT_SET_PARSER_SYNTAX,
12620 MSGCAT_SYNTAX_INVALID_UNION_ORDERBY);
12626 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12629 | select_or_subquery
12633 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12638 select_expression_without_values_query
12639 : select_expression_without_values_query
12641 PT_NODE *node = $1;
12642 parser_push_orderby_node (node);
12647 PT_NODE *node = parser_pop_orderby_node ();
12649 if (node && parser_cannot_cache)
12651 node->info.query.flag.reexecute = 1;
12652 node->info.query.flag.do_cache = 0;
12653 node->info.query.flag.do_not_cache = 1;
12656 if (parser_subquery_check == 0)
12657 PT_ERRORmf (this_parser, pt_top(this_parser), MSGCAT_SET_PARSER_SEMANTIC,
12658 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12663 PT_NODE *order = node->info.query.order_by;
12664 if (order && order->info.sort_spec.expr
12665 && order->info.sort_spec.expr->node_type == PT_VALUE
12666 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12668 if (!node->info.query.q.select.group_by)
12670 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12671 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12675 parser_free_tree (this_parser, node->info.query.order_by);
12676 node->info.query.order_by = NULL;
12681 parser_push_orderby_node (node);
12684 opt_select_limit_clause
12685 opt_for_update_clause
12688 PT_NODE *node = parser_pop_orderby_node ();
12690 PARSER_SAVE_ERR_CONTEXT ($<node>$, @$.buffer_pos)
12693 table_op select_or_subquery_without_values_query
12696 PT_NODE *stmt = $8;
12697 PT_NODE *arg1 = $1;
12701 stmt->info.query.id = (UINTPTR) stmt;
12702 stmt->info.query.q.union_.arg1 = $1;
12703 stmt->info.query.q.union_.arg2 = $9;
12704 stmt->flag.recompile = $1->flag.recompile | $9->flag.recompile;
12707 && arg1->info.query.is_subquery != PT_IS_SUBQUERY
12708 && arg1->info.query.order_by != NULL)
12710 PT_ERRORm (this_parser, stmt, MSGCAT_SET_PARSER_SYNTAX,
12711 MSGCAT_SYNTAX_INVALID_UNION_ORDERBY);
12717 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12720 | select_or_subquery_without_values_query
12724 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12729 select_expression_without_values_query_no_with_clause
12730 : select_expression_without_values_query_no_with_clause
12732 PT_NODE *node = $1;
12733 parser_push_orderby_node (node);
12738 PT_NODE *node = parser_pop_orderby_node ();
12740 if (node && parser_cannot_cache)
12742 node->info.query.flag.reexecute = 1;
12743 node->info.query.flag.do_cache = 0;
12744 node->info.query.flag.do_not_cache = 1;
12747 if (parser_subquery_check == 0)
12748 PT_ERRORmf (this_parser, pt_top(this_parser), MSGCAT_SET_PARSER_SEMANTIC,
12749 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12754 PT_NODE *order = node->info.query.order_by;
12755 if (order && order->info.sort_spec.expr
12756 && order->info.sort_spec.expr->node_type == PT_VALUE
12757 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12759 if (!node->info.query.q.select.group_by)
12761 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12762 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12766 parser_free_tree (this_parser, node->info.query.order_by);
12767 node->info.query.order_by = NULL;
12772 parser_push_orderby_node (node);
12775 opt_select_limit_clause
12776 opt_for_update_clause
12779 PT_NODE *node = parser_pop_orderby_node ();
12781 PARSER_SAVE_ERR_CONTEXT ($<node>$, @$.buffer_pos)
12784 table_op select_or_subquery_without_values_query_no_with_clause
12787 PT_NODE *stmt = $8;
12788 PT_NODE *arg1 = $1;
12792 stmt->info.query.id = (UINTPTR) stmt;
12793 stmt->info.query.q.union_.arg1 = $1;
12794 stmt->info.query.q.union_.arg2 = $9;
12795 stmt->flag.recompile = $1->flag.recompile | $9->flag.recompile;
12798 && arg1->info.query.is_subquery != PT_IS_SUBQUERY
12799 && arg1->info.query.order_by != NULL)
12801 PT_ERRORm (this_parser, stmt, MSGCAT_SET_PARSER_SYNTAX,
12802 MSGCAT_SYNTAX_INVALID_UNION_ORDERBY);
12808 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12811 | select_or_subquery_without_values_query_no_with_clause
12815 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12820 select_expression_without_values_and_single_subquery
12821 : select_expression_without_values_query_no_with_clause
12823 PT_NODE *node = $1;
12824 parser_push_orderby_node (node);
12829 PT_NODE *node = parser_pop_orderby_node ();
12831 if (node && parser_cannot_cache)
12833 node->info.query.flag.reexecute = 1;
12834 node->info.query.flag.do_cache = 0;
12835 node->info.query.flag.do_not_cache = 1;
12839 if (parser_subquery_check == 0)
12840 PT_ERRORmf (this_parser, pt_top(this_parser), MSGCAT_SET_PARSER_SEMANTIC,
12841 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
12846 PT_NODE *order = node->info.query.order_by;
12847 if (order && order->info.sort_spec.expr
12848 && order->info.sort_spec.expr->node_type == PT_VALUE
12849 && order->info.sort_spec.expr->type_enum == PT_TYPE_NULL)
12851 if (!node->info.query.q.select.group_by)
12853 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
12854 MSGCAT_SEMANTIC_ORDERBYNULL_REQUIRES_GROUPBY);
12858 parser_free_tree (this_parser, node->info.query.order_by);
12859 node->info.query.order_by = NULL;
12864 parser_push_orderby_node (node);
12867 opt_select_limit_clause
12868 opt_for_update_clause
12871 PT_NODE *node = parser_pop_orderby_node ();
12873 PARSER_SAVE_ERR_CONTEXT ($<node>$, @$.buffer_pos)
12876 table_op select_or_subquery_without_values_query_no_with_clause
12879 PT_NODE *stmt = $8;
12880 PT_NODE *arg1 = $1;
12884 stmt->info.query.id = (UINTPTR) stmt;
12885 stmt->info.query.q.union_.arg1 = $1;
12886 stmt->info.query.q.union_.arg2 = $9;
12887 stmt->flag.recompile = $1->flag.recompile | $9->flag.recompile;
12890 && arg1->info.query.is_subquery != PT_IS_SUBQUERY
12891 && arg1->info.query.order_by != NULL)
12893 PT_ERRORm (this_parser, stmt, MSGCAT_SET_PARSER_SYNTAX,
12894 MSGCAT_SYNTAX_INVALID_UNION_ORDERBY);
12900 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12903 | select_or_nested_values_query
12907 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12913 : Union all_distinct
12915 PT_MISC_TYPE isAll = $2;
12916 PT_NODE *node = parser_new_node (this_parser, PT_UNION);
12919 if (isAll == PT_EMPTY)
12920 isAll = PT_DISTINCT;
12921 node->info.query.all_distinct = isAll;
12925 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12928 | DIFFERENCE_ all_distinct
12931 PT_MISC_TYPE isAll = $2;
12932 PT_NODE *node = parser_new_node (this_parser, PT_DIFFERENCE);
12935 if (isAll == PT_EMPTY)
12936 isAll = PT_DISTINCT;
12937 node->info.query.all_distinct = isAll;
12941 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12944 | EXCEPT all_distinct
12947 PT_MISC_TYPE isAll = $2;
12948 PT_NODE *node = parser_new_node (this_parser, PT_DIFFERENCE);
12951 if (isAll == PT_EMPTY)
12952 isAll = PT_DISTINCT;
12953 node->info.query.all_distinct = isAll;
12957 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12960 | INTERSECTION all_distinct
12963 PT_MISC_TYPE isAll = $2;
12964 PT_NODE *node = parser_new_node (this_parser, PT_INTERSECTION);
12967 if (isAll == PT_EMPTY)
12968 isAll = PT_DISTINCT;
12969 node->info.query.all_distinct = isAll;
12973 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12976 | INTERSECT all_distinct
12979 PT_MISC_TYPE isAll = $2;
12980 PT_NODE *node = parser_new_node (this_parser, PT_INTERSECTION);
12983 if (isAll == PT_EMPTY)
12984 isAll = PT_DISTINCT;
12985 node->info.query.all_distinct = isAll;
12989 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
12999 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13006 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13012 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13016 select_or_values_query
13020 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13026 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13031 select_or_subquery_without_values_query
13036 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13043 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13048 select_or_subquery_without_values_query_no_with_clause
13053 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13056 | subquery_without_subquery_and_with_clause
13060 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13065 select_or_nested_values_query
13070 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13073 | '(' values_query ')'
13076 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13084 parser_save_found_Oracle_outer ();
13085 if (parser_select_level >= 0)
13086 parser_select_level++;
13087 parser_hidden_incr_list = NULL;
13089 node = parser_new_node (this_parser, PT_SELECT);
13093 PT_SET_VALUE_QUERY(node); /* generated by "values" */
13094 node->info.query.q.select.flavor = PT_USER_SELECT;
13095 node->info.query.q.select.hint = PT_HINT_NONE;
13098 parser_push_select_stmt_node (node);
13099 parser_push_hint_node (node);
13103 /* $3 node of type PT_NODE_LIST */
13105 PT_NODE *node = parser_pop_select_stmt_node ();
13106 parser_found_Oracle_outer = false;
13107 parser_pop_hint_node ();
13112 node->info.query.q.select.list = n;
13113 node->info.query.into_list = NULL;
13114 node->info.query.id = (UINTPTR)node;
13115 node->info.query.all_distinct = PT_ALL;
13118 /* We don't want to allow subqueries for VALUES query */
13119 if (PT_IS_VALUE_QUERY (node))
13121 PT_NODE *node_list, *attrs;
13123 for (node_list = node->info.query.q.select.list; node_list;
13124 node_list = node_list->next)
13126 /* node_list->node_type should be PT_NODE_LIST */
13127 for (attrs = node_list->info.node_list.list; attrs; attrs = attrs->next)
13129 if (PT_IS_QUERY (attrs))
13131 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
13132 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Subquery");
13139 parser_restore_found_Oracle_outer ();
13140 if (parser_select_level >= 0)
13141 parser_select_level--;
13148 : values_expression ',' values_expr_item
13150 PT_NODE *node1 = $1;
13151 PT_NODE *node2 = $3;
13152 parser_make_link (node1, node2);
13163 : '(' alias_enabled_expression_list_top ')'
13165 PT_NODE *node_value = $2;
13166 PT_NODE *node_tmp = $2;
13167 PT_NODE *node = NULL;
13171 PT_SET_VALUE_QUERY(node_tmp);
13172 node_tmp = node_tmp->next;
13175 node = pt_node_list(this_parser, PT_IS_VALUE, node_value);
13176 PT_SET_VALUE_QUERY(node);
13188 parser_save_found_Oracle_outer ();
13189 if (parser_select_level >= 0)
13190 parser_select_level++;
13191 parser_hidden_incr_list = NULL;
13193 node = parser_new_node (this_parser, PT_SELECT);
13197 node->info.query.q.select.flavor = PT_USER_SELECT;
13198 node->info.query.q.select.hint = PT_HINT_NONE;
13201 parser_push_select_stmt_node (node);
13202 parser_push_hint_node (node);
13205 opt_hint_list /* $3 */
13206 all_distinct /* $4 */
13207 select_list /* $5 */
13208 opt_select_param_list /* $6 */
13211 PT_MISC_TYPE isAll = $4;
13212 PT_NODE *node = parser_top_select_stmt_node ();
13215 if (isAll == PT_EMPTY)
13217 node->info.query.all_distinct = isAll;
13218 node->info.query.q.select.list = $5;
13219 node->info.query.into_list = $6;
13220 if (parser_hidden_incr_list)
13222 (void) parser_append_node (parser_hidden_incr_list,
13223 node->info.query.q.select.list);
13224 parser_hidden_incr_list = NULL;
13229 opt_from_clause /* $8 */
13243 opt_recursive /* $2 */
13244 cte_definition_list /* $3 */
13247 PT_NODE *node = parser_new_node (this_parser, PT_WITH_CLAUSE);
13250 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
13251 node->info.with_clause.recursive = $2;
13254 node->info.with_clause.cte_definition_list = $3;
13276 cte_definition_list
13277 : cte_definition_list ',' cte_definition
13280 $$ = parser_make_link($1, $3);
13281 PARSER_SAVE_ERR_CONTEXT($$, @$.buffer_pos)
13288 PARSER_SAVE_ERR_CONTEXT($$, @$.buffer_pos)
13294 : identifier /* $1 */
13295 opt_bracketed_identifier_list /* $2 */
13297 cte_query_list /* $4 */
13299 PT_NODE *node = parser_new_node (this_parser, PT_CTE);
13302 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
13303 node->info.cte.name = $1;
13306 node->info.cte.as_attr_list = $2;
13308 node->info.cte.non_recursive_part = $4;
13309 node->info.cte.recursive_part = NULL;
13323 PT_NODE *stmt = $2;
13324 PT_NODE *arg1 = $1, *arg2 = $3;
13327 stmt->info.query.id = (UINTPTR) stmt;
13328 stmt->info.query.q.union_.arg1 = arg1;
13329 stmt->info.query.q.union_.arg2 = arg2;
13330 stmt->flag.recompile = arg1->flag.recompile | arg2->flag.recompile;
13334 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13337 | select_or_subquery
13341 PARSER_SAVE_ERR_CONTEXT($$, @$.buffer_pos);
13351 PT_NODE *node = parser_pop_select_stmt_node ();
13352 parser_found_Oracle_outer = false;
13353 parser_pop_hint_node ();
13357 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
13358 n = node->info.query.q.select.list;
13359 if (n && n->type_enum == PT_TYPE_STAR)
13361 /* "select *" is not valid, raise an error */
13362 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
13363 MSGCAT_SEMANTIC_NO_TABLES_USED);
13366 node->info.query.id = (UINTPTR) node;
13367 node->info.query.all_distinct = PT_ALL;
13370 if (parser_hidden_incr_list)
13372 /* if not handle hidden expressions, raise an error */
13373 PT_ERRORf (this_parser, node,
13374 "%s can be used at select or with increment clause only.",
13375 pt_short_print (this_parser, parser_hidden_incr_list));
13378 parser_restore_found_Oracle_outer (); /* restore */
13379 if (parser_select_level >= 0)
13380 parser_select_level--;
13386 extended_table_spec_list /* $2 */
13389 parser_found_Oracle_outer = false;
13392 opt_where_clause /* $4 */
13393 opt_startwith_connectby_clause/* $5 */
13394 opt_groupby_clause /* $6 */
13395 opt_with_rollup /* $7 */
13396 opt_having_clause /* $8 */
13397 opt_using_index_clause /* $9 */
13398 opt_with_increment_clause /* $10 */
13402 bool is_dummy_select;
13403 PT_NODE *node = parser_pop_select_stmt_node ();
13404 int with_rollup = $7;
13405 parser_pop_hint_node ();
13407 is_dummy_select = false;
13411 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
13412 n = node->info.query.q.select.list;
13413 if (n && n->next == NULL && n->node_type == PT_VALUE
13414 && n->type_enum == PT_TYPE_STAR)
13416 /* select * from ... */
13417 is_dummy_select = true; /* Here, guess as TRUE */
13419 else if (n && n->next == NULL && n->node_type == PT_NAME
13420 && n->type_enum == PT_TYPE_STAR)
13422 /* select A.* from */
13423 is_dummy_select = true; /* Here, guess as TRUE */
13427 is_dummy_select = false; /* not dummy */
13430 if (node->info.query.into_list)
13432 is_dummy_select = false; /* not dummy */
13435 node->info.query.q.select.from = n = CONTAINER_AT_0 ($2);
13437 is_dummy_select = false; /* not dummy */
13438 if (TO_NUMBER (CONTAINER_AT_1 ($2)) == 1)
13440 PT_SELECT_INFO_SET_FLAG (node, PT_SELECT_INFO_ANSI_JOIN);
13443 node->info.query.q.select.where = n = $4;
13445 is_dummy_select = false; /* not dummy */
13446 if (parser_found_Oracle_outer == true)
13447 PT_SELECT_INFO_SET_FLAG (node, PT_SELECT_INFO_ORACLE_OUTER);
13449 node->info.query.q.select.start_with = n = CONTAINER_AT_0 ($5);
13451 is_dummy_select = false; /* not dummy */
13453 node->info.query.q.select.connect_by = n = CONTAINER_AT_1 ($5);
13455 is_dummy_select = false; /* not dummy */
13457 node->info.query.q.select.group_by = n = $6;
13459 is_dummy_select = false; /* not dummy */
13463 if (!node->info.query.q.select.group_by)
13465 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
13466 MSGCAT_SEMANTIC_WITHROLLUP_REQUIRES_GROUPBY);
13470 node->info.query.q.select.group_by->flag.with_rollup = 1;
13474 node->info.query.q.select.having = n = $8;
13476 is_dummy_select = false; /* not dummy */
13478 node->info.query.q.select.using_index =
13479 (node->info.query.q.select.using_index ?
13480 parser_make_link (node->info.query.q.select.using_index, $9) : $9);
13482 node->info.query.q.select.with_increment = $10;
13483 node->info.query.id = (UINTPTR) node;
13486 if (node->info.query.all_distinct != PT_ALL)
13487 is_dummy_select = false; /* not dummy */
13488 if (is_dummy_select == true)
13490 /* mark as dummy */
13491 PT_SELECT_INFO_SET_FLAG (node, PT_SELECT_INFO_DUMMY);
13494 if (parser_hidden_incr_list)
13496 /* if not handle hidden expressions, raise an error */
13497 PT_ERRORf (this_parser, node,
13498 "%s can be used at select or with increment clause only.",
13499 pt_short_print (this_parser, parser_hidden_incr_list));
13502 parser_restore_found_Oracle_outer (); /* restore */
13503 if (parser_select_level >= 0)
13504 parser_select_level--;
13511 opt_select_param_list
13518 | INTO to_param_list
13522 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13529 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13540 : hint_list CPP_STYLE_HINT
13543 PT_NODE *node = parser_top_hint_node ();
13544 char *hint_comment = $2;
13545 (void) pt_get_hint (hint_comment, parser_hint_table, node);
13548 | hint_list SQL_STYLE_HINT
13551 PT_NODE *node = parser_top_hint_node ();
13552 char *hint_comment = $2;
13553 (void) pt_get_hint (hint_comment, parser_hint_table, node);
13556 | hint_list C_STYLE_HINT
13559 PT_NODE *node = parser_top_hint_node ();
13560 char *hint_comment = $2;
13561 (void) pt_get_hint (hint_comment, parser_hint_table, node);
13567 PT_NODE *node = parser_top_hint_node ();
13568 char *hint_comment = $1;
13569 (void) pt_get_hint (hint_comment, parser_hint_table, node);
13575 PT_NODE *node = parser_top_hint_node ();
13576 char *hint_comment = $1;
13577 (void) pt_get_hint (hint_comment, parser_hint_table, node);
13583 PT_NODE *node = parser_top_hint_node ();
13584 char *hint_comment = $1;
13585 (void) pt_get_hint (hint_comment, parser_hint_table, node);
13621 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
13623 node->type_enum = PT_TYPE_STAR;
13625 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13629 | '*' ',' alias_enabled_expression_list_top
13632 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
13634 node->type_enum = PT_TYPE_STAR;
13636 $$ = parser_make_link (node, $3);
13637 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13641 | alias_enabled_expression_list_top
13644 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13648 alias_enabled_expression_list_top
13652 parser_save_and_set_ic (2);
13653 parser_save_and_set_gc (2);
13654 parser_save_and_set_oc (2);
13655 parser_save_and_set_sysc (1);
13656 parser_save_and_set_prc (1);
13657 parser_save_and_set_cbrc (1);
13660 alias_enabled_expression_list
13664 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13665 parser_restore_ic ();
13666 parser_restore_gc ();
13667 parser_restore_oc ();
13668 parser_restore_sysc ();
13669 parser_restore_prc ();
13670 parser_restore_cbrc ();
13675 alias_enabled_expression_list
13676 : alias_enabled_expression_list ',' alias_enabled_expression_
13679 $$ = parser_make_link ($1, $3);
13680 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13683 | alias_enabled_expression_
13686 PT_NODE *node = $1;
13689 node->flag.is_alias_enabled_expr = 1;
13692 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13697 alias_enabled_expression_
13698 : normal_expression opt_as_identifier %dprec 2
13701 PT_NODE *subq, *id;
13702 PT_NODE *node = $1;
13703 if (node->node_type == PT_VALUE && node->type_enum == PT_TYPE_EXPR_SET)
13705 node->type_enum = PT_TYPE_SEQUENCE; /* for print out */
13706 PT_ERRORf (this_parser, node,
13707 "check syntax at %s, illegal parentheses set expression.",
13708 pt_short_print (this_parser, node));
13710 else if (PT_IS_QUERY_NODE_TYPE (node->node_type))
13712 /* mark as single tuple query */
13713 node->info.query.flag.single_tuple = 1;
13715 if ((subq = pt_get_subquery_list (node)) && subq->next)
13717 /* illegal multi-column subquery */
13718 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
13719 MSGCAT_SEMANTIC_NOT_SINGLE_COL);
13725 if (id && id->node_type == PT_NAME)
13727 if (node->type_enum == PT_TYPE_STAR)
13729 PT_ERROR (this_parser, id,
13730 "please check syntax after '*', expecting ',' or FROM in select statement.");
13734 node->alias_print = pt_makename (id->info.name.original);
13735 parser_free_node (this_parser, id);
13740 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13743 | predicate_expression opt_as_identifier %dprec 1
13747 PT_NODE *node = $1;
13750 if (id && id->node_type == PT_NAME)
13752 node->alias_print = pt_makename (id->info.name.original);
13753 parser_free_node (this_parser, id);
13757 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13766 $$ = CONTAINER_AT_0($1);
13772 : expression_queue ',' expression_
13776 PT_NODE* q_head = CONTAINER_AT_0($1);
13777 PT_NODE* q_tail = CONTAINER_AT_1($1);
13780 SET_CONTAINER_2(new_q, q_head, $3);
13782 PARSER_SAVE_ERR_CONTEXT (q_head, @$.buffer_pos)
13789 SET_CONTAINER_2(new_q, $1, $1);
13791 PARSER_SAVE_ERR_CONTEXT ($1, @$.buffer_pos)
13797 : to_param_list ',' to_param
13800 $$ = parser_make_link ($1, $3);
13801 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13808 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13814 : host_param_output
13817 $1->info.host_var.var_type = PT_HOST_OUT;
13819 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13829 val->info.name.meta_class = PT_PARAMETER;
13830 val->info.name.spec_id = (UINTPTR) val;
13831 val->info.name.resolved = pt_makename ("out parameter");
13835 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13845 val->info.name.meta_class = PT_PARAMETER;
13846 val->info.name.spec_id = (UINTPTR) val;
13847 val->info.name.resolved = pt_makename ("out parameter");
13851 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13864 val->info.name.meta_class = PT_PARAMETER;
13865 val->data_type = parser_new_node (this_parser, PT_DATA_TYPE);
13869 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13879 val->info.name.meta_class = PT_PARAMETER;
13880 val->data_type = parser_new_node (this_parser, PT_DATA_TYPE);
13884 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13894 val->info.name.meta_class = PT_META_CLASS;
13895 val->data_type = parser_new_node (this_parser, PT_DATA_TYPE);
13899 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13909 val->info.name.meta_class = PT_PARAMETER;
13910 val->data_type = parser_new_node (this_parser, PT_DATA_TYPE);
13914 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13924 PT_NODE *node = parser_new_node (this_parser, PT_HOST_VAR);
13928 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
13929 node->info.host_var.var_type = PT_HOST_IN;
13930 node->info.host_var.str = pt_makename ("?");
13931 node->info.host_var.index = parser_input_host_index++;
13933 if (parser_hostvar_check == 0)
13935 PT_ERRORmf(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
13936 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "host variable");
13942 | PARAM_HEADER uint_text
13945 PT_NODE *node = parser_new_node (this_parser, PT_HOST_VAR);
13949 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
13950 node->info.host_var.var_type = PT_HOST_IN;
13951 node->info.host_var.str = pt_makename ("?");
13952 node->info.host_var.index = atol ($2);
13953 if (node->info.host_var.index >= parser_input_host_index)
13955 parser_input_host_index = node->info.host_var.index + 1;
13958 if (parser_hostvar_check == 0)
13960 PT_ERRORmf(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
13961 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "host variable");
13973 PT_NODE *node = parser_new_node (this_parser, PT_HOST_VAR);
13977 node->info.host_var.var_type = PT_HOST_IN;
13978 node->info.host_var.str = pt_makename ("?");
13979 node->info.host_var.index = parser_output_host_index++;
13983 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
13986 | PARAM_HEADER uint_text
13989 PT_NODE *node = parser_new_node (this_parser, PT_HOST_VAR);
13991 if (parent_parser == NULL)
13993 /* This syntax is only permitted at internal statement parsing */
13994 PT_ERRORf (this_parser, node, "check syntax at %s",
13995 parser_print_tree (this_parser, node));
13999 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
14000 node->info.host_var.var_type = PT_HOST_IN;
14001 node->info.host_var.str = pt_makename ("?");
14002 node->info.host_var.index = atol ($2);
14003 if (node->info.host_var.index >= parser_output_host_index)
14005 parser_output_host_index = node->info.host_var.index + 1;
14018 $2->info.name.meta_class = PT_PARAMETER;
14020 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14033 parser_save_and_set_ic (1);
14034 assert (parser_prior_check == 0);
14035 assert (parser_connectbyroot_check == 0);
14036 parser_save_and_set_sysc (1);
14037 parser_save_and_set_prc (1);
14038 parser_save_and_set_cbrc (1);
14040 WHERE search_condition
14043 parser_restore_ic ();
14044 parser_restore_sysc ();
14045 parser_restore_prc ();
14046 parser_restore_cbrc ();
14048 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14053 opt_startwith_connectby_clause
14058 SET_CONTAINER_2 (ctn, NULL, NULL);
14062 | startwith_clause connectby_clause
14066 SET_CONTAINER_2 (ctn, $1, $2);
14070 | connectby_clause startwith_clause
14074 SET_CONTAINER_2 (ctn, $2, $1);
14082 SET_CONTAINER_2 (ctn, NULL, $1);
14089 parser_save_and_set_pseudoc (0);
14091 START_ WITH search_condition
14094 parser_restore_pseudoc ();
14096 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14103 parser_save_and_set_prc (1);
14104 parser_save_and_set_serc (0);
14105 parser_save_and_set_pseudoc (1);
14106 parser_save_and_set_sqc (0);
14108 CONNECT BY opt_nocycle search_condition
14111 parser_restore_prc ();
14112 parser_restore_serc ();
14113 parser_restore_pseudoc ();
14114 parser_restore_sqc ();
14116 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14126 PT_NODE *node = parser_top_select_stmt_node ();
14129 node->info.query.q.select.check_cycles =
14130 CONNECT_BY_CYCLES_NONE;
14143 | GROUP_ BY group_spec_list
14147 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14168 : group_spec_list ',' group_spec
14171 $$ = parser_make_link ($1, $3);
14172 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14179 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14189 parser_groupby_exception = 0;
14192 opt_asc_or_desc /* $3 */
14195 PT_NODE *node = parser_new_node (this_parser, PT_SORT_SPEC);
14197 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
14199 switch (parser_groupby_exception)
14204 case PT_ORDERBY_NUM:
14206 PT_ERROR (this_parser, node,
14207 "expression is not allowed as group by spec");
14210 case PT_IS_SUBINSERT:
14211 PT_ERROR (this_parser, node,
14212 "insert expression is not allowed as group by spec");
14215 case PT_IS_SUBQUERY:
14216 PT_ERROR (this_parser, node,
14217 "subquery is not allowed to group as spec");
14221 PT_ERROR (this_parser, node,
14222 "search condition is not allowed as group by spec");
14228 node->info.sort_spec.asc_or_desc = PT_ASC;
14229 node->info.sort_spec.expr = $2;
14232 node->info.sort_spec.asc_or_desc = PT_DESC;
14249 | { parser_save_and_set_gc(1); }
14250 HAVING search_condition
14253 parser_restore_gc ();
14255 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14260 opt_using_index_clause
14267 | USING INDEX index_name_keylimit_list
14271 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14277 PT_NODE *node = parser_new_node (this_parser, PT_NAME);
14281 node->info.name.original = NULL;
14282 node->info.name.resolved = NULL;
14283 node->info.name.meta_class = PT_INDEX_NAME;
14284 node->etc = (void *) PT_IDX_HINT_NONE;
14288 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14291 | USING INDEX ALL EXCEPT index_name_list
14294 PT_NODE *node = parser_new_node (this_parser, PT_NAME);
14298 node->info.name.original = NULL;
14299 node->info.name.resolved = "*";
14300 node->info.name.meta_class = PT_INDEX_NAME;
14301 node->etc = (void *) PT_IDX_HINT_ALL_EXCEPT;
14306 for (curr = node; curr; curr = curr->next)
14308 if (curr->etc == (void *) PT_IDX_HINT_FORCE)
14310 PT_ERRORmf(this_parser, curr, MSGCAT_SET_PARSER_SEMANTIC,
14311 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "(+)");
14314 else if (curr->etc == (void *) PT_IDX_HINT_IGNORE)
14316 PT_ERRORmf(this_parser, curr, MSGCAT_SET_PARSER_SEMANTIC,
14317 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "(-)");
14320 curr->etc = (void *) PT_IDX_HINT_ALL_EXCEPT;
14324 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14329 index_name_keylimit_list
14330 : index_name_keylimit_list ',' index_name_keylimit
14333 $$ = parser_make_link ($1, $3);
14334 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14337 | index_name_keylimit
14341 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14347 : index_name_list ',' index_name
14350 $$ = parser_make_link ($1, $3);
14351 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14358 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14363 index_name_keylimit
14364 : index_name KEYLIMIT limit_expr
14367 PT_NODE *node = $1;
14368 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
14372 if (node->etc == (void *) PT_IDX_HINT_NONE
14373 || node->etc == (void *) PT_IDX_HINT_CLASS_NONE)
14375 PT_ERRORm(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_KEYLIMIT_INDEX_NONE);
14377 else if (node->etc == (void *) PT_IDX_HINT_IGNORE)
14379 PT_ERRORmf(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "KEYLIMIT");
14383 /* set key limit */
14384 node->info.name.indx_key_limit = $3;
14390 | index_name KEYLIMIT limit_expr ',' limit_expr
14393 PT_NODE *node = $1;
14396 if (node->etc == (void *) PT_IDX_HINT_NONE
14397 || node->etc == (void *) PT_IDX_HINT_CLASS_NONE)
14399 PT_ERRORm(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_KEYLIMIT_INDEX_NONE);
14403 /* set key limits */
14404 node->info.name.indx_key_limit = $5;
14412 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14419 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14425 : class_name paren_plus
14428 PT_NODE *node = $1;
14429 node->info.name.meta_class = PT_INDEX_NAME;
14430 node->etc = (void *) PT_IDX_HINT_FORCE;
14432 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14435 | class_name paren_minus
14438 PT_NODE *node = $1;
14439 node->info.name.meta_class = PT_INDEX_NAME;
14440 node->etc = (void *) PT_IDX_HINT_IGNORE;
14442 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14448 PT_NODE *node = $1;
14449 node->info.name.meta_class = PT_INDEX_NAME;
14450 node->etc = (void *) PT_IDX_HINT_USE;
14452 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14455 | identifier DOT NONE
14458 PT_NODE *node = $1;
14459 node->info.name.meta_class = PT_INDEX_NAME;
14460 node->info.name.resolved = node->info.name.original;
14461 node->info.name.original = NULL;
14462 node->etc = (void *) PT_IDX_HINT_CLASS_NONE;
14464 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14469 opt_with_increment_clause
14476 | WITH INCREMENT For incr_arg_name_list__inc
14480 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14483 | WITH DECREMENT For incr_arg_name_list__dec
14487 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14492 opt_for_update_clause
14497 PT_NODE *node = parser_top_orderby_node ();
14499 if (node != NULL && node->node_type == PT_SELECT)
14501 PT_SELECT_INFO_SET_FLAG(node, PT_SELECT_INFO_FOR_UPDATE);
14505 PT_ERRORm (this_parser, node,
14506 MSGCAT_SET_PARSER_SEMANTIC,
14507 MSGCAT_SEMANTIC_INVALID_USE_FOR_UPDATE_CLAUSE);
14511 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14514 | For UPDATE OF class_name_list
14517 PT_NODE *node = parser_top_orderby_node ();
14518 PT_NODE *names_list = $4;
14519 PT_NODE *node1 = names_list, *node2 = NULL;
14521 if (node != NULL && node->node_type == PT_SELECT)
14523 PT_SELECT_INFO_SET_FLAG(node, PT_SELECT_INFO_FOR_UPDATE);
14524 node->info.query.q.select.for_update = names_list;
14525 for (; node1 != NULL && node2 == NULL; node1 = node1->next)
14527 for (node2 = node1->next; node2 != NULL; node2 = node2->next)
14529 /* check if search is duplicate of table */
14530 if (!pt_str_compare (node1->info.name.original,
14531 node2->info.name.original, CASE_INSENSITIVE))
14533 /* same class found twice in table list */
14534 PT_ERRORmf (this_parser, node2,
14535 MSGCAT_SET_PARSER_SEMANTIC,
14536 MSGCAT_SEMANTIC_DUPLICATE_CLASS_OR_ALIAS,
14537 node2->info.name.original);
14541 PT_NAME_INFO_SET_FLAG(node1, PT_NAME_FOR_UPDATE);
14546 PT_ERRORm (this_parser, node,
14547 MSGCAT_SET_PARSER_SEMANTIC,
14548 MSGCAT_SEMANTIC_INVALID_USE_FOR_UPDATE_CLAUSE);
14552 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14557 incr_arg_name_list__inc
14558 : incr_arg_name_list__inc ',' incr_arg_name__inc
14561 $$ = parser_make_link ($1, $3);
14562 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14565 | incr_arg_name__inc
14569 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14577 PT_NODE *node = $1;
14579 if (node->node_type == PT_EXPR && node->info.expr.op == PT_INCR)
14583 else if (node->node_type == PT_EXPR && node->info.expr.op == PT_DECR)
14585 PT_ERRORf2 (this_parser, node, "%s can be used at 'with %s for'.",
14586 pt_short_print (this_parser, node), "increment");
14590 node = parser_make_expression (this_parser, PT_INCR, $1, NULL, NULL);
14591 node->flag.is_hidden_column = 1;
14595 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14599 incr_arg_name_list__dec
14600 : incr_arg_name_list__dec ',' incr_arg_name__dec
14603 $$ = parser_make_link ($1, $3);
14604 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14607 | incr_arg_name__dec
14611 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14619 PT_NODE *node = $1;
14621 if (node->node_type == PT_EXPR && node->info.expr.op == PT_INCR)
14623 PT_ERRORf2 (this_parser, node, "%s can be used at 'with %s for'.",
14624 pt_short_print (this_parser, node), "increment");
14626 else if (node->node_type == PT_EXPR && node->info.expr.op == PT_DECR)
14632 node = parser_make_expression (this_parser, PT_DECR, $1, NULL, NULL);
14633 node->flag.is_hidden_column = 1;
14637 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14641 opt_update_orderby_clause
14646 { parser_save_and_set_oc (1); }
14647 opt_for_search_condition
14649 PT_NODE *stmt = parser_pop_orderby_node ();
14651 parser_restore_oc ();
14653 stmt->info.update.order_by = $3;
14654 stmt->info.update.orderby_for = $5;
14657 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14668 PT_NODE *stmt = parser_top_orderby_node ();
14670 if (!stmt->info.query.flag.order_siblings)
14672 parser_save_and_set_sysc (1);
14673 parser_save_and_set_prc (1);
14674 parser_save_and_set_cbrc (1);
14675 parser_save_and_set_pseudoc (1);
14679 parser_save_and_set_sysc (0);
14680 parser_save_and_set_prc (0);
14681 parser_save_and_set_cbrc (0);
14682 parser_save_and_set_pseudoc (0);
14685 if (stmt && !stmt->info.query.q.select.from)
14686 PT_ERRORmf(this_parser, pt_top(this_parser),
14687 MSGCAT_SET_PARSER_SEMANTIC,
14688 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "ORDER BY");
14694 PT_NODE *stmt = parser_top_orderby_node ();
14696 parser_restore_sysc ();
14697 parser_restore_prc ();
14698 parser_restore_cbrc ();
14699 parser_restore_pseudoc ();
14700 parser_save_and_set_oc (1);
14703 opt_for_search_condition
14706 PT_NODE *col, *order, *n, *temp, *list = NULL;
14707 PT_NODE *stmt = parser_top_orderby_node ();
14710 char *n_str, *c_str;
14711 bool is_col, is_alias;
14713 parser_restore_oc ();
14716 stmt->info.query.orderby_for = $7;
14717 /* support for alias in FOR */
14718 n = stmt->info.query.orderby_for;
14721 resolve_alias_in_expr_node (n, stmt->info.query.q.select.list);
14728 stmt->info.query.order_by = order = $5;
14731 PT_SELECT_INFO_CLEAR_FLAG (stmt, PT_SELECT_INFO_DUMMY);
14732 if (pt_is_query (stmt))
14734 /* UNION, INTERSECT, DIFFERENCE, SELECT */
14738 switch (temp->node_type)
14744 case PT_INTERSECTION:
14745 case PT_DIFFERENCE:
14746 temp = temp->info.query.q.union_.arg1;
14757 list = temp->info.query.q.select.list;
14759 found_star = false;
14761 if (list && list->node_type == PT_VALUE
14762 && list->type_enum == PT_TYPE_STAR)
14769 for (col = list; col; col = col->next)
14771 if (col->node_type == PT_NAME
14772 && col->type_enum == PT_TYPE_STAR)
14774 /* found "classname.*" */
14781 for (; order; order = order->next)
14786 n = order->info.sort_spec.expr;
14792 if (n->node_type == PT_VALUE)
14797 n_str = parser_print_tree (this_parser, n);
14803 for (col = list, index_of_col = 1; col;
14804 col = col->next, index_of_col++)
14806 c_str = parser_print_tree (this_parser, col);
14812 if ((col->alias_print
14813 && intl_identifier_namecmp (n_str, col->alias_print) == 0
14814 && (is_alias = true))
14815 || (intl_identifier_namecmp (n_str, c_str) == 0
14816 && (is_col = true)))
14820 temp = parser_copy_tree (this_parser, col);
14825 temp = parser_new_node (this_parser, PT_VALUE);
14831 temp->type_enum = PT_TYPE_INTEGER;
14832 temp->info.value.data_value.i = index_of_col;
14835 parser_free_node (this_parser, order->info.sort_spec.expr);
14836 order->info.sort_spec.expr = temp;
14838 if (is_col == true && is_alias == true)
14840 /* alias/col name ambiguity, raise error */
14841 PT_ERRORmf (this_parser, order, MSGCAT_SET_PARSER_SEMANTIC,
14842 MSGCAT_SEMANTIC_AMBIGUOUS_COLUMN_IN_ORDERING,
14854 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14864 PT_NODE *stmt = parser_top_orderby_node ();
14865 stmt->info.query.flag.order_siblings = true;
14866 if (stmt->info.query.q.select.connect_by == NULL)
14868 PT_ERRORmf(this_parser, stmt,
14869 MSGCAT_SET_PARSER_SEMANTIC,
14870 MSGCAT_SEMANTIC_NOT_HIERACHICAL_QUERY,
14878 : limit_expr '+' limit_term
14880 $$ = parser_make_expression (this_parser, PT_PLUS, $1, $3, NULL);
14881 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14884 | limit_expr '-' limit_term
14886 $$ = parser_make_expression (this_parser, PT_MINUS, $1, $3, NULL);
14887 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14893 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14899 : limit_term '*' limit_factor
14901 $$ = parser_make_expression (this_parser, PT_TIMES, $1, $3, NULL);
14902 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14905 | limit_term '/' limit_factor
14907 $$ = parser_make_expression (this_parser, PT_DIVIDE, $1, $3, NULL);
14908 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14914 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14924 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14931 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14935 | '(' limit_expr ')'
14939 if (exp && exp->node_type == PT_EXPR)
14941 exp->info.expr.paren_type = 1;
14945 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
14950 opt_select_limit_clause
14952 | LIMIT limit_options
14955 PT_NODE *node = $2;
14958 if (node->node_type == PT_SELECT)
14960 if (!node->info.query.q.select.from)
14962 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
14963 MSGCAT_SEMANTIC_NO_TABLES_USED);
14967 PT_SELECT_INFO_CLEAR_FLAG (node, PT_SELECT_INFO_DUMMY);
14969 /* For queries that have LIMIT clause don't allow
14970 * inst_num, groupby_num, orderby_num in where, having, for
14973 if (node->info.query.q.select.having)
14975 bool grbynum_flag = false;
14976 (void) parser_walk_tree (this_parser, node->info.query.q.select.having,
14977 pt_check_groupbynum_pre, NULL,
14978 pt_check_groupbynum_post, &grbynum_flag);
14981 PT_ERRORmf(this_parser, node->info.query.q.select.having,
14982 MSGCAT_SET_PARSER_SEMANTIC,
14983 MSGCAT_SEMANTIC_NOT_ALLOWED_IN_LIMIT_CLAUSE, "GROUPBY_NUM()");
14986 if (node->info.query.q.select.where)
14988 bool instnum_flag = false;
14989 (void) parser_walk_tree (this_parser, node->info.query.q.select.where,
14990 pt_check_instnum_pre, NULL,
14991 pt_check_instnum_post, &instnum_flag);
14994 PT_ERRORmf(this_parser, node->info.query.q.select.where,
14995 MSGCAT_SET_PARSER_SEMANTIC,
14996 MSGCAT_SEMANTIC_NOT_ALLOWED_IN_LIMIT_CLAUSE, "INST_NUM()/ROWNUM");
15001 if (node->info.query.orderby_for)
15003 bool ordbynum_flag = false;
15004 (void) parser_walk_tree (this_parser, node->info.query.orderby_for,
15005 pt_check_orderbynum_pre, NULL,
15006 pt_check_orderbynum_post, &ordbynum_flag);
15009 PT_ERRORmf(this_parser, node->info.query.orderby_for,
15010 MSGCAT_SET_PARSER_SEMANTIC,
15011 MSGCAT_SEMANTIC_NOT_ALLOWED_IN_LIMIT_CLAUSE, "ORDERBY_NUM()");
15016 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15025 PT_NODE *node = parser_top_orderby_node ();
15028 node->info.query.limit = $1;
15029 node->info.query.flag.rewrite_limit = 1;
15032 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15035 | limit_expr ',' limit_expr
15038 PT_NODE *node = parser_top_orderby_node ();
15041 PT_NODE *limit1 = $1;
15042 PT_NODE *limit2 = $3;
15045 limit1->next = limit2;
15047 node->info.query.limit = limit1;
15048 node->info.query.flag.rewrite_limit = 1;
15051 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15054 | limit_expr OFFSET limit_expr
15057 PT_NODE *node = parser_top_orderby_node ();
15060 PT_NODE *limit1 = $3;
15061 PT_NODE *limit2 = $1;
15064 limit1->next = limit2;
15066 node->info.query.limit = limit1;
15067 node->info.query.flag.rewrite_limit = 1;
15070 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15075 opt_upd_del_limit_clause
15082 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15087 opt_for_search_condition
15090 | For search_condition
15092 PT_NODE *node = $2;
15093 bool subquery_flag = false;
15096 (void) parser_walk_tree (this_parser, node,
15097 pt_check_subquery_pre, NULL,
15098 pt_check_subquery_post,
15102 PT_ERRORm(this_parser, node,
15103 MSGCAT_SET_PARSER_SEMANTIC,
15104 MSGCAT_SEMANTIC_SUBQUERY_NOT_ALLOWED_IN_ORDERBY_FOR_CLAUSE);
15112 : sort_spec_list ',' sort_spec
15115 $$ = parser_make_link ($1, $3);
15116 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15123 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15129 : expression_ ASC opt_nulls_first_or_last
15131 PT_NODE *node = parser_new_node (this_parser, PT_SORT_SPEC);
15135 node->info.sort_spec.asc_or_desc = PT_ASC;
15136 node->info.sort_spec.expr = $1;
15137 node->info.sort_spec.nulls_first_or_last = $3;
15141 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15144 | expression_ DESC opt_nulls_first_or_last
15147 PT_NODE *node = parser_new_node (this_parser, PT_SORT_SPEC);
15151 node->info.sort_spec.asc_or_desc = PT_DESC;
15152 node->info.sort_spec.expr = $1;
15153 node->info.sort_spec.nulls_first_or_last = $3;
15157 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15160 | expression_ opt_nulls_first_or_last
15163 PT_NODE *node = parser_new_node (this_parser, PT_SORT_SPEC);
15167 node->info.sort_spec.asc_or_desc = PT_ASC;
15168 node->info.sort_spec.expr = $1;
15169 node->info.sort_spec.nulls_first_or_last = $2;
15173 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15178 opt_nulls_first_or_last
15182 $$ = PT_NULLS_DEFAULT;
15188 $$ = PT_NULLS_FIRST;
15194 $$ = PT_NULLS_LAST;
15200 : normal_expression
15204 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15207 | predicate_expression
15211 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15218 : session_variable_definition
15222 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15225 | expression_strcat
15229 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15235 : expression_strcat STRCAT expression_bitor
15238 $$ = parser_make_expression (this_parser, PT_STRCAT, $1, $3, NULL);
15239 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15246 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15252 : expression_bitor '|' expression_bitand
15255 $$ = parser_make_expression (this_parser, PT_BIT_OR, $1, $3, NULL);
15256 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15259 | expression_bitand
15263 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15269 : expression_bitand '&' expression_bitshift
15272 $$ = parser_make_expression (this_parser, PT_BIT_AND, $1, $3, NULL);
15273 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15276 | expression_bitshift
15280 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15285 expression_bitshift
15286 : expression_bitshift BITSHIFT_LEFT expression_add_sub
15289 $$ = parser_make_expression (this_parser, PT_BITSHIFT_LEFT, $1, $3, NULL);
15290 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15293 | expression_bitshift BITSHIFT_RIGHT expression_add_sub
15296 $$ = parser_make_expression (this_parser, PT_BITSHIFT_RIGHT, $1, $3, NULL);
15297 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15300 | expression_add_sub
15304 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15310 : expression_add_sub '+' term
15313 $$ = parser_make_expression (this_parser, PT_PLUS, $1, $3, NULL);
15314 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15317 | expression_add_sub '-' term
15320 $$ = parser_make_expression (this_parser, PT_MINUS, $1, $3, NULL);
15321 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15328 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15337 $$ = parser_make_expression (this_parser, PT_TIMES, $1, $3, NULL);
15338 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15344 $$ = parser_make_expression (this_parser, PT_DIVIDE, $1, $3, NULL);
15345 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15351 $$ = parser_make_expression (this_parser, PT_DIV, $1, $3, NULL);
15352 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15358 $$ = parser_make_expression (this_parser, PT_MOD, $1, $3, NULL);
15359 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15366 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15372 : factor '^' factor_
15375 $$ = parser_make_expression (this_parser, PT_BIT_XOR, $1, $3, NULL);
15376 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15383 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15389 : primary_w_collate
15393 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15399 $$ = parser_make_expression (this_parser, PT_UNARY_MINUS, $2, NULL, NULL);
15400 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15407 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15413 $$ = parser_make_expression (this_parser, PT_BIT_NOT, $2, NULL, NULL);
15414 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15420 parser_save_and_set_sysc (0);
15421 parser_save_and_set_prc (0);
15422 parser_save_and_set_cbrc (0);
15423 parser_save_and_set_pseudoc (0);
15429 PT_NODE *node = parser_make_expression (this_parser, PT_PRIOR, $3, NULL, NULL);
15430 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
15432 parser_restore_sysc ();
15433 parser_restore_prc ();
15434 parser_restore_cbrc ();
15435 parser_restore_pseudoc ();
15437 if (parser_prior_check == 0)
15439 PT_ERRORmf(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
15440 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "PRIOR");
15449 parser_save_and_set_sysc (0);
15450 parser_save_and_set_prc (0);
15451 parser_save_and_set_cbrc (0);
15452 parser_save_and_set_pseudoc (0);
15458 PT_NODE *node = parser_make_expression (this_parser, PT_CONNECT_BY_ROOT, $3, NULL, NULL);
15459 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
15461 parser_restore_sysc ();
15462 parser_restore_prc ();
15463 parser_restore_cbrc ();
15464 parser_restore_pseudoc ();
15466 if (parser_connectbyroot_check == 0)
15468 PT_ERRORmf(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
15469 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "CONNECT_BY_ROOT");
15478 : primary opt_collation
15480 PT_NODE *node = $1;
15481 PT_NODE *coll_node = $2;
15483 if (node != NULL && coll_node != NULL)
15485 node = pt_set_collation_modifier (this_parser, node, coll_node);
15488 if (node->node_type == PT_VALUE)
15490 node->info.value.is_collate_allowed = true;
15494 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15499 : pseudo_column %dprec 11
15502 if (parser_pseudocolumn_check == 0)
15503 PT_ERRORmf (this_parser, $1, MSGCAT_SET_PARSER_SEMANTIC,
15504 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "Pseudo-column");
15507 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15510 | reserved_func %dprec 10
15514 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15517 | case_expr %dprec 9
15521 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15524 | extract_expr %dprec 8
15528 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15531 | literal_w_o_param %dprec 7
15535 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15538 | insert_expression %dprec 6
15541 $1->info.insert.is_subinsert = PT_IS_SUBINSERT;
15543 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15544 parser_groupby_exception = PT_IS_SUBINSERT;
15547 | path_expression %dprec 5
15551 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15554 | '(' expression_list ')' %dprec 4
15557 exp = pt_create_paren_expr_list (exp);
15559 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15562 | ROW '(' expression_list ')' %dprec 4
15565 exp = pt_create_paren_expr_list (exp);
15567 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15570 | '(' search_condition_query ')' %dprec 2
15575 if (exp && exp->node_type == PT_EXPR)
15577 exp->info.expr.paren_type = 1;
15581 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15582 parser_groupby_exception = PT_EXPR;
15585 | subquery %dprec 1
15587 parser_groupby_exception = PT_IS_SUBQUERY;
15589 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15591 | session_variable_expression
15595 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15600 search_condition_query
15601 : search_condition_expression
15604 PT_NODE *node = $1;
15605 parser_push_orderby_node (node);
15611 PT_NODE *node = parser_pop_orderby_node ();
15613 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15618 search_condition_expression
15623 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15629 : CONNECT_BY_ISCYCLE
15632 $$ = parser_make_expression (this_parser, PT_CONNECT_BY_ISCYCLE, NULL, NULL, NULL);
15633 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15636 | CONNECT_BY_ISLEAF
15639 $$ = parser_make_expression (this_parser, PT_CONNECT_BY_ISLEAF, NULL, NULL, NULL);
15640 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15646 $$ = parser_make_expression (this_parser, PT_LEVEL, NULL, NULL, NULL);
15647 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15654 : COUNT '(' '*' ')'
15657 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15661 node->info.function.arg_list = NULL;
15662 node->info.function.function_type = PT_COUNT_STAR;
15667 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15668 parser_groupby_exception = PT_COUNT;
15671 | COUNT '(' '*' ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15674 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15678 node->info.function.function_type = PT_COUNT_STAR;
15679 node->info.function.all_or_distinct = PT_ALL;
15680 node->info.function.arg_list = NULL;
15681 node->info.function.analytic.is_analytic = true;
15682 node->info.function.analytic.partition_by = $7;
15683 node->info.function.analytic.order_by = $8;
15687 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15690 | COUNT '(' of_distinct_unique expression_ ')'
15693 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15697 node->info.function.all_or_distinct = PT_DISTINCT;
15698 node->info.function.function_type = PT_COUNT;
15699 node->info.function.arg_list = $4;
15703 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15704 parser_groupby_exception = PT_COUNT;
15707 | COUNT '(' of_distinct_unique expression_ ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15710 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15714 node->info.function.all_or_distinct = PT_DISTINCT;
15715 node->info.function.function_type = PT_COUNT;
15716 node->info.function.arg_list = $4;
15717 node->info.function.analytic.is_analytic = true;
15718 node->info.function.analytic.partition_by = $8;
15719 node->info.function.analytic.order_by = $9;
15723 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15726 | COUNT '(' opt_all expression_ ')'
15729 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15733 node->info.function.all_or_distinct = PT_ALL;
15734 node->info.function.function_type = PT_COUNT;
15735 node->info.function.arg_list = $4;
15739 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15740 parser_groupby_exception = PT_COUNT;
15743 | COUNT '(' opt_all expression_ ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15746 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15750 node->info.function.all_or_distinct = PT_ALL;
15751 node->info.function.function_type = PT_COUNT;
15752 node->info.function.arg_list = $4;
15753 node->info.function.analytic.is_analytic = true;
15754 node->info.function.analytic.partition_by = $8;
15755 node->info.function.analytic.order_by = $9;
15759 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15762 | of_avg_max_etc '(' of_distinct_unique expression_ ')'
15763 {{//reserved_func | of_avg_max_etc '(' of_distinct_unique expression_ ')'
15765 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15769 node->info.function.function_type = $1;
15771 if ($1 == PT_MAX || $1 == PT_MIN)
15772 node->info.function.all_or_distinct = PT_ALL;
15774 node->info.function.all_or_distinct = PT_DISTINCT;
15776 node->info.function.arg_list = $4;
15780 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15781 parser_groupby_exception = PT_COUNT;
15784 | of_avg_max_etc '(' opt_all expression_ ')'
15785 {{//reserved_func | of_avg_max_etc '(' opt_all expression_ ')'
15787 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15791 node->info.function.function_type = $1;
15792 node->info.function.all_or_distinct = PT_ALL;
15793 node->info.function.arg_list = $4;
15797 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15798 parser_groupby_exception = PT_COUNT;
15801 | of_analytic '(' of_distinct_unique expression_ ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15804 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15808 node->info.function.function_type = $1;
15809 if ($1 == PT_MAX || $1 == PT_MIN)
15810 node->info.function.all_or_distinct = PT_ALL;
15812 node->info.function.all_or_distinct = PT_DISTINCT;
15813 node->info.function.arg_list = $4;
15814 node->info.function.analytic.is_analytic = true;
15815 node->info.function.analytic.partition_by = $8;
15816 node->info.function.analytic.order_by = $9;
15820 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15823 | of_analytic '(' opt_all expression_ ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15826 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15830 node->info.function.function_type = $1;
15831 node->info.function.all_or_distinct = PT_ALL;
15832 node->info.function.arg_list = $4;
15833 node->info.function.analytic.is_analytic = true;
15834 node->info.function.analytic.partition_by = $8;
15835 node->info.function.analytic.order_by = $9;
15839 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15842 | of_analytic_first_last '(' expression_ ')' opt_analytic_ignore_nulls OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15845 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15849 node->info.function.function_type = $1;
15850 node->info.function.all_or_distinct = PT_ALL;
15851 node->info.function.arg_list = $3;
15853 node->info.function.analytic.ignore_nulls = $5;
15855 node->info.function.analytic.is_analytic = true;
15856 node->info.function.analytic.partition_by = $8;
15857 node->info.function.analytic.order_by = $9;
15861 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15864 | of_analytic_nth_value '(' expression_ ',' expression_ ')' opt_analytic_from_last opt_analytic_ignore_nulls OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15867 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15871 node->info.function.function_type = $1;
15872 node->info.function.all_or_distinct = PT_ALL;
15873 node->info.function.arg_list = $3;
15875 node->info.function.analytic.offset = $5;
15877 node->info.function.analytic.default_value = parser_new_node (this_parser, PT_VALUE);
15878 if (node->info.function.analytic.default_value != NULL)
15880 node->info.function.analytic.default_value->type_enum = PT_TYPE_NULL;
15883 node->info.function.analytic.from_last = $7;
15884 node->info.function.analytic.ignore_nulls = $8;
15886 node->info.function.analytic.is_analytic = true;
15887 node->info.function.analytic.partition_by = $11;
15888 node->info.function.analytic.order_by = $12;
15892 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15895 | of_analytic_lead_lag '(' expression_ ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15898 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15902 node->info.function.function_type = $1;
15903 node->info.function.all_or_distinct = PT_ALL;
15904 node->info.function.arg_list = $3;
15906 node->info.function.analytic.offset = parser_new_node (this_parser, PT_VALUE);
15907 if (node->info.function.analytic.offset != NULL)
15909 node->info.function.analytic.offset->type_enum = PT_TYPE_INTEGER;
15910 node->info.function.analytic.offset->info.value.data_value.i = 1;
15913 node->info.function.analytic.default_value = parser_new_node (this_parser, PT_VALUE);
15914 if (node->info.function.analytic.default_value != NULL)
15916 node->info.function.analytic.default_value->type_enum = PT_TYPE_NULL;
15919 node->info.function.analytic.partition_by = $7;
15920 node->info.function.analytic.order_by = $8;
15921 node->info.function.analytic.is_analytic = true;
15925 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15928 | of_analytic_lead_lag '(' expression_ ',' expression_ ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15931 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15935 node->info.function.function_type = $1;
15936 node->info.function.all_or_distinct = PT_ALL;
15937 node->info.function.arg_list = $3;
15938 node->info.function.analytic.offset = $5;
15940 node->info.function.analytic.default_value = parser_new_node (this_parser, PT_VALUE);
15941 if (node->info.function.analytic.default_value != NULL)
15943 node->info.function.analytic.default_value->type_enum = PT_TYPE_NULL;
15946 node->info.function.analytic.partition_by = $9;
15947 node->info.function.analytic.order_by = $10;
15948 node->info.function.analytic.is_analytic = true;
15952 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15955 | of_analytic_lead_lag '(' expression_ ',' expression_ ',' expression_ ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15958 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15962 node->info.function.function_type = $1;
15963 node->info.function.all_or_distinct = PT_ALL;
15964 node->info.function.arg_list = $3;
15965 node->info.function.analytic.offset = $5;
15966 node->info.function.analytic.default_value = $7;
15967 node->info.function.analytic.partition_by = $11;
15968 node->info.function.analytic.order_by = $12;
15969 node->info.function.analytic.is_analytic = true;
15973 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
15976 | of_analytic_no_args '(' ')' OVER '(' opt_analytic_partition_by opt_analytic_order_by ')'
15979 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
15983 node->info.function.function_type = $1;
15984 node->info.function.all_or_distinct = PT_ALL;
15985 node->info.function.arg_list = NULL;
15986 node->info.function.analytic.is_analytic = true;
15987 node->info.function.analytic.partition_by = $6;
15988 node->info.function.analytic.order_by = $7;
15991 if ($1 == PT_CUME_DIST || $1 == PT_PERCENT_RANK)
15993 PT_ERRORmf (this_parser, node,
15994 MSGCAT_SET_PARSER_SEMANTIC,
15995 MSGCAT_SEMANTIC_NULL_ORDER_BY,
15996 fcode_get_lowercase_name ($1));
16002 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16006 { push_msg(MSGCAT_SYNTAX_INVALID_GROUP_CONCAT); }
16007 '(' of_distinct_unique expression_ opt_agg_order_by opt_group_concat_separator ')'
16011 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
16015 node->info.function.function_type = PT_GROUP_CONCAT;
16016 node->info.function.all_or_distinct = PT_DISTINCT;
16017 node->info.function.arg_list = parser_make_link ($5, $7);
16018 node->info.function.order_by = $6;
16022 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16025 | GROUP_CONCAT '(' opt_all opt_expression_list opt_agg_order_by opt_group_concat_separator ')'
16028 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
16030 PT_NODE *args_list = $4;
16032 if (parser_count_list(args_list) != 1)
16034 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
16035 MSGCAT_SYNTAX_INVALID_GROUP_CONCAT);
16040 node->info.function.function_type = PT_GROUP_CONCAT;
16041 node->info.function.all_or_distinct = PT_ALL;
16042 node->info.function.arg_list = parser_make_link ($4, $6);
16043 node->info.function.order_by = $5;
16047 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16050 | JSON_ARRAYAGG '(' expression_ ')'
16053 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
16057 node->info.function.function_type = PT_JSON_ARRAYAGG;
16058 node->info.function.all_or_distinct = PT_ALL;
16059 node->info.function.arg_list = parser_make_link ($3, NULL);
16063 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16066 | JSON_OBJECTAGG '(' expression_list ')'
16068 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
16069 PT_NODE *args_list = $3;
16071 if (parser_count_list(args_list) != 2)
16073 PT_ERRORm (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
16074 MSGCAT_SYNTAX_INVALID_JSON_OBJECTAGG);
16079 node->info.function.function_type = PT_JSON_OBJECTAGG;
16080 node->info.function.all_or_distinct = PT_ALL;
16081 node->info.function.arg_list = args_list;
16085 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16087 | of_percentile '(' expression_ ')' WITHIN GROUP_ '(' ORDER BY sort_spec ')' opt_over_analytic_partition_by
16090 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
16094 node->info.function.function_type = $1;
16095 node->info.function.all_or_distinct = PT_ALL;
16099 node->info.function.percentile =
16100 pt_wrap_with_cast_op (this_parser, $3,
16101 PT_TYPE_DOUBLE, 0, 0, NULL);
16106 if (pt_is_const ($10->info.sort_spec.expr))
16108 node->info.function.arg_list =
16109 $10->info.sort_spec.expr;
16113 if (is_analytic_function)
16115 node->info.function.analytic.order_by = $10;
16119 node->info.function.order_by = $10;
16122 node->info.function.arg_list =
16123 parser_copy_tree (this_parser,
16124 $10->info.sort_spec.expr);
16128 if (is_analytic_function)
16130 node->info.function.analytic.is_analytic = is_analytic_function;
16131 node->info.function.analytic.partition_by = $12;
16136 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos);
16140 { push_msg(MSGCAT_SYNTAX_INVALID_INSERT_SUBSTRING); }
16141 '(' expression_list ')'
16144 $$ = parser_make_func_with_arg_count (this_parser, F_INSERT_SUBSTRING, $4, 4, 4);
16145 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16147 | ELT '(' opt_expression_list ')'
16149 $$ = parser_make_func_with_arg_count (this_parser, F_ELT, $3, 1, 0);
16150 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16152 | POSITION '(' expression_ IN_ expression_ ')'
16155 $$ = parser_make_expression (this_parser, PT_POSITION, $3, $5, NULL);
16156 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16160 { push_msg(MSGCAT_SYNTAX_INVALID_SUBSTRING); }
16161 '(' expression_ FROM expression_ For expression_ ')'
16165 PT_NODE *node = parser_make_expression (this_parser, PT_SUBSTRING, $4, $6, $8);
16166 node->info.expr.qualifier = PT_SUBSTR_ORG;
16169 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16173 { push_msg(MSGCAT_SYNTAX_INVALID_SUBSTRING); }
16174 '(' expression_ FROM expression_ ')'
16178 PT_NODE *node = parser_make_expression (this_parser, PT_SUBSTRING, $4, $6, NULL);
16179 node->info.expr.qualifier = PT_SUBSTR_ORG;
16182 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16186 { push_msg(MSGCAT_SYNTAX_INVALID_SUBSTRING); }
16187 '(' expression_ ',' expression_ ',' expression_ ')'
16191 PT_NODE *node = parser_make_expression (this_parser, PT_SUBSTRING, $4, $6, $8);
16192 node->info.expr.qualifier = PT_SUBSTR_ORG;
16195 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16199 { push_msg(MSGCAT_SYNTAX_INVALID_SUBSTRING); }
16200 '(' expression_ ',' expression_ ')'
16204 PT_NODE *node = parser_make_expression (this_parser, PT_SUBSTRING, $4, $6, NULL);
16205 node->info.expr.qualifier = PT_SUBSTR_ORG;
16208 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16212 { push_msg(MSGCAT_SYNTAX_INVALID_DATE); }
16213 '(' expression_ ')'
16217 PT_NODE *node = parser_make_expression (this_parser, PT_DATEF, $4, NULL, NULL);
16220 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16224 { push_msg(MSGCAT_SYNTAX_INVALID_TIME); }
16225 '(' expression_ ')'
16229 PT_NODE *node = parser_make_expression (this_parser, PT_TIMEF, $4, NULL, NULL);
16232 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16236 { push_msg(MSGCAT_SYNTAX_INVALID_ADDDATE); }
16237 '(' expression_ ',' expression_ ')'
16241 PT_NODE *node = parser_make_expression (this_parser, PT_ADDDATE, $4, $6, NULL);
16244 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16248 { push_msg(MSGCAT_SYNTAX_INVALID_DATE_ADD); }
16249 '(' expression_ ',' INTERVAL expression_ datetime_field ')'
16254 PT_NODE *node_unit = parser_new_node (this_parser, PT_VALUE);
16258 node_unit->info.expr.qualifier = $8;
16259 node_unit->type_enum = PT_TYPE_INTEGER;
16262 node = parser_make_expression (this_parser, PT_DATE_ADD, $4, $7, node_unit);
16265 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16269 { push_msg(MSGCAT_SYNTAX_INVALID_SUBDATE); }
16270 '(' expression_ ',' expression_ ')'
16274 PT_NODE *node = parser_make_expression (this_parser, PT_SUBDATE, $4, $6, NULL);
16277 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16281 { push_msg(MSGCAT_SYNTAX_INVALID_DATE_SUB); }
16282 '(' expression_ ',' INTERVAL expression_ datetime_field ')'
16287 PT_NODE *node_unit = parser_new_node (this_parser, PT_VALUE);
16291 node_unit->info.expr.qualifier = $8;
16292 node_unit->type_enum = PT_TYPE_INTEGER;
16295 node = parser_make_expression (this_parser, PT_DATE_SUB, $4, $7, node_unit);
16298 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16302 { push_msg(MSGCAT_SYNTAX_INVALID_TIMESTAMP); }
16303 '(' expression_ ')'
16306 PT_NODE *arg2 = NULL;
16307 PT_NODE *node = NULL;
16308 arg2 = parser_new_node(this_parser, PT_VALUE);
16311 db_make_int(&arg2->info.value.db_value, 0);
16312 arg2->type_enum = PT_TYPE_INTEGER;
16314 node = parser_make_expression (this_parser, PT_TIMESTAMP, $4, arg2, NULL); /* will call timestamp(arg1, 0) */
16317 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16321 { push_msg(MSGCAT_SYNTAX_INVALID_TIMESTAMP); }
16322 '(' expression_ ',' expression_ ')'
16326 PT_NODE *node = parser_make_expression (this_parser, PT_TIMESTAMP, $4, $6, NULL); /* 2 parameters */
16329 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16333 { push_msg(MSGCAT_SYNTAX_INVALID_YEAR); }
16334 '(' expression_ ')'
16338 PT_NODE *node = parser_make_expression (this_parser, PT_YEARF, $4, NULL, NULL); /* 1 parameter */
16341 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16345 { push_msg(MSGCAT_SYNTAX_INVALID_MONTH); }
16346 '(' expression_ ')'
16350 PT_NODE *node = parser_make_expression (this_parser, PT_MONTHF, $4, NULL, NULL); /* 1 parameter */
16353 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16357 { push_msg(MSGCAT_SYNTAX_INVALID_DAY); }
16358 '(' expression_ ')'
16362 PT_NODE *node = parser_make_expression (this_parser, PT_DAYF, $4, NULL, NULL); /* 1 parameter */
16365 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16369 { push_msg(MSGCAT_SYNTAX_INVALID_HOUR); }
16370 '(' expression_ ')'
16374 PT_NODE *node = parser_make_expression (this_parser, PT_HOURF, $4, NULL, NULL); /* 1 parameter */
16377 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16381 { push_msg(MSGCAT_SYNTAX_INVALID_MINUTE); }
16382 '(' expression_ ')'
16386 PT_NODE *node = parser_make_expression (this_parser, PT_MINUTEF, $4, NULL, NULL); /* 1 parameter */
16389 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16393 { push_msg(MSGCAT_SYNTAX_INVALID_SECOND); }
16394 '(' expression_ ')'
16398 PT_NODE *node = parser_make_expression (this_parser, PT_SECONDF, $4, NULL, NULL); /* 1 parameter */
16401 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16405 { push_msg(MSGCAT_SYNTAX_INVALID_DATABASE); }
16410 PT_NODE *node = parser_make_expression (this_parser, PT_DATABASE, NULL, NULL, NULL);
16413 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16417 { push_msg(MSGCAT_SYNTAX_INVALID_SCHEMA); }
16422 PT_NODE *node = parser_make_expression (this_parser, PT_SCHEMA, NULL, NULL, NULL);
16425 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16429 { push_msg(MSGCAT_SYNTAX_INVALID_TRIM); }
16430 '(' of_leading_trailing_both expression_ FROM expression_ ')'
16434 PT_NODE *node = parser_make_expression (this_parser, PT_TRIM, $7, $5, NULL);
16435 node->info.expr.qualifier = $4;
16438 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16442 { push_msg(MSGCAT_SYNTAX_INVALID_TRIM); }
16443 '(' of_leading_trailing_both FROM expression_ ')'
16447 PT_NODE *node = parser_make_expression (this_parser, PT_TRIM, $6, NULL, NULL);
16448 node->info.expr.qualifier = $4;
16451 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16455 { push_msg(MSGCAT_SYNTAX_INVALID_TRIM); }
16456 '(' expression_ FROM expression_ ')'
16460 PT_NODE *node = parser_make_expression (this_parser, PT_TRIM, $6, $4, NULL);
16461 node->info.expr.qualifier = PT_BOTH;
16464 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16468 { push_msg(MSGCAT_SYNTAX_INVALID_TRIM); }
16469 '(' expression_ ')'
16473 PT_NODE *node = parser_make_expression (this_parser, PT_TRIM, $4, NULL, NULL);
16474 node->info.expr.qualifier = PT_BOTH;
16477 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16481 { push_msg(MSGCAT_SYNTAX_INVALID_CHR); }
16482 '(' expression_ opt_using_charset ')'
16486 PT_NODE *node = parser_make_expression (this_parser, PT_CHR, $4, $5, NULL);
16489 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16493 { push_msg(MSGCAT_SYNTAX_INVALID_CLOB_TO_CHAR); }
16494 '(' expression_ opt_using_charset ')'
16498 PT_NODE *node = parser_make_expression (this_parser, PT_CLOB_TO_CHAR, $4, $5, NULL);
16501 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16505 { push_msg(MSGCAT_SYNTAX_INVALID_CAST); }
16506 '(' expression_ AS of_cast_data_type ')'
16510 PT_NODE *expr = parser_make_expression (this_parser, PT_CAST, $4, NULL, NULL);
16511 PT_TYPE_ENUM typ = TO_NUMBER (CONTAINER_AT_0 ($6));
16512 PT_NODE *dt = CONTAINER_AT_1 ($6);
16517 dt = parser_new_node (this_parser, PT_DATA_TYPE);
16518 dt->type_enum = TO_NUMBER (CONTAINER_AT_0 ($6));
16519 dt->data_type = NULL;
16521 else if (typ == PT_TYPE_SET || typ == PT_TYPE_MULTISET
16522 || typ == PT_TYPE_SEQUENCE)
16524 set_dt = parser_new_node (this_parser, PT_DATA_TYPE);
16525 set_dt->type_enum = typ;
16526 set_dt->data_type = dt;
16529 if (dt->type_enum == PT_TYPE_ENUMERATION)
16531 (void) pt_check_enum_data_type(this_parser, dt);
16534 expr->info.expr.cast_type = dt;
16536 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16539 | CLASS '(' identifier ')'
16542 $3->info.name.meta_class = PT_OID_ATTR;
16544 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16545 parser_groupby_exception = PT_OID_ATTR;
16551 PT_NODE *expr = parser_make_expression (this_parser, PT_SYS_DATE, NULL, NULL, NULL);
16553 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16559 PT_NODE *expr = parser_make_expression (this_parser, PT_CURRENT_DATE, NULL, NULL, NULL);
16561 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16567 PT_NODE *expr = parser_make_expression (this_parser, PT_SYS_TIME, NULL, NULL, NULL);
16569 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16575 PT_NODE *expr = parser_make_expression (this_parser, PT_CURRENT_TIME, NULL, NULL, NULL);
16577 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16583 PT_NODE *expr = parser_make_expression (this_parser, PT_DBTIMEZONE, NULL, NULL, NULL);
16585 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16588 | of_session_timezone_
16591 PT_NODE *expr = parser_make_expression (this_parser, PT_SESSIONTIMEZONE, NULL, NULL, NULL);
16593 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16599 PT_NODE *expr = parser_make_expression (this_parser, PT_SYS_TIMESTAMP, NULL, NULL, NULL);
16601 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16604 | of_current_timestamps
16607 PT_NODE *expr = parser_make_expression (this_parser, PT_CURRENT_TIMESTAMP, NULL, NULL, NULL);
16609 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16615 PT_NODE *expr = parser_make_expression (this_parser, PT_SYS_DATETIME, NULL, NULL, NULL);
16617 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16620 | of_current_datetime
16623 PT_NODE *expr = parser_make_expression (this_parser, PT_CURRENT_DATETIME, NULL, NULL, NULL);
16625 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16631 PT_NODE *node = parser_new_node (this_parser, PT_EXPR);
16633 node->info.expr.op = PT_CURRENT_USER;
16635 parser_cannot_cache = true;
16637 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16641 { push_msg(MSGCAT_SYNTAX_INVALID_SYSTEM_USER); }
16646 PT_NODE *node = parser_make_expression (this_parser, PT_USER, NULL, NULL, NULL);
16649 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16653 { push_msg(MSGCAT_SYNTAX_INVALID_DEFAULT); }
16658 PT_NODE *node = NULL;
16659 PT_NODE *path = $4;
16663 pt_set_fill_default_in_path_expression (path);
16664 node = parser_make_expression (this_parser, PT_DEFAULTF, path, NULL, NULL);
16668 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16671 | LOCAL_TRANSACTION_ID
16674 PT_NODE *node = parser_new_node (this_parser, PT_EXPR);
16676 node->info.expr.op = PT_LOCAL_TRANSACTION_ID;
16678 parser_si_tran_id = true;
16679 parser_cannot_cache = true;
16681 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16687 PT_NODE *node = parser_new_node (this_parser, PT_EXPR);
16691 node->info.expr.op = PT_ROWNUM;
16692 PT_EXPR_INFO_SET_FLAG (node, PT_EXPR_INFO_INSTNUM_C);
16696 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16697 parser_groupby_exception = PT_ROWNUM;
16699 if (parser_instnum_check == 0)
16700 PT_ERRORmf2 (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
16701 MSGCAT_SEMANTIC_INSTNUM_COMPATIBILITY_ERR,
16702 "INST_NUM() or ROWNUM", "INST_NUM() or ROWNUM");
16706 { push_msg(MSGCAT_SYNTAX_INVALID_ADD_MONTHS); }
16707 '(' expression_ ',' expression_ ')'
16711 $$ = parser_make_expression (this_parser, PT_ADD_MONTHS, $4, $6, NULL);
16712 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16716 { push_msg(MSGCAT_SYNTAX_INVALID_OCTET_LENGTH); }
16717 '(' expression_ ')'
16721 $$ = parser_make_expression (this_parser, PT_OCTET_LENGTH, $4, NULL, NULL);
16722 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16726 { push_msg(MSGCAT_SYNTAX_INVALID_BIT_LENGTH); }
16727 '(' expression_ ')'
16731 $$ = parser_make_expression (this_parser, PT_BIT_LENGTH, $4, NULL, NULL);
16732 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16736 { push_msg(MSGCAT_SYNTAX_INVALID_LOWER); }
16737 '(' expression_ ')'
16741 $$ = parser_make_expression (this_parser, PT_LOWER, $4, NULL, NULL);
16742 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16746 { push_msg(MSGCAT_SYNTAX_INVALID_LOWER); }
16747 '(' expression_ ')'
16751 $$ = parser_make_expression (this_parser, PT_LOWER, $4, NULL, NULL);
16752 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16756 { push_msg(MSGCAT_SYNTAX_INVALID_UPPER); }
16757 '(' expression_ ')'
16761 $$ = parser_make_expression (this_parser, PT_UPPER, $4, NULL, NULL);
16762 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16766 { push_msg(MSGCAT_SYNTAX_INVALID_UPPER); }
16767 '(' expression_ ')'
16771 $$ = parser_make_expression (this_parser, PT_UPPER, $4, NULL, NULL);
16772 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16775 | SYS_CONNECT_BY_PATH
16778 push_msg(MSGCAT_SYNTAX_INVALID_SYS_CONNECT_BY_PATH);
16780 parser_save_and_set_sysc (0);
16781 parser_save_and_set_prc (0);
16782 parser_save_and_set_cbrc (0);
16783 parser_save_and_set_pseudoc (0);
16786 '(' expression_ ',' char_string_literal ')'
16790 PT_NODE *node = parser_make_expression (this_parser, PT_SYS_CONNECT_BY_PATH, $4, $6, NULL);
16791 PT_NODE *char_string_node = $6;
16793 pt_value_set_collation_info (this_parser, char_string_node, NULL);
16795 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
16797 parser_restore_sysc ();
16798 parser_restore_prc ();
16799 parser_restore_cbrc ();
16800 parser_restore_pseudoc ();
16801 if (parser_sysconnectbypath_check == 0)
16803 PT_ERRORmf(this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
16804 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE, "SYS_CONNECT_BY_PATH");
16810 { push_msg (MSGCAT_SYNTAX_INVALID_IF); }
16811 '(' search_condition ',' expression_ ',' expression_ ')'
16815 $$ = parser_make_expression (this_parser, PT_IF, $4, $6, $8);
16816 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16820 { push_msg (MSGCAT_SYNTAX_INVALID_IFNULL); }
16821 '(' expression_ ',' expression_ ')'
16825 $$ = parser_make_expression (this_parser, PT_IFNULL, $4, $6, NULL);
16826 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16830 { push_msg (MSGCAT_SYNTAX_INVALID_ISNULL); }
16831 '(' expression_ ')'
16835 $$ = parser_make_expression (this_parser, PT_ISNULL, $4, NULL, NULL);
16836 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16840 { push_msg(MSGCAT_SYNTAX_INVALID_LEFT); }
16841 '(' expression_ ',' expression_ ')'
16845 parser_make_expression (this_parser, PT_LEFT, $4, $6, NULL);
16848 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16852 { push_msg(MSGCAT_SYNTAX_INVALID_RIGHT); }
16853 '(' expression_ ',' expression_ ')'
16857 parser_make_expression (this_parser, PT_RIGHT, $4, $6, NULL);
16860 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16864 { push_msg(MSGCAT_SYNTAX_INVALID_MODULUS); }
16865 '(' expression_ ',' expression_ ')'
16869 parser_make_expression (this_parser, PT_MODULUS, $4, $6, NULL);
16872 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16876 { push_msg(MSGCAT_SYNTAX_INVALID_TRUNCATE); }
16877 '(' expression_ ',' expression_ ')'
16881 $$ = parser_make_expression (this_parser, PT_TRUNC, $4, $6, NULL);
16882 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16886 { push_msg(MSGCAT_SYNTAX_INVALID_TRANSLATE); }
16887 '(' expression_ ',' expression_ ',' expression_ ')'
16891 $$ = parser_make_expression (this_parser, PT_TRANSLATE, $4, $6, $8);
16892 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16896 { push_msg(MSGCAT_SYNTAX_INVALID_TRANSLATE); }
16897 '(' expression_ ',' expression_ ',' expression_ ')'
16901 $$ = parser_make_expression (this_parser, PT_REPLACE, $4, $6, $8);
16902 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16906 { push_msg(MSGCAT_SYNTAX_INVALID_REPLACE); }
16907 '(' expression_ ',' expression_ ')'
16911 $$ = parser_make_expression (this_parser, PT_REPLACE, $4, $6, NULL);
16912 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16916 { push_msg(MSGCAT_SYNTAX_INVALID_STRTODATE); }
16917 '(' expression_ ',' string_literal_or_input_hv ')'
16921 $$ = parser_make_expression (this_parser, PT_STR_TO_DATE, $4, $6, parser_make_date_lang (2, NULL));
16922 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16926 { push_msg(MSGCAT_SYNTAX_INVALID_STRTODATE); }
16927 '(' expression_ ',' Null ')'
16930 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
16933 node->type_enum = PT_TYPE_NULL;
16934 node->flag.is_added_by_parser = 1;
16937 $$ = parser_make_expression (this_parser, PT_STR_TO_DATE, $4, node, parser_make_date_lang (2, NULL));
16938 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16942 { push_msg(MSGCAT_SYNTAX_INVALID_CHARSET); }
16943 '(' expression_ ')'
16947 parser_make_expression (this_parser, PT_CHARSET, $4, NULL, NULL);
16950 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16954 { push_msg(MSGCAT_SYNTAX_INVALID_COLLATION); }
16955 '(' expression_ ')'
16959 parser_make_expression (this_parser, PT_COLLATION, $4, NULL, NULL);
16962 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16965 | of_cume_dist_percent_rank_function '(' expression_list ')' WITHIN GROUP_ '('ORDER BY sort_spec_list')'
16968 PT_NODE *node = parser_new_node (this_parser, PT_FUNCTION);
16971 node->info.function.function_type = $1;
16972 node->info.function.all_or_distinct = PT_ALL;
16973 node->info.function.arg_list = $3;
16974 node->info.function.analytic.is_analytic = false;
16975 node->info.function.order_by = $10;
16979 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16982 { push_msg(MSGCAT_SYNTAX_INVALID_INDEX_PREFIX); }
16983 '(' expression_ ',' expression_ ',' expression_ ')'
16987 $$ = parser_make_expression (this_parser, PT_INDEX_PREFIX, $4, $6, $8);
16988 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16991 | JSON_ARRAY_APPEND '(' expression_list ')'
16993 $$ = parser_make_func_with_arg_count_mod2 (this_parser, F_JSON_ARRAY_APPEND, $3, 3, 0, 1);
16994 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
16996 | JSON_ARRAY_INSERT '(' expression_list ')'
16998 $$ = parser_make_func_with_arg_count_mod2 (this_parser, F_JSON_ARRAY_INSERT, $3, 3, 0, 1);
16999 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17001 | JSON_ARRAY_LEX '(' opt_expression_list ')'
17003 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_ARRAY, $3, 0, 0);
17004 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17006 | JSON_CONTAINS '(' expression_list ')'
17008 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_CONTAINS, $3, 2, 3);
17009 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17011 | JSON_CONTAINS_PATH '(' expression_list ')'
17013 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_CONTAINS_PATH, $3, 3, 0);
17014 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17016 | JSON_DEPTH '(' expression_list ')'
17018 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_DEPTH, $3, 1, 1);
17019 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17021 | JSON_EXTRACT '(' expression_list ')'
17023 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_EXTRACT, $3, 2, 0);
17024 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17026 | JSON_GET_ALL_PATHS '(' expression_list ')'
17028 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_GET_ALL_PATHS, $3, 1, 1);
17029 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17031 | JSON_INSERT '(' expression_list ')'
17033 $$ = parser_make_func_with_arg_count_mod2 (this_parser, F_JSON_INSERT, $3, 3, 0, 1);
17034 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17036 | JSON_KEYS '(' expression_list ')'
17038 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_KEYS, $3, 0, 2);
17039 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17041 | JSON_LENGTH '(' expression_list ')'
17043 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_LENGTH, $3, 1, 2);
17044 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17046 | JSON_MERGE '(' expression_list ')'
17048 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_MERGE, $3, 2, 0);
17049 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17051 | JSON_MERGE_PATCH '(' expression_list ')'
17053 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_MERGE_PATCH, $3, 2, 0);
17054 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17056 | JSON_MERGE_PRESERVE '(' expression_list ')'
17058 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_MERGE, $3, 2, 0);
17059 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17061 | JSON_OBJECT_LEX '(' opt_expression_list ')'
17063 $$ = parser_make_func_with_arg_count_mod2 (this_parser, F_JSON_OBJECT, $3, 0, 0, 0);
17064 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17066 | JSON_PRETTY '(' expression_list ')'
17068 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_PRETTY, $3, 1, 1);
17069 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17071 | JSON_QUOTE '(' expression_list ')'
17073 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_QUOTE, $3, 1, 1);
17074 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17076 | JSON_REMOVE '(' expression_list ')'
17078 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_REMOVE, $3, 2, 0);
17079 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17081 | JSON_REPLACE '(' expression_list ')'
17083 $$ = parser_make_func_with_arg_count_mod2 (this_parser, F_JSON_REPLACE, $3, 3, 0, 1);
17084 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17086 | JSON_SET '(' expression_list ')'
17088 $$ = parser_make_func_with_arg_count_mod2 (this_parser, F_JSON_SET, $3, 3, 0, 1);
17089 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17091 | JSON_SEARCH '(' expression_list ')'
17093 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_SEARCH, $3, 3, 0);
17094 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17096 | JSON_TYPE '(' expression_list ')'
17098 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_TYPE, $3, 1, 1);
17099 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17101 | JSON_UNQUOTE '(' expression_list ')'
17103 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_UNQUOTE, $3, 1, 1);
17104 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17106 | JSON_VALID '(' expression_list ')'
17108 $$ = parser_make_func_with_arg_count (this_parser, F_JSON_VALID, $3, 1, 1);
17109 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17111 | simple_path_id RIGHT_ARROW CHAR_STRING
17113 PT_NODE *matcher = parser_new_node (this_parser, PT_VALUE);
17114 if (matcher != NULL)
17116 matcher->type_enum = PT_TYPE_CHAR;
17117 matcher->info.value.string_type = ' ';
17118 matcher->info.value.data_value.str = pt_append_bytes (this_parser, NULL, $3, strlen ($3));
17119 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, matcher);
17121 PT_NODE *first_arg = $1;
17122 first_arg->next = matcher;
17123 $$ = parser_make_expr_with_func (this_parser, F_JSON_EXTRACT, first_arg);
17124 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17126 | simple_path_id DOUBLE_RIGHT_ARROW CHAR_STRING
17128 PT_NODE *matcher = parser_new_node (this_parser, PT_VALUE);
17129 if (matcher != NULL)
17131 matcher->type_enum = PT_TYPE_CHAR;
17132 matcher->info.value.string_type = ' ';
17133 matcher->info.value.data_value.str = pt_append_bytes (this_parser, NULL, $3, strlen ($3));
17134 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, matcher);
17136 PT_NODE *first_arg = $1;
17137 first_arg->next = matcher;
17138 PT_NODE *extract_expr = parser_make_expr_with_func (this_parser, F_JSON_EXTRACT, first_arg);
17139 $$ = parser_make_expr_with_func (this_parser, F_JSON_UNQUOTE, extract_expr);
17140 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17142 | BENCHMARK '(' expression_list ')'
17144 $$ = parser_make_func_with_arg_count (this_parser, F_BENCHMARK, $3, 2, 2);
17145 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17147 | REGEXP_COUNT '(' expression_list ')'
17149 $$ = parser_make_func_with_arg_count (this_parser, F_REGEXP_COUNT, $3, 2, 4);
17150 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17152 | REGEXP_INSTR '(' expression_list ')'
17154 $$ = parser_make_func_with_arg_count (this_parser, F_REGEXP_INSTR, $3, 2, 6);
17155 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17157 | REGEXP_LIKE '(' expression_list ')'
17159 $$ = parser_make_func_with_arg_count (this_parser, F_REGEXP_LIKE, $3, 2, 3);
17160 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17162 | REGEXP_REPLACE '(' expression_list ')'
17164 $$ = parser_make_func_with_arg_count (this_parser, F_REGEXP_REPLACE, $3, 3, 6);
17165 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17167 | REGEXP_SUBSTR '(' expression_list ')'
17169 $$ = parser_make_func_with_arg_count (this_parser, F_REGEXP_SUBSTR, $3, 2, 5);
17170 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17174 of_cume_dist_percent_rank_function
17182 $$ = PT_PERCENT_RANK;
17189 { push_msg(MSGCAT_SYNTAX_INVALID_CURRENT_DATE); }
17197 { push_msg(MSGCAT_SYNTAX_INVALID_CURRENT_TIME); }
17205 { push_msg(MSGCAT_SYNTAX_INVALID_DB_TIMEZONE); }
17210 of_session_timezone_
17213 { push_msg(MSGCAT_SYNTAX_INVALID_SESSION_TIMEZONE); }
17218 of_current_timestamps
17219 : CURRENT_TIMESTAMP
17220 | CURRENT_TIMESTAMP
17221 { push_msg(MSGCAT_SYNTAX_INVALID_CURRENT_TIMESTAMP); }
17226 { push_msg(MSGCAT_SYNTAX_INVALID_LOCALTIMESTAMP); }
17231 { push_msg(MSGCAT_SYNTAX_INVALID_LOCALTIME); }
17236 of_current_datetime
17239 { push_msg(MSGCAT_SYNTAX_INVALID_CURRENT_DATETIME); }
17283 $$ = PT_STDDEV_POP;
17289 $$ = PT_STDDEV_SAMP;
17313 $$ = PT_AGG_BIT_AND;
17319 $$ = PT_AGG_BIT_OR;
17325 $$ = PT_AGG_BIT_XOR;
17370 $$ = PT_STDDEV_POP;
17376 $$ = PT_STDDEV_SAMP;
17409 /* add other analytic functions here */
17412 of_analytic_first_last
17416 $$ = PT_FIRST_VALUE;
17422 $$ = PT_LAST_VALUE;
17427 of_analytic_nth_value
17436 of_analytic_lead_lag
17449 /* functions that use other row values */
17456 $$ = PT_PERCENTILE_CONT;
17462 $$ = PT_PERCENTILE_DISC;
17467 of_analytic_no_args
17471 $$ = PT_ROW_NUMBER;
17483 $$ = PT_DENSE_RANK;
17493 $$ = PT_PERCENT_RANK;
17496 /* add other analytic functions here */
17504 opt_group_concat_separator
17511 | SEPARATOR char_string
17515 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17518 | SEPARATOR bit_string_literal
17522 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17534 | ORDER BY sort_spec
17538 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17543 opt_analytic_from_last
17564 opt_analytic_ignore_nulls
17585 opt_analytic_partition_by
17592 | PARTITION BY sort_spec_list
17598 for (list = $3; list != NULL; list = list->next)
17600 if (list->info.sort_spec.expr != NULL)
17602 list->info.sort_spec.expr->flag.do_not_fold = true;
17606 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17611 opt_over_analytic_partition_by
17615 is_analytic_function = false;
17619 | OVER '(' opt_analytic_partition_by ')'
17622 is_analytic_function = true;
17628 opt_analytic_order_by
17635 | ORDER BY sort_spec_list
17641 for (list = $3; list != NULL; list = list->next)
17643 if (list->info.sort_spec.expr != NULL)
17645 list->info.sort_spec.expr->flag.do_not_fold = true;
17648 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17653 of_leading_trailing_both
17675 : NULLIF '(' expression_ ',' expression_ ')'
17677 $$ = parser_make_expression (this_parser, PT_NULLIF, $3, $5, NULL);
17678 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17680 | COALESCE '(' expression_list ')'
17682 PT_NODE *prev, *expr, *arg, *tmp;
17683 int count = parser_count_list ($3);
17687 expr = parser_new_node (this_parser, PT_EXPR);
17690 expr->info.expr.op = PT_COALESCE;
17691 expr->info.expr.arg1 = arg;
17692 expr->info.expr.arg2 = NULL;
17693 expr->info.expr.arg3 = NULL;
17694 expr->info.expr.continued_case = 1;
17706 prev->info.expr.arg2 = arg;
17709 for (i = 3; i <= count; i++)
17715 expr = parser_new_node (this_parser, PT_EXPR);
17718 expr->info.expr.op = PT_COALESCE;
17719 expr->info.expr.arg1 = prev;
17720 expr->info.expr.arg2 = arg;
17721 expr->info.expr.arg3 = NULL;
17722 expr->info.expr.continued_case = 1;
17724 if (prev && prev->info.expr.continued_case >= 1)
17725 prev->info.expr.continued_case++;
17730 if (expr->info.expr.arg2 == NULL)
17732 expr->info.expr.arg2 = parser_new_node (this_parser, PT_VALUE);
17734 if (expr->info.expr.arg2)
17736 expr->info.expr.arg2->type_enum = PT_TYPE_NULL;
17737 expr->info.expr.arg2->flag.is_hidden_column = 1;
17738 expr->info.expr.arg2->flag.is_added_by_parser = 1;
17743 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17746 | CASE expression_ simple_when_clause_list opt_else_expr END
17750 PT_NODE *case_oper = $2;
17751 PT_NODE *node, *prev, *tmp, *curr, *p;
17753 int count = parser_count_list ($3);
17756 node->info.expr.continued_case = 0;
17761 (tmp->info.expr.arg3)->info.expr.arg1 =
17762 parser_copy_tree_list (this_parser, case_oper);
17764 while ((tmp = tmp->next))
17768 for (i = 2; i <= count; i++)
17772 curr->info.expr.continued_case = 1;
17774 prev->info.expr.arg2 = curr; /* else res */
17782 prev->info.expr.arg2 = p;
17785 if (prev && !prev->info.expr.arg2)
17787 p = parser_new_node (this_parser, PT_VALUE);
17790 p->type_enum = PT_TYPE_NULL;
17791 p->flag.is_added_by_parser = 1;
17793 prev->info.expr.arg2 = p;
17798 parser_free_node (this_parser, case_oper);
17801 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17804 | CASE searched_when_clause_list opt_else_expr END
17808 PT_NODE *node, *prev, *curr, *p;
17810 int count = parser_count_list ($2);
17813 node->info.expr.continued_case = 0;
17816 for (i = 2; i <= count; i++)
17820 curr->info.expr.continued_case = 1;
17822 prev->info.expr.arg2 = curr; /* else res */
17830 prev->info.expr.arg2 = p;
17833 if (prev && !prev->info.expr.arg2)
17835 p = parser_new_node (this_parser, PT_VALUE);
17838 p->type_enum = PT_TYPE_NULL;
17839 p->flag.is_added_by_parser = 1;
17841 prev->info.expr.arg2 = p;
17846 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17862 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17867 simple_when_clause_list
17868 : simple_when_clause_list simple_when_clause
17871 $$ = parser_make_link ($1, $2);
17872 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17875 | simple_when_clause
17879 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17885 : WHEN expression_ THEN expression_
17888 PT_NODE *node, *p, *q;
17890 node = parser_new_node (this_parser, PT_EXPR);
17893 node->info.expr.op = PT_CASE;
17894 node->info.expr.qualifier = PT_SIMPLE_CASE;
17895 q = parser_new_node (this_parser, PT_EXPR);
17898 q->info.expr.op = PT_EQ;
17899 q->info.expr.arg2 = p;
17900 node->info.expr.arg3 = q;
17907 node->info.expr.arg1 = p;
17911 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17916 searched_when_clause_list
17917 : searched_when_clause_list searched_when_clause
17920 $$ = parser_make_link ($1, $2);
17921 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17924 | searched_when_clause
17928 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17933 searched_when_clause
17934 : WHEN search_condition THEN expression_
17938 node = parser_new_node (this_parser, PT_EXPR);
17941 node->info.expr.op = PT_CASE;
17942 node->info.expr.qualifier = PT_SEARCHED_CASE;
17947 node->info.expr.arg3 = p;
17952 node->info.expr.arg1 = p;
17956 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
17963 : EXTRACT '(' datetime_field FROM expression_ ')'
17967 tmp = parser_make_expression (this_parser, PT_EXTRACT, $5, NULL, NULL);
17969 tmp->info.expr.qualifier = $3;
17971 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18026 $$ = PT_MILLISECOND;
18041 | SECOND_MILLISECOND
18044 $$ = PT_SECOND_MILLISECOND;
18047 | MINUTE_MILLISECOND
18050 $$ = PT_MINUTE_MILLISECOND;
18056 $$ = PT_MINUTE_SECOND;
18062 $$ = PT_HOUR_MILLISECOND;
18068 $$ = PT_HOUR_SECOND;
18074 $$ = PT_HOUR_MINUTE;
18080 $$ = PT_DAY_MILLISECOND;
18086 $$ = PT_DAY_SECOND;
18092 $$ = PT_DAY_MINUTE;
18104 $$ = PT_YEAR_MONTH;
18120 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18126 : identifier '(' opt_expression_list ')' opt_on_target
18129 PT_NODE *node = NULL;
18131 node = parser_keyword_func ($1->info.name.original, $3);
18135 node = parser_new_node (this_parser, PT_METHOD_CALL);
18139 node->info.method_call.method_name = $1;
18140 node->info.method_call.arg_list = $3;
18141 node->info.method_call.on_call_target = $5;
18142 node->info.method_call.call_or_expr = PT_IS_MTHD_EXPR;
18147 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18152 generic_function_id
18156 PT_NODE *node = $1;
18158 if (node->node_type == PT_METHOD_CALL)
18160 if (node && !node->info.method_call.on_call_target)
18162 const char *callee;
18163 PT_NODE *name = node->info.method_call.method_name;
18164 PT_NODE *func_node = NULL;
18166 /* create new PT_FUNCTION node */
18167 func_node = parser_new_node (this_parser, PT_FUNCTION);
18170 func_node->info.function.arg_list = node->info.method_call.arg_list;
18171 func_node->info.function.function_type = PT_GENERIC;
18172 callee = (name ? name->info.name.original : "");
18173 func_node->info.function.generic_name = callee;
18175 /* free previous PT_METHOD_CALL node */
18176 node->info.method_call.arg_list = NULL;
18177 node->info.method_call.method_name = NULL;
18178 parser_free_node (this_parser, node);
18184 parser_cannot_prepare = true;
18185 parser_cannot_cache = true;
18189 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18194 opt_expression_list
18205 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18210 table_set_function_call
18214 PT_NODE *func_node;
18215 func_node = parser_new_node (this_parser, PT_FUNCTION);
18218 func_node->info.function.arg_list = $2;
18219 func_node->info.function.function_type = F_TABLE_SET;
18222 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18225 | SEQUENCE subquery
18228 PT_NODE *func_node;
18229 func_node = parser_new_node (this_parser, PT_FUNCTION);
18232 func_node->info.function.arg_list = $2;
18233 func_node->info.function.function_type = F_TABLE_SEQUENCE;
18236 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18242 PT_NODE *func_node;
18243 func_node = parser_new_node (this_parser, PT_FUNCTION);
18246 func_node->info.function.arg_list = $2;
18247 func_node->info.function.function_type = F_TABLE_SEQUENCE;
18250 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18253 | MULTISET subquery
18256 PT_NODE *func_node;
18257 func_node = parser_new_node (this_parser, PT_FUNCTION);
18260 func_node->info.function.arg_list = $2;
18261 func_node->info.function.function_type = F_TABLE_MULTISET;
18264 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18270 : search_condition OR boolean_term_xor
18272 PT_NODE *arg1 = pt_convert_to_logical_expr(this_parser, $1, 1,1);
18273 PT_NODE *arg2 = pt_convert_to_logical_expr(this_parser, $3, 1,1);
18274 $$ = parser_make_expression (this_parser, PT_OR, arg1, arg2, NULL);
18275 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18281 $$ = pt_convert_to_logical_expr(this_parser, $1, 1, 1);
18282 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18288 : boolean_term_xor XOR boolean_term_is
18290 PT_NODE *arg1 = pt_convert_to_logical_expr(this_parser, $1, 1,1);
18291 PT_NODE *arg2 = pt_convert_to_logical_expr(this_parser, $3, 1,1);
18292 $$ = parser_make_expression (this_parser, PT_XOR, arg1, arg2, NULL);
18293 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18300 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18305 : boolean_term_is is_op boolean
18307 PT_NODE *arg = pt_convert_to_logical_expr(this_parser, $1, 1,1);
18308 $$ = parser_make_expression (this_parser, $2, arg, $3, NULL);
18309 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18316 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18337 : boolean_term AND boolean_factor
18339 PT_NODE *arg1 = pt_convert_to_logical_expr(this_parser, $1, 1,1);
18340 PT_NODE *arg2 = pt_convert_to_logical_expr(this_parser, $3, 1,1);
18341 $$ = parser_make_expression (this_parser, PT_AND, arg1, arg2, NULL);
18342 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18349 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18358 PT_NODE *arg = pt_convert_to_logical_expr(this_parser, $2, 1,1);
18359 $$ = parser_make_expression (this_parser, PT_NOT, arg, NULL, NULL);
18360 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18366 PT_NODE *arg = pt_convert_to_logical_expr(this_parser, $2, 1,1);
18367 $$ = parser_make_expression (this_parser, PT_NOT, arg, NULL, NULL);
18368 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18375 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18381 : EXISTS expression_
18384 $$ = parser_make_expression (this_parser, PT_EXISTS, $2, NULL, NULL);
18385 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18392 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18397 predicate_expression
18398 : predicate_expr_sub
18401 PT_JOIN_TYPE join_type = parser_top_join_type ();
18402 if (join_type == PT_JOIN_RIGHT_OUTER)
18403 parser_restore_wjc ();
18409 PT_JOIN_TYPE join_type = parser_pop_join_type ();
18414 if (join_type == PT_JOIN_RIGHT_OUTER)
18415 join_type = PT_JOIN_FULL_OUTER;
18417 join_type = PT_JOIN_LEFT_OUTER;
18421 * marking Oracle style left/right outer join operator
18423 * Oracle style outer join support: convert to ANSI standard style
18424 * only permit the following predicate
18426 * 'single_column(+) op expression_'
18427 * 'expression_ op single_column(+)'
18432 if (join_type != PT_JOIN_NONE)
18434 if (e && e->node_type == PT_EXPR)
18438 case PT_JOIN_LEFT_OUTER:
18439 attr = e->info.expr.arg2;
18441 case PT_JOIN_RIGHT_OUTER:
18442 attr = e->info.expr.arg1;
18444 case PT_JOIN_FULL_OUTER:
18445 PT_ERROR (this_parser, e,
18446 "a predicate may reference only one outer-joined table");
18450 PT_ERROR (this_parser, e, "check syntax at '(+)'");
18457 while (attr->node_type == PT_DOT_)
18458 attr = attr->info.dot.arg2;
18460 if (attr->node_type == PT_NAME)
18464 case PT_JOIN_LEFT_OUTER:
18465 PT_EXPR_INFO_SET_FLAG (e, PT_EXPR_INFO_LEFT_OUTER);
18466 parser_found_Oracle_outer = true;
18468 case PT_JOIN_RIGHT_OUTER:
18469 PT_EXPR_INFO_SET_FLAG (e, PT_EXPR_INFO_RIGHT_OUTER);
18470 parser_found_Oracle_outer = true;
18478 PT_ERROR (this_parser, e,
18479 "'(+)' operator can be applied only to a column, not to an arbitary expression");
18483 } /* if (join_type != PT_JOIN_INNER) */
18486 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18493 : pred_lhs comp_op normal_expression
18496 PT_NODE *e, *opd1, *opd2, *subq, *t;
18498 bool found_paren_set_expr = false;
18499 int lhs_cnt, rhs_cnt = 0;
18500 bool found_match = false;
18503 e = parser_make_expression (this_parser, $2, $1, NULL, NULL);
18505 if (e && !pt_has_error (this_parser))
18508 e->info.expr.arg2 = opd2;
18509 opd1 = e->info.expr.arg1;
18510 op = e->info.expr.op;
18512 /* convert parentheses set expr value into sequence */
18515 if (opd1->node_type == PT_VALUE &&
18516 opd1->type_enum == PT_TYPE_EXPR_SET)
18518 opd1->type_enum = PT_TYPE_SEQUENCE;
18519 found_paren_set_expr = true;
18521 else if (PT_IS_QUERY_NODE_TYPE (opd1->node_type))
18523 if ((subq = pt_get_subquery_list (opd1)) && subq->next == NULL)
18525 /* single-column subquery */
18531 /* If not PT_TYPE_STAR */
18532 pt_select_list_to_one_col (this_parser, opd1, true);
18534 found_paren_set_expr = true;
18540 if (opd2->node_type == PT_VALUE &&
18541 opd2->type_enum == PT_TYPE_EXPR_SET)
18543 opd2->type_enum = PT_TYPE_SEQUENCE;
18544 found_paren_set_expr = true;
18546 else if (PT_IS_QUERY_NODE_TYPE (opd2->node_type))
18548 if ((subq = pt_get_subquery_list (opd2)) && subq->next == NULL)
18550 /* single-column subquery */
18556 /* If not PT_TYPE_STAR */
18557 pt_select_list_to_one_col (this_parser, opd2, true);
18559 found_paren_set_expr = true;
18563 if (found_paren_set_expr == true)
18565 /* expression number check */
18566 if ((lhs_cnt = pt_get_expression_count (opd1)) < 0)
18568 found_match = true;
18572 for (t = opd2; t; t = t->next)
18574 rhs_cnt = pt_get_expression_count (t);
18575 if ((rhs_cnt < 0) || (lhs_cnt == rhs_cnt))
18577 /* can not check negative rhs_cnt. go ahead */
18578 found_match = true;
18584 if (found_match == false)
18586 PT_ERRORmf2 (this_parser, e, MSGCAT_SET_PARSER_SEMANTIC,
18587 MSGCAT_SEMANTIC_ATT_CNT_COL_CNT_NE,
18591 if (op == PT_EQ || op == PT_NE || op == PT_GT || op == PT_GE || op == PT_LT || op == PT_LE)
18593 /* expression number check */
18594 if (found_paren_set_expr == true &&
18595 pt_check_set_count_set (this_parser, opd1, opd2))
18597 /* rewrite parentheses set expr equi-comparions predicate
18598 * as equi-comparison predicates tree of each elements.
18599 * for example, (a, b) = (x, y) -> a = x and b = y
18601 if (op == PT_EQ && pt_is_set_type (opd1) && pt_is_set_type (opd2))
18603 e = pt_rewrite_set_eq_set (this_parser, e);
18606 /* mark as single tuple list */
18607 if (PT_IS_QUERY_NODE_TYPE (opd1->node_type))
18609 opd1->info.query.flag.single_tuple = 1;
18611 if (PT_IS_QUERY_NODE_TYPE (opd2->node_type))
18613 opd2->info.query.flag.single_tuple = 1;
18618 if (found_paren_set_expr == true)
18619 { /* operator check */
18620 PT_ERRORf (this_parser, e,
18621 "check syntax at %s, illegal operator.",
18622 pt_show_binopcode (op));
18629 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18632 | pred_lhs like_op normal_expression ESCAPE escape_literal
18635 PT_NODE *esc = parser_make_expression (this_parser, PT_LIKE_ESCAPE, $3, $5, NULL);
18636 PT_NODE *node = parser_make_expression (this_parser, $2, $1, esc, NULL);
18638 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18641 | pred_lhs like_op normal_expression
18644 if (prm_get_bool_value (PRM_ID_REQUIRE_LIKE_ESCAPE_CHARACTER)
18645 && prm_get_bool_value (PRM_ID_NO_BACKSLASH_ESCAPES))
18647 PT_ERRORmf2 (this_parser, $1, MSGCAT_SET_PARSER_SEMANTIC,
18648 MSGCAT_SEMANTIC_ESCAPE_CHAR_REQUIRED,
18649 prm_get_name (PRM_ID_REQUIRE_LIKE_ESCAPE_CHARACTER),
18650 prm_get_name (PRM_ID_NO_BACKSLASH_ESCAPES));
18652 $$ = parser_make_expression (this_parser, $2, $1, $3, NULL);
18653 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18656 | pred_lhs rlike_op normal_expression
18659 /* case sensitivity flag */
18660 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
18663 node->type_enum = PT_TYPE_INTEGER;
18664 node->info.value.data_value.i =
18665 ($2 == PT_RLIKE_BINARY || $2 == PT_NOT_RLIKE_BINARY ? 1 : 0);
18667 $$ = parser_make_expression (this_parser, $2, $1, $3, node);
18673 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18679 $$ = parser_make_expression (this_parser, $2, $1, NULL, NULL);
18680 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18683 | pred_lhs set_op normal_expression
18686 $$ = parser_make_expression (this_parser, $2, $1, $3, NULL);
18687 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18690 | pred_lhs between_op normal_expression AND normal_expression
18693 PT_NODE *node = parser_make_expression (this_parser, PT_BETWEEN_AND, $3, $5, NULL);
18694 $$ = parser_make_expression (this_parser, $2, $1, node, NULL);
18695 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18698 | pred_lhs in_op in_pred_operand
18701 PT_NODE *node = parser_make_expression (this_parser, $2, $1, NULL, NULL);
18702 PT_NODE *t = CONTAINER_AT_1 ($3);
18703 bool is_paren = (bool)TO_NUMBER (CONTAINER_AT_0 ($3));
18704 int lhs_cnt, rhs_cnt = 0;
18705 PT_NODE *v, *lhs, *rhs, *subq;
18706 bool found_match = false;
18707 bool found_paren_set_expr = false;
18709 PARSER_SAVE_ERR_CONTEXT (node, @$.buffer_pos)
18712 lhs = node->info.expr.arg1;
18713 /* convert lhs parentheses set expr value into
18714 * sequence value */
18717 if (lhs->node_type == PT_VALUE && lhs->type_enum == PT_TYPE_EXPR_SET)
18719 lhs->type_enum = PT_TYPE_SEQUENCE;
18720 found_paren_set_expr = true;
18722 else if (PT_IS_QUERY_NODE_TYPE (lhs->node_type))
18724 if ((subq = pt_get_subquery_list (lhs)) && subq->next == NULL)
18726 /* single column subquery */
18732 /* If not PT_TYPE_STAR */
18733 pt_select_list_to_one_col (this_parser, lhs, true);
18735 found_paren_set_expr = true;
18740 if (is_paren == true)
18741 { /* convert to multi-set */
18742 v = parser_new_node (this_parser, PT_VALUE);
18745 v->info.value.data_value.set = t;
18746 v->type_enum = PT_TYPE_MULTISET;
18748 node->info.expr.arg2 = v;
18752 /* convert subquery-starting parentheses set expr
18753 * ( i.e., {subquery, x, y, ...} ) into multi-set */
18754 if (t->node_type == PT_VALUE && t->type_enum == PT_TYPE_EXPR_SET)
18756 is_paren = true; /* mark as parentheses set expr */
18757 t->type_enum = PT_TYPE_MULTISET;
18759 node->info.expr.arg2 = t;
18762 rhs = node->info.expr.arg2;
18763 if (is_paren == true)
18765 rhs = rhs->info.value.data_value.set;
18767 else if (rhs->node_type == PT_VALUE
18768 && !(PT_IS_COLLECTION_TYPE (rhs->type_enum)
18769 || rhs->type_enum == PT_TYPE_EXPR_SET))
18771 PT_ERRORmf2 (this_parser, rhs, MSGCAT_SET_PARSER_SYNTAX,
18772 MSGCAT_SYNTAX_ERROR_MSG1,
18773 pt_show_binopcode ($2),
18777 /* for each rhs elements, convert parentheses
18778 * set expr value into sequence value */
18779 for (t = rhs; t; t = t->next)
18781 if (t->node_type == PT_VALUE && t->type_enum == PT_TYPE_EXPR_SET)
18783 t->type_enum = PT_TYPE_SEQUENCE;
18784 found_paren_set_expr = true;
18786 else if (PT_IS_QUERY_NODE_TYPE (t->node_type))
18788 if ((subq = pt_get_subquery_list (t)) && subq->next == NULL)
18790 /* single column subquery */
18796 /* If not PT_TYPE_STAR */
18797 pt_select_list_to_one_col (this_parser, t, true);
18799 found_paren_set_expr = true;
18803 if (found_paren_set_expr == true)
18805 /* expression number check */
18806 if ((lhs_cnt = pt_get_expression_count (lhs)) < 0)
18808 found_match = true;
18812 for (t = rhs; t; t = t->next)
18814 if (!PT_IS_QUERY_NODE_TYPE (t->node_type))
18816 if (pt_is_set_type (t))
18818 if (pt_is_set_type (t->info.value.data_value.set))
18820 /* syntax error case : (a,b) in ((1,1),((2,2),(3,3)) */
18821 found_match = false;
18828 /* syntax error case : (a,b) in ((1,1),2) */
18829 found_match = false;
18834 rhs_cnt = pt_get_expression_count (t);
18837 /* can not check negative rhs_cnt. go ahead */
18838 found_match = true;
18841 else if (lhs_cnt != rhs_cnt)
18843 found_match = false;
18848 found_match = true;
18853 if (found_match == false)
18855 PT_ERRORmf2 (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
18856 MSGCAT_SEMANTIC_ATT_CNT_COL_CNT_NE,
18861 rhs = node->info.expr.arg2;
18862 if (PT_IS_COLLECTION_TYPE (rhs->type_enum) && rhs->info.value.data_value.set
18863 && rhs->info.value.data_value.set->next == NULL)
18865 /* only one element in set. convert expr as EQ/NE expr. */
18868 new_arg2 = rhs->info.value.data_value.set;
18871 rhs->info.value.data_value.set = NULL;
18872 parser_free_tree (this_parser, node->info.expr.arg2);
18875 node->info.expr.arg2 = new_arg2;
18876 node->info.expr.op = (node->info.expr.op == PT_IS_IN) ? PT_EQ : PT_NE;
18877 if (node->info.expr.op == PT_EQ)
18879 node = pt_rewrite_set_eq_set (this_parser, node);
18887 | pred_lhs RANGE_ '(' range_list ')'
18890 $$ = parser_make_expression (this_parser, PT_RANGE, $1, $4, NULL);
18891 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18896 PT_ERRORm (this_parser, $1, MSGCAT_SET_PARSER_SYNTAX,
18897 MSGCAT_SYNTAX_INVALID_RELATIONAL_OP);
18903 : normal_expression opt_paren_plus
18906 PT_JOIN_TYPE join_type = PT_JOIN_NONE;
18910 join_type = PT_JOIN_RIGHT_OUTER;
18911 parser_save_and_set_wjc (1);
18913 parser_push_join_type (join_type);
18916 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
18937 : '=' opt_of_all_some_any
18957 | COMP_NOT_EQ opt_of_all_some_any
18977 | '>' opt_of_all_some_any
18997 | COMP_GE opt_of_all_some_any
19017 | '<' opt_of_all_some_any
19037 | COMP_LE opt_of_all_some_any
19057 | '=''=' opt_of_all_some_any
19060 push_msg (MSGCAT_SYNTAX_INVALID_EQUAL_OP);
19061 csql_yyerror_explicit (@1.first_line, @1.first_column);
19064 | '!''=' opt_of_all_some_any
19067 push_msg (MSGCAT_SYNTAX_INVALID_NOT_EQUAL);
19068 csql_yyerror_explicit (@1.first_line, @1.first_column);
19071 | COMP_NULLSAFE_EQ opt_of_all_some_any
19074 $$ = PT_NULLSAFE_EQ;
19079 opt_of_all_some_any
19128 | NOT rlike_or_regexp
19134 | rlike_or_regexp BINARY
19137 $$ = PT_RLIKE_BINARY;
19140 | NOT rlike_or_regexp BINARY
19143 $$ = PT_NOT_RLIKE_BINARY;
19157 $$ = PT_IS_NOT_NULL;
19173 $$ = PT_NOT_BETWEEN;
19204 if (exp && exp->flag.is_paren == 0)
19206 SET_CONTAINER_2 (ctn, FROM_NUMBER (0), exp);
19210 SET_CONTAINER_2 (ctn, FROM_NUMBER (1), exp);
19218 : range_list OR range_
19221 $$ = parser_make_link_or ($1, $3);
19222 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19229 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19235 : expression_ GE_LE_ expression_
19238 $$ = parser_make_expression (this_parser, PT_BETWEEN_GE_LE, $1, $3, NULL);
19239 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19242 | expression_ GE_LT_ expression_
19245 $$ = parser_make_expression (this_parser, PT_BETWEEN_GE_LT, $1, $3, NULL);
19246 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19249 | expression_ GT_LE_ expression_
19252 $$ = parser_make_expression (this_parser, PT_BETWEEN_GT_LE, $1, $3, NULL);
19253 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19256 | expression_ GT_LT_ expression_
19259 $$ = parser_make_expression (this_parser, PT_BETWEEN_GT_LT, $1, $3, NULL);
19260 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19266 $$ = parser_make_expression (this_parser, PT_BETWEEN_EQ_NA, $1, NULL, NULL);
19267 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19270 | expression_ GE_INF_ Max
19273 $$ = parser_make_expression (this_parser, PT_BETWEEN_GE_INF, $1, NULL, NULL);
19274 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19277 | expression_ GT_INF_ Max
19280 $$ = parser_make_expression (this_parser, PT_BETWEEN_GT_INF, $1, NULL, NULL);
19281 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19284 | Min INF_LE_ expression_
19287 $$ = parser_make_expression (this_parser, PT_BETWEEN_INF_LE, $3, NULL, NULL);
19288 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19291 | Min INF_LT_ expression_
19294 $$ = parser_make_expression (this_parser, PT_BETWEEN_INF_LT, $3, NULL, NULL);
19295 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19328 $$ = PT_SUPERSETEQ;
19340 : '(' csql_query ')'
19343 PT_NODE *stmt = $2;
19345 if (parser_within_join_condition)
19347 PT_ERRORm (this_parser, stmt, MSGCAT_SET_PARSER_SYNTAX,
19348 MSGCAT_SYNTAX_JOIN_COND_SUBQ);
19352 stmt->info.query.is_subquery = PT_IS_SUBQUERY;
19354 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19359 subquery_without_subquery_and_with_clause
19360 : '(' csql_query_without_subquery_and_with_clause ')'
19363 PT_NODE *stmt = $2;
19365 if (parser_within_join_condition)
19367 PT_ERRORm (this_parser, stmt, MSGCAT_SET_PARSER_SYNTAX,
19368 MSGCAT_SYNTAX_JOIN_COND_SUBQ);
19372 stmt->info.query.is_subquery = PT_IS_SUBQUERY;
19374 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19381 : path_header path_dot NONE %dprec 6
19384 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
19387 p->info.name.original = $3;
19390 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19393 | path_header path_dot IDENTITY %dprec 5
19397 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19400 | path_header path_dot OBJECT %dprec 4
19403 PT_NODE *node = $1;
19404 if (node && node->node_type == PT_NAME)
19406 PT_NAME_INFO_SET_FLAG (node, PT_NAME_INFO_EXTERNAL);
19410 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19413 | path_header DOT '*' %dprec 3
19416 PT_NODE *node = $1;
19417 if (node && node->node_type == PT_NAME &&
19418 node->info.name.meta_class == PT_META_CLASS)
19420 /* don't allow "class class_variable.*" */
19421 PT_ERROR (this_parser, node, "check syntax at '*'");
19426 node->type_enum = PT_TYPE_STAR;
19430 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19433 | path_id_list %dprec 2
19436 PT_NODE *serial_value = NULL;
19440 && dot->node_type == PT_DOT_
19441 && dot->info.dot.arg2 && dot->info.dot.arg2->node_type == PT_NAME)
19443 PT_NODE *name = dot->info.dot.arg2;
19445 if (intl_identifier_casecmp (name->info.name.original, "current_value") == 0 ||
19446 intl_identifier_casecmp (name->info.name.original, "currval") == 0)
19448 serial_value = parser_new_node (this_parser, PT_EXPR);
19449 serial_value->info.expr.op = PT_CURRENT_VALUE;
19450 serial_value->info.expr.arg1
19451 = dot->info.dot.arg1;
19452 dot->info.dot.arg1 = NULL; /* cut */
19454 serial_value->info.expr.arg2 = NULL;
19456 PICE (serial_value);
19457 if (parser_serial_check == 0)
19458 PT_ERRORmf(this_parser, serial_value,
19459 MSGCAT_SET_PARSER_SEMANTIC,
19460 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE,
19463 parser_free_node (this_parser, dot);
19464 dot = serial_value;
19466 parser_cannot_cache = true;
19469 if (intl_identifier_casecmp (name->info.name.original, "next_value") == 0 ||
19470 intl_identifier_casecmp (name->info.name.original, "nextval") == 0)
19472 serial_value = parser_new_node (this_parser, PT_EXPR);
19473 serial_value->info.expr.op = PT_NEXT_VALUE;
19475 serial_value->info.expr.arg1
19476 = dot->info.dot.arg1;
19477 dot->info.dot.arg1 = NULL; /* cut */
19479 serial_value->info.expr.arg2
19480 = parser_new_node (this_parser, PT_VALUE);
19481 if (serial_value->info.expr.arg2)
19485 arg2 = serial_value->info.expr.arg2;
19486 arg2->type_enum = PT_TYPE_INTEGER;
19487 arg2->info.value.data_value.i = 1;
19490 PICE (serial_value);
19491 if (parser_serial_check == 0)
19492 PT_ERRORmf(this_parser, serial_value,
19493 MSGCAT_SET_PARSER_SEMANTIC,
19494 MSGCAT_SEMANTIC_NOT_ALLOWED_HERE,
19497 parser_free_node (this_parser, dot);
19498 dot = serial_value;
19500 parser_cannot_cache = true;
19505 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19511 : path_id_list path_dot path_id %dprec 1
19514 PT_NODE *dot = parser_new_node (this_parser, PT_DOT_);
19517 dot->info.dot.arg1 = $1;
19518 dot->info.dot.arg2 = $3;
19522 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19525 | path_header %dprec 2
19529 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19539 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19545 PT_NODE *node = $2;
19546 if (node && node->node_type == PT_NAME)
19547 node->info.name.meta_class = PT_META_CLASS;
19554 PT_NODE *node = $1;
19555 if (node && node->node_type == PT_NAME)
19556 node->info.name.meta_class = PT_NORMAL;
19558 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19569 : identifier '{' identifier '}'
19572 PT_NODE *corr = $3;
19573 PT_NODE *name = $1;
19576 name->info.name.path_correlation = corr;
19578 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19585 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19588 | generic_function_id
19592 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19595 | table_set_function_call
19599 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19605 : identifier DOT identifier
19608 PT_NODE *dot = parser_new_node (this_parser, PT_DOT_);
19611 dot->info.dot.arg1 = $1;
19612 dot->info.dot.arg2 = $3;
19616 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19623 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19650 $$ = PT_INPUTOUTPUT;
19655 negative_prec_cast_type
19665 $$ = PT_TYPE_NCHAR;
19671 $$ = PT_TYPE_NCHAR;
19682 | negative_prec_cast_type '(' '-' unsigned_integer ')' opt_charset opt_collation
19685 PT_TYPE_ENUM typ = $1;
19686 PT_NODE *len = NULL, *dt = NULL;
19688 PT_NODE *charset_node = NULL;
19689 PT_NODE *coll_node = NULL;
19695 if (len && len->type_enum == PT_TYPE_INTEGER)
19697 l = -len->info.value.data_value.i;
19702 int maxlen = (typ == PT_TYPE_NCHAR)
19703 ? DB_MAX_NCHAR_PRECISION : DB_MAX_CHAR_PRECISION;
19704 PT_ERRORmf3 (this_parser, len,
19705 MSGCAT_SET_PARSER_SEMANTIC,
19706 MSGCAT_SEMANTIC_INV_PREC,
19710 dt = parser_new_node (this_parser, PT_DATA_TYPE);
19713 int coll_id, charset;
19715 dt->type_enum = typ;
19716 dt->info.data_type.precision = l;
19720 case PT_TYPE_NCHAR:
19721 if (pt_check_grammar_charset_collation
19722 (this_parser, charset_node, coll_node, &charset, &coll_id) == NO_ERROR)
19724 dt->info.data_type.units = charset;
19725 dt->info.data_type.collation_id = coll_id;
19729 dt->info.data_type.units = -1;
19730 dt->info.data_type.collation_id = -1;
19739 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
19743 parser_free_node (this_parser, len);
19748 parser_free_node (this_parser, charset_node);
19753 parser_free_node (this_parser, coll_node);
19760 : nested_set primitive_type
19764 PT_TYPE_ENUM typ, e;
19768 e = TO_NUMBER (CONTAINER_AT_0 ($2));
19769 dt = CONTAINER_AT_1 ($2);
19773 dt = parser_new_node (this_parser, PT_DATA_TYPE);
19777 dt->data_type = NULL;
19781 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
19785 | nested_set '(' data_type_list ')'
19795 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
19799 | nested_set '(' ')'
19806 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), NULL);
19810 | nested_set set_type
19818 dt = parser_new_node (this_parser, PT_DATA_TYPE);
19821 dt->type_enum = $2;
19822 dt->data_type = NULL;
19825 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
19835 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), NULL);
19848 : nested_set set_type
19863 : data_type_list ',' data_type
19869 e = TO_NUMBER (CONTAINER_AT_0 ($3));
19870 dt = CONTAINER_AT_1 ($3);
19874 if (e == PT_TYPE_SET ||
19875 e == PT_TYPE_MULTISET ||
19876 e == PT_TYPE_SEQUENCE)
19878 csql_yyerror("nested data type definition");
19884 dt = parser_new_node (this_parser, PT_DATA_TYPE);
19888 dt->data_type = NULL;
19892 $$ = parser_make_link ($1, dt);
19893 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19902 e = TO_NUMBER (CONTAINER_AT_0 ($1));
19903 dt = CONTAINER_AT_1 ($1);
19907 if (e == PT_TYPE_SET ||
19908 e == PT_TYPE_MULTISET ||
19909 e == PT_TYPE_SEQUENCE)
19911 csql_yyerror("nested data type definition");
19917 dt = parser_new_node (this_parser, PT_DATA_TYPE);
19921 dt->data_type = NULL;
19926 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
19932 : CHAR_ opt_varying
19936 $$ = PT_TYPE_VARCHAR;
19944 $$ = PT_TYPE_VARCHAR;
19947 | NATIONAL CHAR_ opt_varying
19951 $$ = PT_TYPE_VARNCHAR;
19953 $$ = PT_TYPE_NCHAR;
19956 | NCHAR opt_varying
19960 $$ = PT_TYPE_VARNCHAR;
19962 $$ = PT_TYPE_NCHAR;
19969 $$ = PT_TYPE_VARBIT;
19998 | '(' CHAR_STRING ')'
20007 : INTEGER opt_padding
20011 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_INTEGER), NULL);
20019 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_SMALLINT), NULL);
20027 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_BIGINT), NULL);
20035 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DOUBLE), NULL);
20043 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DOUBLE), NULL);
20051 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DATE), NULL);
20059 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_TIME), NULL);
20067 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_TIMESTAMP), NULL);
20075 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_TIMESTAMP), NULL);
20079 | TIMESTAMP WITH Time ZONE
20083 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_TIMESTAMPTZ), NULL);
20091 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_TIMESTAMPTZ), NULL);
20095 | TIMESTAMP WITH LOCAL Time ZONE
20099 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_TIMESTAMPLTZ), NULL);
20107 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_TIMESTAMPLTZ), NULL);
20115 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DATETIME), NULL);
20119 | DATETIME WITH Time ZONE
20123 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DATETIMETZ), NULL);
20131 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DATETIMETZ), NULL);
20135 | DATETIME WITH LOCAL Time ZONE
20139 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DATETIMELTZ), NULL);
20147 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_DATETIMELTZ), NULL);
20155 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_MONETARY), NULL);
20161 const char * json_schema_str = $2;
20163 PT_TYPE_ENUM type = PT_TYPE_JSON;
20164 PT_NODE * dt = parser_new_node (this_parser, PT_DATA_TYPE);
20166 if (dt && json_schema_str)
20168 dt->type_enum = type;
20169 dt->info.data_type.json_schema = pt_append_bytes (this_parser,
20172 strlen (json_schema_str));
20173 SET_CONTAINER_2 (ctn, FROM_NUMBER (type), dt);
20177 SET_CONTAINER_2 (ctn, FROM_NUMBER (type), NULL);
20185 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_OBJECT), NULL);
20195 PT_TYPE_ENUM typ = PT_TYPE_VARCHAR;
20196 PT_NODE *dt = parser_new_node (this_parser, PT_DATA_TYPE);
20197 PT_NODE *charset_node = $2;
20198 PT_NODE *coll_node = $3;
20201 int coll_id, charset;
20203 dt->type_enum = typ;
20204 dt->info.data_type.precision = DB_MAX_VARCHAR_PRECISION;
20206 if (pt_check_grammar_charset_collation
20207 (this_parser, charset_node,
20208 coll_node, &charset, &coll_id) == NO_ERROR)
20210 dt->info.data_type.units = charset;
20211 dt->info.data_type.collation_id = coll_id;
20215 dt->info.data_type.units = -1;
20216 dt->info.data_type.collation_id = -1;
20221 dt->info.data_type.has_cs_spec = true;
20225 dt->info.data_type.has_cs_spec = false;
20230 dt->info.data_type.has_coll_spec = true;
20234 dt->info.data_type.has_coll_spec = false;
20237 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
20242 parser_free_node (this_parser, charset_node);
20247 parser_free_node (this_parser, coll_node);
20251 | BLOB_ opt_internal_external
20255 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_BLOB), NULL);
20259 | CLOB_ opt_internal_external
20263 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_CLOB), NULL);
20267 | class_name opt_identity
20271 PT_TYPE_ENUM typ = PT_TYPE_OBJECT;
20272 PT_NODE *dt = parser_new_node (this_parser, PT_DATA_TYPE);
20276 dt->type_enum = typ;
20277 dt->info.data_type.entity = $1;
20278 dt->info.data_type.units = $2;
20281 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
20292 PT_TYPE_ENUM typ = $1;
20293 PT_NODE *len = NULL, *dt = NULL;
20295 PT_NODE *charset_node = NULL;
20296 PT_NODE *coll_node = NULL;
20304 int maxlen = DB_MAX_VARCHAR_PRECISION;
20305 l = len->info.value.data_value.i;
20310 maxlen = DB_MAX_CHAR_PRECISION;
20313 case PT_TYPE_VARCHAR:
20314 maxlen = DB_MAX_VARCHAR_PRECISION;
20317 case PT_TYPE_NCHAR:
20318 maxlen = DB_MAX_NCHAR_PRECISION;
20321 case PT_TYPE_VARNCHAR:
20322 maxlen = DB_MAX_VARNCHAR_PRECISION;
20326 maxlen = DB_MAX_BIT_PRECISION;
20329 case PT_TYPE_VARBIT:
20330 maxlen = DB_MAX_VARBIT_PRECISION;
20337 if ((l > maxlen) || (len->type_enum != PT_TYPE_INTEGER))
20339 if (typ == PT_TYPE_BIT || typ == PT_TYPE_VARBIT)
20341 PT_ERRORmf (this_parser, len, MSGCAT_SET_PARSER_SYNTAX,
20342 MSGCAT_SYNTAX_MAX_BITLEN, maxlen);
20346 PT_ERRORmf (this_parser, len, MSGCAT_SET_PARSER_SYNTAX,
20347 MSGCAT_SYNTAX_MAX_BYTELEN, maxlen);
20351 l = (l > maxlen ? maxlen : l);
20358 case PT_TYPE_NCHAR:
20363 case PT_TYPE_VARCHAR:
20364 l = DB_MAX_VARCHAR_PRECISION;
20367 case PT_TYPE_VARNCHAR:
20368 l = DB_MAX_VARNCHAR_PRECISION;
20371 case PT_TYPE_VARBIT:
20372 l = DB_MAX_VARBIT_PRECISION;
20380 dt = parser_new_node (this_parser, PT_DATA_TYPE);
20383 int coll_id, charset;
20385 dt->type_enum = typ;
20386 dt->info.data_type.precision = l;
20390 case PT_TYPE_VARCHAR:
20391 case PT_TYPE_NCHAR:
20392 case PT_TYPE_VARNCHAR:
20393 if (pt_check_grammar_charset_collation
20394 (this_parser, charset_node,
20395 coll_node, &charset, &coll_id) == NO_ERROR)
20397 dt->info.data_type.units = charset;
20398 dt->info.data_type.collation_id = coll_id;
20402 dt->info.data_type.units = -1;
20403 dt->info.data_type.collation_id = -1;
20408 dt->info.data_type.has_cs_spec = true;
20412 dt->info.data_type.has_cs_spec = false;
20417 dt->info.data_type.has_coll_spec = true;
20421 dt->info.data_type.has_coll_spec = false;
20427 case PT_TYPE_VARBIT:
20428 dt->info.data_type.units = INTL_CODESET_RAW_BITS;
20436 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
20439 parser_free_node (this_parser, len);
20443 parser_free_node (this_parser, charset_node);
20448 parser_free_node (this_parser, coll_node);
20452 | NUMERIC opt_prec_2
20457 PT_NODE *prec, *scale, *dt;
20458 prec = CONTAINER_AT_0 ($2);
20459 scale = CONTAINER_AT_1 ($2);
20461 dt = parser_new_node (this_parser, PT_DATA_TYPE);
20462 typ = PT_TYPE_NUMERIC;
20466 dt->type_enum = typ;
20467 dt->info.data_type.precision = prec ? prec->info.value.data_value.i : 15;
20468 dt->info.data_type.dec_precision =
20469 scale ? scale->info.value.data_value.i : 0;
20472 if (scale->info.value.data_value.i > prec->info.value.data_value.i)
20474 PT_ERRORmf2 (this_parser, dt,
20475 MSGCAT_SET_PARSER_SEMANTIC,
20476 MSGCAT_SEMANTIC_INV_PREC_SCALE,
20477 prec->info.value.data_value.i,
20478 scale->info.value.data_value.i);
20481 if (prec->info.value.data_value.i > DB_MAX_NUMERIC_PRECISION)
20483 PT_ERRORmf2 (this_parser, dt,
20484 MSGCAT_SET_PARSER_SEMANTIC,
20485 MSGCAT_SEMANTIC_PREC_TOO_BIG,
20486 prec->info.value.data_value.i,
20487 DB_MAX_NUMERIC_PRECISION);
20491 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
20495 parser_free_node (this_parser, prec);
20497 parser_free_node (this_parser, scale);
20500 | FLOAT_ opt_prec_1
20505 PT_NODE *prec, *dt = NULL;
20509 prec->info.value.data_value.i >= 8 &&
20510 prec->info.value.data_value.i <= DB_MAX_NUMERIC_PRECISION)
20512 typ = PT_TYPE_DOUBLE;
20516 dt = parser_new_node (this_parser, PT_DATA_TYPE);
20517 typ = PT_TYPE_FLOAT;
20521 dt->type_enum = typ;
20522 dt->info.data_type.precision =
20523 prec ? prec->info.value.data_value.i : 7;
20524 dt->info.data_type.dec_precision = 0;
20527 if (prec->info.value.data_value.i > DB_MAX_NUMERIC_PRECISION)
20529 PT_ERRORmf2 (this_parser, dt,
20530 MSGCAT_SET_PARSER_SEMANTIC,
20531 MSGCAT_SEMANTIC_PREC_TOO_BIG,
20532 prec->info.value.data_value.i,
20533 DB_MAX_NUMERIC_PRECISION);
20539 SET_CONTAINER_2 (ctn, FROM_NUMBER (typ), dt);
20543 parser_free_node (this_parser, prec);
20546 | ENUM '(' char_string_literal_list ')' opt_charset opt_collation
20556 PT_NODE *charset_node = $5;
20557 PT_NODE *coll_node = $6;
20558 PT_NODE *elem_list = $3;
20559 PT_NODE *dt, *elem;
20562 while (elem != NULL)
20564 if (elem->data_type == NULL)
20570 assert (elem->node_type == PT_VALUE);
20571 elem->info.value.print_charset = false;
20573 elem_cs = elem->data_type->info.data_type.units;
20574 if (elem->info.value.has_cs_introducer)
20580 else if (list_cs != elem_cs)
20582 PT_ERRORm (this_parser, elem,
20583 MSGCAT_SET_PARSER_SEMANTIC,
20584 MSGCAT_SEMANTIC_INCOMPATIBLE_CS_COLL);
20592 dt = parser_new_node (this_parser, PT_DATA_TYPE);
20594 if (!has_error && dt != NULL)
20596 dt->type_enum = PT_TYPE_ENUMERATION;
20597 dt->info.data_type.enumeration = elem_list;
20599 if (charset_node == NULL && coll_node == NULL)
20603 charset = LANG_SYS_CODESET;
20609 coll_id = LANG_GET_BINARY_COLLATION (charset);
20610 dt->info.data_type.has_cs_spec = false;
20611 dt->info.data_type.has_coll_spec = false;
20613 else if (pt_check_grammar_charset_collation (
20614 this_parser, charset_node,
20615 coll_node, &charset,
20616 &coll_id) == NO_ERROR)
20620 dt->info.data_type.has_cs_spec = true;
20624 dt->info.data_type.has_cs_spec = false;
20628 dt->info.data_type.has_coll_spec = true;
20632 dt->info.data_type.has_coll_spec = false;
20638 dt->info.data_type.units = -1;
20639 dt->info.data_type.collation_id = -1;
20644 dt->info.data_type.units = charset;
20645 dt->info.data_type.collation_id = coll_id;
20649 PARSER_SAVE_ERR_CONTEXT (dt, @3.buffer_pos)
20651 SET_CONTAINER_2 (ctn, FROM_NUMBER (PT_TYPE_ENUMERATION), dt);
20657 opt_internal_external
20667 $$ = PT_LOB_INTERNAL;
20673 $$ = PT_LOB_EXTERNAL;
20700 | '(' unsigned_integer ')'
20715 | '(' unsigned_integer ')'
20728 SET_CONTAINER_2 (ctn, NULL, NULL);
20732 | '(' unsigned_integer ')'
20736 SET_CONTAINER_2 (ctn, $2, NULL);
20740 | '(' unsigned_integer ',' unsigned_integer ')'
20744 SET_CONTAINER_2 (ctn, $2, $4);
20771 : COLLATE char_string_literal
20781 node = parser_new_node (this_parser, PT_VALUE);
20785 node->type_enum = PT_TYPE_CHAR;
20786 node->info.value.string_type = ' ';
20787 node->info.value.data_value.str =
20788 pt_append_bytes (this_parser, NULL, "binary", strlen ("binary"));
20789 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
20798 node = parser_new_node (this_parser, PT_VALUE);
20802 node->type_enum = PT_TYPE_CHAR;
20803 node->info.value.string_type = ' ';
20804 node->info.value.data_value.str =
20805 pt_append_bytes (this_parser, NULL, $2, strlen ($2));
20806 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
20814 : ENCRYPT opt_equalsign opt_encrypt_algorithm
20816 PT_NODE *node = NULL;
20818 node = parser_new_node (this_parser, PT_VALUE);
20822 node->type_enum = PT_TYPE_INTEGER;
20823 node->info.value.data_value.i = $3;
20824 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
20832 : COMMENT opt_equalsign char_string_literal
20834 PT_NODE *node = $3;
20838 node->type_enum = PT_TYPE_VARCHAR;
20840 if (node->info.value.data_value.str->length >
20841 SM_MAX_CLASS_COMMENT_LENGTH)
20843 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
20844 MSGCAT_SYNTAX_MAX_CLASS_COMMENT_LEN,
20845 SM_MAX_CLASS_COMMENT_LENGTH);
20847 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
20854 opt_of_column_attribute /* 3 */
20855 { parser_attr_type = PT_NORMAL; } /* 4 */
20856 attr_def_comment_list /* 5 */
20858 PT_NODE *alter_node = parser_get_alter_node();
20860 if (alter_node != NULL)
20862 alter_node->info.alter.code = PT_CHANGE_COLUMN_COMMENT;
20863 alter_node->info.alter.alter_clause.attr_mthd.attr_def_list = $5;
20868 CLASS ATTRIBUTE /* 3, 4 */
20869 { parser_attr_type = PT_META_ATTR; } /* 5 */
20870 attr_def_comment_list /* 6 */
20872 PT_NODE *alter_node = parser_get_alter_node();
20874 if (alter_node != NULL)
20876 alter_node->info.alter.code = PT_CHANGE_COLUMN_COMMENT;
20877 alter_node->info.alter.alter_clause.attr_mthd.attr_def_list = $6;
20882 opt_vclass_comment_spec
20885 | class_comment_spec
20894 opt_encrypt_algorithm
20896 { $$ = -1; } /* default algorithm from the system parameter */
20898 { $$ = 1; } /* TDE_ALGORITHM_AES */
20900 { $$ = 2; } /* TDE_ALGORITHM_ARIA */
20906 | COMMENT comment_value
20911 : char_string_literal
20913 PT_NODE *node = $1;
20917 node->type_enum = PT_TYPE_VARCHAR;
20919 if (node->info.value.data_value.str->length >
20920 SM_MAX_COMMENT_LENGTH)
20922 PT_ERRORmf (this_parser, node, MSGCAT_SET_PARSER_SYNTAX,
20923 MSGCAT_SYNTAX_MAX_COMMENT_LEN,
20924 SM_MAX_COMMENT_LENGTH);
20926 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
20949 : of_charset char_string_literal
20955 | of_charset BINARY
20959 node = parser_new_node (this_parser, PT_VALUE);
20963 node->type_enum = PT_TYPE_CHAR;
20964 node->info.value.string_type = ' ';
20965 node->info.value.data_value.str =
20966 pt_append_bytes (this_parser, NULL, "binary", strlen ("binary"));
20967 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
20972 | of_charset IdName
20976 node = parser_new_node (this_parser, PT_VALUE);
20980 node->type_enum = PT_TYPE_CHAR;
20981 node->info.value.string_type = ' ';
20982 node->info.value.data_value.str =
20983 pt_append_bytes (this_parser, NULL, $2, strlen ($2));
20984 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
20995 int charset = lang_get_client_charset ();
20998 node = parser_new_node (this_parser, PT_VALUE);
21001 node->type_enum = PT_TYPE_INTEGER;
21002 node->info.value.data_value.i = charset;
21006 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21009 | USING char_string_literal
21012 PT_NODE *charset_node = $2;
21014 int charset = lang_get_client_charset ();
21019 if (pt_check_grammar_charset_collation
21020 (this_parser, charset_node, NULL, &charset, &dummy) == 0)
21022 parser_free_node (this_parser, charset_node);
21025 node = parser_new_node (this_parser, PT_VALUE);
21028 node->type_enum = PT_TYPE_INTEGER;
21029 node->info.value.data_value.i = charset;
21033 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21039 PT_NODE *temp_node = NULL;
21041 int charset = lang_charset ();
21044 temp_node = parser_new_node (this_parser, PT_VALUE);
21048 temp_node->type_enum = PT_TYPE_CHAR;
21049 temp_node->info.value.string_type = ' ';
21050 temp_node->info.value.data_value.str =
21051 pt_append_bytes (this_parser, NULL, $2, strlen ($2));
21052 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, temp_node);
21057 if (pt_check_grammar_charset_collation
21058 (this_parser, temp_node, NULL, &charset, &dummy) == 0)
21060 parser_free_node (this_parser, temp_node);
21064 node = parser_new_node (this_parser, PT_VALUE);
21067 node->type_enum = PT_TYPE_INTEGER;
21068 node->info.value.data_value.i = charset;
21072 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21080 node = parser_new_node (this_parser, PT_VALUE);
21083 node->type_enum = PT_TYPE_INTEGER;
21084 node->info.value.data_value.i = INTL_CODESET_BINARY;
21088 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21103 $$ = PT_TYPE_MULTISET;
21109 $$ = PT_TYPE_SEQUENCE;
21112 | of_container opt_of
21130 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21133 | '-' unsigned_integer
21136 PT_NODE *node = $2;
21139 if (node->type_enum == PT_TYPE_BIGINT)
21141 node->info.value.data_value.bigint
21142 = -node->info.value.data_value.bigint;
21144 else if (node->type_enum == PT_TYPE_NUMERIC)
21146 const char *min_big_int = "9223372036854775808";
21147 if (node->info.value.data_value.str->length == 19
21148 && (strcmp ((const char *) node->info.value.data_value.str->bytes,
21149 min_big_int) == 0))
21151 node->info.value.data_value.bigint = DB_BIGINT_MIN;
21152 node->type_enum = PT_TYPE_BIGINT;
21158 PARSER_VARCHAR *buf = 0;
21159 minus_sign = pt_append_string (this_parser, NULL, "-");
21160 buf = pt_append_nulstring (this_parser, buf,
21162 buf = pt_append_nulstring (this_parser, buf,
21163 (const char *) node->info.value.data_value.str->bytes);
21164 node->info.value.data_value.str = buf;
21169 node->info.value.data_value.i = -node->info.value.data_value.i;
21172 node->info.value.text = NULL;
21173 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
21177 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21180 | '-' unsigned_real
21183 /* not allowed partition type */
21184 /* this will cause semantic error */
21185 PT_NODE *node = $2;
21188 if (node->type_enum == PT_TYPE_FLOAT)
21190 node->info.value.data_value.f = -node->info.value.data_value.f;
21192 else if (node->type_enum == PT_TYPE_DOUBLE)
21194 node->info.value.data_value.d = -node->info.value.data_value.d;
21199 PARSER_VARCHAR *buf = 0;
21201 assert (node->type_enum == PT_TYPE_NUMERIC);
21202 minus_sign = pt_append_string (this_parser, NULL, "-");
21204 buf = pt_append_nulstring (this_parser, buf,
21206 buf = pt_append_nulstring (this_parser, buf,
21207 (const char *) node->info.value.data_value.str->bytes);
21208 node->info.value.data_value.str = buf;
21211 node->info.value.text = NULL;
21212 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
21216 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21219 | '-' monetary_literal
21222 /* not allowed partition type */
21223 /* this will cause semantic error */
21225 PT_NODE *node = $2;
21229 assert (node->type_enum == PT_TYPE_MONETARY);
21230 node->info.value.data_value.money.amount =
21231 - node->info.value.data_value.money.amount;
21232 node->info.value.text = NULL;
21233 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
21237 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21243 : literal_w_o_param
21247 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21254 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21264 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21271 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21278 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21281 | char_string_literal
21284 PT_NODE *node = $1;
21286 pt_value_set_collation_info (this_parser, node, NULL);
21289 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21292 | bit_string_literal
21296 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21303 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21309 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
21311 node->type_enum = PT_TYPE_NULL;
21313 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21320 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21326 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
21328 node->type_enum = PT_TYPE_NA;
21330 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21333 | date_or_time_literal
21337 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21344 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21351 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21359 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
21362 node->info.value.text = "true";
21363 node->info.value.data_value.i = 1;
21364 node->type_enum = PT_TYPE_LOGICAL;
21367 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21373 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
21376 node->info.value.text = "false";
21377 node->info.value.data_value.i = 0;
21378 node->type_enum = PT_TYPE_LOGICAL;
21381 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21387 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
21389 node->type_enum = PT_TYPE_NULL;
21391 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21397 : opt_of_container '{' expression_list '}'
21400 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
21405 node->info.value.data_value.set = $3;
21406 node->type_enum = $1;
21408 for (e = node->info.value.data_value.set; e; e = e->next)
21410 if (e->type_enum == PT_TYPE_STAR)
21412 PT_ERRORf (this_parser, e,
21413 "check syntax at %s, illegal '*' expression.",
21414 pt_short_print (this_parser, e));
21422 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21425 | opt_of_container '{' '}'
21428 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
21432 node->info.value.data_value.set = 0;
21433 node->type_enum = $1;
21437 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21446 $$ = PT_TYPE_SEQUENCE;
21467 $$ = PT_TYPE_MULTISET;
21473 $$ = PT_TYPE_SEQUENCE;
21479 $$ = PT_TYPE_SEQUENCE;
21485 : identifier_list ',' identifier
21488 $$ = parser_make_link ($1, $3);
21489 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21496 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21501 opt_bracketed_identifier_list
21506 | '(' identifier_list ')'
21512 simple_path_id_list
21513 : simple_path_id_list ',' simple_path_id
21516 $$ = parser_make_link ($1, $3);
21517 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21524 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21531 {{//identifier : IdName
21532 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21537 char *str_name = $1;
21539 size_in = strlen(str_name);
21541 PARSER_SAVE_ERR_CONTEXT (p, @$.buffer_pos)
21542 str_name = pt_check_identifier (this_parser, p,
21543 str_name, size_in);
21544 p->info.name.original = str_name;
21549 | BracketDelimitedIdName
21550 {{//identifier | BracketDelimitedIdName
21551 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21556 char *str_name = $1;
21558 size_in = strlen(str_name);
21560 PARSER_SAVE_ERR_CONTEXT (p, @$.buffer_pos)
21561 str_name = pt_check_identifier (this_parser, p,
21562 str_name, size_in);
21563 p->info.name.original = str_name;
21568 | BacktickDelimitedIdName
21569 {{//identifier | BacktickDelimitedIdName
21570 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21575 char *str_name = $1;
21577 size_in = strlen(str_name);
21579 PARSER_SAVE_ERR_CONTEXT (p, @$.buffer_pos)
21580 str_name = pt_check_identifier (this_parser, p,
21581 str_name, size_in);
21582 p->info.name.original = str_name;
21588 {{//identifier | DelimitedIdName
21589 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21594 char *str_name = $1;
21596 size_in = strlen(str_name);
21598 PARSER_SAVE_ERR_CONTEXT (p, @$.buffer_pos)
21599 str_name = pt_check_identifier (this_parser, p,
21600 str_name, size_in);
21601 p->info.name.original = str_name;
21610 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21612 p->info.name.original = $1;
21614 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21620 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21622 p->info.name.original = $1;
21624 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21630 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21632 p->info.name.original = $1;
21634 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21640 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21642 p->info.name.original = $1;
21644 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21650 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21652 p->info.name.original = $1;
21654 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21660 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21662 p->info.name.original = $1;
21664 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21670 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21672 p->info.name.original = $1;
21674 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21680 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21682 p->info.name.original = $1;
21684 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21690 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21692 p->info.name.original = $1;
21694 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21700 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21702 p->info.name.original = $1;
21704 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21710 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21712 p->info.name.original = $1;
21714 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21720 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21722 p->info.name.original = $1;
21724 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21730 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21732 p->info.name.original = $1;
21734 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21740 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21742 p->info.name.original = $1;
21744 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21750 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21752 p->info.name.original = $1;
21754 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21760 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21762 p->info.name.original = $1;
21764 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21769 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21771 p->info.name.original = $1;
21773 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21778 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21781 p->info.name.original = $1;
21784 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21790 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21792 p->info.name.original = $1;
21794 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21800 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21802 p->info.name.original = $1;
21804 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21810 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21812 p->info.name.original = $1;
21814 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21820 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21822 p->info.name.original = $1;
21824 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21830 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21832 p->info.name.original = $1;
21834 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21840 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21842 p->info.name.original = $1;
21844 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21850 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21852 p->info.name.original = $1;
21854 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21860 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21862 p->info.name.original = $1;
21864 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21870 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21872 p->info.name.original = $1;
21874 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21880 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21882 p->info.name.original = $1;
21884 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21890 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21892 p->info.name.original = $1;
21894 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21900 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21902 p->info.name.original = $1;
21904 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21910 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21912 p->info.name.original = $1;
21914 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21920 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21922 p->info.name.original = $1;
21924 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21930 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21932 p->info.name.original = $1;
21934 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21940 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21942 p->info.name.original = $1;
21944 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21950 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21952 p->info.name.original = $1;
21954 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21960 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21962 p->info.name.original = $1;
21964 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21970 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21972 p->info.name.original = $1;
21974 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21980 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21982 p->info.name.original = $1;
21984 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
21990 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
21992 p->info.name.original = $1;
21994 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22000 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22002 p->info.name.original = $1;
22004 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22010 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22012 p->info.name.original = $1;
22014 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22020 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22022 p->info.name.original = $1;
22024 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22030 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22032 p->info.name.original = $1;
22034 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22040 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22042 p->info.name.original = $1;
22044 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22049 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22051 p->info.name.original = $1;
22053 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22058 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22060 p->info.name.original = $1;
22062 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22069 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22071 p->info.name.original = $1;
22073 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22080 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22082 p->info.name.original = $1;
22084 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22090 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22092 p->info.name.original = $1;
22094 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22097 | JSON_ARRAY_APPEND
22100 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22102 p->info.name.original = $1;
22104 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22107 | JSON_ARRAY_INSERT
22110 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22112 p->info.name.original = $1;
22114 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22120 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22122 p->info.name.original = $1;
22124 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22127 | JSON_CONTAINS_PATH
22130 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22132 p->info.name.original = $1;
22134 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22140 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22142 p->info.name.original = $1;
22144 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22150 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22152 p->info.name.original = $1;
22154 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22157 | JSON_GET_ALL_PATHS
22160 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22162 p->info.name.original = $1;
22164 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22170 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22172 p->info.name.original = $1;
22174 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22180 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22182 p->info.name.original = $1;
22184 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22190 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22192 p->info.name.original = $1;
22194 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22200 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22202 p->info.name.original = $1;
22204 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22210 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22212 p->info.name.original = $1;
22214 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22217 | JSON_MERGE_PRESERVE
22220 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22222 p->info.name.original = $1;
22224 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22230 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22232 p->info.name.original = $1;
22234 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22240 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22242 p->info.name.original = $1;
22244 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22250 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22252 p->info.name.original = $1;
22254 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22260 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22262 p->info.name.original = $1;
22264 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22270 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22272 p->info.name.original = $1;
22274 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22280 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22282 p->info.name.original = $1;
22284 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22290 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22292 p->info.name.original = $1;
22294 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22300 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22302 p->info.name.original = $1;
22304 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22310 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22312 p->info.name.original = $1;
22314 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22320 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22322 p->info.name.original = $1;
22324 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22330 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22332 p->info.name.original = $1;
22334 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22340 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22342 p->info.name.original = $1;
22344 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22350 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22352 p->info.name.original = $1;
22354 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22360 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22362 p->info.name.original = $1;
22364 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22370 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22372 p->info.name.original = $1;
22374 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22380 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22382 p->info.name.original = $1;
22384 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22390 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22392 p->info.name.original = $1;
22394 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22400 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22402 p->info.name.original = $1;
22404 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22410 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22412 p->info.name.original = $1;
22414 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22420 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22422 p->info.name.original = $1;
22424 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22430 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22432 p->info.name.original = $1;
22434 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22440 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22442 p->info.name.original = $1;
22444 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22450 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22452 p->info.name.original = $1;
22454 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22460 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22462 p->info.name.original = $1;
22464 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22470 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22472 p->info.name.original = $1;
22474 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22480 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22482 p->info.name.original = $1;
22484 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22490 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22492 p->info.name.original = $1;
22494 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22500 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22502 p->info.name.original = $1;
22504 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22510 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22512 p->info.name.original = $1;
22514 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22520 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22522 p->info.name.original = $1;
22524 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22530 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22532 p->info.name.original = $1;
22534 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22540 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22542 p->info.name.original = $1;
22544 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22550 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22552 p->info.name.original = $1;
22554 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22560 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22563 p->info.name.original = $1;
22566 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22572 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22574 p->info.name.original = $1;
22576 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22582 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22584 p->info.name.original = $1;
22586 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22592 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22594 p->info.name.original = $1;
22596 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22602 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22604 p->info.name.original = $1;
22606 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22612 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22614 p->info.name.original = $1;
22616 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22622 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22624 p->info.name.original = $1;
22626 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22632 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22634 p->info.name.original = $1;
22636 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22642 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22644 p->info.name.original = $1;
22646 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22652 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22654 p->info.name.original = $1;
22656 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22662 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22664 p->info.name.original = $1;
22666 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22672 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22674 p->info.name.original = $1;
22676 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22682 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22684 p->info.name.original = $1;
22686 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22692 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22694 p->info.name.original = $1;
22696 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22702 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22704 p->info.name.original = $1;
22706 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22712 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22714 p->info.name.original = $1;
22716 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22722 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22724 p->info.name.original = $1;
22726 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22732 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22734 p->info.name.original = $1;
22736 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22742 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22744 p->info.name.original = $1;
22746 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22752 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22754 p->info.name.original = $1;
22756 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22762 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22764 p->info.name.original = $1;
22766 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22772 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22774 p->info.name.original = $1;
22776 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22782 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22784 p->info.name.original = $1;
22786 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22792 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22794 p->info.name.original = $1;
22796 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22802 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22804 p->info.name.original = $1;
22806 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22812 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22814 p->info.name.original = $1;
22816 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22822 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22824 p->info.name.original = $1;
22826 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22832 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22834 p->info.name.original = $1;
22836 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22842 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22844 p->info.name.original = $1;
22846 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22852 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22854 p->info.name.original = $1;
22856 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22862 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22864 p->info.name.original = $1;
22866 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22872 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22874 p->info.name.original = $1;
22881 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22883 p->info.name.original = $1;
22885 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22891 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22893 p->info.name.original = $1;
22895 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22901 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22903 p->info.name.original = $1;
22905 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22911 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22913 p->info.name.original = $1;
22915 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22921 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22923 p->info.name.original = $1;
22925 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22931 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22933 p->info.name.original = $1;
22935 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22941 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22943 p->info.name.original = $1;
22945 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22951 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22953 p->info.name.original = $1;
22955 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22961 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22963 p->info.name.original = $1;
22965 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22971 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22973 p->info.name.original = $1;
22975 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22980 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22982 p->info.name.original = $1;
22984 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22989 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
22991 p->info.name.original = $1;
22993 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
22999 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23001 p->info.name.original = $1;
23003 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23009 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23011 p->info.name.original = $1;
23013 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23019 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23021 p->info.name.original = $1;
23023 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23029 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23031 p->info.name.original = $1;
23033 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23039 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23041 p->info.name.original = $1;
23043 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23049 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23051 p->info.name.original = $1;
23053 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23059 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23061 p->info.name.original = $1;
23063 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23069 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23071 p->info.name.original = $1;
23073 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23079 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23081 p->info.name.original = $1;
23083 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23089 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23091 p->info.name.original = $1;
23093 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23099 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23101 p->info.name.original = $1;
23103 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23109 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23111 p->info.name.original = $1;
23113 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23119 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23121 p->info.name.original = $1;
23123 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23129 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23131 p->info.name.original = $1;
23133 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23139 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23141 p->info.name.original = $1;
23143 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23149 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23151 p->info.name.original = $1;
23153 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23160 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23163 p->info.name.original = $1;
23167 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23173 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23176 p->info.name.original = $1;
23180 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23186 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23189 p->info.name.original = $1;
23193 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23199 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23202 p->info.name.original = $1;
23206 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23212 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23215 p->info.name.original = $1;
23219 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23225 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23228 p->info.name.original = $1;
23232 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23238 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23241 p->info.name.original = $1;
23245 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23251 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23254 p->info.name.original = $1;
23258 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23264 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23267 p->info.name.original = $1;
23271 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23277 PT_NODE *p = parser_new_node (this_parser, PT_NAME);
23280 p->info.name.original = $1;
23284 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23290 : string_literal_or_input_hv
23293 PT_NODE *node = $1;
23295 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23301 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
23303 node->type_enum = PT_TYPE_NULL;
23305 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23310 string_literal_or_input_hv
23311 : char_string_literal
23314 PT_NODE *node = $1;
23316 pt_value_set_collation_info (this_parser, node, NULL);
23319 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23326 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23332 char_string_literal
23333 : char_string_literal CHAR_STRING
23339 str->info.value.data_value.str =
23340 pt_append_bytes (this_parser, str->info.value.data_value.str, $2,
23342 str->info.value.text = NULL;
23343 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, str);
23347 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23354 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23363 PT_NODE *node = NULL;
23364 PT_TYPE_ENUM typ = PT_TYPE_CHAR;
23365 INTL_CODESET charset;
23369 if (lang_get_parser_use_client_charset ())
23371 charset = lang_get_client_charset ();
23372 collation_id = lang_get_client_collation ();
23377 charset = LANG_SYS_CODESET;
23378 collation_id = LANG_SYS_COLLATION;
23382 node = pt_create_char_string_literal (this_parser,
23388 pt_value_set_charset_coll (this_parser, node,
23389 charset, collation_id,
23391 node->info.value.has_cs_introducer = force;
23395 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23400 PT_NODE *node = NULL;
23401 INTL_CODESET charset;
23405 if (lang_get_parser_use_client_charset ())
23407 charset = lang_get_client_charset ();
23408 collation_id = lang_get_client_collation ();
23413 charset = LANG_SYS_CODESET;
23414 collation_id = LANG_SYS_COLLATION;
23418 node = pt_create_char_string_literal (this_parser,
23422 if (node && lang_get_parser_use_client_charset ())
23424 pt_value_set_charset_coll (this_parser, node,
23425 charset, collation_id,
23427 node->info.value.has_cs_introducer = force;
23431 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23437 PT_NODE *node = NULL;
23439 node = pt_create_char_string_literal (this_parser, PT_TYPE_CHAR,
23440 $1, INTL_CODESET_RAW_BYTES);
23444 pt_value_set_charset_coll (this_parser, node,
23445 INTL_CODESET_RAW_BYTES,
23448 node->info.value.has_cs_introducer = true;
23452 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23458 PT_NODE *node = NULL;
23460 node = pt_create_char_string_literal (this_parser, PT_TYPE_CHAR,
23461 $1, INTL_CODESET_KSC5601_EUC);
23465 pt_value_set_charset_coll (this_parser, node,
23466 INTL_CODESET_KSC5601_EUC,
23467 LANG_COLL_EUCKR_BINARY,
23469 node->info.value.has_cs_introducer = true;
23473 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23479 PT_NODE *node = NULL;
23481 node = pt_create_char_string_literal (this_parser, PT_TYPE_CHAR,
23482 $1, INTL_CODESET_ISO88591);
23486 pt_value_set_charset_coll (this_parser, node,
23487 INTL_CODESET_ISO88591,
23488 LANG_COLL_ISO_BINARY,
23490 node->info.value.has_cs_introducer = true;
23494 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23500 PT_NODE *node = NULL;
23502 node = pt_create_char_string_literal (this_parser, PT_TYPE_CHAR,
23503 $1, INTL_CODESET_UTF8);
23507 pt_value_set_charset_coll (this_parser, node,
23509 LANG_COLL_UTF8_BINARY,
23511 node->info.value.has_cs_introducer = true;
23515 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23522 : bit_string_literal CHAR_STRING
23528 str->info.value.data_value.str =
23529 pt_append_bytes (this_parser, str->info.value.data_value.str, $2,
23531 str->info.value.text = NULL;
23532 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, str);
23536 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23543 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23552 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
23556 node->type_enum = PT_TYPE_BIT;
23557 node->info.value.string_type = 'B';
23558 node->info.value.data_value.str =
23559 pt_append_bytes (this_parser, NULL, $1, strlen ($1));
23560 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
23564 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23570 PT_NODE *node = parser_new_node (this_parser, PT_VALUE);
23574 node->type_enum = PT_TYPE_BIT;
23575 node->info.value.string_type = 'X';
23576 node->info.value.data_value.str =
23577 pt_append_bytes (this_parser, NULL, $1, strlen ($1));
23578 PT_NODE_PRINT_VALUE_TO_TEXT (this_parser, node);
23582 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23591 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23594 val->info.value.text = $1;
23596 if ((strlen (val->info.value.text) <= 9) ||
23597 (strlen (val->info.value.text) == 10 &&
23598 (val->info.value.text[0] == '0' || val->info.value.text[0] == '1')))
23600 val->info.value.data_value.i = atol ($1);
23601 val->type_enum = PT_TYPE_INTEGER;
23603 else if ((strlen (val->info.value.text) <= 18) ||
23604 (strlen (val->info.value.text) == 19 &&
23605 (val->info.value.text[0] >= '0' &&
23606 val->info.value.text[0] <= '8')))
23608 val->info.value.data_value.bigint = atoll ($1);
23609 val->type_enum = PT_TYPE_BIGINT;
23613 const char *max_big_int = "9223372036854775807";
23615 if ((strlen (val->info.value.text) == 19) &&
23616 (strcmp (val->info.value.text, max_big_int) <= 0))
23618 val->info.value.data_value.bigint = atoll ($1);
23619 val->type_enum = PT_TYPE_BIGINT;
23623 val->type_enum = PT_TYPE_NUMERIC;
23624 val->info.value.data_value.str =
23625 pt_append_bytes (this_parser, NULL,
23626 val->info.value.text,
23634 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23647 val = parser_new_node (this_parser, PT_VALUE);
23650 result = parse_int (&int_val, $1, 10);
23653 PT_ERRORmf (this_parser, val, MSGCAT_SET_PARSER_SYNTAX,
23654 MSGCAT_SYNTAX_INVALID_UNSIGNED_INT32, $1);
23657 val->info.value.data_value.i = int_val;
23658 val->type_enum = PT_TYPE_INTEGER;
23661 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23671 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23675 if (strchr ($1, 'E') != NULL || strchr ($1, 'e') != NULL)
23679 dval = strtod ($1, NULL);
23680 if (errno == ERANGE)
23682 PT_ERRORmf2 (this_parser, val, MSGCAT_SET_PARSER_SYNTAX,
23683 MSGCAT_SYNTAX_FLT_DBL_OVERFLOW, $1, pt_show_type_enum (PT_TYPE_DOUBLE));
23685 val->info.value.text = $1;
23686 val->type_enum = PT_TYPE_DOUBLE;
23687 val->info.value.data_value.d = dval;
23689 else if (strchr ($1, 'F') != NULL || strchr ($1, 'f') != NULL)
23693 dval = strtod ($1, NULL);
23694 if (errno == ERANGE || (dval > FLT_MAX || dval < FLT_MIN))
23696 PT_ERRORmf2 (this_parser, val, MSGCAT_SET_PARSER_SYNTAX,
23697 MSGCAT_SYNTAX_FLT_DBL_OVERFLOW, $1, pt_show_type_enum (PT_TYPE_FLOAT));
23699 val->info.value.text = $1;
23700 val->type_enum = PT_TYPE_FLOAT;
23701 val->info.value.data_value.f = (float) dval;
23705 val->info.value.text = $1;
23706 val->type_enum = PT_TYPE_NUMERIC;
23707 val->info.value.data_value.str =
23708 pt_append_bytes (this_parser, NULL,
23709 val->info.value.text,
23710 strlen (val->info.value.
23716 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23722 : YEN_SIGN of_integer_real_literal
23726 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23728 str = pt_append_string (this_parser, NULL, YEN_SIGN_TEXT);
23733 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_YEN);
23737 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23740 | DOLLAR_SIGN of_integer_real_literal
23744 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23746 str = pt_append_string (this_parser, NULL, DOLLAR_SIGN_TEXT);
23751 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_DOLLAR);
23755 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23758 | WON_SIGN of_integer_real_literal
23762 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23764 str = pt_append_string (this_parser, NULL, WON_SIGN_TEXT);
23769 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_WON);
23773 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23776 | TURKISH_LIRA_SIGN of_integer_real_literal
23780 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23782 str = pt_append_string (this_parser, NULL, TURKISH_LIRA_TEXT);
23787 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_TL);
23791 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
23794 | BRITISH_POUND_SIGN of_integer_real_literal
23798 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23800 str = pt_append_string (this_parser, NULL, BRITISH_POUND_TEXT);
23805 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_BRITISH_POUND);
23811 | CAMBODIAN_RIEL_SIGN of_integer_real_literal
23815 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23817 str = pt_append_string (this_parser, NULL, CAMBODIAN_RIEL_TEXT);
23822 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_CAMBODIAN_RIEL);
23828 | CHINESE_RENMINBI_SIGN of_integer_real_literal
23832 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23834 str = pt_append_string (this_parser, NULL, CHINESE_RENMINBI_TEXT);
23839 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_CHINESE_RENMINBI);
23845 | INDIAN_RUPEE_SIGN of_integer_real_literal
23849 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23851 str = pt_append_string (this_parser, NULL, INDIAN_RUPEE_TEXT);
23856 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_INDIAN_RUPEE);
23862 | RUSSIAN_RUBLE_SIGN of_integer_real_literal
23866 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23868 str = pt_append_string (this_parser, NULL, RUSSIAN_RUBLE_TEXT);
23873 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_RUSSIAN_RUBLE);
23879 | AUSTRALIAN_DOLLAR_SIGN of_integer_real_literal
23883 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23885 str = pt_append_string (this_parser, NULL, AUSTRALIAN_DOLLAR_TEXT);
23890 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_AUSTRALIAN_DOLLAR);
23896 | CANADIAN_DOLLAR_SIGN of_integer_real_literal
23900 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23902 str = pt_append_string (this_parser, NULL, CANADIAN_DOLLAR_TEXT);
23907 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_CANADIAN_DOLLAR);
23913 | BRASILIAN_REAL_SIGN of_integer_real_literal
23917 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23919 str = pt_append_string (this_parser, NULL, BRASILIAN_REAL_TEXT);
23924 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_BRASILIAN_REAL);
23930 | ROMANIAN_LEU_SIGN of_integer_real_literal
23934 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23936 str = pt_append_string (this_parser, NULL, ROMANIAN_LEU_TEXT);
23941 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_ROMANIAN_LEU);
23947 | EURO_SIGN of_integer_real_literal
23951 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23953 str = pt_append_string (this_parser, NULL, EURO_TEXT);
23958 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_EURO);
23964 | SWISS_FRANC_SIGN of_integer_real_literal
23968 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23970 str = pt_append_string (this_parser, NULL, SWISS_FRANC_TEXT);
23975 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_SWISS_FRANC);
23981 | DANISH_KRONE_SIGN of_integer_real_literal
23985 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
23987 str = pt_append_string (this_parser, NULL, DANISH_KRONE_TEXT);
23992 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_DANISH_KRONE);
23998 | NORWEGIAN_KRONE_SIGN of_integer_real_literal
24002 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24004 str = pt_append_string (this_parser, NULL, NORWEGIAN_KRONE_TEXT);
24009 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_NORWEGIAN_KRONE);
24015 | BULGARIAN_LEV_SIGN of_integer_real_literal
24019 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24021 str = pt_append_string (this_parser, NULL, BULGARIAN_LEV_TEXT);
24026 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_BULGARIAN_LEV);
24032 | VIETNAMESE_DONG_SIGN of_integer_real_literal
24036 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24038 str = pt_append_string (this_parser, NULL, VIETNAMESE_DONG_TEXT);
24043 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_VIETNAMESE_DONG);
24049 | CZECH_KORUNA_SIGN of_integer_real_literal
24053 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24055 str = pt_append_string (this_parser, NULL, CZECH_KORUNA_TEXT);
24060 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_CZECH_KORUNA);
24066 | POLISH_ZLOTY_SIGN of_integer_real_literal
24070 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24072 str = pt_append_string (this_parser, NULL, POLISH_ZLOTY_TEXT);
24077 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_POLISH_ZLOTY);
24083 | SWEDISH_KRONA_SIGN of_integer_real_literal
24087 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24089 str = pt_append_string (this_parser, NULL, SWEDISH_KRONA_TEXT);
24094 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_SWEDISH_KRONA);
24100 | CROATIAN_KUNA_SIGN of_integer_real_literal
24104 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24106 str = pt_append_string (this_parser, NULL, CROATIAN_KUNA_TEXT);
24111 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_CROATIAN_KUNA);
24117 | SERBIAN_DINAR_SIGN of_integer_real_literal
24121 PT_NODE *val = parser_new_node (this_parser, PT_VALUE);
24123 str = pt_append_string (this_parser, NULL, SERBIAN_DINAR_TEXT);
24128 pt_value_set_monetary (this_parser, val, str, txt, PT_CURRENCY_SERBIAN_DINAR);
24136 of_integer_real_literal
24143 | opt_plus UNSIGNED_REAL
24149 | '-' UNSIGNED_REAL
24152 $$ = pt_append_string (this_parser, (char *) "-", $2);
24157 date_or_time_literal
24162 val = pt_create_date_value (this_parser, PT_TYPE_DATE, $2);
24164 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24171 val = pt_create_date_value (this_parser, PT_TYPE_TIME, $2);
24173 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24176 | TIMESTAMP CHAR_STRING
24180 val = pt_create_date_value (this_parser, PT_TYPE_TIMESTAMP, $2);
24182 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24185 | TIMESTAMP WITH Time ZONE CHAR_STRING
24189 val = pt_create_date_value (this_parser, PT_TYPE_TIMESTAMPTZ, $5);
24191 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24194 | TIMESTAMPTZ CHAR_STRING
24198 val = pt_create_date_value (this_parser, PT_TYPE_TIMESTAMPTZ, $2);
24200 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24203 | TIMESTAMPLTZ CHAR_STRING
24207 val = pt_create_date_value (this_parser, PT_TYPE_TIMESTAMPLTZ, $2);
24209 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24212 | TIMESTAMP WITH LOCAL Time ZONE CHAR_STRING
24216 val = pt_create_date_value (this_parser, PT_TYPE_TIMESTAMPLTZ, $6);
24218 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24221 | DATETIME CHAR_STRING
24225 val = pt_create_date_value (this_parser, PT_TYPE_DATETIME, $2);
24227 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24230 | DATETIME WITH Time ZONE CHAR_STRING
24234 val = pt_create_date_value (this_parser, PT_TYPE_DATETIMETZ, $5);
24236 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24239 | DATETIMETZ CHAR_STRING
24243 val = pt_create_date_value (this_parser, PT_TYPE_DATETIMETZ, $2);
24245 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24248 | DATETIMELTZ CHAR_STRING
24252 val = pt_create_date_value (this_parser, PT_TYPE_DATETIMELTZ, $2);
24254 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24257 | DATETIME WITH LOCAL Time ZONE CHAR_STRING
24261 val = pt_create_date_value (this_parser, PT_TYPE_DATETIMELTZ, $6);
24263 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24272 val = pt_create_json_value (this_parser, $2);
24274 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24279 : opt_replace AS csql_query
24282 SET_CONTAINER_2(ctn, FROM_NUMBER ($1), $3);
24288 : PARTITION opt_by HASH '(' expression_ ')' PARTITIONS literal_w_o_param
24291 PT_NODE *qc = parser_new_node (this_parser, PT_PARTITION);
24294 qc->info.partition.expr = $5;
24295 qc->info.partition.type = PT_PARTITION_HASH;
24296 qc->info.partition.hashsize = $8;
24302 | PARTITION opt_by RANGE_ '(' expression_ ')' '(' partition_def_list ')'
24305 PT_NODE *qc = parser_new_node (this_parser, PT_PARTITION);
24308 qc->info.partition.expr = $5;
24309 qc->info.partition.type = PT_PARTITION_RANGE;
24310 qc->info.partition.parts = $8;
24311 qc->info.partition.hashsize = NULL;
24315 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24318 | PARTITION opt_by LIST '(' expression_ ')' '(' partition_def_list ')'
24321 PT_NODE *qc = parser_new_node (this_parser, PT_PARTITION);
24324 qc->info.partition.expr = $5;
24325 qc->info.partition.type = PT_PARTITION_LIST;
24326 qc->info.partition.parts = $8;
24327 qc->info.partition.hashsize = NULL;
24331 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24342 : partition_def_list ',' partition_def
24345 $$ = parser_make_link ($1, $3);
24346 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24353 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24359 : PARTITION identifier VALUES LESS THAN MAXVALUE opt_comment_spec
24362 PT_NODE *node = parser_new_node (this_parser, PT_PARTS);
24365 node->info.parts.name = $2;
24366 node->info.parts.type = PT_PARTITION_RANGE;
24367 node->info.parts.values = NULL;
24368 node->info.parts.comment = $7;
24372 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24375 | PARTITION identifier VALUES LESS THAN '(' signed_literal_ ')' opt_comment_spec
24378 PT_NODE *node = parser_new_node (this_parser, PT_PARTS);
24381 node->info.parts.name = $2;
24382 node->info.parts.type = PT_PARTITION_RANGE;
24383 node->info.parts.values = $7;
24384 node->info.parts.comment = $9;
24388 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24391 | PARTITION identifier VALUES IN_ '(' signed_literal_list ')' opt_comment_spec
24394 PT_NODE *node = parser_new_node (this_parser, PT_PARTS);
24397 node->info.parts.name = $2;
24398 node->info.parts.type = PT_PARTITION_LIST;
24399 node->info.parts.values = $6;
24400 node->info.parts.comment = $8;
24404 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24409 alter_partition_clause_for_alter_list
24413 PT_NODE *alt = parser_get_alter_node ();
24417 alt->info.alter.code = PT_APPLY_PARTITION;
24418 alt->info.alter.alter_clause.partition.info = $1;
24422 | REMOVE PARTITIONING
24425 PT_NODE *alt = parser_get_alter_node ();
24428 alt->info.alter.code = PT_REMOVE_PARTITION;
24431 | REORGANIZE PARTITION identifier_list INTO '(' partition_def_list ')'
24434 PT_NODE *alt = parser_get_alter_node ();
24438 alt->info.alter.code = PT_REORG_PARTITION;
24439 alt->info.alter.alter_clause.partition.name_list = $3;
24440 alt->info.alter.alter_clause.partition.parts = $6;
24444 | ANALYZE PARTITION opt_all
24447 PT_NODE *alt = parser_get_alter_node ();
24451 alt->info.alter.code = PT_ANALYZE_PARTITION;
24452 alt->info.alter.alter_clause.partition.name_list = NULL;
24456 | ANALYZE PARTITION identifier_list
24459 PT_NODE *alt = parser_get_alter_node ();
24463 alt->info.alter.code = PT_ANALYZE_PARTITION;
24464 alt->info.alter.alter_clause.partition.name_list = $3;
24468 | COALESCE PARTITION literal_w_o_param
24471 PT_NODE *alt = parser_get_alter_node ();
24475 alt->info.alter.code = PT_COALESCE_PARTITION;
24476 alt->info.alter.alter_clause.partition.size = $3;
24480 | PROMOTE PARTITION identifier_list
24483 PT_NODE *alt = parser_get_alter_node ();
24487 alt->info.alter.code = PT_PROMOTE_PARTITION;
24488 alt->info.alter.alter_clause.partition.name_list = $3;
24500 : execute_using_list ',' session_variable_expression
24503 $$ = parser_make_link ($1, $3);
24504 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24507 | execute_using_list ',' signed_literal_
24510 $$ = parser_make_link ($1, $3);
24511 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24514 | session_variable_expression
24518 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24525 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24530 signed_literal_list
24531 : signed_literal_list ',' signed_literal_
24534 $$ = parser_make_link ($1, $3);
24535 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24542 PARSER_SAVE_ERR_CONTEXT ($$, @$.buffer_pos)
24556 bad_tokens_for_error_message_only_dont_mind_this_rule
24569 parser_new_node (this_parser, PT_VACUUM);
24572 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
24573 ER_OUT_OF_VIRTUAL_MEMORY, 1,
24580 json_table_column_behavior_rule
24583 $$.m_behavior = JSON_TABLE_RETURN_NULL;
24584 $$.m_default_value = NULL;
24588 $$.m_behavior = JSON_TABLE_THROW_ERROR;
24589 $$.m_default_value = NULL;
24591 | DEFAULT expression_
24593 PT_NODE * default_value = $2;
24594 if (default_value->node_type != PT_VALUE)
24596 PT_ERROR (this_parser, default_value, "invalid JSON_TABLE default");
24598 DB_VALUE * temp = pt_value_to_db (this_parser, default_value);
24599 $$.m_behavior = JSON_TABLE_DEFAULT_VALUE;
24600 $$.m_default_value = db_value_copy (temp);
24602 parser_free_node(this_parser, default_value);
24606 json_table_on_error_rule_optional
24609 $$.m_behavior = JSON_TABLE_RETURN_NULL;
24610 $$.m_default_value = NULL;
24612 | json_table_column_behavior_rule ON_ ERROR_
24618 json_table_on_empty_rule_optional
24621 $$.m_behavior = JSON_TABLE_RETURN_NULL;
24622 $$.m_default_value = NULL;
24624 | json_table_column_behavior_rule ON_ EMPTY
24630 json_table_column_rule
24631 : identifier For ORDINALITY
24633 PT_NODE *pt_col = parser_new_node (this_parser, PT_JSON_TABLE_COLUMN);
24634 pt_col->info.json_table_column_info.name = $1;
24635 pt_col->info.json_table_column_info.func = JSON_TABLE_ORDINALITY;
24636 pt_col->type_enum = PT_TYPE_INTEGER;
24639 | identifier data_type PATH CHAR_STRING json_table_on_empty_rule_optional json_table_on_error_rule_optional
24640 // $1 $2 $3 $4 $5 $6
24642 PT_NODE *pt_col = parser_new_node (this_parser, PT_JSON_TABLE_COLUMN);
24643 pt_col->info.json_table_column_info.name = $1;
24644 pt_col->type_enum = TO_NUMBER (CONTAINER_AT_0 ($2));
24645 pt_col->data_type = CONTAINER_AT_1 ($2);
24646 pt_col->info.json_table_column_info.path=$4;
24647 pt_col->info.json_table_column_info.func = JSON_TABLE_EXTRACT;
24648 pt_col->info.json_table_column_info.on_empty = $5;
24649 pt_col->info.json_table_column_info.on_error = $6;
24652 | identifier data_type EXISTS PATH CHAR_STRING
24654 PT_NODE *pt_col = parser_new_node (this_parser, PT_JSON_TABLE_COLUMN);
24655 pt_col->info.json_table_column_info.name = $1;
24656 pt_col->type_enum = TO_NUMBER (CONTAINER_AT_0 ($2));
24657 pt_col->data_type = CONTAINER_AT_1 ($2);
24658 pt_col->info.json_table_column_info.path=$5;
24659 pt_col->info.json_table_column_info.func = JSON_TABLE_EXISTS;
24662 | NESTED json_table_node_rule
24666 | NESTED PATH json_table_node_rule
24672 json_table_column_list_rule
24673 : json_table_column_list_rule ',' json_table_column_rule
24675 pt_jt_append_column_or_nested_node ($1, $3);
24678 | json_table_column_rule
24680 PT_NODE *pt_jt_node = parser_new_node (this_parser, PT_JSON_TABLE_NODE);
24681 pt_jt_append_column_or_nested_node (pt_jt_node, $1);
24686 json_table_node_rule
24687 : CHAR_STRING COLUMNS '(' json_table_column_list_rule ')'
24689 PT_NODE *jt_node = $4;
24690 assert (jt_node != NULL);
24691 assert (jt_node->node_type == PT_JSON_TABLE_NODE);
24693 jt_node->info.json_table_node_info.path = $1;
24700 : {{json_table_column_count = 0;
24702 '(' expression_ ',' json_table_node_rule ')'
24704 PT_NODE *jt = parser_new_node (this_parser, PT_JSON_TABLE);
24705 jt->info.json_table_info.expr = $3;
24706 jt->info.json_table_info.tree = $5;
24707 json_table_column_count = 0; // reset for next json table, if I am nested
24719 _push_msg (int code, int line)
24721 PRINT_2 ("push msg called: %d at line %d\n", code, line);
24722 g_msg[msg_ptr++] = code;
24732 extern void csql_yyset_lineno (int line_number);
24734 int yycolumn_end = 0;
24737 int parser_function_code = PT_EMPTY;
24738 size_t json_table_column_count = 0;
24741 parser_make_expr_with_func (PARSER_CONTEXT * parser, FUNC_TYPE func_code,
24742 PT_NODE * args_list)
24744 PT_NODE *node = NULL;
24745 PT_NODE *node_function = parser_new_node (parser, PT_FUNCTION);
24747 if (node_function != NULL)
24749 node_function->info.function.function_type = func_code;
24750 node_function->info.function.arg_list = args_list;
24753 parser_make_expression (parser, PT_FUNCTION_HOLDER, node_function, NULL,
24761 parser_make_func_with_arg_count (PARSER_CONTEXT * parser, FUNC_TYPE func_code, PT_NODE * args_list,
24762 size_t min_args, size_t max_args)
24764 size_t count = (size_t) parser_count_list (args_list);
24765 if (min_args > count || (max_args != 0 && max_args < count))
24767 // todo - a more clear message
24768 PT_ERRORmf (parser, args_list, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_INVALID_INTERNAL_FUNCTION,
24769 fcode_get_lowercase_name (func_code));
24770 // todo - return null?
24772 return parser_make_expr_with_func (parser, func_code, args_list);
24776 parser_make_func_with_arg_count_mod2 (PARSER_CONTEXT * parser, FUNC_TYPE func_code, PT_NODE * args_list,
24777 size_t min_args, size_t max_args, size_t mod2)
24779 size_t count = (size_t) parser_count_list (args_list);
24780 assert (mod2 == 0 || mod2 == 1);
24781 if (min_args > count || (max_args != 0 && max_args < count) || (count % 2 != mod2))
24783 // todo - a more clear message
24784 PT_ERRORmf (parser, args_list, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_INVALID_INTERNAL_FUNCTION,
24785 fcode_get_lowercase_name (func_code));
24786 // todo - return null?
24788 return parser_make_expr_with_func (parser, func_code, args_list);
24792 parser_make_expression (PARSER_CONTEXT * parser, PT_OP_TYPE OP, PT_NODE * arg1, PT_NODE * arg2,
24796 expr = parser_new_node (parser, PT_EXPR);
24799 expr->info.expr.op = OP;
24800 if (pt_is_operator_logical (expr->info.expr.op))
24802 expr->type_enum = PT_TYPE_LOGICAL;
24805 expr->info.expr.arg1 = arg1;
24806 expr->info.expr.arg2 = arg2;
24807 expr->info.expr.arg3 = arg3;
24809 if (parser_instnum_check == 1 && !pt_instnum_compatibility (expr))
24811 PT_ERRORmf2 (parser, expr, MSGCAT_SET_PARSER_SEMANTIC,
24812 MSGCAT_SEMANTIC_INSTNUM_COMPATIBILITY_ERR,
24813 "INST_NUM() or ROWNUM", "INST_NUM() or ROWNUM");
24816 if (parser_groupbynum_check == 1 && !pt_groupbynum_compatibility (expr))
24818 PT_ERRORmf2 (parser, expr, MSGCAT_SET_PARSER_SEMANTIC,
24819 MSGCAT_SEMANTIC_INSTNUM_COMPATIBILITY_ERR,
24820 "GROUPBY_NUM()", "GROUPBY_NUM()");
24823 if (parser_orderbynum_check == 1 && !pt_orderbynum_compatibility (expr))
24825 PT_ERRORmf2 (parser, expr, MSGCAT_SET_PARSER_SEMANTIC,
24826 MSGCAT_SEMANTIC_INSTNUM_COMPATIBILITY_ERR,
24827 "ORDERBY_NUM()", "ORDERBY_NUM()");
24830 if (PT_IS_SERIAL(OP))
24832 parser_cannot_cache = true;
24835 if (OP == PT_SYS_TIME || OP == PT_CURRENT_TIME || OP == PT_SYS_DATE
24836 || OP == PT_CURRENT_DATE || OP == PT_SYS_DATETIME
24837 || OP == PT_CURRENT_DATETIME || OP == PT_SYS_TIMESTAMP
24838 || OP == PT_CURRENT_TIMESTAMP || OP == PT_UTC_TIME
24839 || OP == PT_UTC_DATE || OP == PT_UNIX_TIMESTAMP
24840 || OP == PT_TZ_OFFSET || OP == PT_UTC_TIMESTAMP)
24842 parser_si_datetime = true;
24843 parser_cannot_cache = true;
24851 parser_make_link (PT_NODE * list, PT_NODE * node)
24853 parser_append_node (node, list);
24858 parser_make_link_or (PT_NODE * list, PT_NODE * node)
24860 parser_append_node_or (node, list);
24864 static bool parser_cannot_cache_stack_default[STACK_SIZE];
24865 static bool *parser_cannot_cache_stack = parser_cannot_cache_stack_default;
24866 static int parser_cannot_cache_sp = 0;
24867 static int parser_cannot_cache_limit = STACK_SIZE;
24870 parser_save_and_set_cannot_cache (bool value)
24872 if (parser_cannot_cache_sp >= parser_cannot_cache_limit)
24874 size_t new_size = parser_cannot_cache_limit * 2 * sizeof (bool);
24875 bool *new_p = malloc (new_size);
24878 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
24879 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
24883 memcpy (new_p, parser_cannot_cache_stack, parser_cannot_cache_limit * sizeof (bool));
24884 if (parser_cannot_cache_stack != parser_cannot_cache_stack_default)
24885 free (parser_cannot_cache_stack);
24887 parser_cannot_cache_stack = new_p;
24888 parser_cannot_cache_limit *= 2;
24891 assert (parser_cannot_cache_sp >= 0);
24892 parser_cannot_cache_stack[parser_cannot_cache_sp++] = parser_cannot_cache;
24893 parser_cannot_cache = value;
24897 parser_restore_cannot_cache ()
24899 assert (parser_cannot_cache_sp >= 1);
24900 parser_cannot_cache = parser_cannot_cache_stack[--parser_cannot_cache_sp];
24903 static int parser_si_datetime_saved;
24906 parser_save_and_set_si_datetime (int value)
24908 parser_si_datetime_saved = parser_si_datetime;
24909 parser_si_datetime = value;
24913 parser_restore_si_datetime ()
24915 parser_si_datetime = parser_si_datetime_saved;
24918 static int parser_si_tran_id_saved;
24921 parser_save_and_set_si_tran_id (int value)
24923 parser_si_tran_id_saved = parser_si_tran_id;
24924 parser_si_tran_id = value;
24928 parser_restore_si_tran_id ()
24930 parser_si_tran_id = parser_si_tran_id_saved;
24933 static int parser_cannot_prepare_saved;
24936 parser_save_and_set_cannot_prepare (bool value)
24938 parser_cannot_prepare_saved = parser_cannot_prepare;
24939 parser_cannot_prepare = value;
24943 parser_restore_cannot_prepare ()
24945 parser_cannot_prepare = parser_cannot_prepare_saved;
24948 static int parser_wjc_stack_default[STACK_SIZE];
24949 static int *parser_wjc_stack = parser_wjc_stack_default;
24950 static int parser_wjc_sp = 0;
24951 static int parser_wjc_limit = STACK_SIZE;
24954 parser_save_and_set_wjc (int value)
24956 if (parser_wjc_sp >= parser_wjc_limit)
24958 size_t new_size = parser_wjc_limit * 2 * sizeof (int);
24959 int *new_p = malloc (new_size);
24962 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
24963 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
24967 memcpy (new_p, parser_wjc_stack, parser_wjc_limit * sizeof (int));
24968 if (parser_wjc_stack != parser_wjc_stack_default)
24969 free (parser_wjc_stack);
24971 parser_wjc_stack = new_p;
24972 parser_wjc_limit *= 2;
24975 assert (parser_wjc_sp >= 0);
24976 parser_wjc_stack[parser_wjc_sp++] = parser_within_join_condition;
24977 parser_within_join_condition = value;
24981 parser_restore_wjc ()
24983 assert (parser_wjc_sp >= 1);
24984 parser_within_join_condition = parser_wjc_stack[--parser_wjc_sp];
24987 static int parser_instnum_stack_default[STACK_SIZE];
24988 static int *parser_instnum_stack = parser_instnum_stack_default;
24989 static int parser_instnum_sp = 0;
24990 static int parser_instnum_limit = STACK_SIZE;
24993 parser_save_and_set_ic (int value)
24995 if (parser_instnum_sp >= parser_instnum_limit)
24997 size_t new_size = parser_instnum_limit * 2 * sizeof (int);
24998 int *new_p = malloc (new_size);
25001 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25002 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25006 memcpy (new_p, parser_instnum_stack, parser_instnum_limit * sizeof (int));
25007 if (parser_instnum_stack != parser_instnum_stack_default)
25008 free (parser_instnum_stack);
25010 parser_instnum_stack = new_p;
25011 parser_instnum_limit *= 2;
25014 assert (parser_instnum_sp >= 0);
25015 parser_instnum_stack[parser_instnum_sp++] = parser_instnum_check;
25016 parser_instnum_check = value;
25020 parser_restore_ic ()
25022 assert (parser_instnum_sp >= 1);
25023 parser_instnum_check = parser_instnum_stack[--parser_instnum_sp];
25026 static int parser_groupbynum_stack_default[STACK_SIZE];
25027 static int *parser_groupbynum_stack = parser_groupbynum_stack_default;
25028 static int parser_groupbynum_sp = 0;
25029 static int parser_groupbynum_limit = STACK_SIZE;
25032 parser_save_and_set_gc (int value)
25034 if (parser_groupbynum_sp >= parser_groupbynum_limit)
25036 size_t new_size = parser_groupbynum_limit * 2 * sizeof (int);
25037 int *new_p = malloc (new_size);
25040 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25041 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25045 memcpy (new_p, parser_groupbynum_stack, parser_groupbynum_limit * sizeof (int));
25046 if (parser_groupbynum_stack != parser_groupbynum_stack_default)
25047 free (parser_groupbynum_stack);
25049 parser_groupbynum_stack = new_p;
25050 parser_groupbynum_limit *= 2;
25053 assert (parser_groupbynum_sp >= 0);
25054 parser_groupbynum_stack[parser_groupbynum_sp++] = parser_groupbynum_check;
25055 parser_groupbynum_check = value;
25059 parser_restore_gc ()
25061 assert (parser_groupbynum_sp >= 1);
25062 parser_groupbynum_check = parser_groupbynum_stack[--parser_groupbynum_sp];
25065 static int parser_orderbynum_stack_default[STACK_SIZE];
25066 static int *parser_orderbynum_stack = parser_orderbynum_stack_default;
25067 static int parser_orderbynum_sp = 0;
25068 static int parser_orderbynum_limit = STACK_SIZE;
25071 parser_save_and_set_oc (int value)
25073 if (parser_orderbynum_sp >= parser_orderbynum_limit)
25075 size_t new_size = parser_orderbynum_limit * 2 * sizeof (int);
25076 int *new_p = malloc (new_size);
25079 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25080 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25084 memcpy (new_p, parser_orderbynum_stack, parser_orderbynum_limit * sizeof (int));
25085 if (parser_orderbynum_stack != parser_orderbynum_stack_default)
25086 free (parser_orderbynum_stack);
25088 parser_orderbynum_stack = new_p;
25089 parser_orderbynum_limit *= 2;
25092 assert (parser_orderbynum_sp >= 0);
25093 parser_orderbynum_stack[parser_orderbynum_sp++] = parser_orderbynum_check;
25094 parser_orderbynum_check = value;
25098 parser_restore_oc ()
25100 assert (parser_orderbynum_sp >= 1);
25101 parser_orderbynum_check = parser_orderbynum_stack[--parser_orderbynum_sp];
25104 static int parser_sysc_stack_default[STACK_SIZE];
25105 static int *parser_sysc_stack = parser_sysc_stack_default;
25106 static int parser_sysc_sp = 0;
25107 static int parser_sysc_limit = STACK_SIZE;
25110 parser_save_and_set_sysc (int value)
25112 if (parser_sysc_sp >= parser_sysc_limit)
25114 size_t new_size = parser_sysc_limit * 2 * sizeof (int);
25115 int *new_p = malloc (new_size);
25118 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25119 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25123 memcpy (new_p, parser_sysc_stack, parser_sysc_limit * sizeof (int));
25124 if (parser_sysc_stack != parser_sysc_stack_default)
25125 free (parser_sysc_stack);
25127 parser_sysc_stack = new_p;
25128 parser_sysc_limit *= 2;
25131 assert (parser_sysc_sp >= 0);
25132 parser_sysc_stack[parser_sysc_sp++] = parser_sysconnectbypath_check;
25133 parser_sysconnectbypath_check = value;
25137 parser_restore_sysc ()
25139 assert (parser_sysc_sp >= 1);
25140 parser_sysconnectbypath_check = parser_sysc_stack[--parser_sysc_sp];
25143 static int parser_prc_stack_default[STACK_SIZE];
25144 static int *parser_prc_stack = parser_prc_stack_default;
25145 static int parser_prc_sp = 0;
25146 static int parser_prc_limit = STACK_SIZE;
25149 parser_save_and_set_prc (int value)
25151 if (parser_prc_sp >= parser_prc_limit)
25153 size_t new_size = parser_prc_limit * 2 * sizeof (int);
25154 int *new_p = malloc (new_size);
25157 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25158 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25162 memcpy (new_p, parser_prc_stack, parser_prc_limit * sizeof (int));
25163 if (parser_prc_stack != parser_prc_stack_default)
25164 free (parser_prc_stack);
25166 parser_prc_stack = new_p;
25167 parser_prc_limit *= 2;
25170 assert (parser_prc_sp >= 0);
25171 parser_prc_stack[parser_prc_sp++] = parser_prior_check;
25172 parser_prior_check = value;
25176 parser_restore_prc ()
25178 assert (parser_prc_sp >= 1);
25179 parser_prior_check = parser_prc_stack[--parser_prc_sp];
25182 static int parser_cbrc_stack_default[STACK_SIZE];
25183 static int *parser_cbrc_stack = parser_cbrc_stack_default;
25184 static int parser_cbrc_sp = 0;
25185 static int parser_cbrc_limit = STACK_SIZE;
25188 parser_save_and_set_cbrc (int value)
25190 if (parser_cbrc_sp >= parser_cbrc_limit)
25192 size_t new_size = parser_cbrc_limit * 2 * sizeof (int);
25193 int *new_p = malloc (new_size);
25196 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25197 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25201 memcpy (new_p, parser_cbrc_stack, parser_cbrc_limit * sizeof (int));
25202 if (parser_cbrc_stack != parser_cbrc_stack_default)
25203 free (parser_cbrc_stack);
25205 parser_cbrc_stack = new_p;
25206 parser_cbrc_limit *= 2;
25209 assert (parser_cbrc_sp >= 0);
25210 parser_cbrc_stack[parser_cbrc_sp++] = parser_connectbyroot_check;
25211 parser_connectbyroot_check = value;
25215 parser_restore_cbrc ()
25217 assert (parser_cbrc_sp >= 1);
25218 parser_connectbyroot_check = parser_cbrc_stack[--parser_cbrc_sp];
25221 static int parser_serc_stack_default[STACK_SIZE];
25222 static int *parser_serc_stack = parser_serc_stack_default;
25223 static int parser_serc_sp = 0;
25224 static int parser_serc_limit = STACK_SIZE;
25227 parser_save_and_set_serc (int value)
25229 if (parser_serc_sp >= parser_serc_limit)
25231 size_t new_size = parser_serc_limit * 2 * sizeof (int);
25232 int *new_p = malloc (new_size);
25235 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25236 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25240 memcpy (new_p, parser_serc_stack, parser_serc_limit * sizeof (int));
25241 if (parser_serc_stack != parser_serc_stack_default)
25242 free (parser_serc_stack);
25244 parser_serc_stack = new_p;
25245 parser_serc_limit *= 2;
25248 assert (parser_serc_sp >= 0);
25249 parser_serc_stack[parser_serc_sp++] = parser_serial_check;
25250 parser_serial_check = value;
25254 parser_restore_serc ()
25256 assert (parser_serc_sp >= 1);
25257 parser_serial_check = parser_serc_stack[--parser_serc_sp];
25260 static int parser_pseudoc_stack_default[STACK_SIZE];
25261 static int *parser_pseudoc_stack = parser_pseudoc_stack_default;
25262 static int parser_pseudoc_sp = 0;
25263 static int parser_pseudoc_limit = STACK_SIZE;
25266 parser_save_and_set_pseudoc (int value)
25268 if (parser_pseudoc_sp >= parser_pseudoc_limit)
25270 size_t new_size = parser_pseudoc_limit * 2 * sizeof (int);
25271 int *new_p = malloc (new_size);
25274 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25275 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25279 memcpy (new_p, parser_pseudoc_stack, parser_pseudoc_limit * sizeof (int));
25280 if (parser_pseudoc_stack != parser_pseudoc_stack_default)
25281 free (parser_pseudoc_stack);
25283 parser_pseudoc_stack = new_p;
25284 parser_pseudoc_limit *= 2;
25287 assert (parser_pseudoc_sp >= 0);
25288 parser_pseudoc_stack[parser_pseudoc_sp++] = parser_pseudocolumn_check;
25289 parser_pseudocolumn_check = value;
25293 parser_restore_pseudoc ()
25295 assert (parser_pseudoc_sp >= 1);
25296 parser_pseudocolumn_check = parser_pseudoc_stack[--parser_pseudoc_sp];
25299 static int parser_sqc_stack_default[STACK_SIZE];
25300 static int *parser_sqc_stack = parser_sqc_stack_default;
25301 static int parser_sqc_sp = 0;
25302 static int parser_sqc_limit = STACK_SIZE;
25305 parser_save_and_set_sqc (int value)
25307 if (parser_sqc_sp >= parser_sqc_limit)
25309 size_t new_size = parser_sqc_limit * 2 * sizeof (int);
25310 int *new_p = malloc (new_size);
25313 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25314 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25318 memcpy (new_p, parser_sqc_stack, parser_sqc_limit * sizeof (int));
25319 if (parser_sqc_stack != parser_sqc_stack_default)
25320 free (parser_sqc_stack);
25322 parser_sqc_stack = new_p;
25323 parser_sqc_limit *= 2;
25326 assert (parser_sqc_sp >= 0);
25327 parser_sqc_stack[parser_sqc_sp++] = parser_subquery_check;
25328 parser_subquery_check = value;
25332 parser_restore_sqc ()
25334 assert (parser_sqc_sp >= 1);
25335 parser_subquery_check = parser_sqc_stack[--parser_sqc_sp];
25338 static int parser_hvar_stack_default[STACK_SIZE];
25339 static int *parser_hvar_stack = parser_hvar_stack_default;
25340 static int parser_hvar_sp = 0;
25341 static int parser_hvar_limit = STACK_SIZE;
25344 parser_save_and_set_hvar (int value)
25346 if (parser_hvar_sp >= parser_hvar_limit)
25348 size_t new_size = parser_hvar_limit * 2 * sizeof (int);
25349 int *new_p = malloc (new_size);
25352 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25353 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25357 memcpy (new_p, parser_hvar_stack, parser_hvar_limit * sizeof (int));
25358 if (parser_hvar_stack != parser_hvar_stack_default)
25359 free (parser_hvar_stack);
25361 parser_hvar_stack = new_p;
25362 parser_hvar_limit *= 2;
25365 assert (parser_hvar_sp >= 0);
25366 parser_hvar_stack[parser_hvar_sp++] = parser_hostvar_check;
25367 parser_hostvar_check = value;
25371 parser_restore_hvar ()
25373 assert (parser_hvar_sp >= 1);
25374 parser_hostvar_check = parser_hvar_stack[--parser_hvar_sp];
25377 static int parser_oracle_stack_default[STACK_SIZE];
25378 static int *parser_oracle_stack = parser_oracle_stack_default;
25379 static int parser_oracle_sp = 0;
25380 static int parser_oracle_limit = STACK_SIZE;
25383 parser_save_found_Oracle_outer ()
25385 if (parser_oracle_sp >= parser_oracle_limit)
25387 size_t new_size = parser_oracle_limit * 2 * sizeof (int);
25388 int *new_p = malloc (new_size);
25391 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25392 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25396 memcpy (new_p, parser_oracle_stack, parser_oracle_limit * sizeof (int));
25397 if (parser_oracle_stack != parser_oracle_stack_default)
25398 free (parser_oracle_stack);
25400 parser_oracle_stack = new_p;
25401 parser_oracle_limit *= 2;
25404 assert (parser_oracle_sp >= 0);
25405 parser_oracle_stack[parser_oracle_sp++] = parser_found_Oracle_outer;
25409 parser_restore_found_Oracle_outer ()
25411 assert (parser_oracle_sp >= 1);
25412 parser_found_Oracle_outer = parser_oracle_stack[--parser_oracle_sp];
25415 static PT_NODE *parser_alter_node_saved;
25418 parser_save_alter_node (PT_NODE * node)
25420 parser_alter_node_saved = node;
25424 parser_get_alter_node ()
25426 return parser_alter_node_saved;
25429 static PT_NODE *parser_attr_def_one_saved;
25432 parser_save_attr_def_one (PT_NODE * node)
25434 parser_attr_def_one_saved = node;
25438 parser_get_attr_def_one ()
25440 return parser_attr_def_one_saved;
25443 static PT_NODE *parser_orderby_node_stack_default[STACK_SIZE];
25444 static PT_NODE **parser_orderby_node_stack = parser_orderby_node_stack_default;
25445 static int parser_orderby_node_sp = 0;
25446 static int parser_orderby_node_limit = STACK_SIZE;
25449 parser_push_orderby_node (PT_NODE * node)
25451 if (parser_orderby_node_sp >= parser_orderby_node_limit)
25453 size_t new_size = parser_orderby_node_limit * 2 * sizeof (PT_NODE **);
25454 PT_NODE **new_p = malloc (new_size);
25457 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25458 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25462 memcpy (new_p, parser_orderby_node_stack, parser_orderby_node_limit * sizeof (PT_NODE *));
25463 if (parser_orderby_node_stack != parser_orderby_node_stack_default)
25464 free (parser_orderby_node_stack);
25466 parser_orderby_node_stack = new_p;
25467 parser_orderby_node_limit *= 2;
25470 assert (parser_orderby_node_sp >= 0);
25471 parser_orderby_node_stack[parser_orderby_node_sp++] = node;
25475 parser_top_orderby_node ()
25477 assert (parser_orderby_node_sp >= 1);
25478 return parser_orderby_node_stack[parser_orderby_node_sp - 1];
25482 parser_pop_orderby_node ()
25484 assert (parser_orderby_node_sp >= 1);
25485 return parser_orderby_node_stack[--parser_orderby_node_sp];
25488 static PT_NODE *parser_select_node_stack_default[STACK_SIZE];
25489 static PT_NODE **parser_select_node_stack = parser_select_node_stack_default;
25490 static int parser_select_node_sp = 0;
25491 static int parser_select_node_limit = STACK_SIZE;
25494 parser_push_select_stmt_node (PT_NODE * node)
25496 if (parser_select_node_sp >= parser_select_node_limit)
25498 size_t new_size = parser_select_node_limit * 2 * sizeof (PT_NODE **);
25499 PT_NODE **new_p = malloc (new_size);
25502 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25503 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25507 memcpy (new_p, parser_select_node_stack, parser_select_node_limit * sizeof (PT_NODE *));
25508 if (parser_select_node_stack != parser_select_node_stack_default)
25509 free (parser_select_node_stack);
25511 parser_select_node_stack = new_p;
25512 parser_select_node_limit *= 2;
25515 assert (parser_select_node_sp >= 0);
25516 parser_select_node_stack[parser_select_node_sp++] = node;
25520 parser_top_select_stmt_node ()
25522 assert (parser_select_node_sp >= 1);
25523 return parser_select_node_stack[parser_select_node_sp - 1];
25527 parser_pop_select_stmt_node ()
25529 assert (parser_select_node_sp >= 1);
25530 return parser_select_node_stack[--parser_select_node_sp];
25534 parser_is_select_stmt_node_empty ()
25536 return parser_select_node_sp < 1;
25539 static PT_NODE *parser_hint_node_stack_default[STACK_SIZE];
25540 static PT_NODE **parser_hint_node_stack = parser_hint_node_stack_default;
25541 static int parser_hint_node_sp = 0;
25542 static int parser_hint_node_limit = STACK_SIZE;
25545 parser_push_hint_node (PT_NODE * node)
25547 if (parser_hint_node_sp >= parser_hint_node_limit)
25549 size_t new_size = parser_hint_node_limit * 2 * sizeof (PT_NODE **);
25550 PT_NODE **new_p = malloc (new_size);
25553 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25554 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25558 memcpy (new_p, parser_hint_node_stack, parser_hint_node_limit * sizeof (PT_NODE *));
25559 if (parser_hint_node_stack != parser_hint_node_stack_default)
25560 free (parser_hint_node_stack);
25562 parser_hint_node_stack = new_p;
25563 parser_hint_node_limit *= 2;
25566 assert (parser_hint_node_sp >= 0);
25567 parser_hint_node_stack[parser_hint_node_sp++] = node;
25571 parser_top_hint_node ()
25573 assert (parser_hint_node_sp >= 1);
25574 return parser_hint_node_stack[parser_hint_node_sp - 1];
25578 parser_pop_hint_node ()
25580 assert (parser_hint_node_sp >= 1);
25581 return parser_hint_node_stack[--parser_hint_node_sp];
25585 parser_is_hint_node_empty ()
25587 return parser_hint_node_sp < 1;
25590 static int parser_join_type_stack_default[STACK_SIZE];
25591 static int *parser_join_type_stack = parser_join_type_stack_default;
25592 static int parser_join_type_sp = 0;
25593 static int parser_join_type_limit = STACK_SIZE;
25596 parser_push_join_type (int v)
25598 if (parser_join_type_sp >= parser_join_type_limit)
25600 size_t new_size = parser_join_type_limit * 2 * sizeof (int);
25601 int *new_p = malloc (new_size);
25604 er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE,
25605 ER_OUT_OF_VIRTUAL_MEMORY, 1, new_size);
25609 memcpy (new_p, parser_join_type_stack, parser_join_type_limit * sizeof (int));
25610 if (parser_join_type_stack != parser_join_type_stack_default)
25611 free (parser_join_type_stack);
25613 parser_join_type_stack = new_p;
25614 parser_join_type_limit *= 2;
25617 assert (parser_join_type_sp >= 0);
25618 parser_join_type_stack[parser_join_type_sp++] = v;
25622 parser_top_join_type ()
25624 assert (parser_join_type_sp >= 1);
25625 return parser_join_type_stack[parser_join_type_sp - 1];
25629 parser_pop_join_type ()
25631 assert (parser_join_type_sp >= 1);
25632 return parser_join_type_stack[--parser_join_type_sp];
25635 static bool parser_is_reverse_saved;
25638 parser_save_is_reverse (bool v)
25640 parser_is_reverse_saved = v;
25644 parser_get_is_reverse ()
25646 return parser_is_reverse_saved;
25650 parser_count_list (PT_NODE * list)
25665 parser_count_prefix_columns (PT_NODE * list, int * arg_count)
25674 if (p->node_type == PT_SORT_SPEC)
25676 if (p->info.sort_spec.expr->node_type == PT_FUNCTION)
25678 PT_NODE *expr = p->info.sort_spec.expr;
25679 PT_NODE *arg_list = expr->info.function.arg_list;
25680 if ((arg_list != NULL) && (arg_list->next == NULL)
25681 && (arg_list->node_type == PT_VALUE))
25683 /* it might be a prefixed column */
25689 /* count all arguments */
25690 *arg_count = (*arg_count) + 1;
25698 parser_initialize_parser_context (void)
25700 parser_select_node_sp = 0;
25701 parser_orderby_node_sp = 0;
25702 parser_oracle_sp = 0;
25703 parser_orderbynum_sp = 0;
25704 parser_groupbynum_sp = 0;
25705 parser_instnum_sp = 0;
25707 parser_cannot_cache_sp = 0;
25708 parser_hint_node_sp = 0;
25710 parser_save_is_reverse (false);
25715 parser_remove_dummy_select (PT_NODE ** ent_inout)
25717 PT_NODE *ent = *ent_inout;
25720 && ent->info.spec.derived_table_type == PT_IS_SUBQUERY
25721 && ent->info.spec.as_attr_list == NULL /* no attr_list */ )
25724 PT_NODE *subq, *new_ent;
25726 /* remove dummy select from FROM clause
25729 * case 1 (simple spec):
25730 * FROM (SELECT * FROM x) AS s
25732 * case 2 (nested spec):
25733 * FROM (SELECT * FROM (SELECT a, b FROM bas) y(p, q)) x
25734 * -> FROM (SELECT a, b FROM bas) x(p, q)
25736 * Note: Subqueries with CTEs are not removed
25738 if ((subq = ent->info.spec.derived_table)
25739 && subq->node_type == PT_SELECT
25740 && PT_SELECT_INFO_IS_FLAGED (subq, PT_SELECT_INFO_DUMMY))
25742 if (subq->info.query.q.select.from && subq->info.query.with == NULL)
25744 if (PT_SELECT_INFO_IS_FLAGED (subq, PT_SELECT_INFO_FOR_UPDATE))
25746 /* the FOR UPDATE clause cannot be used in subqueries */
25747 PT_ERRORm (this_parser, subq, MSGCAT_SET_PARSER_SEMANTIC,
25748 MSGCAT_SEMANTIC_INVALID_USE_FOR_UPDATE_CLAUSE);
25752 new_ent = subq->info.query.q.select.from;
25753 subq->info.query.q.select.from = NULL;
25755 /* free, reset new_spec's range_var, as_attr_list */
25756 if (new_ent->info.spec.range_var)
25758 parser_free_node (this_parser, new_ent->info.spec.range_var);
25759 new_ent->info.spec.range_var = NULL;
25762 new_ent->info.spec.range_var = ent->info.spec.range_var;
25763 ent->info.spec.range_var = NULL;
25765 /* free old ent, reset to new_ent */
25766 parser_free_node (this_parser, ent);
25767 *ent_inout = new_ent;
25773 PT_SELECT_INFO_CLEAR_FLAG (subq, PT_SELECT_INFO_DUMMY);
25781 parser_make_date_lang (int arg_cnt, PT_NODE * arg3)
25783 if (arg3 && arg_cnt == 3)
25786 PT_NODE *date_lang = parser_new_node (this_parser, PT_VALUE);
25790 date_lang->type_enum = PT_TYPE_INTEGER;
25791 if (arg3->type_enum != PT_TYPE_CHAR
25792 && arg3->type_enum != PT_TYPE_NCHAR)
25794 PT_ERROR (this_parser, arg3,
25795 "argument 3 must be character string");
25797 else if (arg3->info.value.data_value.str != NULL)
25800 lang_str = (char *) arg3->info.value.data_value.str->bytes;
25801 if (lang_set_flag_from_lang (lang_str, 1, 1, &flag))
25803 PT_ERROR (this_parser, arg3, "check syntax at 'date_lang'");
25805 date_lang->info.value.data_value.i = (long) flag;
25808 parser_free_node (this_parser, arg3);
25814 PT_NODE *date_lang = parser_new_node (this_parser, PT_VALUE);
25817 const char *lang_str;
25820 date_lang->type_enum = PT_TYPE_INTEGER;
25821 lang_str = prm_get_string_value (PRM_ID_INTL_DATE_LANG);
25823 lang_set_flag_from_lang (lang_str, (arg_cnt == 1) ? 0 : 1, 0, &flag);
25825 date_lang->info.value.data_value.i = (long) flag;
25833 parser_make_number_lang (const int argc)
25835 PT_NODE *number_lang = parser_new_node (this_parser, PT_VALUE);
25839 const char *lang_str;
25842 number_lang->type_enum = PT_TYPE_INTEGER;
25843 lang_str = prm_get_string_value (PRM_ID_INTL_NUMBER_LANG);
25845 lang_set_flag_from_lang (lang_str, (argc >= 2) ? 1 : 0, (argc == 3) ? 1 : 0, &flag);
25847 number_lang->info.value.data_value.i = (long) flag;
25850 return number_lang;
25854 parser_main (PARSER_CONTEXT * parser)
25856 long desc_index = 0;
25860 PARSER_CONTEXT *this_parser_saved;
25865 parser_output_host_index = parser_input_host_index = desc_index = 0;
25867 this_parser_saved = this_parser;
25869 this_parser = parser;
25871 dbcs_start_input ();
25873 yycolumn = yycolumn_end = 1;
25875 csql_yylloc.buffer_pos=0;
25878 g_query_string = NULL;
25879 g_query_string_len = 0;
25880 g_original_buffer_len = 0;
25883 pt_cleanup_hint (parser, parser_hint_table);
25885 if (pt_has_error (parser) || parser->stack_top <= 0 || !parser->node_stack)
25887 parser->statements = NULL;
25891 /* create array of result statements */
25892 parser->statements = (PT_NODE **) parser_alloc (parser,
25894 parser->stack_top) *
25895 sizeof (PT_NODE *));
25896 if (parser->statements)
25898 for (i = 0, top = parser->stack_top; i < top; i++)
25900 parser->statements[i] = parser->node_stack[i];
25902 parser->statements[top] = NULL;
25904 /* record parser_input_host_index into parser->host_var_count for later use;
25905 e.g. parser_set_host_variables(), auto-parameterized query */
25906 parser->host_var_count = parser_input_host_index;
25907 if (parser->host_var_count > 0)
25909 /* allocate place holder for host variables */
25910 parser->host_variables = (DB_VALUE *)
25911 malloc (parser->host_var_count * sizeof (DB_VALUE));
25912 if (parser->host_variables)
25914 memset (parser->host_variables, 0,
25915 parser->host_var_count * sizeof (DB_VALUE));
25919 parser->statements = NULL;
25923 parser->host_var_expected_domains = (TP_DOMAIN **)
25924 malloc (parser->host_var_count * sizeof (TP_DOMAIN *));
25925 if (parser->host_var_expected_domains)
25927 for (i = 0; i < parser->host_var_count; i++)
25929 parser->host_var_expected_domains[i] =
25930 tp_domain_resolve_default (DB_TYPE_UNKNOWN);
25935 free_and_init (parser->host_variables);
25936 parser->statements = NULL;
25938 for (i = 0; i < parser->host_var_count; i++)
25940 db_make_null (&parser->host_variables[i]);
25946 this_parser = this_parser_saved;
25947 return parser->statements;
25954 extern int parser_yyinput_single_mode;
25956 parse_one_statement (int state)
25962 // a new session starts. reset line and column number.
25963 csql_yyset_lineno (1);
25964 yycolumn = yycolumn_end = 1;
25969 this_parser->statement_number = 0;
25971 parser_yyinput_single_mode = 1;
25974 csql_yylloc.buffer_pos=0;
25977 g_query_string = NULL;
25978 g_query_string_len = 0;
25979 g_original_buffer_len = 0;
25982 pt_cleanup_hint (this_parser, parser_hint_table);
25984 if (parser_statement_OK)
25985 this_parser->statement_number = 1;
25987 parser_statement_OK = 1;
25989 if (!parser_yyinput_single_mode) /* eof */
25996 PT_HINT parser_hint_table[] = {
25997 {"ORDERED", NULL, PT_HINT_ORDERED}
25999 {"NO_INDEX_SS", NULL, PT_HINT_NO_INDEX_SS}
26001 {"INDEX_SS", NULL, PT_HINT_INDEX_SS}
26003 {"USE_NL", NULL, PT_HINT_USE_NL}
26005 {"USE_IDX", NULL, PT_HINT_USE_IDX}
26007 {"USE_MERGE", NULL, PT_HINT_USE_MERGE}
26009 {"RECOMPILE", NULL, PT_HINT_RECOMPILE}
26011 {"LOCK_TIMEOUT", NULL, PT_HINT_LK_TIMEOUT}
26013 {"NO_LOGGING", NULL, PT_HINT_NO_LOGGING}
26015 {"QUERY_CACHE", NULL, PT_HINT_QUERY_CACHE}
26017 {"SQL_CACHE", NULL, PT_HINT_QUERY_CACHE}
26019 {"QUERY_NO_CACHE", NULL, PT_HINT_QUERY_NO_CACHE}
26021 {"SQL_NO_CACHE", NULL, PT_HINT_QUERY_NO_CACHE}
26023 {"REEXECUTE", NULL, PT_HINT_REEXECUTE}
26025 {"JDBC_CACHE", NULL, PT_HINT_JDBC_CACHE}
26027 {"USE_DESC_IDX", NULL, PT_HINT_USE_IDX_DESC}
26029 {"NO_COVERING_IDX", NULL, PT_HINT_NO_COVERING_IDX}
26031 {"INSERT_EXECUTION_MODE", NULL, PT_HINT_INSERT_MODE}
26033 {"NO_DESC_IDX", NULL, PT_HINT_NO_IDX_DESC}
26035 {"NO_MULTI_RANGE_OPT", NULL, PT_HINT_NO_MULTI_RANGE_OPT}
26037 {"USE_UPDATE_IDX", NULL, PT_HINT_USE_UPDATE_IDX}
26039 {"USE_INSERT_IDX", NULL, PT_HINT_USE_INSERT_IDX}
26041 {"NO_SORT_LIMIT", NULL, PT_HINT_NO_SORT_LIMIT}
26043 {"NO_HASH_AGGREGATE", NULL, PT_HINT_NO_HASH_AGGREGATE}
26045 {"NO_HASH_LIST_SCAN", NULL, PT_HINT_NO_HASH_LIST_SCAN}
26047 {"SKIP_UPDATE_NULL", NULL, PT_HINT_SKIP_UPDATE_NULL}
26049 {"NO_INDEX_LS", NULL, PT_HINT_NO_INDEX_LS}
26051 {"INDEX_LS", NULL, PT_HINT_INDEX_LS}
26053 {"SELECT_RECORD_INFO", NULL, PT_HINT_SELECT_RECORD_INFO}
26055 {"SELECT_PAGE_INFO", NULL, PT_HINT_SELECT_PAGE_INFO}
26057 {"SELECT_KEY_INFO", NULL, PT_HINT_SELECT_KEY_INFO}
26059 {"SELECT_BTREE_NODE_INFO", NULL, PT_HINT_SELECT_BTREE_NODE_INFO}
26061 {"USE_SBR", NULL, PT_HINT_USE_SBR}
26063 {NULL, NULL, -1} /* mark as end */
26069 function_keyword_cmp (const void *f1, const void *f2)
26071 return strcasecmp (((FUNCTION_MAP *) f1)->keyword,
26072 ((FUNCTION_MAP *) f2)->keyword);
26078 keyword_offset (const char *text)
26080 static bool function_keyword_sorted = false;
26081 FUNCTION_MAP dummy;
26082 FUNCTION_MAP *result_key;
26084 if (function_keyword_sorted == false)
26087 (sizeof (functions) / sizeof (functions[0])),
26088 sizeof (functions[0]), function_keyword_cmp);
26090 function_keyword_sorted = true;
26098 if (strlen (text) >= MAX_KEYWORD_SIZE)
26103 dummy.keyword = text;
26106 (FUNCTION_MAP *) bsearch (&dummy, functions,
26107 (sizeof (functions) / sizeof (functions[0])),
26108 sizeof (FUNCTION_MAP), function_keyword_cmp);
26115 parser_keyword_func (const char *name, PT_NODE * args)
26119 PT_NODE *a1, *a2, *a3;
26122 PT_NODE *val, *between_ge_lt, *between;
26125 parser_function_code = PT_EMPTY;
26126 c = parser_count_list (args);
26127 key = keyword_offset (name);
26131 parser_function_code = key->op;
26133 a1 = a2 = a3 = NULL;
26140 case PT_SYS_DATETIME:
26141 case PT_SYS_TIMESTAMP:
26142 case PT_CURRENT_TIME:
26143 case PT_CURRENT_DATE:
26144 case PT_CURRENT_DATETIME:
26145 case PT_CURRENT_TIMESTAMP:
26149 case PT_UTC_TIMESTAMP:
26154 return parser_make_expression (this_parser, key->op, NULL, NULL, NULL);
26157 case PT_LAST_INSERT_ID:
26158 case PT_TRACE_STATS:
26163 parser_cannot_cache = true;
26164 parser_cannot_prepare = true;
26165 return parser_make_expression (this_parser, key->op, NULL, NULL, NULL);
26174 parser_cannot_cache = true;
26176 expr = parser_make_expression (this_parser, key->op, NULL, NULL, NULL);
26177 expr->flag.do_not_fold = 1;
26189 parser_cannot_cache = true;
26191 if (c < 0 || c > 1)
26200 expr = parser_make_expression (this_parser, key->op, a1, NULL, NULL);
26201 expr->flag.do_not_fold = 1;
26209 case PT_CHAR_LENGTH: /* char_length, length, lengthb */
26229 case PT_DAYOFMONTH:
26238 case PT_EXEC_STATS:
26239 case PT_CURRENT_VALUE:
26244 case PT_COERCIBILITY:
26247 case PT_FROM_BASE64:
26249 case PT_SCHEMA_DEF:
26258 if (key->op == PT_COERCIBILITY && a1)
26260 a1->flag.do_not_fold = 1;
26263 expr = parser_make_expression (this_parser, key->op, a1, NULL, NULL);
26264 if (key->op == PT_SCHEMA_DEF && a1)
26266 if (!PT_IS_VALUE_NODE (a1)
26267 || (a1->type_enum != PT_TYPE_NULL
26268 && !PT_IS_STRING_TYPE(a1->type_enum)))
26270 PT_ERRORf (this_parser, a1, "%s argument must be "
26271 "a string literal", pt_short_print (this_parser, expr));
26279 case PT_UNIX_TIMESTAMP:
26287 return parser_make_expression (this_parser, key->op, a1, NULL, NULL);
26289 else /* no arguments */
26291 return parser_make_expression (this_parser, key->op, NULL, NULL, NULL);
26295 case PT_DATE_FORMAT:
26296 case PT_TIME_FORMAT:
26298 case PT_STR_TO_DATE:
26304 return parser_make_expression (this_parser, key->op, a1, a2, parser_make_date_lang (2, NULL));
26307 case PT_MONTHS_BETWEEN:
26317 case PT_AES_ENCRYPT:
26318 case PT_AES_DECRYPT:
26326 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26328 case PT_NEXT_VALUE:
26333 /* default value for the second argument is 1. */
26334 a2 = parser_new_node (this_parser, PT_VALUE);
26337 a2->type_enum = PT_TYPE_INTEGER;
26338 a2->info.value.data_value.i = 1;
26341 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26349 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26360 return parser_make_expression (this_parser, key->op, a1, NULL, NULL);
26367 return parser_make_expression (this_parser, PT_ATAN2, a1, a2, NULL);
26375 case PT_SUBSTRING_INDEX:
26378 case PT_INDEX_CARDINALITY:
26386 a1->next = a2->next = NULL;
26387 return parser_make_expression (this_parser, key->op, a1, a2, a3);
26390 case PT_WIDTH_BUCKET:
26397 a2 = a1->next; /* a2 is the lower bound, a2->next is the upper bound */
26398 a3 = a2->next->next;
26399 a1->next = a2->next->next = a3->next = NULL;
26401 val = parser_new_node (this_parser, PT_VALUE);
26406 val->type_enum = PT_TYPE_NULL;
26407 val->flag.is_added_by_parser = 1;
26409 between_ge_lt = parser_make_expression (this_parser, PT_BETWEEN_GE_LT, a2, a2->next, NULL);
26410 if (between_ge_lt == NULL)
26416 between = parser_make_expression (this_parser, PT_BETWEEN, val, between_ge_lt, NULL);
26417 if (between == NULL)
26422 between->flag.do_not_fold = 1;
26424 return parser_make_expression (this_parser, key->op, a1, between, a3);
26426 /* arg 1 + default */
26431 a2 = parser_new_node (this_parser, PT_VALUE);
26434 /* default fmt value */
26435 if(a1->node_type == PT_VALUE
26436 && PT_IS_DATE_TIME_TYPE(a1->type_enum))
26438 a2->type_enum = PT_TYPE_CHAR;
26439 a2->info.value.data_value.str =
26440 pt_append_bytes(this_parser, NULL, "dd", 2);
26442 else if(a1->node_type == PT_VALUE
26443 && PT_IS_NUMERIC_TYPE(a1->type_enum))
26445 a2->type_enum = PT_TYPE_INTEGER;
26446 a2->info.value.data_value.i = 0;
26450 a2->type_enum = PT_TYPE_CHAR;
26451 a2->info.value.data_value.str =
26452 pt_append_bytes(this_parser, NULL, "default", 7);
26456 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26465 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26471 a2 = parser_new_node (this_parser, PT_VALUE);
26474 /* default fmt value */
26475 if (a1->node_type == PT_VALUE
26476 && PT_IS_NUMERIC_TYPE (a1->type_enum))
26478 a2->type_enum = PT_TYPE_INTEGER;
26479 a2->info.value.data_value.i = 0;
26483 a2->type_enum = PT_TYPE_CHAR;
26484 a2->info.value.data_value.str =
26485 pt_append_bytes (this_parser, NULL, "default", 7);
26489 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26498 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26500 /* arg 2 + default */
26501 case PT_INSTR: /* instr, instrb */
26504 a3 = parser_new_node (this_parser, PT_VALUE);
26507 a3->type_enum = PT_TYPE_INTEGER;
26508 a3->info.value.data_value.i = 1;
26515 return parser_make_expression (this_parser, key->op, a1, a2, a3);
26523 a1->next = a2->next = NULL;
26524 return parser_make_expression (this_parser, key->op, a1, a2, a3);
26528 if (c < 1 || c > 2)
26533 a2 = parser_new_node (this_parser, PT_VALUE);
26536 a2->info.value.data_value.i =
26537 prm_get_integer_value (PRM_ID_DEFAULT_WEEK_FORMAT);
26538 a2->type_enum = PT_TYPE_INTEGER;
26540 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26547 return parser_make_expression (this_parser, key->op, a1, a2, NULL);
26552 case PT_LIKE_LOWER_BOUND:
26553 case PT_LIKE_UPPER_BOUND:
26554 if (c < 1 || c > 2)
26560 return parser_make_expression (this_parser, key->op, a1, a2, a3);
26562 case PT_FROM_UNIXTIME:
26563 if (c < 1 || c > 2)
26569 a3 = parser_make_date_lang (2, NULL);
26570 return parser_make_expression (this_parser, key->op, a1, a2, a3);
26574 if (c < 1 || c > 2)
26576 push_msg (MSGCAT_SYNTAX_INVALID_TO_NUMBER);
26577 csql_yyerror_explicit (10, 10);
26583 PT_NODE *node = args->next;
26584 if (node->node_type != PT_VALUE ||
26585 (node->type_enum != PT_TYPE_CHAR &&
26586 node->type_enum != PT_TYPE_VARCHAR &&
26587 node->type_enum != PT_TYPE_NCHAR &&
26588 node->type_enum != PT_TYPE_VARNCHAR))
26590 push_msg (MSGCAT_SYNTAX_INVALID_TO_NUMBER);
26591 csql_yyerror_explicit (10, 10);
26600 return parser_make_expression (this_parser, key->op, a1, a2, parser_make_number_lang (c));
26605 case PT_SUBSTRING: /* substr, substrb */
26607 if (c < 2 || c > 3)
26620 node = parser_make_expression (this_parser, key->op, a1, a2, a3);
26621 if (key->op == PT_SUBSTRING)
26623 node->info.expr.qualifier = PT_SUBSTR;
26629 case PT_ORDERBY_NUM:
26633 node = parser_new_node (this_parser, PT_EXPR);
26636 node->info.expr.op = PT_ORDERBY_NUM;
26637 PT_EXPR_INFO_SET_FLAG (node, PT_EXPR_INFO_ORDERBYNUM_C);
26640 if (parser_orderbynum_check == 0)
26641 PT_ERRORmf2 (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
26642 MSGCAT_SEMANTIC_INSTNUM_COMPATIBILITY_ERR,
26643 "ORDERBY_NUM()", "ORDERBY_NUM()");
26645 parser_groupby_exception = PT_ORDERBY_NUM;
26652 node = parser_new_node (this_parser, PT_EXPR);
26656 node->info.expr.op = PT_INST_NUM;
26657 PT_EXPR_INFO_SET_FLAG (node, PT_EXPR_INFO_INSTNUM_C);
26660 if (parser_instnum_check == 0)
26661 PT_ERRORmf2 (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
26662 MSGCAT_SEMANTIC_INSTNUM_COMPATIBILITY_ERR,
26663 "INST_NUM() or ROWNUM", "INST_NUM() or ROWNUM");
26665 parser_groupby_exception = PT_INST_NUM;
26672 node = parser_make_expression (this_parser, key->op, args, NULL, NULL);
26674 if ((args->node_type != PT_NAME && args->node_type != PT_DOT_) ||
26675 (args->node_type == PT_NAME && args->info.name.tag_click_counter) ||
26676 (args->node_type == PT_DOT_ && args->info.dot.tag_click_counter))
26678 PT_ERRORf (this_parser, node,
26679 "%s argument must be identifier or dotted identifier(path expression)",
26680 pt_short_print (this_parser, node));
26683 if (parser_select_level != 1)
26685 PT_ERRORf (this_parser, node,
26686 "%s can be used at top select statement only.",
26687 pt_short_print (this_parser, node));
26689 node->flag.is_hidden_column = 1;
26690 parser_hidden_incr_list =
26691 parser_append_node (node, parser_hidden_incr_list);
26692 if ((a1 = parser_copy_tree (this_parser, node->info.expr.arg1)) == NULL)
26697 parser_cannot_cache = true;
26699 if (a1->node_type == PT_NAME)
26700 a1->info.name.tag_click_counter = 1;
26701 else if (a1->node_type == PT_DOT_)
26702 a1->info.dot.tag_click_counter = 1;
26704 top_node = parser_is_select_stmt_node_empty () ? NULL : parser_top_select_stmt_node ();
26707 top_node->flag.is_click_counter = 1;
26715 case PT_TO_TIMESTAMP:
26716 case PT_TO_DATETIME:
26717 case PT_TO_DATETIME_TZ:
26718 case PT_TO_TIMESTAMP_TZ:
26719 if (c < 1 || c > 3)
26737 a2 = parser_new_node (this_parser, PT_VALUE);
26741 a2->type_enum = PT_TYPE_NULL;
26742 a2->flag.is_added_by_parser = 1;
26746 return parser_make_expression (this_parser, key->op, a1, a2,
26747 parser_make_date_lang (c, a3));
26749 case PT_BIT_TO_BLOB:
26750 case PT_CHAR_TO_BLOB:
26751 case PT_CHAR_TO_CLOB:
26752 case PT_BLOB_LENGTH:
26753 case PT_CLOB_LENGTH:
26761 a2 = parser_new_node (this_parser, PT_VALUE);
26764 if (key->op == PT_BIT_TO_BLOB ||
26765 key->op == PT_CHAR_TO_BLOB)
26767 a2->type_enum = PT_TYPE_BLOB;
26769 else if (key->op == PT_CHAR_TO_CLOB)
26771 a2->type_enum = PT_TYPE_CLOB;
26773 else if (key->op == PT_BLOB_LENGTH ||
26774 key->op == PT_CLOB_LENGTH)
26776 a2->type_enum = PT_TYPE_BIGINT;
26780 return parser_make_expression (this_parser, key->op, a1, NULL, NULL);
26782 case PT_BLOB_TO_BIT:
26789 return parser_make_expression (this_parser, key->op, a1, NULL, NULL);
26791 case PT_BLOB_FROM_FILE:
26792 case PT_CLOB_FROM_FILE:
26802 a2 = parser_new_node (this_parser, PT_VALUE);
26805 if (key->op == PT_BLOB_FROM_FILE)
26807 a2->type_enum = PT_TYPE_BLOB;
26809 else if (key->op == PT_CLOB_FROM_FILE)
26811 a2->type_enum = PT_TYPE_CLOB;
26815 /* Those two functions should be evaluated at the compile time */
26816 parser_cannot_cache = true;
26817 parser_cannot_prepare = true;
26818 node = parser_make_expression (this_parser, key->op, a1, a2, NULL);
26820 if (a1->node_type != PT_VALUE || a1->type_enum != PT_TYPE_CHAR)
26822 PT_ERRORf (this_parser, node,
26823 "%s argument must be a string liternal",
26824 pt_short_print (this_parser, node));
26833 PT_NODE *case_oper, *p, *q, *r, *nodep, *node, *curr, *prev;
26845 node = parser_new_node (this_parser, PT_EXPR);
26848 node->info.expr.op = PT_DECODE;
26849 q = parser_new_node (this_parser, PT_EXPR);
26852 q->info.expr.op = PT_EQ;
26853 q->info.expr.qualifier = PT_EQ_TORDER;
26854 q->info.expr.arg1 =
26855 parser_copy_tree_list (this_parser, case_oper);
26856 q->info.expr.arg2 = p;
26857 node->info.expr.arg3 = q;
26863 node->info.expr.arg1 = curr;
26868 count = parser_count_list (p);
26869 for (i = 1; i <= count; i++)
26875 nodep = parser_new_node (this_parser, PT_EXPR);
26878 nodep->info.expr.op = PT_DECODE;
26879 q = parser_new_node (this_parser, PT_EXPR);
26882 q->info.expr.op = PT_EQ;
26883 q->info.expr.qualifier = PT_EQ_TORDER;
26884 q->info.expr.arg1 =
26885 parser_copy_tree_list (this_parser, case_oper);
26886 q->info.expr.arg2 = p;
26887 nodep->info.expr.arg3 = q;
26890 nodep->info.expr.arg1 = r;
26891 nodep->info.expr.continued_case = 1;
26896 prev->info.expr.arg2 = nodep;
26905 /* default value */
26909 prev->info.expr.arg2 = p;
26912 else if (prev && prev->info.expr.arg2 == NULL)
26914 p = parser_new_node (this_parser, PT_VALUE);
26917 p->type_enum = PT_TYPE_NULL;
26918 p->flag.is_added_by_parser = 1;
26920 prev->info.expr.arg2 = p;
26925 parser_free_node (this_parser, case_oper);
26933 PT_NODE *prev, *expr, *arg, *tmp;
26940 expr = parser_new_node (this_parser, PT_EXPR);
26943 expr->info.expr.op = key->op;
26944 expr->info.expr.arg1 = arg;
26945 expr->info.expr.arg2 = NULL;
26946 expr->info.expr.arg3 = NULL;
26947 expr->info.expr.continued_case = 1;
26960 prev->info.expr.arg2 = arg;
26963 for (i = 3; i <= c; i++)
26969 expr = parser_new_node (this_parser, PT_EXPR);
26972 expr->info.expr.op = key->op;
26973 expr->info.expr.arg1 = prev;
26974 expr->info.expr.arg2 = arg;
26975 expr->info.expr.arg3 = NULL;
26976 expr->info.expr.continued_case = 1;
26979 if (prev && prev->info.expr.continued_case >= 1)
26980 prev->info.expr.continued_case++;
26985 if (expr && expr->info.expr.arg2 == NULL)
26987 expr->info.expr.arg2 =
26988 parser_copy_tree_list (this_parser, expr->info.expr.arg1);
26989 expr->info.expr.arg2->flag.is_hidden_column = 1;
26999 PT_NODE *prev, *expr, *arg, *tmp, *sep, *val;
27003 ws = (key->op != PT_CONCAT) ? 1 : 0;
27007 if (key->op != PT_CONCAT)
27017 expr = parser_new_node (this_parser, PT_EXPR);
27020 expr->info.expr.op = key->op;
27021 expr->info.expr.arg1 = arg;
27022 expr->info.expr.arg2 = NULL;
27023 if (key->op == PT_FIELD && sep)
27025 val = parser_new_node (this_parser, PT_VALUE);
27028 val->type_enum = PT_TYPE_INTEGER;
27029 val->info.value.data_value.i = 1;
27030 val->flag.is_hidden_column = 1;
27032 expr->info.expr.arg3 = parser_copy_tree (this_parser, sep);
27033 expr->info.expr.arg3->next = val;
27037 expr->info.expr.arg3 = sep;
27039 expr->info.expr.continued_case = 1;
27052 prev->info.expr.arg2 = arg;
27055 for (i = 3 + ws; i <= c; i++)
27061 expr = parser_new_node (this_parser, PT_EXPR);
27064 expr->info.expr.op = key->op;
27065 expr->info.expr.arg1 = prev;
27066 expr->info.expr.arg2 = arg;
27069 expr->info.expr.arg3 =
27070 parser_copy_tree (this_parser, sep);
27071 if (key->op == PT_FIELD)
27073 val = parser_new_node (this_parser, PT_VALUE);
27076 val->type_enum = PT_TYPE_INTEGER;
27077 val->info.value.data_value.i = i - ws;
27078 val->flag.is_hidden_column = 1;
27080 expr->info.expr.arg3->next = val;
27085 expr->info.expr.arg3 = NULL;
27087 expr->info.expr.continued_case = 1;
27090 if (prev && prev->info.expr.continued_case >= 1)
27091 prev->info.expr.continued_case++;
27096 if (key->op == PT_FIELD && expr && expr->info.expr.arg2 == NULL)
27098 val = parser_new_node (this_parser, PT_VALUE);
27101 val->type_enum = PT_TYPE_NULL;
27102 val->flag.is_hidden_column = 1;
27103 val->flag.is_added_by_parser = 1;
27105 expr->info.expr.arg2 = val;
27112 if (c < 2 || c > 3)
27124 node = parser_make_expression (this_parser, key->op, a1, a2, a3);
27138 node = parser_make_expression (this_parser, key->op, a1, a2, a3);
27149 node = parser_make_expression (this_parser, key->op, a1, a2, a3);
27159 node = parser_make_expression (this_parser, key->op, a1, NULL, NULL);
27167 node = parser_make_expression (this_parser, key->op, a1, NULL, NULL);
27170 case PT_GROUPBY_NUM:
27174 node = parser_new_node (this_parser, PT_FUNCTION);
27178 node->info.function.function_type = PT_GROUPBY_NUM;
27179 node->info.function.arg_list = NULL;
27180 node->info.function.all_or_distinct = PT_ALL;
27183 if (parser_groupbynum_check == 0)
27184 PT_ERRORmf2 (this_parser, node, MSGCAT_SET_PARSER_SEMANTIC,
27185 MSGCAT_SEMANTIC_INSTNUM_COMPATIBILITY_ERR,
27186 "GROUPBY_NUM()", "GROUPBY_NUM()");
27192 node = parser_make_expression (this_parser, key->op, NULL, NULL, NULL);
27202 node = parser_make_expression (this_parser, key->op, a1, NULL, NULL);
27205 node->flag.do_not_fold = 1;
27219 resolve_alias_in_expr_node (PT_NODE * node, PT_NODE * list)
27226 switch (node->node_type)
27229 if (node->info.sort_spec.expr
27230 && node->info.sort_spec.expr->node_type == PT_NAME)
27232 resolve_alias_in_name_node (&node->info.sort_spec.expr, list);
27236 resolve_alias_in_expr_node (node->info.sort_spec.expr, list);
27241 if (node->info.expr.arg1 && node->info.expr.arg1->node_type == PT_NAME)
27243 resolve_alias_in_name_node (&node->info.expr.arg1, list);
27247 resolve_alias_in_expr_node (node->info.expr.arg1, list);
27249 if (node->info.expr.arg2 && node->info.expr.arg2->node_type == PT_NAME)
27251 resolve_alias_in_name_node (&node->info.expr.arg2, list);
27255 resolve_alias_in_expr_node (node->info.expr.arg2, list);
27257 if (node->info.expr.arg3 && node->info.expr.arg3->node_type == PT_NAME)
27259 resolve_alias_in_name_node (&node->info.expr.arg3, list);
27263 resolve_alias_in_expr_node (node->info.expr.arg3, list);
27273 resolve_alias_in_name_node (PT_NODE ** node, PT_NODE * list)
27276 char *n_str, *c_str;
27277 bool resolved = false;
27279 n_str = parser_print_tree (this_parser, *node);
27281 for (col = list; col; col = col->next)
27283 if (col->node_type == PT_NAME)
27285 c_str = parser_print_tree (this_parser, col);
27291 if (intl_identifier_casecmp (n_str, c_str) == 0)
27299 if (resolved != true)
27301 for (col = list; col; col = col->next)
27303 if (col->alias_print
27304 && intl_identifier_casecmp (n_str, col->alias_print) == 0)
27306 parser_free_node (this_parser, *node);
27307 *node = parser_copy_tree (this_parser, col);
27308 (*node)->next = NULL;
27316 pt_check_identifier (PARSER_CONTEXT *parser, PT_NODE *p, const char *str,
27317 const int str_size)
27319 char *invalid_pos = NULL;
27322 if (intl_check_string ((char *) str, str_size, &invalid_pos, LANG_SYS_CODESET) == INTL_UTF8_INVALID)
27324 PT_ERRORmf (parser, NULL, MSGCAT_SET_ERROR, -(ER_INVALID_CHAR),
27325 (invalid_pos != NULL) ? invalid_pos - str : 0);
27328 else if (intl_identifier_fix ((char *) str, -1, true) != NO_ERROR)
27330 PT_ERRORf (parser, p, "invalid identifier : %s", str);
27334 if (LANG_SYS_CODESET == INTL_CODESET_UTF8
27335 && unicode_string_need_compose (str, str_size, &composed_size,
27336 lang_get_generic_unicode_norm ()))
27338 char *composed = NULL;
27339 bool is_composed = false;
27341 composed = parser_allocate_string_buffer (parser, composed_size + 1,
27343 if (composed == NULL)
27345 PT_ERRORf (parser, p, "cannot alloc %d bytes", composed_size + 1);
27349 unicode_compose_string (str, str_size, composed, &composed_size,
27350 &is_composed, lang_get_generic_unicode_norm ());
27351 composed[composed_size] = '\0';
27352 assert (composed_size <= str_size);
27360 return (char *)str;
27364 pt_create_char_string_literal (PARSER_CONTEXT *parser, const PT_TYPE_ENUM char_type,
27365 const char *str, const INTL_CODESET codeset)
27367 int str_size = strlen (str);
27368 PT_NODE *node = NULL;
27369 char *invalid_pos = NULL;
27372 if (intl_check_string (str, str_size, &invalid_pos, codeset) != INTL_UTF8_VALID)
27374 PT_ERRORmf (parser, NULL,
27375 MSGCAT_SET_ERROR, -(ER_INVALID_CHAR),
27376 (invalid_pos != NULL) ? invalid_pos - str : 0);
27379 if (codeset == INTL_CODESET_UTF8
27380 && unicode_string_need_compose (str, str_size, &composed_size,
27381 lang_get_generic_unicode_norm ()))
27383 char *composed = NULL;
27384 bool is_composed = false;
27386 composed = parser_allocate_string_buffer (parser, composed_size + 1,
27389 if (composed != NULL)
27391 unicode_compose_string (str, str_size, composed, &composed_size,
27392 &is_composed, lang_get_generic_unicode_norm ());
27393 composed[composed_size] = '\0';
27395 assert (composed_size <= str_size);
27400 str_size = composed_size;
27406 PT_ERRORf (parser, NULL, "cannot alloc %d bytes", composed_size + 1);
27410 node = parser_new_node (parser, PT_VALUE);
27413 unsigned char *string;
27416 node->info.value.data_value.str = pt_append_bytes (parser, NULL, str, str_size);
27417 string = node->info.value.data_value.str->bytes;
27418 length = node->info.value.data_value.str->length;
27420 node->type_enum = char_type;
27423 if (string[length - 1] == 0x20)
27425 if (char_type == PT_TYPE_CHAR)
27427 node->type_enum = PT_TYPE_VARCHAR;
27429 else if (char_type == PT_TYPE_NCHAR)
27431 node->type_enum = PT_TYPE_VARNCHAR;
27436 if (char_type == PT_TYPE_NCHAR)
27438 node->info.value.string_type = 'N';
27442 node->info.value.string_type = ' ';
27445 PT_NODE_PRINT_VALUE_TO_TEXT (parser, node);
27452 pt_create_date_value (PARSER_CONTEXT *parser, const PT_TYPE_ENUM type,
27455 PT_NODE *node = NULL;
27457 node = parser_new_node (parser, PT_VALUE);
27461 node->type_enum = type;
27463 node->info.value.data_value.str = pt_append_bytes (parser, NULL, str, strlen (str));
27464 PT_NODE_PRINT_VALUE_TO_TEXT (parser, node);
27471 pt_value_set_charset_coll (PARSER_CONTEXT *parser, PT_NODE *node,
27472 const int codeset_id, const int collation_id,
27475 PT_NODE *dt = NULL;
27477 assert (node->node_type == PT_VALUE);
27478 assert (PT_HAS_COLLATION (node->type_enum));
27479 assert (node->data_type == NULL);
27481 if (!force && codeset_id == LANG_SYS_CODESET
27482 && collation_id == LANG_SYS_COLLATION)
27484 /* not necessary to add a new node, by default constants get the
27485 * coercible (system) charset and collation */
27489 dt = parser_new_node (parser, PT_DATA_TYPE);
27492 dt->type_enum = node->type_enum;
27493 dt->info.data_type.precision = TP_FLOATING_PRECISION_VALUE;
27494 dt->info.data_type.units = codeset_id;
27495 dt->info.data_type.collation_id = collation_id;
27497 node->data_type = dt;
27498 if (collation_id != LANG_GET_BINARY_COLLATION (codeset_id))
27500 assert (collation_id != LANG_SYS_COLLATION);
27501 node->info.value.print_collation = true;
27507 pt_value_set_collation_info (PARSER_CONTEXT *parser, PT_NODE *node,
27508 PT_NODE *coll_node)
27510 LANG_COLLATION *lang_coll = NULL;
27517 assert (node->node_type == PT_VALUE);
27519 if (node->data_type != NULL
27520 && node->data_type->info.data_type.units != LANG_SYS_CODESET)
27522 assert (node->node_type == PT_VALUE);
27523 assert (PT_HAS_COLLATION (node->type_enum));
27525 node->info.value.print_charset = true;
27528 /* coll_node is the optional collation specified by user with COLLATE */
27529 if (coll_node == NULL)
27531 int client_collation = lang_get_client_collation ();
27533 if (client_collation == LANG_SYS_COLLATION)
27535 /* no need for collation info */
27540 lang_coll = lang_get_collation (client_collation);
27541 assert (lang_coll != NULL);
27546 assert (coll_node->node_type == PT_VALUE);
27548 assert (coll_node->info.value.data_value.str != NULL);
27549 lang_coll = lang_get_collation_by_name ((const char *) coll_node->info.value.data_value.str->bytes);
27552 if (lang_coll != NULL)
27554 if (node->data_type != NULL)
27556 /* check charset-collation compatibility */
27557 if (lang_coll->codeset != node->data_type->info.data_type.units)
27559 /* set an error only when charset and collation given by user
27560 are not compatible */
27561 if (coll_node != NULL)
27563 if (!node->info.value.has_cs_introducer)
27565 node->data_type->info.data_type.units =
27566 lang_coll->codeset;
27567 node->data_type->info.data_type.collation_id =
27568 lang_coll->coll.coll_id;
27572 PT_ERRORm (parser, coll_node, MSGCAT_SET_PARSER_SEMANTIC,
27573 MSGCAT_SEMANTIC_INCOMPATIBLE_CS_COLL);
27579 /* COLLATE was not specified: leave the default collation of
27580 charset set by charset introducer */
27581 assert (node->info.value.print_collation == false);
27588 node->data_type->info.data_type.collation_id = lang_coll->coll.coll_id;
27590 if (LANG_GET_BINARY_COLLATION (node->data_type->info.data_type.units)
27591 == lang_coll->coll.coll_id)
27593 /* do not print collation */
27600 pt_value_set_charset_coll (parser, node, lang_coll->codeset,
27601 lang_coll->coll.coll_id, false);
27606 PT_ERRORmf (parser, coll_node, MSGCAT_SET_PARSER_SEMANTIC,
27607 MSGCAT_SEMANTIC_UNKNOWN_COLL,
27608 coll_node->info.value.data_value.str->bytes);
27612 node->info.value.print_collation = true;
27616 pt_value_set_monetary (PARSER_CONTEXT *parser, PT_NODE *node,
27617 const char *currency_str, const char *value, DB_CURRENCY type)
27621 assert (node != NULL);
27622 assert (node->node_type == PT_VALUE);
27623 assert (value != NULL);
27626 dval = strtod (value, NULL);
27627 if (errno == ERANGE)
27629 PT_ERRORmf2 (parser, node, MSGCAT_SET_PARSER_SYNTAX,
27630 MSGCAT_SYNTAX_FLT_DBL_OVERFLOW, value, pt_show_type_enum (PT_TYPE_MONETARY));
27633 node->info.value.data_value.money.type = type;
27634 node->info.value.text = pt_append_string (parser, currency_str, value);
27635 node->type_enum = PT_TYPE_MONETARY;
27636 node->info.value.data_value.money.amount = dval;
27642 pt_set_collation_modifier (PARSER_CONTEXT *parser, PT_NODE *node,
27643 PT_NODE *coll_node)
27645 LANG_COLLATION *lang_coll = NULL;
27646 bool do_wrap_with_cast = false;
27648 assert (coll_node != NULL);
27649 assert (coll_node->node_type == PT_VALUE);
27651 assert (coll_node->info.value.data_value.str != NULL);
27652 lang_coll = lang_get_collation_by_name ((const char *) coll_node->info.value.data_value.str->bytes);
27654 if (lang_coll == NULL)
27656 PT_ERRORmf (parser, coll_node, MSGCAT_SET_PARSER_SEMANTIC,
27657 MSGCAT_SEMANTIC_UNKNOWN_COLL, coll_node->info.value.data_value.str->bytes);
27661 if (node->node_type == PT_VALUE)
27663 if (!(PT_HAS_COLLATION (node->type_enum)))
27665 PT_ERRORm (parser, coll_node, MSGCAT_SET_PARSER_SEMANTIC,
27666 MSGCAT_SEMANTIC_COLLATE_NOT_ALLOWED);
27669 PT_SET_NODE_COLL_MODIFIER (node, lang_coll->coll.coll_id);
27670 pt_value_set_collation_info (parser, node, coll_node);
27672 else if (node->node_type == PT_EXPR)
27674 if (node->info.expr.op == PT_EVALUATE_VARIABLE || node->info.expr.op == PT_DEFINE_VARIABLE)
27676 PT_ERRORm (parser, coll_node, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_COLLATE_NOT_ALLOWED);
27679 else if (node->info.expr.op == PT_CAST
27680 && PT_EXPR_INFO_IS_FLAGED (node, PT_EXPR_INFO_CAST_COLL_MODIFIER))
27682 LANG_COLLATION *lc_node = lang_get_collation (PT_GET_COLLATION_MODIFIER (node));
27683 if (lc_node->codeset != lang_coll->codeset)
27685 PT_ERRORmf2 (parser, node, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_CS_MATCH_COLLATE,
27686 lang_get_codeset_name (lc_node->codeset),
27687 lang_get_codeset_name (lang_coll->codeset));
27691 PT_SET_NODE_COLL_MODIFIER (node, lang_coll->coll.coll_id);
27692 if (!pt_is_comp_op (node->info.expr.op))
27694 do_wrap_with_cast = true;
27697 else if (node->node_type == PT_NAME || node->node_type == PT_DOT_ || node->node_type == PT_FUNCTION)
27699 PT_SET_NODE_COLL_MODIFIER (node, lang_coll->coll.coll_id);
27700 do_wrap_with_cast = true;
27704 PT_ERRORm (parser, node, MSGCAT_SET_PARSER_SEMANTIC, MSGCAT_SEMANTIC_COLLATE_NOT_ALLOWED);
27705 assert (do_wrap_with_cast == false);
27708 if (do_wrap_with_cast)
27710 PT_NODE *cast_expr = parser_make_expression (parser, PT_CAST, node, NULL, NULL);
27711 if (cast_expr != NULL)
27713 cast_expr->info.expr.cast_type = NULL;
27714 PT_EXPR_INFO_SET_FLAG (cast_expr, PT_EXPR_INFO_CAST_COLL_MODIFIER);
27716 PT_SET_NODE_COLL_MODIFIER (cast_expr, lang_coll->coll.coll_id);
27724 pt_create_json_value (PARSER_CONTEXT *parser, const char *str)
27726 PT_NODE *node = NULL;
27728 node = parser_new_node (parser, PT_VALUE);
27731 node->type_enum = PT_TYPE_JSON;
27733 node->info.value.data_value.str = pt_append_bytes (parser, NULL, str, strlen (str));
27734 PT_NODE_PRINT_VALUE_TO_TEXT (parser, node);
27741 pt_jt_append_column_or_nested_node (PT_NODE * jt_node, PT_NODE * jt_col_or_nested)
27743 assert (jt_node != NULL && jt_node->node_type == PT_JSON_TABLE_NODE);
27744 assert (jt_col_or_nested != NULL);
27746 if (jt_col_or_nested->node_type == PT_JSON_TABLE_COLUMN)
27748 jt_col_or_nested->info.json_table_column_info.index = json_table_column_count++;
27749 jt_node->info.json_table_node_info.columns =
27750 parser_append_node (jt_col_or_nested, jt_node->info.json_table_node_info.columns);
27754 assert (jt_col_or_nested->node_type == PT_JSON_TABLE_NODE);
27755 jt_node->info.json_table_node_info.nested_paths =
27756 parser_append_node (jt_col_or_nested, jt_node->info.json_table_node_info.nested_paths);
27761 pt_create_paren_expr_list (PT_NODE * exp)
27763 PT_NODE *val, *tmp;
27765 if (exp && exp->next == NULL)
27767 if (exp->node_type == PT_EXPR)
27769 exp->info.expr.paren_type = 1;
27771 exp->flag.is_paren = 1;
27775 val = parser_new_node (this_parser, PT_VALUE);
27778 for (tmp = exp; tmp; tmp = tmp->next)
27780 if (tmp->node_type == PT_VALUE && tmp->type_enum == PT_TYPE_EXPR_SET)
27782 tmp->type_enum = PT_TYPE_SEQUENCE;
27786 val->info.value.data_value.set = exp;
27787 val->type_enum = PT_TYPE_EXPR_SET;
27790 parser_groupby_exception = PT_EXPR;