summaryrefslogtreecommitdiff
path: root/sql/sql_yacc_ora.yy
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_yacc_ora.yy')
-rw-r--r--sql/sql_yacc_ora.yy5316
1 files changed, 2894 insertions, 2422 deletions
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index ec2aeeaefba..5c885a5a2cf 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -37,7 +37,7 @@
#include "sql_priv.h"
#include "sql_parse.h" /* comp_*_creator */
#include "sql_table.h" /* primary_key_name */
-#include "sql_partition.h" /* mem_alloc_error, partition_info, HASH_PARTITION */
+#include "sql_partition.h" /* partition_info, HASH_PARTITION */
#include "sql_acl.h" /* *_ACL */
#include "sql_class.h" /* Key_part_spec, enum_filetype, Diag_condition_item_name */
#include "slave.h"
@@ -67,6 +67,7 @@
#include "lex_token.h"
#include "sql_lex.h"
#include "sql_sequence.h"
+#include "my_base.h"
/* this is to get the bison compilation windows warnings out */
#ifdef _MSC_VER
@@ -79,7 +80,7 @@ int yylex(void *yylval, void *yythd);
#define yyoverflow(A,B,C,D,E,F) \
{ \
size_t val= *(F); \
- if (my_yyoverflow((B), (D), &val)) \
+ if (unlikely(my_yyoverflow((B), (D), &val))) \
{ \
yyerror(thd, (char*) (A)); \
return 2; \
@@ -98,7 +99,7 @@ int yylex(void *yylval, void *yythd);
} while (0)
#define MYSQL_YYABORT_UNLESS(A) \
- if (!(A)) \
+ if (unlikely(!(A))) \
{ \
thd->parse_error(); \
MYSQL_YYABORT; \
@@ -155,7 +156,7 @@ void ORAerror(THD *thd, const char *s)
#define bincmp_collation(X,Y) \
do \
{ \
- if (Lex->set_bincmp(X,Y)) \
+ if (unlikely(Lex->set_bincmp(X,Y))) \
MYSQL_YYABORT; \
} while(0)
@@ -169,9 +170,10 @@ void ORAerror(THD *thd, const char *s)
/* structs */
LEX_CSTRING lex_str;
- LEX_SYMBOL symbol;
+ Lex_ident_cli_st kwd;
+ Lex_ident_cli_st ident_cli;
+ Lex_ident_sys_st ident_sys;
Lex_string_with_metadata_st lex_string_with_metadata;
- Lex_string_with_pos_st lex_string_with_pos;
Lex_spblock_st spblock;
Lex_spblock_handlers_st spblock_handlers;
Lex_length_and_dec_st Lex_length_and_dec;
@@ -186,6 +188,7 @@ void ORAerror(THD *thd, const char *s)
LEX_CSTRING name;
uint offset;
} sp_cursor_name_and_offset;
+ vers_history_point_t vers_history_point;
/* pointers */
Create_field *create_field;
@@ -267,6 +270,8 @@ void ORAerror(THD *thd, const char *s)
enum Window_frame::Frame_exclusion frame_exclusion;
enum trigger_order_type trigger_action_order_type;
DDL_options_st object_ddl_options;
+ enum vers_sys_type_t vers_range_unit;
+ enum Column_definition::enum_column_versioning vers_column_versioning;
}
%{
@@ -277,10 +282,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 104 shift/reduce conflicts.
+ Currently there are 69 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 104
+%expect 69
/*
Comments for TOKENS.
@@ -300,679 +305,277 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
This makes the code grep-able, and helps maintenance.
*/
-
+
+
+/*
+ Reserved keywords and operators
+*/
%token ABORT_SYM /* INTERNAL (used in lex) */
%token ACCESSIBLE_SYM
-%token ACTION /* SQL-2003-N */
%token ADD /* SQL-2003-R */
-%token ADMIN_SYM /* SQL-2003-N */
-%token ADDDATE_SYM /* MYSQL-FUNC */
-%token AFTER_SYM /* SQL-2003-N */
-%token AGAINST
-%token AGGREGATE_SYM
-%token ALGORITHM_SYM
%token ALL /* SQL-2003-R */
%token ALTER /* SQL-2003-R */
-%token ALWAYS_SYM
%token ANALYZE_SYM
%token AND_AND_SYM /* OPERATOR */
%token AND_SYM /* SQL-2003-R */
-%token ANY_SYM /* SQL-2003-R */
%token AS /* SQL-2003-R */
%token ASC /* SQL-2003-N */
-%token ASCII_SYM /* MYSQL-FUNC */
%token ASENSITIVE_SYM /* FUTURE-USE */
-%token AT_SYM /* SQL-2003-R */
-%token ATOMIC_SYM /* SQL-2003-R */
-%token AUTHORS_SYM
-%token AUTOEXTEND_SIZE_SYM
-%token AUTO_INC
-%token AUTO_SYM
-%token AVG_ROW_LENGTH
-%token AVG_SYM /* SQL-2003-N */
-%token BACKUP_SYM
%token BEFORE_SYM /* SQL-2003-N */
-%token BEGIN_SYM /* SQL-2003-R */
%token BETWEEN_SYM /* SQL-2003-R */
%token BIGINT /* SQL-2003-R */
%token BINARY /* SQL-2003-R */
-%token BINLOG_SYM
%token BIN_NUM
%token BIT_AND /* MYSQL-FUNC */
%token BIT_OR /* MYSQL-FUNC */
-%token BIT_SYM /* MYSQL-FUNC */
%token BIT_XOR /* MYSQL-FUNC */
%token BLOB_SYM /* SQL-2003-R */
-%token BLOCK_SYM
-%token BODY_SYM /* Oracle-R */
-%token BOOLEAN_SYM /* SQL-2003-R */
-%token BOOL_SYM
%token BOTH /* SQL-2003-R */
-%token BTREE_SYM
%token BY /* SQL-2003-R */
-%token BYTE_SYM
-%token CACHE_SYM
%token CALL_SYM /* SQL-2003-R */
%token CASCADE /* SQL-2003-N */
-%token CASCADED /* SQL-2003-R */
%token CASE_SYM /* SQL-2003-R */
%token CAST_SYM /* SQL-2003-R */
-%token CATALOG_NAME_SYM /* SQL-2003-N */
-%token CHAIN_SYM /* SQL-2003-N */
%token CHANGE
-%token CHANGED
-%token CHARSET
%token CHAR_SYM /* SQL-2003-R */
-%token CHECKPOINT_SYM
-%token CHECKSUM_SYM
%token CHECK_SYM /* SQL-2003-R */
-%token CIPHER_SYM
-%token CLASS_ORIGIN_SYM /* SQL-2003-N */
-%token CLIENT_SYM
-%token CLOSE_SYM /* SQL-2003-R */
-%token CLOB /* SQL-2003-R */
-%token COALESCE /* SQL-2003-N */
-%token CODE_SYM
%token COLLATE_SYM /* SQL-2003-R */
-%token COLLATION_SYM /* SQL-2003-N */
-%token COLUMNS
-%token COLUMN_ADD_SYM
-%token COLUMN_CHECK_SYM
-%token COLUMN_CREATE_SYM
-%token COLUMN_DELETE_SYM
-%token COLUMN_GET_SYM
-%token COLUMN_SYM /* SQL-2003-R */
-%token COLUMN_NAME_SYM /* SQL-2003-N */
-%token COMMENT_SYM
-%token COMMITTED_SYM /* SQL-2003-N */
-%token COMMIT_SYM /* SQL-2003-R */
-%token COMPACT_SYM
-%token COMPLETION_SYM
-%token COMPRESSED_SYM
-%token CONCURRENT
%token CONDITION_SYM /* SQL-2003-R, SQL-2008-R */
-%token CONNECTION_SYM
-%token CONSISTENT_SYM
%token CONSTRAINT /* SQL-2003-R */
-%token CONSTRAINT_CATALOG_SYM /* SQL-2003-N */
-%token CONSTRAINT_NAME_SYM /* SQL-2003-N */
-%token CONSTRAINT_SCHEMA_SYM /* SQL-2003-N */
-%token CONTAINS_SYM /* SQL-2003-N */
-%token CONTEXT_SYM
%token CONTINUE_SYM /* SQL-2003-R */
-%token CONTRIBUTORS_SYM
%token CONVERT_SYM /* SQL-2003-N */
%token COUNT_SYM /* SQL-2003-N */
-%token CPU_SYM
%token CREATE /* SQL-2003-R */
%token CROSS /* SQL-2003-R */
-%token CUBE_SYM /* SQL-2003-R */
%token CUME_DIST_SYM
%token CURDATE /* MYSQL-FUNC */
-%token CURRENT_SYM /* SQL-2003-R */
%token CURRENT_USER /* SQL-2003-R */
%token CURRENT_ROLE /* SQL-2003-R */
-%token CURRENT_POS_SYM
%token CURSOR_SYM /* SQL-2003-R */
-%token CURSOR_NAME_SYM /* SQL-2003-N */
%token CURTIME /* MYSQL-FUNC */
-%token CYCLE_SYM
%token DATABASE
%token DATABASES
-%token DATAFILE_SYM
-%token DATA_SYM /* SQL-2003-N */
-%token DATETIME
%token DATE_ADD_INTERVAL /* MYSQL-FUNC */
-%token DATE_FORMAT_SYM /* MYSQL-FUNC */
%token DATE_SUB_INTERVAL /* MYSQL-FUNC */
-%token DATE_SYM /* SQL-2003-R */
%token DAY_HOUR_SYM
%token DAY_MICROSECOND_SYM
%token DAY_MINUTE_SYM
%token DAY_SECOND_SYM
-%token DAY_SYM /* SQL-2003-R */
-%token DEALLOCATE_SYM /* SQL-2003-R */
%token DECIMAL_NUM
%token DECIMAL_SYM /* SQL-2003-R */
%token DECLARE_SYM /* SQL-2003-R */
-%token DECODE_SYM /* Oracle function, non-reserved */
%token DEFAULT /* SQL-2003-R */
-%token DEFINER_SYM
-%token DELAYED_SYM
-%token DELAY_KEY_WRITE_SYM
%token DELETE_DOMAIN_ID_SYM
%token DELETE_SYM /* SQL-2003-R */
%token DENSE_RANK_SYM
%token DESC /* SQL-2003-N */
%token DESCRIBE /* SQL-2003-R */
-%token DES_KEY_FILE
%token DETERMINISTIC_SYM /* SQL-2003-R */
-%token DIAGNOSTICS_SYM /* SQL-2003-N */
-%token DIRECTORY_SYM
-%token DISABLE_SYM
-%token DISCARD
-%token DISK_SYM
%token DISTINCT /* SQL-2003-R */
%token DIV_SYM
%token DOUBLE_SYM /* SQL-2003-R */
%token DO_DOMAIN_IDS_SYM
-%token DO_SYM
%token DOT_DOT_SYM
%token DROP /* SQL-2003-R */
%token DUAL_SYM
-%token DUMPFILE
-%token DUPLICATE_SYM
-%token DYNAMIC_SYM /* SQL-2003-R */
%token EACH_SYM /* SQL-2003-R */
%token ELSE /* SQL-2003-R */
%token ELSEIF_SYM
-%token ELSIF_SYM /* Oracle, reserved in PL/SQL*/
-%token ENABLE_SYM
%token ENCLOSED
-%token END /* SQL-2003-R */
-%token ENDS_SYM
%token END_OF_INPUT /* INTERNAL */
-%token ENGINES_SYM
-%token ENGINE_SYM
-%token ENUM
%token EQUAL_SYM /* OPERATOR */
-%token ERROR_SYM
-%token ERRORS
%token ESCAPED
-%token ESCAPE_SYM /* SQL-2003-R */
-%token EVENTS_SYM
-%token EVENT_SYM
-%token EVERY_SYM /* SQL-2003-N */
-%token EXCHANGE_SYM
-%token EXAMINED_SYM
%token EXCEPT_SYM /* SQL-2003-R */
-%token EXCLUDE_SYM /* SQL-2011-N */
-%token EXECUTE_SYM /* SQL-2003-R */
-%token EXCEPTION_SYM /* SQL-2003-N, Oracle-PLSQL-R */
%token EXISTS /* SQL-2003-R */
-%token EXIT_SYM
-%token EXPANSION_SYM
-%token EXPORT_SYM
-%token EXTENDED_SYM
-%token EXTENT_SIZE_SYM
%token EXTRACT_SYM /* SQL-2003-N */
%token FALSE_SYM /* SQL-2003-R */
-%token FAST_SYM
-%token FAULTS_SYM
%token FETCH_SYM /* SQL-2003-R */
-%token FILE_SYM
%token FIRST_VALUE_SYM /* SQL-2011 */
-%token FIRST_SYM /* SQL-2003-N */
-%token FIXED_SYM
%token FLOAT_NUM
%token FLOAT_SYM /* SQL-2003-R */
-%token FLUSH_SYM
-%token FOLLOWS_SYM /* MYSQL trigger*/
-%token FOLLOWING_SYM /* SQL-2011-N */
-%token FORCE_SYM
%token FOREIGN /* SQL-2003-R */
%token FOR_SYM /* SQL-2003-R */
%token FOR_SYSTEM_TIME_SYM /* INTERNAL */
-%token FORMAT_SYM
-%token FOUND_SYM /* SQL-2003-R */
%token FROM
-%token FULL /* SQL-2003-R */
%token FULLTEXT_SYM
-%token FUNCTION_SYM /* SQL-2003-R */
%token GE
-%token GENERAL
-%token GENERATED_SYM
-%token GEOMETRYCOLLECTION
-%token GEOMETRY_SYM
-%token GET_FORMAT /* MYSQL-FUNC */
-%token GET_SYM /* SQL-2003-R */
-%token GLOBAL_SYM /* SQL-2003-R */
-%token GOTO_SYM /* Oracle, reserved in PL/SQL*/
%token GRANT /* SQL-2003-R */
-%token GRANTS
%token GROUP_SYM /* SQL-2003-R */
%token GROUP_CONCAT_SYM
%token LAG_SYM /* SQL-2011 */
%token LEAD_SYM /* SQL-2011 */
-%token HANDLER_SYM
-%token HARD_SYM
-%token HASH_SYM
%token HAVING /* SQL-2003-R */
-%token HELP_SYM
%token HEX_NUM
%token HEX_STRING
-%token HIGH_PRIORITY
-%token HISTORY_SYM /* MYSQL */
-%token HOST_SYM
-%token HOSTS_SYM
%token HOUR_MICROSECOND_SYM
%token HOUR_MINUTE_SYM
%token HOUR_SECOND_SYM
-%token HOUR_SYM /* SQL-2003-R */
-%token ID_SYM /* MYSQL */
%token IDENT
-%token IDENTIFIED_SYM
%token IDENT_QUOTED
%token IF_SYM
%token IGNORE_DOMAIN_IDS_SYM
%token IGNORE_SYM
-%token IGNORE_SERVER_IDS_SYM
-%token IMMEDIATE_SYM /* SQL-2003-R */
-%token IMPORT
-%token INCREMENT_SYM
-%token INDEXES
%token INDEX_SYM
%token INFILE
-%token INITIAL_SIZE_SYM
%token INNER_SYM /* SQL-2003-R */
%token INOUT_SYM /* SQL-2003-R */
%token INSENSITIVE_SYM /* SQL-2003-R */
%token INSERT /* SQL-2003-R */
-%token INSERT_METHOD
-%token INSTALL_SYM
%token INTERSECT_SYM /* SQL-2003-R */
%token INTERVAL_SYM /* SQL-2003-R */
%token INTO /* SQL-2003-R */
%token INT_SYM /* SQL-2003-R */
-%token INVOKER_SYM
%token IN_SYM /* SQL-2003-R */
-%token IO_SYM
-%token IPC_SYM
%token IS /* SQL-2003-R */
-%token ISOLATION /* SQL-2003-R */
-%token ISOPEN_SYM /* Oracle-N */
-%token ISSUER_SYM
%token ITERATE_SYM
-%token INVISIBLE_SYM
%token JOIN_SYM /* SQL-2003-R */
-%token JSON_SYM
%token KEYS
-%token KEY_BLOCK_SIZE
%token KEY_SYM /* SQL-2003-N */
%token KILL_SYM
-%token LANGUAGE_SYM /* SQL-2003-R */
-%token LAST_SYM /* SQL-2003-N */
-%token LAST_VALUE
-%token LASTVAL_SYM /* PostgreSQL sequence function */
%token LE /* OPERATOR */
%token LEADING /* SQL-2003-R */
-%token LEAVES
%token LEAVE_SYM
%token LEFT /* SQL-2003-R */
-%token LESS_SYM
-%token LEVEL_SYM
%token LEX_HOSTNAME
%token LIKE /* SQL-2003-R */
%token LIMIT
%token LINEAR_SYM
%token LINES
-%token LINESTRING
-%token LIST_SYM
%token LOAD
-%token LOCAL_SYM /* SQL-2003-R */
%token LOCATOR_SYM /* SQL-2003-N */
-%token LOCKS_SYM
%token LOCK_SYM
-%token LOGFILE_SYM
-%token LOGS_SYM
%token LONGBLOB
%token LONGTEXT
%token LONG_NUM
%token LONG_SYM
%token LOOP_SYM
%token LOW_PRIORITY
-%token MASTER_CONNECT_RETRY_SYM
-%token MASTER_DELAY_SYM
-%token MASTER_GTID_POS_SYM
-%token MASTER_HOST_SYM
-%token MASTER_LOG_FILE_SYM
-%token MASTER_LOG_POS_SYM
-%token MASTER_PASSWORD_SYM
-%token MASTER_PORT_SYM
-%token MASTER_SERVER_ID_SYM
-%token MASTER_SSL_CAPATH_SYM
-%token MASTER_SSL_CA_SYM
-%token MASTER_SSL_CERT_SYM
-%token MASTER_SSL_CIPHER_SYM
-%token MASTER_SSL_CRL_SYM
-%token MASTER_SSL_CRLPATH_SYM
-%token MASTER_SSL_KEY_SYM
-%token MASTER_SSL_SYM
%token MASTER_SSL_VERIFY_SERVER_CERT_SYM
-%token MASTER_SYM
-%token MASTER_USER_SYM
-%token MASTER_USE_GTID_SYM
-%token MASTER_HEARTBEAT_PERIOD_SYM
%token MATCH /* SQL-2003-R */
-%token MAX_CONNECTIONS_PER_HOUR
-%token MAX_QUERIES_PER_HOUR
-%token MAX_ROWS
-%token MAX_SIZE_SYM
%token MAX_SYM /* SQL-2003-N */
-%token MAX_UPDATES_PER_HOUR
-%token MAX_STATEMENT_TIME_SYM
-%token MAX_USER_CONNECTIONS_SYM
%token MAXVALUE_SYM /* SQL-2003-N */
%token MEDIAN_SYM
%token MEDIUMBLOB
%token MEDIUMINT
%token MEDIUMTEXT
-%token MEDIUM_SYM
-%token MEMORY_SYM
-%token MERGE_SYM /* SQL-2003-R */
-%token MESSAGE_TEXT_SYM /* SQL-2003-N */
-%token MICROSECOND_SYM /* MYSQL-FUNC */
-%token MIGRATE_SYM
%token MINUTE_MICROSECOND_SYM
%token MINUTE_SECOND_SYM
-%token MINUTE_SYM /* SQL-2003-R */
-%token MINVALUE_SYM
-%token MIN_ROWS
%token MIN_SYM /* SQL-2003-N */
-%token MODE_SYM
%token MODIFIES_SYM /* SQL-2003-R */
-%token MODIFY_SYM
%token MOD_SYM /* SQL-2003-N */
-%token MONTH_SYM /* SQL-2003-R */
-%token MULTILINESTRING
-%token MULTIPOINT
-%token MULTIPOLYGON
-%token MUTEX_SYM
-%token MYSQL_SYM
-%token MYSQL_ERRNO_SYM
-%token NAMES_SYM /* SQL-2003-N */
-%token NAME_SYM /* SQL-2003-N */
-%token NATIONAL_SYM /* SQL-2003-R */
+%token MYSQL_CONCAT_SYM /* OPERATOR */
%token NATURAL /* SQL-2003-R */
%token NCHAR_STRING
-%token NCHAR_SYM /* SQL-2003-R */
%token NE /* OPERATOR */
%token NEG
-%token NEW_SYM /* SQL-2003-R */
-%token NEXT_SYM /* SQL-2003-N */
-%token NEXTVAL_SYM /* PostgreSQL sequence function */
-%token NOCACHE_SYM
-%token NOCYCLE_SYM
-%token NODEGROUP_SYM
-%token NONE_SYM /* SQL-2003-R */
%token NOT2_SYM
%token NOT_SYM /* SQL-2003-R */
-%token NOTFOUND_SYM /* Oracle-R */
%token NOW_SYM
-%token NO_SYM /* SQL-2003-R */
-%token NOMAXVALUE_SYM
-%token NOMINVALUE_SYM
-%token NO_WAIT_SYM
-%token NOWAIT_SYM
%token NO_WRITE_TO_BINLOG
%token NTILE_SYM
%token NULL_SYM /* SQL-2003-R */
%token NUM
-%token NUMBER_SYM /* SQL-2003-N */
%token NUMERIC_SYM /* SQL-2003-R */
%token NTH_VALUE_SYM /* SQL-2011 */
-%token NVARCHAR_SYM
-%token OF_SYM /* SQL-1992-R, Oracle-R */
-%token OFFSET_SYM
-%token OLD_PASSWORD_SYM
%token ON /* SQL-2003-R */
-%token ONE_SYM
-%token ONLY_SYM /* SQL-2003-R */
-%token ONLINE_SYM
-%token OPEN_SYM /* SQL-2003-R */
%token OPTIMIZE
-%token OPTIONS_SYM
-%token OPTION /* SQL-2003-N */
%token OPTIONALLY
+%token ORACLE_CONCAT_SYM /* INTERNAL */
%token OR2_SYM
%token ORDER_SYM /* SQL-2003-R */
-%token OR_OR_SYM /* OPERATOR */
%token OR_SYM /* SQL-2003-R */
-%token OTHERS_SYM /* SQL-2011-N */
%token OUTER
%token OUTFILE
%token OUT_SYM /* SQL-2003-R */
%token OVER_SYM
-%token OWNER_SYM
-%token PACKAGE_SYM /* Oracle-R */
-%token PACK_KEYS_SYM
-%token PAGE_SYM
%token PAGE_CHECKSUM_SYM
%token PARAM_MARKER
-%token PARSER_SYM
%token PARSE_VCOL_EXPR_SYM
-%token PARTIAL /* SQL-2003-N */
%token PARTITION_SYM /* SQL-2003-R */
-%token PARTITIONS_SYM
-%token PARTITIONING_SYM
-%token PASSWORD_SYM
%token PERCENT_RANK_SYM
%token PERCENTILE_CONT_SYM
%token PERCENTILE_DISC_SYM
-%token PERIOD_SYM /* SQL-2011-R */
-%token PERSISTENT_SYM
-%token PHASE_SYM
-%token PLUGINS_SYM
-%token PLUGIN_SYM
-%token POINT_SYM
-%token POLYGON
-%token PORT_SYM
%token POSITION_SYM /* SQL-2003-N */
-%token PRECEDES_SYM /* MYSQL */
-%token PRECEDING_SYM /* SQL-2011-N */
%token PRECISION /* SQL-2003-R */
-%token PREPARE_SYM /* SQL-2003-R */
-%token PRESERVE_SYM
-%token PREV_SYM
-%token PREVIOUS_SYM
%token PRIMARY_SYM /* SQL-2003-R */
-%token PRIVILEGES /* SQL-2003-N */
%token PROCEDURE_SYM /* SQL-2003-R */
-%token PROCESS
-%token PROCESSLIST_SYM
-%token PROFILE_SYM
-%token PROFILES_SYM
-%token PROXY_SYM
%token PURGE
-%token QUARTER_SYM
-%token QUERY_SYM
-%token QUICK
-%token RAISE_SYM /* Oracle-PLSQL-R */
%token RANGE_SYM /* SQL-2003-R */
%token RANK_SYM
-%token RAW /* Oracle */
%token READS_SYM /* SQL-2003-R */
-%token READ_ONLY_SYM
%token READ_SYM /* SQL-2003-N */
%token READ_WRITE_SYM
%token REAL /* SQL-2003-R */
-%token REBUILD_SYM
-%token RECOVER_SYM
%token RECURSIVE_SYM
-%token REDOFILE_SYM
-%token REDO_BUFFER_SIZE_SYM
-%token REDUNDANT_SYM
+%token REF_SYSTEM_ID_SYM
%token REFERENCES /* SQL-2003-R */
%token REGEXP
-%token RELAY
-%token RELAYLOG_SYM
-%token RELAY_LOG_FILE_SYM
-%token RELAY_LOG_POS_SYM
-%token RELAY_THREAD
%token RELEASE_SYM /* SQL-2003-R */
-%token RELOAD
-%token REMOVE_SYM
%token RENAME
-%token REORGANIZE_SYM
-%token REPAIR
-%token REPEATABLE_SYM /* SQL-2003-N */
%token REPEAT_SYM /* MYSQL-FUNC */
%token REPLACE /* MYSQL-FUNC */
-%token REPLICATION
%token REQUIRE_SYM
-%token RESET_SYM
-%token RESTART_SYM
%token RESIGNAL_SYM /* SQL-2003-R */
-%token RESOURCES
-%token RESTORE_SYM
%token RESTRICT
-%token RESUME_SYM
-%token RETURNED_SQLSTATE_SYM /* SQL-2003-N */
%token RETURNING_SYM
-%token RETURNS_SYM /* SQL-2003-R */
%token RETURN_SYM /* SQL-2003-R */
-%token REUSE_SYM /* Oracle-R */
-%token REVERSE_SYM
%token REVOKE /* SQL-2003-R */
%token RIGHT /* SQL-2003-R */
-%token ROLE_SYM
-%token ROLLBACK_SYM /* SQL-2003-R */
-%token ROLLUP_SYM /* SQL-2003-R */
-%token ROUTINE_SYM /* SQL-2003-N */
-%token ROWCOUNT_SYM /* Oracle-N */
-%token ROW_SYM /* SQL-2003-R */
%token ROWS_SYM /* SQL-2003-R */
-%token ROWTYPE_SYM /* Oracle-PLSQL-R */
-%token ROW_COUNT_SYM /* SQL-2003-N */
-%token ROW_FORMAT_SYM
%token ROW_NUMBER_SYM
-%token RTREE_SYM
-%token SAVEPOINT_SYM /* SQL-2003-R */
-%token SCHEDULE_SYM
-%token SCHEMA_NAME_SYM /* SQL-2003-N */
%token SECOND_MICROSECOND_SYM
-%token SECOND_SYM /* SQL-2003-R */
-%token SECURITY_SYM /* SQL-2003-N */
%token SELECT_SYM /* SQL-2003-R */
%token SENSITIVE_SYM /* FUTURE-USE */
%token SEPARATOR_SYM
-%token SEQUENCE_SYM
-%token SERIALIZABLE_SYM /* SQL-2003-N */
-%token SERIAL_SYM
-%token SESSION_SYM /* SQL-2003-N */
-%token SERVER_SYM
%token SERVER_OPTIONS
%token SET /* SQL-2003-R */
-%token SETVAL_SYM /* PostgreSQL sequence function */
%token SET_VAR
-%token SHARE_SYM
%token SHIFT_LEFT /* OPERATOR */
%token SHIFT_RIGHT /* OPERATOR */
%token SHOW
-%token SHUTDOWN
%token SIGNAL_SYM /* SQL-2003-R */
-%token SIGNED_SYM
-%token SIMPLE_SYM /* SQL-2003-N */
-%token SLAVE
-%token SLAVES
-%token SLAVE_POS_SYM
-%token SLOW
%token SMALLINT /* SQL-2003-R */
-%token SNAPSHOT_SYM
-%token SOCKET_SYM
-%token SOFT_SYM
-%token SONAME_SYM
-%token SOUNDS_SYM
-%token SOURCE_SYM
%token SPATIAL_SYM
%token SPECIFIC_SYM /* SQL-2003-R */
%token SQLEXCEPTION_SYM /* SQL-2003-R */
%token SQLSTATE_SYM /* SQL-2003-R */
%token SQLWARNING_SYM /* SQL-2003-R */
%token SQL_BIG_RESULT
-%token SQL_BUFFER_RESULT
-%token SQL_CACHE_SYM
-%token SQL_CALC_FOUND_ROWS
-%token SQL_NO_CACHE_SYM
%token SQL_SMALL_RESULT
%token SQL_SYM /* SQL-2003-R */
-%token SQL_THREAD
-%token REF_SYSTEM_ID_SYM
%token SSL_SYM
%token STARTING
-%token STARTS_SYM
-%token START_SYM /* SQL-2003-R */
-%token STATEMENT_SYM
%token STATS_AUTO_RECALC_SYM
%token STATS_PERSISTENT_SYM
%token STATS_SAMPLE_PAGES_SYM
-%token STATUS_SYM
%token STDDEV_SAMP_SYM /* SQL-2003-N */
%token STD_SYM
-%token STOP_SYM
-%token STORAGE_SYM
-%token STORED_SYM
%token STRAIGHT_JOIN
-%token STRING_SYM
-%token SUBCLASS_ORIGIN_SYM /* SQL-2003-N */
-%token SUBDATE_SYM
-%token SUBJECT_SYM
-%token SUBPARTITIONS_SYM
-%token SUBPARTITION_SYM
%token SUBSTRING /* SQL-2003-N */
%token SUM_SYM /* SQL-2003-N */
-%token SUPER_SYM
-%token SUSPEND_SYM
-%token SWAPS_SYM
-%token SWITCHES_SYM
%token SYSDATE
-%token SYSTEM /* SQL-2011-R */
-%token SYSTEM_TIME_SYM /* SQL-2011-R */
-%token TABLES
-%token TABLESPACE
%token TABLE_REF_PRIORITY
%token TABLE_SYM /* SQL-2003-R */
-%token TABLE_CHECKSUM_SYM
-%token TABLE_NAME_SYM /* SQL-2003-N */
-%token TEMPORARY /* SQL-2003-N */
-%token TEMPTABLE_SYM
%token TERMINATED
%token TEXT_STRING
-%token TEXT_SYM
-%token THAN_SYM
%token THEN_SYM /* SQL-2003-R */
-%token TIES_SYM /* SQL-2011-N */
-%token TIMESTAMP /* SQL-2003-R */
-%token TIMESTAMP_ADD
-%token TIMESTAMP_DIFF
-%token TIME_SYM /* SQL-2003-R */
%token TINYBLOB
%token TINYINT
%token TINYTEXT
%token TO_SYM /* SQL-2003-R */
%token TRAILING /* SQL-2003-R */
-%token TRANSACTION_SYM
-%token TRANSACTIONAL_SYM
-%token TRIGGERS_SYM
%token TRIGGER_SYM /* SQL-2003-R */
%token TRIM /* SQL-2003-N */
-%token TRIM_ORACLE
%token TRUE_SYM /* SQL-2003-R */
-%token TRUNCATE_SYM
-%token TYPES_SYM
-%token TYPE_SYM /* SQL-2003-N */
-%token UDF_RETURNS_SYM
%token ULONGLONG_NUM
-%token UNBOUNDED_SYM /* SQL-2011-N */
-%token UNCOMMITTED_SYM /* SQL-2003-N */
-%token UNDEFINED_SYM
%token UNDERSCORE_CHARSET
-%token UNDOFILE_SYM
-%token UNDO_BUFFER_SIZE_SYM
%token UNDO_SYM /* FUTURE-USE */
-%token UNICODE_SYM
-%token UNINSTALL_SYM
%token UNION_SYM /* SQL-2003-R */
%token UNIQUE_SYM
-%token UNKNOWN_SYM /* SQL-2003-R */
%token UNLOCK_SYM
%token UNSIGNED
-%token UNTIL_SYM
%token UPDATE_SYM /* SQL-2003-R */
-%token UPGRADE_SYM
%token USAGE /* SQL-2003-N */
-%token USER_SYM /* SQL-2003-R */
-%token USE_FRM
%token USE_SYM
%token USING /* SQL-2003-R */
%token UTC_DATE_SYM
@@ -981,83 +584,597 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token VALUES /* SQL-2003-R */
%token VALUES_IN_SYM
%token VALUES_LESS_SYM
-%token VALUE_SYM /* SQL-2003-R */
%token VARBINARY
%token VARCHAR /* SQL-2003-R */
-%token VARCHAR2 /* Oracle */
-%token VARIABLES
%token VARIANCE_SYM
%token VARYING /* SQL-2003-R */
%token VAR_SAMP_SYM
-%token VERSIONING_SYM /* SQL-2011-R */
-%token VIA_SYM
-%token VIEW_SYM /* SQL-2003-N */
-%token VIRTUAL_SYM
-%token WAIT_SYM
-%token WARNINGS
-%token WEEK_SYM
-%token WEIGHT_STRING_SYM
%token WHEN_SYM /* SQL-2003-R */
%token WHERE /* SQL-2003-R */
-%token WINDOW_SYM
%token WHILE_SYM
%token WITH /* SQL-2003-R */
-%token WITHIN
-%token WITHOUT /* SQL-2003-R */
%token WITH_CUBE_SYM /* INTERNAL */
%token WITH_ROLLUP_SYM /* INTERNAL */
%token WITH_SYSTEM_SYM /* INTERNAL */
-%token WORK_SYM /* SQL-2003-N */
-%token WRAPPER_SYM
-%token WRITE_SYM /* SQL-2003-N */
-%token X509_SYM
-%token XA_SYM
-%token XML_SYM
%token XOR
%token YEAR_MONTH_SYM
-%token YEAR_SYM /* SQL-2003-R */
%token ZEROFILL
-%token IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */
+%token IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */
+
+
+/*
+ Keywords that have different reserved status in std/oracle modes.
+*/
+%token BODY_SYM /* Oracle-R */
+%token COMMENT_SYM
+%token ELSIF_SYM /* Oracle, reserved in PL/SQL*/
+%token GOTO_SYM /* Oracle, reserved in PL/SQL*/
+%token OTHERS_SYM /* SQL-2011-N */
+%token PACKAGE_SYM /* Oracle-R */
+%token RAISE_SYM /* Oracle-PLSQL-R */
+%token ROWTYPE_SYM /* Oracle-PLSQL-R */
+
+/*
+ Non-reserved keywords
+*/
+
+%token <kwd> ACTION /* SQL-2003-N */
+%token <kwd> ADMIN_SYM /* SQL-2003-N */
+%token <kwd> ADDDATE_SYM /* MYSQL-FUNC */
+%token <kwd> AFTER_SYM /* SQL-2003-N */
+%token <kwd> AGAINST
+%token <kwd> AGGREGATE_SYM
+%token <kwd> ALGORITHM_SYM
+%token <kwd> ALWAYS_SYM
+%token <kwd> ANY_SYM /* SQL-2003-R */
+%token <kwd> ASCII_SYM /* MYSQL-FUNC */
+%token <kwd> AT_SYM /* SQL-2003-R */
+%token <kwd> ATOMIC_SYM /* SQL-2003-R */
+%token <kwd> AUTHORS_SYM
+%token <kwd> AUTOEXTEND_SIZE_SYM
+%token <kwd> AUTO_INC
+%token <kwd> AUTO_SYM
+%token <kwd> AVG_ROW_LENGTH
+%token <kwd> AVG_SYM /* SQL-2003-N */
+%token <kwd> BACKUP_SYM
+%token <kwd> BEGIN_SYM /* SQL-2003-R */
+%token <kwd> BINLOG_SYM
+%token <kwd> BIT_SYM /* MYSQL-FUNC */
+%token <kwd> BLOCK_SYM
+%token <kwd> BOOL_SYM
+%token <kwd> BOOLEAN_SYM /* SQL-2003-R, PLSQL-R */
+%token <kwd> BTREE_SYM
+%token <kwd> BYTE_SYM
+%token <kwd> CACHE_SYM
+%token <kwd> CASCADED /* SQL-2003-R */
+%token <kwd> CATALOG_NAME_SYM /* SQL-2003-N */
+%token <kwd> CHAIN_SYM /* SQL-2003-N */
+%token <kwd> CHANGED
+%token <kwd> CHARSET
+%token <kwd> CHECKPOINT_SYM
+%token <kwd> CHECKSUM_SYM
+%token <kwd> CIPHER_SYM
+%token <kwd> CLASS_ORIGIN_SYM /* SQL-2003-N */
+%token <kwd> CLIENT_SYM
+%token <kwd> CLOB /* SQL-2003-R */
+%token <kwd> CLOSE_SYM /* SQL-2003-R */
+%token <kwd> COALESCE /* SQL-2003-N */
+%token <kwd> CODE_SYM
+%token <kwd> COLLATION_SYM /* SQL-2003-N */
+%token <kwd> COLUMNS
+%token <kwd> COLUMN_ADD_SYM
+%token <kwd> COLUMN_CHECK_SYM
+%token <kwd> COLUMN_CREATE_SYM
+%token <kwd> COLUMN_DELETE_SYM
+%token <kwd> COLUMN_GET_SYM
+%token <kwd> COLUMN_SYM /* SQL-2003-R */
+%token <kwd> COLUMN_NAME_SYM /* SQL-2003-N */
+%token <kwd> COMMITTED_SYM /* SQL-2003-N */
+%token <kwd> COMMIT_SYM /* SQL-2003-R */
+%token <kwd> COMPACT_SYM
+%token <kwd> COMPLETION_SYM
+%token <kwd> COMPRESSED_SYM
+%token <kwd> CONCURRENT
+%token <kwd> CONNECTION_SYM
+%token <kwd> CONSISTENT_SYM
+%token <kwd> CONSTRAINT_CATALOG_SYM /* SQL-2003-N */
+%token <kwd> CONSTRAINT_NAME_SYM /* SQL-2003-N */
+%token <kwd> CONSTRAINT_SCHEMA_SYM /* SQL-2003-N */
+%token <kwd> CONTAINS_SYM /* SQL-2003-N */
+%token <kwd> CONTEXT_SYM
+%token <kwd> CONTRIBUTORS_SYM
+%token <kwd> CPU_SYM
+%token <kwd> CUBE_SYM /* SQL-2003-R */
+%token <kwd> CURRENT_SYM /* SQL-2003-R */
+%token <kwd> CURRENT_POS_SYM
+%token <kwd> CURSOR_NAME_SYM /* SQL-2003-N */
+%token <kwd> CYCLE_SYM
+%token <kwd> DATAFILE_SYM
+%token <kwd> DATA_SYM /* SQL-2003-N */
+%token <kwd> DATETIME
+%token <kwd> DATE_FORMAT_SYM /* MYSQL-FUNC */
+%token <kwd> DATE_SYM /* SQL-2003-R, Oracle-R, PLSQL-R */
+%token <kwd> DAY_SYM /* SQL-2003-R */
+%token <kwd> DEALLOCATE_SYM /* SQL-2003-R */
+%token <kwd> DECODE_SYM /* Oracle function, non-reserved */
+%token <kwd> DEFINER_SYM
+%token <kwd> DELAYED_SYM
+%token <kwd> DELAY_KEY_WRITE_SYM
+%token <kwd> DES_KEY_FILE
+%token <kwd> DIAGNOSTICS_SYM /* SQL-2003-N */
+%token <kwd> DIRECTORY_SYM
+%token <kwd> DISABLE_SYM
+%token <kwd> DISCARD
+%token <kwd> DISK_SYM
+%token <kwd> DO_SYM
+%token <kwd> DUMPFILE
+%token <kwd> DUPLICATE_SYM
+%token <kwd> DYNAMIC_SYM /* SQL-2003-R */
+%token <kwd> ENABLE_SYM
+%token <kwd> END /* SQL-2003-R */
+%token <kwd> ENDS_SYM
+%token <kwd> ENGINES_SYM
+%token <kwd> ENGINE_SYM
+%token <kwd> ENUM
+%token <kwd> ERROR_SYM
+%token <kwd> ERRORS
+%token <kwd> ESCAPE_SYM /* SQL-2003-R */
+%token <kwd> EVENTS_SYM
+%token <kwd> EVENT_SYM
+%token <kwd> EVERY_SYM /* SQL-2003-N */
+%token <kwd> EXCHANGE_SYM
+%token <kwd> EXAMINED_SYM
+%token <kwd> EXCLUDE_SYM /* SQL-2011-N */
+%token <kwd> EXECUTE_SYM /* SQL-2003-R */
+%token <kwd> EXCEPTION_SYM /* SQL-2003-N, Oracle-PLSQL-R */
+%token <kwd> EXIT_SYM
+%token <kwd> EXPANSION_SYM
+%token <kwd> EXPORT_SYM
+%token <kwd> EXTENDED_SYM
+%token <kwd> EXTENT_SIZE_SYM
+%token <kwd> FAST_SYM
+%token <kwd> FAULTS_SYM
+%token <kwd> FILE_SYM
+%token <kwd> FIRST_SYM /* SQL-2003-N */
+%token <kwd> FIXED_SYM
+%token <kwd> FLUSH_SYM
+%token <kwd> FOLLOWS_SYM /* MYSQL trigger*/
+%token <kwd> FOLLOWING_SYM /* SQL-2011-N */
+%token <kwd> FORCE_SYM
+%token <kwd> FORMAT_SYM
+%token <kwd> FOUND_SYM /* SQL-2003-R */
+%token <kwd> FULL /* SQL-2003-R */
+%token <kwd> FUNCTION_SYM /* SQL-2003-R */
+%token <kwd> GENERAL
+%token <kwd> GENERATED_SYM
+%token <kwd> GEOMETRYCOLLECTION
+%token <kwd> GEOMETRY_SYM
+%token <kwd> GET_FORMAT /* MYSQL-FUNC */
+%token <kwd> GET_SYM /* SQL-2003-R */
+%token <kwd> GLOBAL_SYM /* SQL-2003-R */
+%token <kwd> GRANTS
+%token <kwd> HANDLER_SYM
+%token <kwd> HARD_SYM
+%token <kwd> HASH_SYM
+%token <kwd> HELP_SYM
+%token <kwd> HIGH_PRIORITY
+%token <kwd> HISTORY_SYM /* MYSQL */
+%token <kwd> HOST_SYM
+%token <kwd> HOSTS_SYM
+%token <kwd> HOUR_SYM /* SQL-2003-R */
+%token <kwd> ID_SYM /* MYSQL */
+%token <kwd> IDENTIFIED_SYM
+%token <kwd> IGNORE_SERVER_IDS_SYM
+%token <kwd> IMMEDIATE_SYM /* SQL-2003-R */
+%token <kwd> IMPORT
+%token <kwd> INCREMENT_SYM
+%token <kwd> INDEXES
+%token <kwd> INITIAL_SIZE_SYM
+%token <kwd> INSERT_METHOD
+%token <kwd> INSTALL_SYM
+%token <kwd> INVOKER_SYM
+%token <kwd> IO_SYM
+%token <kwd> IPC_SYM
+%token <kwd> ISOLATION /* SQL-2003-R */
+%token <kwd> ISOPEN_SYM /* Oracle-N */
+%token <kwd> ISSUER_SYM
+%token <kwd> INVISIBLE_SYM
+%token <kwd> JSON_SYM
+%token <kwd> KEY_BLOCK_SIZE
+%token <kwd> LANGUAGE_SYM /* SQL-2003-R */
+%token <kwd> LAST_SYM /* SQL-2003-N */
+%token <kwd> LAST_VALUE
+%token <kwd> LASTVAL_SYM /* PostgreSQL sequence function */
+%token <kwd> LEAVES
+%token <kwd> LESS_SYM
+%token <kwd> LEVEL_SYM
+%token <kwd> LINESTRING
+%token <kwd> LIST_SYM
+%token <kwd> LOCAL_SYM /* SQL-2003-R */
+%token <kwd> LOCKS_SYM
+%token <kwd> LOGFILE_SYM
+%token <kwd> LOGS_SYM
+%token <kwd> MASTER_CONNECT_RETRY_SYM
+%token <kwd> MASTER_DELAY_SYM
+%token <kwd> MASTER_GTID_POS_SYM
+%token <kwd> MASTER_HOST_SYM
+%token <kwd> MASTER_LOG_FILE_SYM
+%token <kwd> MASTER_LOG_POS_SYM
+%token <kwd> MASTER_PASSWORD_SYM
+%token <kwd> MASTER_PORT_SYM
+%token <kwd> MASTER_SERVER_ID_SYM
+%token <kwd> MASTER_SSL_CAPATH_SYM
+%token <kwd> MASTER_SSL_CA_SYM
+%token <kwd> MASTER_SSL_CERT_SYM
+%token <kwd> MASTER_SSL_CIPHER_SYM
+%token <kwd> MASTER_SSL_CRL_SYM
+%token <kwd> MASTER_SSL_CRLPATH_SYM
+%token <kwd> MASTER_SSL_KEY_SYM
+%token <kwd> MASTER_SSL_SYM
+%token <kwd> MASTER_SYM
+%token <kwd> MASTER_USER_SYM
+%token <kwd> MASTER_USE_GTID_SYM
+%token <kwd> MASTER_HEARTBEAT_PERIOD_SYM
+%token <kwd> MAX_CONNECTIONS_PER_HOUR
+%token <kwd> MAX_QUERIES_PER_HOUR
+%token <kwd> MAX_ROWS
+%token <kwd> MAX_SIZE_SYM
+%token <kwd> MAX_UPDATES_PER_HOUR
+%token <kwd> MAX_STATEMENT_TIME_SYM
+%token <kwd> MAX_USER_CONNECTIONS_SYM
+%token <kwd> MEDIUM_SYM
+%token <kwd> MEMORY_SYM
+%token <kwd> MERGE_SYM /* SQL-2003-R */
+%token <kwd> MESSAGE_TEXT_SYM /* SQL-2003-N */
+%token <kwd> MICROSECOND_SYM /* MYSQL-FUNC */
+%token <kwd> MIGRATE_SYM
+%token <kwd> MINUTE_SYM /* SQL-2003-R */
+%token <kwd> MINVALUE_SYM
+%token <kwd> MIN_ROWS
+%token <kwd> MODE_SYM
+%token <kwd> MODIFY_SYM
+%token <kwd> MONTH_SYM /* SQL-2003-R */
+%token <kwd> MULTILINESTRING
+%token <kwd> MULTIPOINT
+%token <kwd> MULTIPOLYGON
+%token <kwd> MUTEX_SYM
+%token <kwd> MYSQL_SYM
+%token <kwd> MYSQL_ERRNO_SYM
+%token <kwd> NAMES_SYM /* SQL-2003-N */
+%token <kwd> NAME_SYM /* SQL-2003-N */
+%token <kwd> NATIONAL_SYM /* SQL-2003-R */
+%token <kwd> NCHAR_SYM /* SQL-2003-R */
+%token <kwd> NEW_SYM /* SQL-2003-R */
+%token <kwd> NEXT_SYM /* SQL-2003-N */
+%token <kwd> NEXTVAL_SYM /* PostgreSQL sequence function */
+%token <kwd> NOCACHE_SYM
+%token <kwd> NOCYCLE_SYM
+%token <kwd> NODEGROUP_SYM
+%token <kwd> NONE_SYM /* SQL-2003-R */
+%token <kwd> NOTFOUND_SYM /* Oracle-R */
+%token <kwd> NO_SYM /* SQL-2003-R */
+%token <kwd> NOMAXVALUE_SYM
+%token <kwd> NOMINVALUE_SYM
+%token <kwd> NO_WAIT_SYM
+%token <kwd> NOWAIT_SYM
+%token <kwd> NUMBER_SYM /* SQL-2003-N, Oracle-R, PLSQL-R */
+%token <kwd> NVARCHAR_SYM
+%token <kwd> OF_SYM /* SQL-1992-R, Oracle-R */
+%token <kwd> OFFSET_SYM
+%token <kwd> OLD_PASSWORD_SYM
+%token <kwd> ONE_SYM
+%token <kwd> ONLY_SYM /* SQL-2003-R */
+%token <kwd> ONLINE_SYM
+%token <kwd> OPEN_SYM /* SQL-2003-R */
+%token <kwd> OPTIONS_SYM
+%token <kwd> OPTION /* SQL-2003-N */
+%token <kwd> OWNER_SYM
+%token <kwd> PACK_KEYS_SYM
+%token <kwd> PAGE_SYM
+%token <kwd> PARSER_SYM
+%token <kwd> PARTIAL /* SQL-2003-N */
+%token <kwd> PARTITIONS_SYM
+%token <kwd> PARTITIONING_SYM
+%token <kwd> PASSWORD_SYM
+%token <kwd> PERIOD_SYM /* SQL-2011-R */
+%token <kwd> PERSISTENT_SYM
+%token <kwd> PHASE_SYM
+%token <kwd> PLUGINS_SYM
+%token <kwd> PLUGIN_SYM
+%token <kwd> POINT_SYM
+%token <kwd> POLYGON
+%token <kwd> PORT_SYM
+%token <kwd> PRECEDES_SYM /* MYSQL */
+%token <kwd> PRECEDING_SYM /* SQL-2011-N */
+%token <kwd> PREPARE_SYM /* SQL-2003-R */
+%token <kwd> PRESERVE_SYM
+%token <kwd> PREV_SYM
+%token <kwd> PREVIOUS_SYM
+%token <kwd> PRIVILEGES /* SQL-2003-N */
+%token <kwd> PROCESS
+%token <kwd> PROCESSLIST_SYM
+%token <kwd> PROFILE_SYM
+%token <kwd> PROFILES_SYM
+%token <kwd> PROXY_SYM
+%token <kwd> QUARTER_SYM
+%token <kwd> QUERY_SYM
+%token <kwd> QUICK
+%token <kwd> RAW /* Oracle-R */
+%token <kwd> READ_ONLY_SYM
+%token <kwd> REBUILD_SYM
+%token <kwd> RECOVER_SYM
+%token <kwd> REDOFILE_SYM
+%token <kwd> REDO_BUFFER_SIZE_SYM
+%token <kwd> REDUNDANT_SYM
+%token <kwd> RELAY
+%token <kwd> RELAYLOG_SYM
+%token <kwd> RELAY_LOG_FILE_SYM
+%token <kwd> RELAY_LOG_POS_SYM
+%token <kwd> RELAY_THREAD
+%token <kwd> RELOAD
+%token <kwd> REMOVE_SYM
+%token <kwd> REORGANIZE_SYM
+%token <kwd> REPAIR
+%token <kwd> REPEATABLE_SYM /* SQL-2003-N */
+%token <kwd> REPLICATION
+%token <kwd> RESET_SYM
+%token <kwd> RESTART_SYM
+%token <kwd> RESOURCES
+%token <kwd> RESTORE_SYM
+%token <kwd> RESUME_SYM
+%token <kwd> RETURNED_SQLSTATE_SYM /* SQL-2003-N */
+%token <kwd> RETURNS_SYM /* SQL-2003-R */
+%token <kwd> REUSE_SYM /* Oracle-R */
+%token <kwd> REVERSE_SYM
+%token <kwd> ROLE_SYM
+%token <kwd> ROLLBACK_SYM /* SQL-2003-R */
+%token <kwd> ROLLUP_SYM /* SQL-2003-R */
+%token <kwd> ROUTINE_SYM /* SQL-2003-N */
+%token <kwd> ROWCOUNT_SYM /* Oracle-N */
+%token <kwd> ROW_SYM /* SQL-2003-R */
+%token <kwd> ROW_COUNT_SYM /* SQL-2003-N */
+%token <kwd> ROW_FORMAT_SYM
+%token <kwd> RTREE_SYM
+%token <kwd> SAVEPOINT_SYM /* SQL-2003-R */
+%token <kwd> SCHEDULE_SYM
+%token <kwd> SCHEMA_NAME_SYM /* SQL-2003-N */
+%token <kwd> SECOND_SYM /* SQL-2003-R */
+%token <kwd> SECURITY_SYM /* SQL-2003-N */
+%token <kwd> SEQUENCE_SYM
+%token <kwd> SERIALIZABLE_SYM /* SQL-2003-N */
+%token <kwd> SERIAL_SYM
+%token <kwd> SESSION_SYM /* SQL-2003-N */
+%token <kwd> SERVER_SYM
+%token <kwd> SETVAL_SYM /* PostgreSQL sequence function */
+%token <kwd> SHARE_SYM
+%token <kwd> SHUTDOWN
+%token <kwd> SIGNED_SYM
+%token <kwd> SIMPLE_SYM /* SQL-2003-N */
+%token <kwd> SLAVE
+%token <kwd> SLAVES
+%token <kwd> SLAVE_POS_SYM
+%token <kwd> SLOW
+%token <kwd> SNAPSHOT_SYM
+%token <kwd> SOCKET_SYM
+%token <kwd> SOFT_SYM
+%token <kwd> SONAME_SYM
+%token <kwd> SOUNDS_SYM
+%token <kwd> SOURCE_SYM
+%token <kwd> SQL_BUFFER_RESULT
+%token <kwd> SQL_CACHE_SYM
+%token <kwd> SQL_CALC_FOUND_ROWS
+%token <kwd> SQL_NO_CACHE_SYM
+%token <kwd> SQL_THREAD
+%token <kwd> STARTS_SYM
+%token <kwd> START_SYM /* SQL-2003-R */
+%token <kwd> STATEMENT_SYM
+%token <kwd> STATUS_SYM
+%token <kwd> STOP_SYM
+%token <kwd> STORAGE_SYM
+%token <kwd> STORED_SYM
+%token <kwd> STRING_SYM
+%token <kwd> SUBCLASS_ORIGIN_SYM /* SQL-2003-N */
+%token <kwd> SUBDATE_SYM
+%token <kwd> SUBJECT_SYM
+%token <kwd> SUBPARTITIONS_SYM
+%token <kwd> SUBPARTITION_SYM
+%token <kwd> SUPER_SYM
+%token <kwd> SUSPEND_SYM
+%token <kwd> SWAPS_SYM
+%token <kwd> SWITCHES_SYM
+%token <kwd> SYSTEM /* SQL-2011-R */
+%token <kwd> SYSTEM_TIME_SYM /* SQL-2011-R */
+%token <kwd> TABLES
+%token <kwd> TABLESPACE
+%token <kwd> TABLE_CHECKSUM_SYM
+%token <kwd> TABLE_NAME_SYM /* SQL-2003-N */
+%token <kwd> TEMPORARY /* SQL-2003-N */
+%token <kwd> TEMPTABLE_SYM
+%token <kwd> TEXT_SYM
+%token <kwd> THAN_SYM
+%token <kwd> TIES_SYM /* SQL-2011-N */
+%token <kwd> TIMESTAMP /* SQL-2003-R */
+%token <kwd> TIMESTAMP_ADD
+%token <kwd> TIMESTAMP_DIFF
+%token <kwd> TIME_SYM /* SQL-2003-R, Oracle-R */
+%token <kwd> TRANSACTION_SYM
+%token <kwd> TRANSACTIONAL_SYM
+%token <kwd> TRIGGERS_SYM
+%token <kwd> TRIM_ORACLE
+%token <kwd> TRUNCATE_SYM
+%token <kwd> TYPES_SYM
+%token <kwd> TYPE_SYM /* SQL-2003-N */
+%token <kwd> UDF_RETURNS_SYM
+%token <kwd> UNBOUNDED_SYM /* SQL-2011-N */
+%token <kwd> UNCOMMITTED_SYM /* SQL-2003-N */
+%token <kwd> UNDEFINED_SYM
+%token <kwd> UNDOFILE_SYM
+%token <kwd> UNDO_BUFFER_SIZE_SYM
+%token <kwd> UNICODE_SYM
+%token <kwd> UNINSTALL_SYM
+%token <kwd> UNKNOWN_SYM /* SQL-2003-R */
+%token <kwd> UNTIL_SYM
+%token <kwd> UPGRADE_SYM
+%token <kwd> USER_SYM /* SQL-2003-R */
+%token <kwd> USE_FRM
+%token <kwd> VALUE_SYM /* SQL-2003-R */
+%token <kwd> VARCHAR2 /* Oracle-R, PLSQL-R */
+%token <kwd> VARIABLES
+%token <kwd> VERSIONING_SYM /* SQL-2011-R */
+%token <kwd> VIA_SYM
+%token <kwd> VIEW_SYM /* SQL-2003-N */
+%token <kwd> VIRTUAL_SYM
+%token <kwd> WAIT_SYM
+%token <kwd> WARNINGS
+%token <kwd> WEEK_SYM
+%token <kwd> WEIGHT_STRING_SYM
+%token <kwd> WINDOW_SYM /* SQL-2003-R */
+%token <kwd> WITHIN
+%token <kwd> WITHOUT /* SQL-2003-R */
+%token <kwd> WORK_SYM /* SQL-2003-N */
+%token <kwd> WRAPPER_SYM
+%token <kwd> WRITE_SYM /* SQL-2003-N */
+%token <kwd> X509_SYM
+%token <kwd> XA_SYM
+%token <kwd> XML_SYM
+%token <kwd> YEAR_SYM /* SQL-2003-R */
+
%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
/* A dummy token to force the priority of table_ref production in a join. */
%left TABLE_REF_PRIORITY
%left SET_VAR
-%left OR_OR_SYM OR_SYM OR2_SYM
+%left OR_SYM OR2_SYM
%left XOR
%left AND_SYM AND_AND_SYM
+
+%left PREC_BELOW_NOT
+%left NOT_SYM
+
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
%left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE REGEXP IN_SYM
%left '|'
%left '&'
%left SHIFT_LEFT SHIFT_RIGHT
-%left '-' '+'
+%left '-' '+' ORACLE_CONCAT_SYM
%left '*' '/' DIV_SYM MOD_SYM
%left '^'
-%left NEG '~'
-%right NOT_SYM NOT2_SYM
-%right BINARY COLLATE_SYM
-%left INTERVAL_SYM
+%left MYSQL_CONCAT_SYM
+%left NEG '~' NOT2_SYM BINARY
+%left COLLATE_SYM
+
+/*
+ Tokens that can change their meaning from identifier to something else
+ in certain context.
+
+ - TRANSACTION: identifier, history unit:
+ SELECT transaction FROM t1;
+ SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION @var;
+
+ - TIMESTAMP: identifier, literal, history unit:
+ SELECT timestamp FROM t1;
+ SELECT TIMESTAMP '2001-01-01 10:20:30';
+ SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP CONCAT(@date,' ',@time);
+
+ - PERIOD: identifier, period for sytem time:
+ SELECT period FROM t1;
+ ALTER TABLE DROP PERIOD FOR SYSTEM TIME;
+
+ - SYSTEM: identifier, system versioning:
+ SELECT system FROM t1;
+ ALTER TABLE DROP SYSTEM VERSIONIONG;
+
+ Note, we need here only tokens that cause shirt/reduce conflicts
+ with keyword identifiers. For example:
+ opt_clause1: %empty | KEYWORD ... ;
+ clause2: opt_clause1 ident;
+ KEYWORD can appear both in opt_clause1 and in "ident" through the "keyword"
+ rule. So the parser reports a conflict on how to interpret KEYWORD:
+ - as a start of non-empty branch in opt_clause1, or
+ - as an identifier which follows the empty branch in opt_clause1.
+
+ Example#1:
+ alter_list_item:
+ DROP opt_column opt_if_exists_table_element field_ident
+ | DROP SYSTEM VERSIONING_SYM
+ SYSTEM can be a keyword in field_ident, or can be a start of
+ SYSTEM VERSIONING.
+
+ Example#2:
+ system_time_expr: AS OF_SYM history_point
+ history_point: opt_history_unit bit_expr
+ opt_history_unit: | TRANSACTION_SYM
+ TRANSACTION can be a non-empty history unit, or can be an identifier
+ in bit_expr.
+
+ In the grammar below we use %prec to explicitely tell Bison to go
+ through the empty branch in the optional rule only when the lookahead
+ token does not belong to a small set of selected tokens.
+
+ Tokens NEXT_SYM and PREVIOUS_SYM also change their meaning from
+ identifiers to sequence operations when followed by VALUE_SYM:
+ SELECT NEXT VALUE FOR s1, PREVIOUS VALUE FOR s1;
+ but we don't need to list them here as they do not seem to cause
+ conflicts (according to bison -v), as both meanings
+ (as identifier, and as a sequence operation) are parts of the same target
+ column_default_non_parenthesized_expr, and there are no any optional
+ clauses between the start of column_default_non_parenthesized_expr
+ and until NEXT_SYM / PREVIOUS_SYM.
+*/
+%left PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE
+%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM
+
+
+/*
+ Tokens that can appear in a token contraction on the second place
+ and change the meaning of the previous token.
+
+ - TEXT_STRING: changes the meaning of TIMESTAMP/TIME/DATE
+ from identifier to literal:
+ SELECT timestamp FROM t1;
+ SELECT TIMESTAMP'2001-01-01 00:00:00' FROM t1;
+
+ - Parenthesis: changes the meaning of TIMESTAMP/TIME/DATE
+ from identifiers to CAST-alike functions:
+ SELECT timestamp FROM t1;
+ SELECT timestamp(1) FROM t1;
+
+ - VALUE: changes NEXT and PREVIOUS from identifier to sequence operation:
+ SELECT next, previous FROM t1;
+ SELECT NEXT VALUE FOR s1, PREVIOUS VALUE FOR s1;
+
+ - VERSIONING: changes SYSTEM from identifier to SYSTEM VERSIONING
+ SELECT system FROM t1;
+ ALTER TABLE t1 ADD SYSTEM VERSIONING;
+*/
+%left PREC_BELOW_CONTRACTION_TOKEN2
+%left TEXT_STRING '(' VALUE_SYM VERSIONING_SYM
%type <lex_str>
- IDENT IDENT_QUOTED DECIMAL_NUM FLOAT_NUM NUM LONG_NUM
+ DECIMAL_NUM FLOAT_NUM NUM LONG_NUM
HEX_NUM HEX_STRING
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text
- IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
+ TEXT_STRING_sys TEXT_STRING_literal
opt_component key_cache_name
- sp_opt_label BIN_NUM TEXT_STRING_filesystem ident_or_empty
+ sp_opt_label BIN_NUM TEXT_STRING_filesystem
opt_constraint constraint opt_ident
- ident_directly_assignable
opt_package_routine_end_name
- sp_decl_ident
sp_block_label opt_place opt_db
%type <lex_str>
- label_ident
label_declaration_oracle
labels_declaration_oracle
+%type <ident_sys>
+ IDENT_sys
+ ident
+ label_ident
+ sp_decl_ident
+ ident_or_empty
+ ident_table_alias
+ ident_directly_assignable
+
%type <lex_string_with_metadata>
TEXT_STRING
NCHAR_STRING
@@ -1065,8 +1182,21 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <lex_str_ptr>
opt_table_alias
-%type <lex_string_with_pos>
- ident ident_with_tok_start
+%type <ident_cli>
+ IDENT
+ IDENT_QUOTED
+ IDENT_cli
+ ident_cli
+
+%type <kwd>
+ keyword keyword_sp
+ keyword_alias
+ keyword_directly_assignable
+ keyword_directly_not_assignable
+ keyword_sp_data_type
+ keyword_sp_not_data_type
+ keyword_sp_verb_clause
+ sp_decl_ident_keyword
%type <table>
table_ident table_ident_nodb references xid
@@ -1082,6 +1212,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <const_simple_string>
field_length opt_field_length opt_field_length_default_1
+ opt_compression_method
%type <string>
text_string hex_or_bin_String opt_gconcat_separator
@@ -1118,7 +1249,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
optional_flush_tables_arguments
opt_time_precision kill_type kill_option int_num
opt_default_time_precision
- case_stmt_body opt_bin_mod
+ case_stmt_body opt_bin_mod opt_for_system_time_clause
opt_if_exists_table_element opt_if_not_exists_table_element
opt_recursive opt_format_xid
@@ -1142,7 +1273,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <ulong_num>
ulong_num real_ulong_num merge_insert_types
- ws_nweights
+ ws_nweights opt_versioning_interval_start
ws_level_flag_desc ws_level_flag_reverse ws_level_flags
opt_ws_levels ws_level_list ws_level_list_item ws_level_number
ws_level_range ws_level_list_or_range bool
@@ -1164,11 +1295,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
variable variable_aux bool_pri
predicate bit_expr parenthesized_expr
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
+ primary_expr string_factor_expr mysql_concatenation_expr
+ select_sublist_qualified_asterisk
expr_or_default set_expr_or_default
geometry_function signed_literal expr_or_literal
opt_escape
sp_opt_default
- simple_ident_nospvar simple_ident_q simple_ident_q2
+ simple_ident_nospvar
field_or_var limit_option
part_func_expr
window_func_expr
@@ -1179,6 +1312,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
inverse_distribution_function_def
explicit_cursor_attr
function_call_keyword
+ function_call_keyword_timestamp
function_call_nonkeyword
function_call_generic
function_call_conflict kill_expr
@@ -1233,7 +1367,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
table_primary_ident table_primary_derived
select_derived derived_table_list
select_derived_union
+ derived_simple_table
derived_query_specification
+ derived_table_value_constructor
%type <date_time_type> date_time_type;
%type <interval> interval
@@ -1253,13 +1389,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
opt_field_length_default_sp_param_varchar
opt_field_length_default_sp_param_char
-%type <symbol> keyword keyword_sp
- keyword_directly_assignable
- keyword_directly_not_assignable
- sp_decl_ident_keyword
- keyword_sp_data_type
- keyword_sp_not_data_type
-
%type <lex_user> user grant_user grant_role user_or_role current_role
admin_option_for_role user_maybe_role
@@ -1277,11 +1406,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <select_lex> subselect
get_select_lex get_select_lex_derived
+ simple_table
query_specification
query_term_union_not_ready
query_term_union_ready
query_expression_body
select_paren_derived
+ table_value_constructor
%type <boolfunc2creator> comp_op
@@ -1352,12 +1483,16 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keep_gcc_happy
key_using_alg
part_column_list
+ period_for_system_time
server_def server_options_list server_option
definer_opt no_definer definer get_diagnostics
parse_vcol_expr vcol_opt_specifier vcol_opt_attribute
vcol_opt_attribute_list vcol_attribute
opt_serial_attribute opt_serial_attribute_list serial_attribute
- explainable_command opt_lock_wait_timeout
+ explainable_command
+ opt_lock_wait_timeout
+ opt_delete_gtid_domain
+ asrow_attribute
set_assign
sf_tail_standalone
sp_tail_standalone
@@ -1440,12 +1575,11 @@ END_OF_INPUT
%type <frame_exclusion> opt_window_frame_exclusion;
%type <window_frame_bound> window_frame_start window_frame_bound;
-
%type <NONE>
'-' '+' '*' '/' '%' '(' ')'
- ',' '!' '{' '}' '&' '|' AND_SYM OR_SYM OR_OR_SYM BETWEEN_SYM CASE_SYM
+ ',' '!' '{' '}' '&' '|' AND_SYM OR_SYM BETWEEN_SYM CASE_SYM
THEN_SYM WHEN_SYM DIV_SYM MOD_SYM OR2_SYM AND_AND_SYM DELETE_SYM
- ROLE_SYM
+ MYSQL_CONCAT_SYM ORACLE_CONCAT_SYM
%type <with_clause> opt_with_clause with_clause
@@ -1453,6 +1587,9 @@ END_OF_INPUT
%type <lex_str_list> opt_with_column_list
+%type <vers_range_unit> opt_history_unit
+%type <vers_history_point> history_point
+%type <vers_column_versioning> with_or_without_system
%%
@@ -1480,8 +1617,8 @@ rule: <-- starts at col 1
query:
END_OF_INPUT
{
- if (!thd->bootstrap &&
- (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
+ if (likely(!thd->bootstrap) &&
+ unlikely(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
my_yyabort_error((ER_EMPTY_QUERY, MYF(0)));
thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
@@ -1609,7 +1746,7 @@ prepare:
PREPARE_SYM ident FROM prepare_src
{
LEX *lex= thd->lex;
- if (lex->table_or_sp_used())
+ if (unlikely(lex->table_or_sp_used()))
my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0),
"PREPARE..FROM"));
lex->sql_command= SQLCOM_PREPARE;
@@ -1637,7 +1774,7 @@ execute:
{}
| EXECUTE_SYM IMMEDIATE_SYM prepare_src
{
- if (Lex->table_or_sp_used())
+ if (unlikely(Lex->table_or_sp_used()))
my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0),
"EXECUTE IMMEDIATE"));
Lex->sql_command= SQLCOM_EXECUTE_IMMEDIATE;
@@ -1651,7 +1788,7 @@ execute_using:
| USING { Lex->expr_allows_subselect= false; }
execute_var_list
{
- if (Lex->table_or_sp_used())
+ if (unlikely(Lex->table_or_sp_used()))
my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0),
"EXECUTE..USING"));
Lex->expr_allows_subselect= true;
@@ -1666,7 +1803,8 @@ execute_var_list:
execute_var_ident:
expr_or_default
{
- if (Lex->prepared_stmt_params.push_back($1, thd->mem_root))
+ if (unlikely(Lex->prepared_stmt_params.push_back($1,
+ thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -1676,7 +1814,7 @@ execute_var_ident:
help:
HELP_SYM
{
- if (Lex->sphead)
+ if (unlikely(Lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HELP"));
}
ident_or_text
@@ -1776,20 +1914,21 @@ master_def:
| MASTER_HEARTBEAT_PERIOD_SYM '=' NUM_literal
{
Lex->mi.heartbeat_period= (float) $3->val_real();
- if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
- Lex->mi.heartbeat_period < 0.0)
+ if (unlikely(Lex->mi.heartbeat_period >
+ SLAVE_MAX_HEARTBEAT_PERIOD) ||
+ unlikely(Lex->mi.heartbeat_period < 0.0))
my_yyabort_error((ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0),
SLAVE_MAX_HEARTBEAT_PERIOD));
- if (Lex->mi.heartbeat_period > slave_net_timeout)
+ if (unlikely(Lex->mi.heartbeat_period > slave_net_timeout))
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX,
ER_THD(thd, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX));
}
- if (Lex->mi.heartbeat_period < 0.001)
+ if (unlikely(Lex->mi.heartbeat_period < 0.001))
{
- if (Lex->mi.heartbeat_period != 0.0)
+ if (unlikely(Lex->mi.heartbeat_period != 0.0))
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN,
@@ -1887,19 +2026,19 @@ master_file_def:
}
| MASTER_USE_GTID_SYM '=' CURRENT_POS_SYM
{
- if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
+ if (unlikely(Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS;
}
| MASTER_USE_GTID_SYM '=' SLAVE_POS_SYM
{
- if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
+ if (unlikely(Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS;
}
| MASTER_USE_GTID_SYM '=' NO_SYM
{
- if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
+ if (unlikely(Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_NO;
}
@@ -1919,7 +2058,7 @@ connection_name:
{
Lex->mi.connection_name= $1;
#ifdef HAVE_REPLICATION
- if (check_master_connection_name(&$1))
+ if (unlikely(check_master_connection_name(&$1)))
my_yyabort_error((ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME"));
#endif
}
@@ -1932,11 +2071,13 @@ create:
{
LEX *lex= thd->lex;
lex->create_info.init();
- if (lex->set_command_with_check(SQLCOM_CREATE_TABLE, $2, $1 | $4))
+ if (unlikely(lex->set_command_with_check(SQLCOM_CREATE_TABLE, $2,
+ $1 | $4)))
MYSQL_YYABORT;
- if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
- TL_OPTION_UPDATING,
- TL_WRITE, MDL_EXCLUSIVE))
+ if (unlikely(!lex->select_lex.add_table_to_list(thd, $5, NULL,
+ TL_OPTION_UPDATING,
+ TL_WRITE,
+ MDL_EXCLUSIVE)))
MYSQL_YYABORT;
lex->alter_info.reset();
/*
@@ -1968,12 +2109,14 @@ create:
{
LEX *lex= thd->lex;
lex->create_info.init();
- if (lex->set_command_with_check(SQLCOM_CREATE_SEQUENCE, $2, $1 | $4))
+ if (unlikely(lex->set_command_with_check(SQLCOM_CREATE_SEQUENCE, $2,
+ $1 | $4)))
MYSQL_YYABORT;
- if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
- TL_OPTION_UPDATING,
- TL_WRITE, MDL_EXCLUSIVE))
+ if (unlikely(!lex->select_lex.add_table_to_list(thd, $5, NULL,
+ TL_OPTION_UPDATING,
+ TL_WRITE,
+ MDL_EXCLUSIVE)))
MYSQL_YYABORT;
/*
@@ -1985,15 +2128,15 @@ create:
lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB;
lex->name= null_clex_str;
lex->create_last_non_select_table= lex->last_table();
- if (!(lex->create_info.seq_create_info= new (thd->mem_root)
- sequence_definition()))
+ if (unlikely(!(lex->create_info.seq_create_info=
+ new (thd->mem_root) sequence_definition())))
MYSQL_YYABORT;
}
opt_sequence opt_create_table_options
{
LEX *lex= thd->lex;
- if (lex->create_info.seq_create_info->check_and_adjust(1))
+ if (unlikely(lex->create_info.seq_create_info->check_and_adjust(1)))
{
my_error(ER_SEQUENCE_INVALID_DATA, MYF(0),
lex->select_lex.table_list.first->db.str,
@@ -2002,7 +2145,8 @@ create:
}
/* No fields specified, generate them */
- if (prepare_sequence_fields(thd, &lex->alter_info.create_list))
+ if (unlikely(prepare_sequence_fields(thd,
+ &lex->alter_info.create_list)))
MYSQL_YYABORT;
/* CREATE SEQUENCE always creates a sequence */
@@ -2010,8 +2154,9 @@ create:
Lex->create_info.sequence= 1;
lex->current_select= &lex->select_lex;
- if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) &&
- !lex->create_info.db_type)
+ if (unlikely((lex->create_info.used_fields &
+ HA_CREATE_USED_ENGINE) &&
+ !lex->create_info.db_type))
{
lex->create_info.use_default_db_type(thd);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -2026,9 +2171,9 @@ create:
opt_key_algorithm_clause
ON table_ident
{
- if (Lex->add_create_index_prepare($8))
+ if (unlikely(Lex->add_create_index_prepare($8)))
MYSQL_YYABORT;
- if (Lex->add_create_index($2, &$5, $6, $1 | $4))
+ if (unlikely(Lex->add_create_index($2, &$5, $6, $1 | $4)))
MYSQL_YYABORT;
}
'(' key_list ')' opt_lock_wait_timeout normal_key_options
@@ -2036,9 +2181,10 @@ create:
| create_or_replace fulltext INDEX_SYM opt_if_not_exists ident
ON table_ident
{
- if (Lex->add_create_index_prepare($7))
+ if (unlikely(Lex->add_create_index_prepare($7)))
MYSQL_YYABORT;
- if (Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF, $1 | $4))
+ if (unlikely(Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF,
+ $1 | $4)))
MYSQL_YYABORT;
}
'(' key_list ')' opt_lock_wait_timeout fulltext_key_options
@@ -2046,9 +2192,10 @@ create:
| create_or_replace spatial INDEX_SYM opt_if_not_exists ident
ON table_ident
{
- if (Lex->add_create_index_prepare($7))
+ if (unlikely(Lex->add_create_index_prepare($7)))
MYSQL_YYABORT;
- if (Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF, $1 | $4))
+ if (unlikely(Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF,
+ $1 | $4)))
MYSQL_YYABORT;
}
'(' key_list ')' opt_lock_wait_timeout spatial_key_options
@@ -2061,15 +2208,17 @@ create:
opt_create_database_options
{
LEX *lex=Lex;
- if (lex->set_command_with_check(SQLCOM_CREATE_DB, 0, $1 | $3))
+ if (unlikely(lex->set_command_with_check(SQLCOM_CREATE_DB, 0,
+ $1 | $3)))
MYSQL_YYABORT;
lex->name= $4;
}
| create_or_replace definer_opt opt_view_suid VIEW_SYM
opt_if_not_exists table_ident
{
- if (Lex->add_create_view(thd, $1 | $5,
- DTYPE_ALGORITHM_UNDEFINED, $3, $6))
+ if (unlikely(Lex->add_create_view(thd, $1 | $5,
+ DTYPE_ALGORITHM_UNDEFINED, $3,
+ $6)))
MYSQL_YYABORT;
}
view_list_opt AS view_select
@@ -2077,7 +2226,7 @@ create:
| create_or_replace view_algorithm definer_opt opt_view_suid VIEW_SYM
opt_if_not_exists table_ident
{
- if (Lex->add_create_view(thd, $1 | $6, $2, $4, $7))
+ if (unlikely(Lex->add_create_view(thd, $1 | $6, $2, $4, $7)))
MYSQL_YYABORT;
}
view_list_opt AS view_select
@@ -2112,13 +2261,15 @@ create:
| create_or_replace USER_SYM opt_if_not_exists clear_privileges grant_list
opt_require_clause opt_resource_options
{
- if (Lex->set_command_with_check(SQLCOM_CREATE_USER, $1 | $3))
+ if (unlikely(Lex->set_command_with_check(SQLCOM_CREATE_USER,
+ $1 | $3)))
MYSQL_YYABORT;
}
| create_or_replace ROLE_SYM opt_if_not_exists
clear_privileges role_list opt_with_admin
{
- if (Lex->set_command_with_check(SQLCOM_CREATE_ROLE, $1 | $3))
+ if (unlikely(Lex->set_command_with_check(SQLCOM_CREATE_ROLE,
+ $1 | $3)))
MYSQL_YYABORT;
}
| CREATE LOGFILE_SYM GROUP_SYM logfile_group_info
@@ -2138,17 +2289,18 @@ create:
remember_name
{
sp_package *pkg;
- if (!(pkg= Lex->create_package_start(thd,
- SQLCOM_CREATE_PACKAGE,
- &sp_handler_package_spec,
- $5, $1 | $4)))
+ if (unlikely(!(pkg= Lex->
+ create_package_start(thd,
+ SQLCOM_CREATE_PACKAGE,
+ &sp_handler_package_spec,
+ $5, $1 | $4))))
MYSQL_YYABORT;
pkg->set_chistics(Lex->sp_chistics);
}
opt_package_specification_element_list END
remember_end_opt opt_sp_name
{
- if (Lex->create_package_finalize(thd, $5, $13, $8, $12))
+ if (unlikely(Lex->create_package_finalize(thd, $5, $13, $8, $12)))
MYSQL_YYABORT;
}
| create_or_replace definer_opt PACKAGE_SYM BODY_SYM
@@ -2157,28 +2309,29 @@ create:
remember_name
{
sp_package *pkg;
- if (!(pkg= Lex->create_package_start(thd,
- SQLCOM_CREATE_PACKAGE_BODY,
- &sp_handler_package_body,
- $6, $1 | $5)))
+ if (unlikely(!(pkg= Lex->
+ create_package_start(thd,
+ SQLCOM_CREATE_PACKAGE_BODY,
+ &sp_handler_package_body,
+ $6, $1 | $5))))
MYSQL_YYABORT;
pkg->set_chistics(Lex->sp_chistics);
Lex->sp_block_init(thd);
}
package_implementation_declare_section
{
- if (Lex->sp_block_with_exceptions_finalize_declarations(thd))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
package_implementation_executable_section
{
$11.hndlrs+= $13.hndlrs;
- if (Lex->sp_block_finalize(thd, $11))
+ if (unlikely(Lex->sp_block_finalize(thd, $11)))
MYSQL_YYABORT;
}
remember_end_opt opt_sp_name
{
- if (Lex->create_package_finalize(thd, $6, $16, $9, $15))
+ if (unlikely(Lex->create_package_finalize(thd, $6, $16, $9, $15)))
MYSQL_YYABORT;
}
;
@@ -2186,7 +2339,7 @@ create:
package_implementation_executable_section:
END
{
- if (Lex->sp_block_with_exceptions_add_empty(thd))
+ if (unlikely(Lex->sp_block_with_exceptions_add_empty(thd)))
MYSQL_YYABORT;
$$.init(0);
}
@@ -2221,7 +2374,8 @@ package_implementation_declare_section_list2:
package_routine_lex:
{
- if (!($$= new (thd->mem_root) sp_lex_local(thd, thd->lex)))
+ if (unlikely(!($$= new (thd->mem_root)
+ sp_lex_local(thd, thd->lex))))
MYSQL_YYABORT;
thd->m_parser_state->m_yacc.reset_before_substatement();
}
@@ -2234,11 +2388,11 @@ package_specification_function:
DBUG_ASSERT($1->sphead->get_package());
$2->sql_command= SQLCOM_CREATE_FUNCTION;
sp_name *spname= $1->make_sp_name_package_routine(thd, &$3);
- if (!spname)
+ if (unlikely(!spname))
MYSQL_YYABORT;
thd->lex= $2;
- if (!$2->make_sp_head_no_recursive(thd, spname,
- &sp_handler_package_function))
+ if (unlikely(!$2->make_sp_head_no_recursive(thd, spname,
+ &sp_handler_package_function)))
MYSQL_YYABORT;
$1->sphead->get_package()->m_current_routine= $2;
(void) is_native_function_with_warn(thd, &$3);
@@ -2260,11 +2414,11 @@ package_specification_procedure:
DBUG_ASSERT($1->sphead->get_package());
$2->sql_command= SQLCOM_CREATE_PROCEDURE;
sp_name *spname= $1->make_sp_name_package_routine(thd, &$3);
- if (!spname)
+ if (unlikely(!spname))
MYSQL_YYABORT;
thd->lex= $2;
- if (!$2->make_sp_head_no_recursive(thd, spname,
- &sp_handler_package_procedure))
+ if (unlikely(!$2->make_sp_head_no_recursive(thd, spname,
+ &sp_handler_package_procedure)))
MYSQL_YYABORT;
$1->sphead->get_package()->m_current_routine= $2;
}
@@ -2285,7 +2439,7 @@ package_implementation_routine_definition:
package_implementation_function_body ';'
{
sp_package *pkg= Lex->get_sp_package();
- if (pkg->add_routine_implementation($2))
+ if (unlikely(pkg->add_routine_implementation($2)))
MYSQL_YYABORT;
pkg->m_current_routine= NULL;
$$.init();
@@ -2294,7 +2448,7 @@ package_implementation_routine_definition:
package_implementation_procedure_body ';'
{
sp_package *pkg= Lex->get_sp_package();
- if (pkg->add_routine_implementation($2))
+ if (unlikely(pkg->add_routine_implementation($2)))
MYSQL_YYABORT;
pkg->m_current_routine= NULL;
$$.init();
@@ -2314,13 +2468,13 @@ package_implementation_function_body:
}
sp_body opt_package_routine_end_name
{
- if (Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR)
+ if (unlikely(Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR))
{
my_yyabort_error((ER_NOT_AGGREGATE_FUNCTION, MYF(0)));
}
Lex->sphead->set_chistics_agg_type(NOT_AGGREGATE);
- if (thd->lex->sp_body_finalize_function(thd) ||
- thd->lex->sphead->check_package_routine_end_name($5))
+ if (unlikely(thd->lex->sp_body_finalize_function(thd) ||
+ thd->lex->sphead->check_package_routine_end_name($5)))
MYSQL_YYABORT;
thd->lex= $2;
}
@@ -2337,8 +2491,8 @@ package_implementation_procedure_body:
}
sp_body opt_package_routine_end_name
{
- if (thd->lex->sp_body_finalize_procedure(thd) ||
- thd->lex->sphead->check_package_routine_end_name($5))
+ if (unlikely(thd->lex->sp_body_finalize_procedure(thd) ||
+ thd->lex->sphead->check_package_routine_end_name($5)))
MYSQL_YYABORT;
thd->lex= $2;
}
@@ -2363,14 +2517,14 @@ package_specification_element:
FUNCTION_SYM package_specification_function ';'
{
sp_package *pkg= Lex->get_sp_package();
- if (pkg->add_routine_declaration($2))
+ if (unlikely(pkg->add_routine_declaration($2)))
MYSQL_YYABORT;
pkg->m_current_routine= NULL;
}
| PROCEDURE_SYM package_specification_procedure ';'
{
sp_package *pkg= Lex->get_sp_package();
- if (pkg->add_routine_declaration($2))
+ if (unlikely(pkg->add_routine_declaration($2)))
MYSQL_YYABORT;
pkg->m_current_routine= NULL;
}
@@ -2399,105 +2553,105 @@ sequence_def:
}
| NO_SYM MINVALUE_SYM
{
- if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
}
| NOMINVALUE_SYM
{
- if (Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value;
}
| MAXVALUE_SYM opt_equal longlong_num
{
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_max_value)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_max_value))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->max_value= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| NO_SYM MAXVALUE_SYM
{
- if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| NOMAXVALUE_SYM
{
- if (Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value;
}
| START_SYM opt_with longlong_num
{
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_start)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_start))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "START"));
Lex->create_info.seq_create_info->start= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_start;
}
| INCREMENT_SYM opt_by longlong_num
{
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_increment)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_increment))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "INCREMENT"));
Lex->create_info.seq_create_info->increment= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment;
}
| CACHE_SYM opt_equal longlong_num
{
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_cache)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cache))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
Lex->create_info.seq_create_info->cache= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
}
| NOCACHE_SYM
{
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_cache)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cache))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE"));
Lex->create_info.seq_create_info->cache= 0;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache;
}
| CYCLE_SYM
{
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_cycle)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cycle))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
Lex->create_info.seq_create_info->cycle= 1;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
}
| NOCYCLE_SYM
{
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_cycle)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_cycle))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE"));
Lex->create_info.seq_create_info->cycle= 0;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle;
}
| RESTART_SYM
{
- if (Lex->sql_command != SQLCOM_ALTER_SEQUENCE)
+ if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE))
{
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
}
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_restart)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_restart))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart;
}
| RESTART_SYM opt_with longlong_num
{
- if (Lex->sql_command != SQLCOM_ALTER_SEQUENCE)
+ if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE))
{
thd->parse_error(ER_SYNTAX_ERROR, "RESTART");
YYABORT;
}
- if (Lex->create_info.seq_create_info->used_fields &
- seq_field_used_restart)
+ if (unlikely(Lex->create_info.seq_create_info->used_fields &
+ seq_field_used_restart))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART"));
Lex->create_info.seq_create_info->restart= $3;
Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value;
@@ -2507,7 +2661,7 @@ sequence_def:
server_def:
SERVER_SYM opt_if_not_exists ident_or_text
{
- if (Lex->add_create_options_with_check($2))
+ if (unlikely(Lex->add_create_options_with_check($2)))
MYSQL_YYABORT;
Lex->server_options.reset($3);
}
@@ -2566,9 +2720,10 @@ event_tail:
LEX *lex=Lex;
lex->stmt_definition_begin= $1;
- if (lex->add_create_options_with_check($2))
+ if (unlikely(lex->add_create_options_with_check($2)))
MYSQL_YYABORT;
- if (!(lex->event_parse_data= Event_parse_data::new_instance(thd)))
+ if (unlikely(!(lex->event_parse_data=
+ Event_parse_data::new_instance(thd))))
MYSQL_YYABORT;
lex->event_parse_data->identifier= $3;
lex->event_parse_data->on_completion=
@@ -2631,7 +2786,7 @@ ev_starts:
/* empty */
{
Item *item= new (thd->mem_root) Item_func_now_local(thd, 0);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
Lex->event_parse_data->item_starts= item;
}
@@ -2695,11 +2850,12 @@ ev_sql_stmt:
(the nested ALTER EVENT can have anything but DO clause)
- CREATE PROCEDURE ... BEGIN DROP EVENT ... END|
*/
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_EVENT_RECURSION_FORBIDDEN, MYF(0)));
- if (!lex->make_sp_head(thd, lex->event_parse_data->identifier,
- &sp_handler_procedure))
+ if (unlikely(!lex->make_sp_head(thd,
+ lex->event_parse_data->identifier,
+ &sp_handler_procedure)))
MYSQL_YYABORT;
lex->sphead->set_body_start(thd, lip->get_cpp_ptr());
@@ -2734,12 +2890,12 @@ clear_privileges:
sp_name:
ident '.' ident
{
- if (!($$= Lex->make_sp_name(thd, &$1, &$3)))
+ if (unlikely(!($$= Lex->make_sp_name(thd, &$1, &$3))))
MYSQL_YYABORT;
}
| ident
{
- if (!($$= Lex->make_sp_name(thd, &$1)))
+ if (unlikely(!($$= Lex->make_sp_name(thd, &$1))))
MYSQL_YYABORT;
}
;
@@ -2813,7 +2969,7 @@ sp_suid:
call:
CALL_SYM sp_name
{
- if (Lex->call_statement_start(thd, $2))
+ if (unlikely(Lex->call_statement_start(thd, $2)))
MYSQL_YYABORT;
}
opt_sp_cparam_list {}
@@ -2855,7 +3011,7 @@ sp_fdparams:
sp_param_name:
ident
{
- if (!($$= Lex->sp_param_init(&$1)))
+ if (unlikely(!($$= Lex->sp_param_init(&$1))))
MYSQL_YYABORT;
}
;
@@ -2863,32 +3019,32 @@ sp_param_name:
sp_param_name_and_type:
sp_param_name sp_param_type_with_opt_collate
{
- if (Lex->sp_param_fill_definition($$= $1))
+ if (unlikely(Lex->sp_param_fill_definition($$= $1)))
MYSQL_YYABORT;
}
| sp_param_name sp_decl_ident '.' ident '%' TYPE_SYM
{
- if (Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4))
+ if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4)))
MYSQL_YYABORT;
}
| sp_param_name sp_decl_ident '.' ident '.' ident '%' TYPE_SYM
{
- if (Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4, $6))
+ if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4, $6)))
MYSQL_YYABORT;
}
| sp_param_name sp_decl_ident '%' ROWTYPE_SYM
{
- if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2))
+ if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2)))
MYSQL_YYABORT;
}
| sp_param_name sp_decl_ident '.' ident '%' ROWTYPE_SYM
{
- if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2, $4))
+ if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2, $4)))
MYSQL_YYABORT;
}
| sp_param_name ROW_SYM row_type_body
{
- if (Lex->sphead->spvar_fill_row(thd, $$= $1, $3))
+ if (unlikely(Lex->sphead->spvar_fill_row(thd, $$= $1, $3)))
MYSQL_YYABORT;
}
;
@@ -2908,37 +3064,37 @@ sp_pdparam:
sp_param_name sp_opt_inout sp_param_type_with_opt_collate
{
$1->mode= $2;
- if (Lex->sp_param_fill_definition($1))
+ if (unlikely(Lex->sp_param_fill_definition($1)))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout sp_decl_ident '.' ident '%' TYPE_SYM
{
$1->mode= $2;
- if (Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5))
+ if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5)))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout sp_decl_ident '.' ident '.' ident '%' TYPE_SYM
{
$1->mode= $2;
- if (Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5, $7))
+ if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5, $7)))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout sp_decl_ident '%' ROWTYPE_SYM
{
$1->mode= $2;
- if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3))
+ if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3)))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout sp_decl_ident '.' ident '%' ROWTYPE_SYM
{
$1->mode= $2;
- if (Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3, $5))
+ if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3, $5)))
MYSQL_YYABORT;
}
| sp_param_name sp_opt_inout ROW_SYM row_type_body
{
$1->mode= $2;
- if (Lex->sphead->spvar_fill_row(thd, $1, $4))
+ if (unlikely(Lex->sphead->spvar_fill_row(thd, $1, $4)))
MYSQL_YYABORT;
}
;
@@ -3009,7 +3165,7 @@ sp_proc_stmts1_implicit_block:
}
sp_proc_stmts1
{
- if (Lex->sp_block_finalize(thd))
+ if (unlikely(Lex->sp_block_finalize(thd)))
MYSQL_YYABORT;
}
;
@@ -3025,7 +3181,7 @@ opt_sp_decl_body_list:
sp_decl_body_list:
sp_decl_non_handler_list
{
- if (Lex->sphead->sp_add_instr_cpush_for_cursors(thd, Lex->spcont))
+ if (unlikely(Lex->sphead->sp_add_instr_cpush_for_cursors(thd, Lex->spcont)))
MYSQL_YYABORT;
}
opt_sp_decl_handler_list
@@ -3059,18 +3215,20 @@ opt_sp_decl_handler_list:
optionally_qualified_column_ident:
sp_decl_ident
{
- if (!($$= new (thd->mem_root) Qualified_column_ident(&$1)))
+ if (unlikely(!($$= new (thd->mem_root)
+ Qualified_column_ident(&$1))))
MYSQL_YYABORT;
}
| sp_decl_ident '.' ident
{
- if (!($$= new (thd->mem_root) Qualified_column_ident(&$1, &$3)))
+ if (unlikely(!($$= new (thd->mem_root)
+ Qualified_column_ident(&$1, &$3))))
MYSQL_YYABORT;
}
| sp_decl_ident '.' ident '.' ident
{
- if (!($$= new (thd->mem_root) Qualified_column_ident(thd,
- &$1, &$3, &$5)))
+ if (unlikely(!($$= new (thd->mem_root)
+ Qualified_column_ident(thd, &$1, &$3, &$5))))
MYSQL_YYABORT;
}
;
@@ -3078,10 +3236,10 @@ optionally_qualified_column_ident:
row_field_name:
ident_directly_assignable
{
- if (check_string_char_length(&$1, 0, NAME_CHAR_LEN,
- system_charset_info, 1))
+ if (unlikely(check_string_char_length(&$1, 0, NAME_CHAR_LEN,
+ system_charset_info, 1)))
my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str));
- if (!($$= new (thd->mem_root) Spvar_definition()))
+ if (unlikely(!($$= new (thd->mem_root) Spvar_definition())))
MYSQL_YYABORT;
Lex->init_last_field($$, &$1, thd->variables.collation_database);
}
@@ -3094,17 +3252,18 @@ row_field_definition:
row_field_definition_list:
row_field_definition
{
- if (!($$= new (thd->mem_root) Row_definition_list()))
+ if (unlikely(!($$= new (thd->mem_root) Row_definition_list())) ||
+ unlikely($$->push_back($1, thd->mem_root)))
MYSQL_YYABORT;
- $$->push_back($1, thd->mem_root);
}
| row_field_definition_list ',' row_field_definition
{
uint unused;
- if ($1->find_row_field_by_name(&$3->field_name, &unused))
+ if (unlikely($1->find_row_field_by_name(&$3->field_name, &unused)))
my_yyabort_error((ER_DUP_FIELDNAME, MYF(0), $3->field_name.str));
$$= $1;
- $$->push_back($3, thd->mem_root);
+ if (unlikely($$->push_back($3, thd->mem_root)))
+ MYSQL_YYABORT;
}
;
@@ -3124,8 +3283,9 @@ sp_decl_vars:
type_with_opt_collate
sp_opt_default
{
- if (Lex->sp_variable_declarations_finalize(thd, $1,
- &Lex->last_field[0], $3))
+ if (unlikely(Lex->sp_variable_declarations_finalize(thd, $1,
+ &Lex->last_field[0],
+ $3)))
MYSQL_YYABORT;
$$.init_using_vars($1);
}
@@ -3133,7 +3293,7 @@ sp_decl_vars:
optionally_qualified_column_ident '%' TYPE_SYM
sp_opt_default
{
- if (Lex->sp_variable_declarations_with_ref_finalize(thd, $1, $2, $5))
+ if (unlikely(Lex->sp_variable_declarations_with_ref_finalize(thd, $1, $2, $5)))
MYSQL_YYABORT;
$$.init_using_vars($1);
}
@@ -3141,7 +3301,7 @@ sp_decl_vars:
optionally_qualified_column_ident '%' ROWTYPE_SYM
sp_opt_default
{
- if (Lex->sp_variable_declarations_rowtype_finalize(thd, $1, $2, $5))
+ if (unlikely(Lex->sp_variable_declarations_rowtype_finalize(thd, $1, $2, $5)))
MYSQL_YYABORT;
$$.init_using_vars($1);
}
@@ -3149,7 +3309,7 @@ sp_decl_vars:
ROW_SYM row_type_body
sp_opt_default
{
- if (Lex->sp_variable_declarations_row_finalize(thd, $1, $3, $4))
+ if (unlikely(Lex->sp_variable_declarations_row_finalize(thd, $1, $3, $4)))
MYSQL_YYABORT;
$$.init_using_vars($1);
}
@@ -3159,7 +3319,7 @@ sp_decl_non_handler:
sp_decl_vars
| ident_directly_assignable CONDITION_SYM FOR_SYM sp_cond
{
- if (Lex->spcont->declare_condition(thd, &$1, $4))
+ if (unlikely(Lex->spcont->declare_condition(thd, &$1, $4)))
MYSQL_YYABORT;
$$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1;
@@ -3168,8 +3328,8 @@ sp_decl_non_handler:
{
sp_condition_value *spcond= new (thd->mem_root)
sp_condition_value_user_defined();
- if (!spcond ||
- Lex->spcont->declare_condition(thd, &$1, spcond))
+ if (unlikely(!spcond) ||
+ unlikely(Lex->spcont->declare_condition(thd, &$1, spcond)))
MYSQL_YYABORT;
$$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1;
@@ -3182,9 +3342,9 @@ sp_decl_non_handler:
IS sp_cursor_stmt
{
sp_pcontext *param_ctx= Lex->spcont;
- if (Lex->sp_block_finalize(thd))
+ if (unlikely(Lex->sp_block_finalize(thd)))
MYSQL_YYABORT;
- if (Lex->sp_declare_cursor(thd, &$2, $6, param_ctx, false))
+ if (unlikely(Lex->sp_declare_cursor(thd, &$2, $6, param_ctx, false)))
MYSQL_YYABORT;
$$.vars= $$.conds= $$.hndlrs= 0;
$$.curs= 1;
@@ -3194,12 +3354,12 @@ sp_decl_non_handler:
sp_decl_handler:
sp_handler_type HANDLER_SYM FOR_SYM
{
- if (Lex->sp_handler_declaration_init(thd, $1))
+ if (unlikely(Lex->sp_handler_declaration_init(thd, $1)))
MYSQL_YYABORT;
}
sp_hcond_list sp_proc_stmt
{
- if (Lex->sp_handler_declaration_finalize(thd, $1))
+ if (unlikely(Lex->sp_handler_declaration_finalize(thd, $1)))
MYSQL_YYABORT;
$$.vars= $$.conds= $$.curs= 0;
$$.hndlrs= 1;
@@ -3215,7 +3375,8 @@ opt_parenthesized_cursor_formal_parameters:
sp_cursor_stmt_lex:
{
DBUG_ASSERT(thd->lex->sphead);
- if (!($$= new (thd->mem_root) sp_lex_cursor(thd, thd->lex)))
+ if (unlikely(!($$= new (thd->mem_root)
+ sp_lex_cursor(thd, thd->lex))))
MYSQL_YYABORT;
}
;
@@ -3229,8 +3390,8 @@ sp_cursor_stmt:
select
{
DBUG_ASSERT(Lex == $1);
- if ($1->stmt_finalize(thd) ||
- $1->sphead->restore_lex(thd))
+ if (unlikely($1->stmt_finalize(thd)) ||
+ unlikely($1->sphead->restore_lex(thd)))
MYSQL_YYABORT;
$$= $1;
}
@@ -3256,7 +3417,7 @@ sp_hcond_element:
sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont->parent_context();
- if (ctx->check_duplicate_handler($1))
+ if (unlikely(ctx->check_duplicate_handler($1)))
my_yyabort_error((ER_SP_DUP_HANDLER, MYF(0)));
sp_instr_hpush_jump *i= (sp_instr_hpush_jump *)sp->last_instruction();
@@ -3267,10 +3428,10 @@ sp_hcond_element:
sp_cond:
ulong_num
{ /* mysql errno */
- if ($1 == 0)
+ if (unlikely($1 == 0))
my_yyabort_error((ER_WRONG_VALUE, MYF(0), "CONDITION", "0"));
$$= new (thd->mem_root) sp_condition_value($1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| sqlstate
@@ -3287,10 +3448,11 @@ sqlstate:
allowed to SIGNAL, or declare a handler for the completion
condition.
*/
- if (!is_sqlstate_valid(&$3) || is_sqlstate_completion($3.str))
+ if (unlikely(!is_sqlstate_valid(&$3) ||
+ is_sqlstate_completion($3.str)))
my_yyabort_error((ER_SP_BAD_SQLSTATE, MYF(0), $3.str));
$$= new (thd->mem_root) sp_condition_value($3.str);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -3308,25 +3470,25 @@ sp_hcond:
| ident /* CONDITION name */
{
$$= Lex->spcont->find_declared_or_predefined_condition(&$1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
}
| SQLWARNING_SYM /* SQLSTATEs 01??? */
{
$$= new (thd->mem_root) sp_condition_value(sp_condition_value::WARNING);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| not FOUND_SYM /* SQLSTATEs 02??? */
{
$$= new (thd->mem_root) sp_condition_value(sp_condition_value::NOT_FOUND);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| OTHERS_SYM /* All other SQLSTATEs */
{
$$= new (thd->mem_root) sp_condition_value(sp_condition_value::EXCEPTION);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -3335,12 +3497,12 @@ sp_hcond:
raise_stmt:
RAISE_SYM opt_set_signal_information
{
- if (Lex->add_resignal_statement(thd, NULL))
+ if (unlikely(Lex->add_resignal_statement(thd, NULL)))
MYSQL_YYABORT;
}
| RAISE_SYM signal_value opt_set_signal_information
{
- if (Lex->add_signal_statement(thd, $2))
+ if (unlikely(Lex->add_signal_statement(thd, $2)))
MYSQL_YYABORT;
}
;
@@ -3348,7 +3510,7 @@ raise_stmt:
signal_stmt:
SIGNAL_SYM signal_value opt_set_signal_information
{
- if (Lex->add_signal_statement(thd, $2))
+ if (unlikely(Lex->add_signal_statement(thd, $2)))
MYSQL_YYABORT;
}
;
@@ -3360,12 +3522,12 @@ signal_value:
sp_condition_value *cond;
/* SIGNAL foo cannot be used outside of stored programs */
- if (lex->spcont == NULL)
+ if (unlikely(lex->spcont == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
cond= lex->spcont->find_declared_or_predefined_condition(&$1);
- if (cond == NULL)
+ if (unlikely(cond == NULL))
my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
- if (!cond->has_sql_state())
+ if (unlikely(!cond->has_sql_state()))
my_yyabort_error((ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0)));
$$= cond;
}
@@ -3403,7 +3565,7 @@ signal_information_item_list:
Set_signal_information *info;
info= &thd->m_parser_state->m_yacc.m_set_signal_info;
int index= (int) $3;
- if (info->m_item[index] != NULL)
+ if (unlikely(info->m_item[index] != NULL))
my_yyabort_error((ER_DUP_SIGNAL_SET, MYF(0),
Diag_condition_item_names[index].str));
info->m_item[index]= $5;
@@ -3421,7 +3583,7 @@ signal_allowed_expr:
if ($1->type() == Item::FUNC_ITEM)
{
Item_func *item= (Item_func*) $1;
- if (item->functype() == Item_func::SUSERVAR_FUNC)
+ if (unlikely(item->functype() == Item_func::SUSERVAR_FUNC))
{
/*
Don't allow the following syntax:
@@ -3469,7 +3631,7 @@ signal_condition_information_item_name:
resignal_stmt:
RESIGNAL_SYM opt_signal_value opt_set_signal_information
{
- if (Lex->add_resignal_statement(thd, $2))
+ if (unlikely(Lex->add_resignal_statement(thd, $2)))
MYSQL_YYABORT;
}
;
@@ -3484,7 +3646,7 @@ get_diagnostics:
Lex->sql_command= SQLCOM_GET_DIAGNOSTICS;
Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_get_diagnostics(info);
- if (Lex->m_sql_cmd == NULL)
+ if (unlikely(Lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
;
@@ -3500,13 +3662,13 @@ diagnostics_information:
statement_information
{
$$= new (thd->mem_root) Statement_information($1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| CONDITION_SYM condition_number condition_information
{
$$= new (thd->mem_root) Condition_information($2, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -3515,12 +3677,13 @@ statement_information:
statement_information_item
{
$$= new (thd->mem_root) List<Statement_information_item>;
- if ($$ == NULL || $$->push_back($1, thd->mem_root))
+ if (unlikely($$ == NULL) ||
+ unlikely($$->push_back($1, thd->mem_root)))
MYSQL_YYABORT;
}
| statement_information ',' statement_information_item
{
- if ($1->push_back($3, thd->mem_root))
+ if (unlikely($1->push_back($3, thd->mem_root)))
MYSQL_YYABORT;
$$= $1;
}
@@ -3530,24 +3693,20 @@ statement_information_item:
simple_target_specification '=' statement_information_item_name
{
$$= new (thd->mem_root) Statement_information_item($3, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
simple_target_specification:
- ident
+ ident_cli
{
- Lex_input_stream *lip= &thd->m_parser_state->m_lip;
- $$= thd->lex->create_item_for_sp_var(&$1, NULL,
- lip->get_tok_start(),
- lip->get_ptr());
- if ($$ == NULL)
+ if (unlikely(!($$= thd->lex->create_item_for_sp_var(&$1, NULL))))
MYSQL_YYABORT;
}
| '@' ident_or_text
{
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -3572,12 +3731,13 @@ condition_information:
condition_information_item
{
$$= new (thd->mem_root) List<Condition_information_item>;
- if ($$ == NULL || $$->push_back($1, thd->mem_root))
+ if (unlikely($$ == NULL) ||
+ unlikely($$->push_back($1, thd->mem_root)))
MYSQL_YYABORT;
}
| condition_information ',' condition_information_item
{
- if ($1->push_back($3, thd->mem_root))
+ if (unlikely($1->push_back($3, thd->mem_root)))
MYSQL_YYABORT;
$$= $1;
}
@@ -3587,7 +3747,7 @@ condition_information_item:
simple_target_specification '=' condition_information_item_name
{
$$= new (thd->mem_root) Condition_information_item($3, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
@@ -3624,10 +3784,8 @@ sp_decl_ident:
IDENT_sys
| sp_decl_ident_keyword
{
- $$.str= thd->strmake($1.str, $1.length);
- if ($$.str == NULL)
+ if (unlikely($$.copy_ident_cli(thd, &$1)))
MYSQL_YYABORT;
- $$.length= $1.length;
}
;
@@ -3645,7 +3803,7 @@ sp_decl_idents:
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
- if (spc->find_variable(&$1, TRUE))
+ if (unlikely(spc->find_variable(&$1, TRUE)))
my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $1.str));
spc->add_variable(thd, &$1);
$$= 1;
@@ -3657,7 +3815,7 @@ sp_decl_idents:
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
- if (spc->find_variable(&$3, TRUE))
+ if (unlikely(spc->find_variable(&$3, TRUE)))
my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $3.str));
spc->add_variable(thd, &$3);
$$= $1 + 1;
@@ -3705,7 +3863,7 @@ sp_proc_stmt_compound_ok:
sp_proc_stmt_if:
IF_SYM
{
- if (Lex->maybe_start_compound_statement(thd))
+ if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
Lex->sphead->new_cont_backpatch(NULL);
}
@@ -3718,13 +3876,13 @@ sp_statement:
| ident_directly_assignable
{
// Direct procedure call (without the CALL keyword)
- if (Lex->call_statement_start(thd, &$1))
+ if (unlikely(Lex->call_statement_start(thd, &$1)))
MYSQL_YYABORT;
}
opt_sp_cparam_list
| ident_directly_assignable '.' ident
{
- if (Lex->call_statement_start(thd, &$1, &$3))
+ if (unlikely(Lex->call_statement_start(thd, &$1, &$3)))
MYSQL_YYABORT;
}
opt_sp_cparam_list
@@ -3746,7 +3904,7 @@ sp_proc_stmt_statement:
sp->m_flags|= sp_get_flags_for_command(lex);
/* "USE db" doesn't work in a procedure */
- if (lex->sql_command == SQLCOM_CHANGE_DB)
+ if (unlikely(lex->sql_command == SQLCOM_CHANGE_DB))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "USE"));
/*
Don't add an instruction for SET statements, since all
@@ -3759,7 +3917,7 @@ sp_proc_stmt_statement:
{
sp_instr_stmt *i=new (thd->mem_root)
sp_instr_stmt(sp->instructions(), lex->spcont, lex);
- if (i == NULL)
+ if (unlikely(i == NULL))
MYSQL_YYABORT;
/*
@@ -3771,13 +3929,13 @@ sp_proc_stmt_statement:
i->m_query.length= lip->get_ptr() - sp->m_tmp_query;
else
i->m_query.length= lip->get_tok_start() - sp->m_tmp_query;;
- if (!(i->m_query.str= strmake_root(thd->mem_root,
- sp->m_tmp_query,
- i->m_query.length)) ||
- sp->add_instr(i))
+ if (unlikely(!(i->m_query.str= strmake_root(thd->mem_root,
+ sp->m_tmp_query,
+ i->m_query.length))) ||
+ unlikely(sp->add_instr(i)))
MYSQL_YYABORT;
}
- if (sp->restore_lex(thd))
+ if (unlikely(sp->restore_lex(thd)))
MYSQL_YYABORT;
}
;
@@ -3789,16 +3947,17 @@ sp_proc_stmt_return:
{
LEX *lex= Lex;
sp_head *sp= lex->sphead;
- if (sp->m_handler->add_instr_freturn(thd, sp, lex->spcont,
- $3, lex) ||
- sp->restore_lex(thd))
+ if (unlikely(sp->m_handler->add_instr_freturn(thd, sp, lex->spcont,
+ $3, lex)) ||
+ unlikely(sp->restore_lex(thd)))
MYSQL_YYABORT;
}
| RETURN_SYM
{
LEX *lex= Lex;
sp_head *sp= lex->sphead;
- if (sp->m_handler->add_instr_preturn(thd, sp, lex->spcont))
+ if (unlikely(sp->m_handler->add_instr_preturn(thd, sp,
+ lex->spcont)))
MYSQL_YYABORT;
}
;
@@ -3810,24 +3969,24 @@ reset_lex_expr:
sp_proc_stmt_exit:
EXIT_SYM
{
- if (Lex->sp_exit_statement(thd, NULL))
+ if (unlikely(Lex->sp_exit_statement(thd, NULL)))
MYSQL_YYABORT;
}
| EXIT_SYM label_ident
{
- if (Lex->sp_exit_statement(thd, &$2, NULL))
+ if (unlikely(Lex->sp_exit_statement(thd, &$2, NULL)))
MYSQL_YYABORT;
}
| EXIT_SYM WHEN_SYM reset_lex_expr
{
- if (Lex->sp_exit_statement(thd, $3) ||
- Lex->sphead->restore_lex(thd))
+ if (unlikely(Lex->sp_exit_statement(thd, $3)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
| EXIT_SYM label_ident WHEN_SYM reset_lex_expr
{
- if (Lex->sp_exit_statement(thd, &$2, $4) ||
- Lex->sphead->restore_lex(thd))
+ if (unlikely(Lex->sp_exit_statement(thd, &$2, $4)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
;
@@ -3835,24 +3994,24 @@ sp_proc_stmt_exit:
sp_proc_stmt_continue:
CONTINUE_SYM
{
- if (Lex->sp_continue_statement(thd, NULL))
+ if (unlikely(Lex->sp_continue_statement(thd, NULL)))
MYSQL_YYABORT;
}
| CONTINUE_SYM label_ident
{
- if (Lex->sp_continue_statement(thd, &$2, NULL))
+ if (unlikely(Lex->sp_continue_statement(thd, &$2, NULL)))
MYSQL_YYABORT;
}
| CONTINUE_SYM WHEN_SYM reset_lex_expr
{
- if (Lex->sp_continue_statement(thd, $3) ||
- Lex->sphead->restore_lex(thd))
+ if (unlikely(Lex->sp_continue_statement(thd, $3)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
| CONTINUE_SYM label_ident WHEN_SYM reset_lex_expr
{
- if (Lex->sp_continue_statement(thd, &$2, $4) ||
- Lex->sphead->restore_lex(thd))
+ if (unlikely(Lex->sp_continue_statement(thd, &$2, $4)) ||
+ unlikely(Lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
;
@@ -3861,7 +4020,7 @@ sp_proc_stmt_continue:
sp_proc_stmt_leave:
LEAVE_SYM label_ident
{
- if (Lex->sp_leave_statement(thd, &$2))
+ if (unlikely(Lex->sp_leave_statement(thd, &$2)))
MYSQL_YYABORT;
}
;
@@ -3869,7 +4028,7 @@ sp_proc_stmt_leave:
sp_proc_stmt_iterate:
ITERATE_SYM label_ident
{
- if (Lex->sp_iterate_statement(thd, &$2))
+ if (unlikely(Lex->sp_iterate_statement(thd, &$2)))
MYSQL_YYABORT;
}
;
@@ -3877,7 +4036,7 @@ sp_proc_stmt_iterate:
sp_proc_stmt_goto:
GOTO_SYM label_ident
{
- if (Lex->sp_goto_statement(thd, &$2))
+ if (unlikely(Lex->sp_goto_statement(thd, &$2)))
MYSQL_YYABORT;
}
;
@@ -3892,7 +4051,8 @@ remember_lex:
assignment_source_lex:
{
DBUG_ASSERT(Lex->sphead);
- if (!($$= new (thd->mem_root) sp_assignment_lex(thd, thd->lex)))
+ if (unlikely(!($$= new (thd->mem_root)
+ sp_assignment_lex(thd, thd->lex))))
MYSQL_YYABORT;
}
;
@@ -3910,7 +4070,7 @@ assignment_source_expr:
$$->sp_lex_in_use= true;
$$->set_item_and_free_list($3, thd->free_list);
thd->free_list= NULL;
- if ($$->sphead->restore_lex(thd))
+ if (unlikely($$->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
;
@@ -3926,7 +4086,7 @@ for_loop_bound_expr:
$$= $1;
$$->sp_lex_in_use= true;
$$->set_item_and_free_list($3, NULL);
- if ($$->sphead->restore_lex(thd))
+ if (unlikely($$->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
;
@@ -3934,7 +4094,7 @@ for_loop_bound_expr:
cursor_actual_parameters:
assignment_source_expr
{
- if (!($$= new (thd->mem_root) List<sp_assignment_lex>))
+ if (unlikely(!($$= new (thd->mem_root) List<sp_assignment_lex>)))
MYSQL_YYABORT;
$$->push_back($1, thd->mem_root);
}
@@ -3953,7 +4113,7 @@ opt_parenthesized_cursor_actual_parameters:
sp_proc_stmt_open:
OPEN_SYM ident opt_parenthesized_cursor_actual_parameters
{
- if (Lex->sp_open_cursor(thd, &$2, $3))
+ if (unlikely(Lex->sp_open_cursor(thd, &$2, $3)))
MYSQL_YYABORT;
}
;
@@ -3961,17 +4121,17 @@ sp_proc_stmt_open:
sp_proc_stmt_fetch_head:
FETCH_SYM ident INTO
{
- if (Lex->sp_add_cfetch(thd, &$2))
+ if (unlikely(Lex->sp_add_cfetch(thd, &$2)))
MYSQL_YYABORT;
}
| FETCH_SYM FROM ident INTO
{
- if (Lex->sp_add_cfetch(thd, &$3))
+ if (unlikely(Lex->sp_add_cfetch(thd, &$3)))
MYSQL_YYABORT;
}
| FETCH_SYM NEXT_SYM FROM ident INTO
{
- if (Lex->sp_add_cfetch(thd, &$4))
+ if (unlikely(Lex->sp_add_cfetch(thd, &$4)))
MYSQL_YYABORT;
}
;
@@ -3988,12 +4148,12 @@ sp_proc_stmt_close:
uint offset;
sp_instr_cclose *i;
- if (! lex->spcont->find_cursor(&$2, &offset, false))
+ if (unlikely(!lex->spcont->find_cursor(&$2, &offset, false)))
my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $2.str));
i= new (thd->mem_root)
sp_instr_cclose(sp->instructions(), lex->spcont, offset);
- if (i == NULL ||
- sp->add_instr(i))
+ if (unlikely(i == NULL) ||
+ unlikely(sp->add_instr(i)))
MYSQL_YYABORT;
}
;
@@ -4006,7 +4166,7 @@ sp_fetch_list:
sp_pcontext *spc= lex->spcont;
sp_variable *spv;
- if (!spc || !(spv = spc->find_variable(&$1, false)))
+ if (unlikely(!spc || !(spv = spc->find_variable(&$1, false))))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
/* An SP local variable */
@@ -4020,7 +4180,7 @@ sp_fetch_list:
sp_pcontext *spc= lex->spcont;
sp_variable *spv;
- if (!spc || !(spv = spc->find_variable(&$3, false)))
+ if (unlikely(!spc || !(spv = spc->find_variable(&$3, false))))
my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str));
/* An SP local variable */
@@ -4039,12 +4199,12 @@ sp_if:
uint ip= sp->instructions();
sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, ctx, $2, lex);
- if (i == NULL ||
- sp->push_backpatch(thd, i, ctx->push_label(thd, &empty_clex_str, 0)) ||
- sp->add_cont_backpatch(i) ||
- sp->add_instr(i))
+ if (unlikely(i == NULL) ||
+ unlikely(sp->push_backpatch(thd, i, ctx->push_label(thd, &empty_clex_str, 0))) ||
+ unlikely(sp->add_cont_backpatch(i)) ||
+ unlikely(sp->add_instr(i)))
MYSQL_YYABORT;
- if (sp->restore_lex(thd))
+ if (unlikely(sp->restore_lex(thd)))
MYSQL_YYABORT;
}
sp_proc_stmts1_implicit_block
@@ -4053,8 +4213,8 @@ sp_if:
sp_pcontext *ctx= Lex->spcont;
uint ip= sp->instructions();
sp_instr_jump *i= new (thd->mem_root) sp_instr_jump(ip, ctx);
- if (i == NULL ||
- sp->add_instr(i))
+ if (unlikely(i == NULL) ||
+ unlikely(sp->add_instr(i)))
MYSQL_YYABORT;
sp->backpatch(ctx->pop_label());
sp->push_backpatch(thd, i, ctx->push_label(thd, &empty_clex_str, 0));
@@ -4076,7 +4236,7 @@ sp_elseifs:
case_stmt_specification:
CASE_SYM
{
- if (Lex->maybe_start_compound_statement(thd))
+ if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
/**
@@ -4147,10 +4307,9 @@ case_stmt_body:
{ Lex->sphead->reset_lex(thd); /* For expr $2 */ }
expr
{
- if (Lex->case_stmt_action_expr($2))
+ if (unlikely(Lex->case_stmt_action_expr($2)))
MYSQL_YYABORT;
-
- if (Lex->sphead->restore_lex(thd))
+ if (unlikely(Lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
simple_when_clause_list
@@ -4179,16 +4338,16 @@ simple_when_clause:
/* Simple case: <caseval> = <whenval> */
LEX *lex= Lex;
- if (lex->case_stmt_action_when($3, true))
+ if (unlikely(lex->case_stmt_action_when($3, true)))
MYSQL_YYABORT;
/* For expr $3 */
- if (lex->sphead->restore_lex(thd))
+ if (unlikely(lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
THEN_SYM
sp_proc_stmts1_implicit_block
{
- if (Lex->case_stmt_action_then())
+ if (unlikely(Lex->case_stmt_action_then()))
MYSQL_YYABORT;
}
;
@@ -4201,16 +4360,16 @@ searched_when_clause:
expr
{
LEX *lex= Lex;
- if (lex->case_stmt_action_when($3, false))
+ if (unlikely(lex->case_stmt_action_when($3, false)))
MYSQL_YYABORT;
/* For expr $3 */
- if (lex->sphead->restore_lex(thd))
+ if (unlikely(lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
THEN_SYM
sp_proc_stmts1_implicit_block
{
- if (Lex->case_stmt_action_then())
+ if (unlikely(Lex->case_stmt_action_then()))
MYSQL_YYABORT;
}
;
@@ -4223,8 +4382,8 @@ else_clause_opt:
uint ip= sp->instructions();
sp_instr_error *i= new (thd->mem_root)
sp_instr_error(ip, lex->spcont, ER_SP_CASE_NOT_FOUND);
- if (i == NULL ||
- sp->add_instr(i))
+ if (unlikely(i == NULL) ||
+ unlikely(sp->add_instr(i)))
MYSQL_YYABORT;
}
| ELSE sp_proc_stmts1_implicit_block
@@ -4238,7 +4397,7 @@ sp_opt_label:
sp_block_label:
labels_declaration_oracle
{
- if (Lex->spcont->block_label_declare(&$1))
+ if (unlikely(Lex->spcont->block_label_declare(&$1)))
MYSQL_YYABORT;
$$= $1;
}
@@ -4249,14 +4408,14 @@ sp_labeled_block:
BEGIN_SYM
{
Lex->sp_block_init(thd, &$1);
- if (Lex->sp_block_with_exceptions_finalize_declarations(thd))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
sp_block_statements_and_exceptions
END
sp_opt_label
{
- if (Lex->sp_block_finalize(thd, Lex_spblock($4), &$6))
+ if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4), &$6)))
MYSQL_YYABORT;
}
| sp_block_label
@@ -4266,7 +4425,7 @@ sp_labeled_block:
}
sp_decl_body_list
{
- if (Lex->sp_block_with_exceptions_finalize_declarations(thd))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
BEGIN_SYM
@@ -4275,7 +4434,7 @@ sp_labeled_block:
sp_opt_label
{
$4.hndlrs+= $7.hndlrs;
- if (Lex->sp_block_finalize(thd, $4, &$9))
+ if (unlikely(Lex->sp_block_finalize(thd, $4, &$9)))
MYSQL_YYABORT;
}
;
@@ -4288,27 +4447,27 @@ opt_not_atomic:
sp_unlabeled_block:
BEGIN_SYM opt_not_atomic
{
- if (Lex->maybe_start_compound_statement(thd))
+ if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
Lex->sp_block_init(thd);
- if (Lex->sp_block_with_exceptions_finalize_declarations(thd))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
sp_block_statements_and_exceptions
END
{
- if (Lex->sp_block_finalize(thd, Lex_spblock($4)))
+ if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4))))
MYSQL_YYABORT;
}
| DECLARE_SYM
{
- if (Lex->maybe_start_compound_statement(thd))
+ if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
Lex->sp_block_init(thd);
}
sp_decl_body_list
{
- if (Lex->sp_block_with_exceptions_finalize_declarations(thd))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
BEGIN_SYM
@@ -4316,7 +4475,7 @@ sp_unlabeled_block:
END
{
$3.hndlrs+= $6.hndlrs;
- if (Lex->sp_block_finalize(thd, $3))
+ if (unlikely(Lex->sp_block_finalize(thd, $3)))
MYSQL_YYABORT;
}
;
@@ -4331,14 +4490,14 @@ sp_body:
}
opt_sp_decl_body_list
{
- if (Lex->sp_block_with_exceptions_finalize_declarations(thd))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
}
BEGIN_SYM
sp_block_statements_and_exceptions
{
$2.hndlrs+= $5.hndlrs;
- if (Lex->sp_block_finalize(thd, $2))
+ if (unlikely(Lex->sp_block_finalize(thd, $2)))
MYSQL_YYABORT;
}
END
@@ -4348,13 +4507,12 @@ sp_block_statements_and_exceptions:
sp_instr_addr
sp_proc_stmts
{
- if (Lex->sp_block_with_exceptions_finalize_executable_section(thd,
- $1))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_executable_section(thd, $1)))
MYSQL_YYABORT;
}
opt_exception_clause
{
- if (Lex->sp_block_with_exceptions_finalize_exceptions(thd, $1, $4))
+ if (unlikely(Lex->sp_block_with_exceptions_finalize_exceptions(thd, $1, $4)))
MYSQL_YYABORT;
$$.init($4);
}
@@ -4373,14 +4531,14 @@ exception_handlers:
exception_handler:
WHEN_SYM
{
- if (Lex->sp_handler_declaration_init(thd, sp_handler::EXIT))
+ if (unlikely(Lex->sp_handler_declaration_init(thd, sp_handler::EXIT)))
MYSQL_YYABORT;
}
sp_hcond_list
THEN_SYM
sp_proc_stmts1_implicit_block
{
- if (Lex->sp_handler_declaration_finalize(thd, sp_handler::EXIT))
+ if (unlikely(Lex->sp_handler_declaration_finalize(thd, sp_handler::EXIT)))
MYSQL_YYABORT;
}
;
@@ -4394,7 +4552,7 @@ opt_sp_for_loop_direction:
sp_for_loop_index_and_bounds:
ident_directly_assignable sp_for_loop_bounds
{
- if (Lex->sp_for_loop_declarations(thd, &$$, &$1, $2))
+ if (unlikely(Lex->sp_for_loop_declarations(thd, &$$, &$1, $2)))
MYSQL_YYABORT;
}
;
@@ -4417,7 +4575,8 @@ sp_for_loop_bounds:
}
| IN_SYM opt_sp_for_loop_direction '(' sp_cursor_stmt ')'
{
- if (Lex->sp_for_loop_implicit_cursor_statement(thd, &$$, $4))
+ if (unlikely(Lex->sp_for_loop_implicit_cursor_statement(thd, &$$,
+ $4)))
MYSQL_YYABORT;
}
;
@@ -4430,8 +4589,8 @@ loop_body:
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump *i= new (thd->mem_root)
sp_instr_jump(ip, lex->spcont, lab->ip);
- if (i == NULL ||
- lex->sphead->add_instr(i))
+ if (unlikely(i == NULL) ||
+ unlikely(lex->sphead->add_instr(i)))
MYSQL_YYABORT;
}
;
@@ -4440,14 +4599,14 @@ while_body:
expr LOOP_SYM
{
LEX *lex= Lex;
- if (lex->sp_while_loop_expression(thd, $1))
+ if (unlikely(lex->sp_while_loop_expression(thd, $1)))
MYSQL_YYABORT;
- if (lex->sphead->restore_lex(thd))
+ if (unlikely(lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
sp_proc_stmts1 END LOOP_SYM
{
- if (Lex->sp_while_loop_finalize(thd))
+ if (unlikely(Lex->sp_while_loop_finalize(thd)))
MYSQL_YYABORT;
}
;
@@ -4462,10 +4621,10 @@ repeat_body:
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, lex->spcont, $4, lab->ip, lex);
- if (i == NULL ||
- lex->sphead->add_instr(i))
+ if (unlikely(i == NULL) ||
+ unlikely(lex->sphead->add_instr(i)))
MYSQL_YYABORT;
- if (lex->sphead->restore_lex(thd))
+ if (unlikely(lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
/* We can shortcut the cont_backpatch here */
i->m_cont_dest= ip+1;
@@ -4475,7 +4634,7 @@ repeat_body:
pop_sp_loop_label:
sp_opt_label
{
- if (Lex->sp_pop_loop_label(thd, &$1))
+ if (unlikely(Lex->sp_pop_loop_label(thd, &$1)))
MYSQL_YYABORT;
}
;
@@ -4483,14 +4642,14 @@ pop_sp_loop_label:
sp_labeled_control:
labels_declaration_oracle LOOP_SYM
{
- if (Lex->sp_push_loop_label(thd, &$1))
+ if (unlikely(Lex->sp_push_loop_label(thd, &$1)))
MYSQL_YYABORT;
}
loop_body pop_sp_loop_label
{ }
| labels_declaration_oracle WHILE_SYM
{
- if (Lex->sp_push_loop_label(thd, &$1))
+ if (unlikely(Lex->sp_push_loop_label(thd, &$1)))
MYSQL_YYABORT;
Lex->sphead->reset_lex(thd);
}
@@ -4503,28 +4662,28 @@ sp_labeled_control:
}
sp_for_loop_index_and_bounds
{
- if (Lex->sp_push_loop_label(thd, &$1)) // The inner WHILE block
+ if (unlikely(Lex->sp_push_loop_label(thd, &$1))) // The inner WHILE block
MYSQL_YYABORT;
- if (Lex->sp_for_loop_condition_test(thd, $4))
+ if (unlikely(Lex->sp_for_loop_condition_test(thd, $4)))
MYSQL_YYABORT;
}
LOOP_SYM
sp_proc_stmts1
END LOOP_SYM
{
- if (Lex->sp_for_loop_finalize(thd, $4))
+ if (unlikely(Lex->sp_for_loop_finalize(thd, $4)))
MYSQL_YYABORT;
}
pop_sp_loop_label // The inner WHILE block
{
Lex_spblock tmp;
tmp.curs= MY_TEST($4.m_implicit_cursor);
- if (Lex->sp_block_finalize(thd, tmp)) // The outer DECLARE..BEGIN..END
+ if (unlikely(Lex->sp_block_finalize(thd, tmp))) // The outer DECLARE..BEGIN..END
MYSQL_YYABORT;
}
| labels_declaration_oracle REPEAT_SYM
{
- if (Lex->sp_push_loop_label(thd, &$1))
+ if (unlikely(Lex->sp_push_loop_label(thd, &$1)))
MYSQL_YYABORT;
}
repeat_body pop_sp_loop_label
@@ -4534,7 +4693,7 @@ sp_labeled_control:
sp_unlabeled_control:
LOOP_SYM
{
- if (Lex->sp_push_loop_empty_label(thd))
+ if (unlikely(Lex->sp_push_loop_empty_label(thd)))
MYSQL_YYABORT;
}
loop_body
@@ -4543,7 +4702,7 @@ sp_unlabeled_control:
}
| WHILE_SYM
{
- if (Lex->sp_push_loop_empty_label(thd))
+ if (unlikely(Lex->sp_push_loop_empty_label(thd)))
MYSQL_YYABORT;
Lex->sphead->reset_lex(thd);
}
@@ -4554,15 +4713,15 @@ sp_unlabeled_control:
| FOR_SYM
{
// See "The FOR LOOP statement" comments in sql_lex.cc
- if (Lex->maybe_start_compound_statement(thd))
+ if (unlikely(Lex->maybe_start_compound_statement(thd)))
MYSQL_YYABORT;
Lex->sp_block_init(thd); // The outer DECLARE..BEGIN..END block
}
sp_for_loop_index_and_bounds
{
- if (Lex->sp_push_loop_empty_label(thd)) // The inner WHILE block
+ if (unlikely(Lex->sp_push_loop_empty_label(thd))) // The inner WHILE block
MYSQL_YYABORT;
- if (Lex->sp_for_loop_condition_test(thd, $3))
+ if (unlikely(Lex->sp_for_loop_condition_test(thd, $3)))
MYSQL_YYABORT;
}
LOOP_SYM
@@ -4571,15 +4730,15 @@ sp_unlabeled_control:
{
Lex_spblock tmp;
tmp.curs= MY_TEST($3.m_implicit_cursor);
- if (Lex->sp_for_loop_finalize(thd, $3))
+ if (unlikely(Lex->sp_for_loop_finalize(thd, $3)))
MYSQL_YYABORT;
Lex->sp_pop_loop_empty_label(thd); // The inner WHILE block
- if (Lex->sp_block_finalize(thd, tmp)) // The outer DECLARE..BEGIN..END
+ if (unlikely(Lex->sp_block_finalize(thd, tmp))) // The outer DECLARE..BEGIN..END
MYSQL_YYABORT;
}
| REPEAT_SYM
{
- if (Lex->sp_push_loop_empty_label(thd))
+ if (unlikely(Lex->sp_push_loop_empty_label(thd)))
MYSQL_YYABORT;
}
repeat_body
@@ -4798,7 +4957,7 @@ tablespace_name:
LEX *lex= Lex;
lex->alter_tablespace_info= (new (thd->mem_root)
st_alter_tablespace());
- if (lex->alter_tablespace_info == NULL)
+ if (unlikely(lex->alter_tablespace_info == NULL))
MYSQL_YYABORT;
lex->alter_tablespace_info->tablespace_name= $1.str;
lex->sql_command= SQLCOM_ALTER_TABLESPACE;
@@ -4811,7 +4970,7 @@ logfile_group_name:
LEX *lex= Lex;
lex->alter_tablespace_info= (new (thd->mem_root)
st_alter_tablespace());
- if (lex->alter_tablespace_info == NULL)
+ if (unlikely(lex->alter_tablespace_info == NULL))
MYSQL_YYABORT;
lex->alter_tablespace_info->logfile_group_name= $1.str;
lex->sql_command= SQLCOM_ALTER_TABLESPACE;
@@ -4888,7 +5047,7 @@ opt_ts_nodegroup:
NODEGROUP_SYM opt_equal real_ulong_num
{
LEX *lex= Lex;
- if (lex->alter_tablespace_info->nodegroup_id != UNDEF_NODEGROUP)
+ if (unlikely(lex->alter_tablespace_info->nodegroup_id != UNDEF_NODEGROUP))
my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NODEGROUP"));
lex->alter_tablespace_info->nodegroup_id= $3;
}
@@ -4898,7 +5057,7 @@ opt_ts_comment:
COMMENT_SYM opt_equal TEXT_STRING_sys
{
LEX *lex= Lex;
- if (lex->alter_tablespace_info->ts_comment != NULL)
+ if (unlikely(lex->alter_tablespace_info->ts_comment != NULL))
my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"COMMENT"));
lex->alter_tablespace_info->ts_comment= $3.str;
}
@@ -4908,7 +5067,7 @@ opt_ts_engine:
opt_storage ENGINE_SYM opt_equal storage_engines
{
LEX *lex= Lex;
- if (lex->alter_tablespace_info->storage_engine != NULL)
+ if (unlikely(lex->alter_tablespace_info->storage_engine != NULL))
my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE, MYF(0),
"STORAGE ENGINE"));
lex->alter_tablespace_info->storage_engine= $4;
@@ -4929,7 +5088,7 @@ ts_wait:
| NO_WAIT_SYM
{
LEX *lex= Lex;
- if (!(lex->alter_tablespace_info->wait_until_completed))
+ if (unlikely(!(lex->alter_tablespace_info->wait_until_completed)))
my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NO_WAIT"));
lex->alter_tablespace_info->wait_until_completed= FALSE;
}
@@ -4939,40 +5098,8 @@ size_number:
real_ulonglong_num { $$= $1;}
| IDENT_sys
{
- ulonglong number;
- uint text_shift_number= 0;
- longlong prefix_number;
- const char *start_ptr= $1.str;
- size_t str_len= $1.length;
- const char *end_ptr= start_ptr + str_len;
- int error;
- prefix_number= my_strtoll10(start_ptr, (char**) &end_ptr, &error);
- if ((start_ptr + str_len - 1) == end_ptr)
- {
- switch (end_ptr[0])
- {
- case 'g':
- case 'G':
- text_shift_number+=10;
- /* fall through */
- case 'm':
- case 'M':
- text_shift_number+=10;
- /* fall through */
- case 'k':
- case 'K':
- text_shift_number+=10;
- break;
- default:
- my_yyabort_error((ER_WRONG_SIZE_NUMBER, MYF(0)));
- }
- if (prefix_number >> 31)
- my_yyabort_error((ER_SIZE_OVERFLOW_ERROR, MYF(0)));
- number= prefix_number << text_shift_number;
- }
- else
- my_yyabort_error((ER_WRONG_SIZE_NUMBER, MYF(0)));
- $$= number;
+ if ($1.to_size_number(&$$))
+ MYSQL_YYABORT;
}
;
@@ -5001,7 +5128,7 @@ create_body:
Lex->create_info.add(DDL_options_st::OPT_LIKE);
TABLE_LIST *src_table= Lex->select_lex.add_table_to_list(thd,
$1, NULL, 0, TL_READ, MDL_SHARED_READ);
- if (! src_table)
+ if (unlikely(! src_table))
MYSQL_YYABORT;
/* CREATE TABLE ... LIKE is not allowed for views. */
src_table->required_type= TABLE_TYPE_NORMAL;
@@ -5015,7 +5142,7 @@ create_like:
opt_create_select:
/* empty */ {}
- | opt_duplicate opt_as create_select_query_expression
+ | opt_duplicate opt_as create_select_query_expression opt_versioning_option
;
create_select_query_expression:
@@ -5085,11 +5212,8 @@ partitioning:
{
LEX *lex= Lex;
lex->part_info= new (thd->mem_root) partition_info();
- if (!lex->part_info)
- {
- mem_alloc_error(sizeof(partition_info));
+ if (unlikely(!lex->part_info))
MYSQL_YYABORT;
- }
if (lex->sql_command == SQLCOM_ALTER_TABLE)
{
lex->alter_info.partition_flags|= ALTER_PARTITION_INFO;
@@ -5103,7 +5227,7 @@ have_partitioning:
{
#ifdef WITH_PARTITION_STORAGE_ENGINE
LEX_CSTRING partition_name={STRING_WITH_LEN("partition")};
- if (!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN))
+ if (unlikely(!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN)))
my_yyabort_error((ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--skip-partition"));
#else
@@ -5116,12 +5240,12 @@ have_partitioning:
partition_entry:
PARTITION_SYM
{
- LEX *lex= Lex;
- if (!lex->part_info)
+ if (unlikely(!Lex->part_info))
{
thd->parse_error(ER_PARTITION_ENTRY_ERROR);
MYSQL_YYABORT;
}
+ DBUG_ASSERT(Lex->part_info->table);
/*
We enter here when opening the frm file to translate
partition info string into part_info data structure.
@@ -5162,6 +5286,12 @@ part_type_def:
}
| LIST_SYM part_column_list
{ Lex->part_info->part_type= LIST_PARTITION; }
+ | SYSTEM_TIME_SYM
+ {
+ if (unlikely(Lex->part_info->vers_init_info(thd)))
+ MYSQL_YYABORT;
+ }
+ opt_versioning_rotation
;
opt_linear:
@@ -5204,12 +5334,10 @@ part_field_item:
{
partition_info *part_info= Lex->part_info;
part_info->num_columns++;
- if (part_info->part_field_list.push_back($1.str, thd->mem_root))
- {
- mem_alloc_error(1);
+ if (unlikely(part_info->part_field_list.push_back($1.str,
+ thd->mem_root)))
MYSQL_YYABORT;
- }
- if (part_info->num_columns > MAX_REF_PARTS)
+ if (unlikely(part_info->num_columns > MAX_REF_PARTS))
my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
"list of partition fields"));
}
@@ -5229,8 +5357,8 @@ part_func:
'(' remember_name part_func_expr remember_end ')'
{
partition_info *part_info= Lex->part_info;
- if (part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE))
- { MYSQL_YYABORT; }
+ if (unlikely(part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE)))
+ MYSQL_YYABORT;
part_info->num_columns= 1;
part_info->column_list= FALSE;
}
@@ -5239,8 +5367,8 @@ part_func:
sub_part_func:
'(' remember_name part_func_expr remember_end ')'
{
- if (Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE))
- { MYSQL_YYABORT; }
+ if (unlikely(Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE)))
+ MYSQL_YYABORT;
}
;
@@ -5251,7 +5379,7 @@ opt_num_parts:
{
uint num_parts= $2;
partition_info *part_info= Lex->part_info;
- if (num_parts == 0)
+ if (unlikely(num_parts == 0))
my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "partitions"));
part_info->num_parts= num_parts;
@@ -5283,12 +5411,11 @@ sub_part_field_item:
ident
{
partition_info *part_info= Lex->part_info;
- if (part_info->subpart_field_list.push_back($1.str, thd->mem_root))
- {
- mem_alloc_error(1);
+ if (unlikely(part_info->subpart_field_list.push_back($1.str,
+ thd->mem_root)))
MYSQL_YYABORT;
- }
- if (part_info->subpart_field_list.elements > MAX_REF_PARTS)
+
+ if (unlikely(part_info->subpart_field_list.elements > MAX_REF_PARTS))
my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
"list of subpartition fields"));
}
@@ -5297,7 +5424,7 @@ sub_part_field_item:
part_func_expr:
bit_expr
{
- if (!Lex->safe_to_cache_query)
+ if (unlikely(!Lex->safe_to_cache_query))
{
thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT;
@@ -5312,7 +5439,7 @@ opt_num_subparts:
{
uint num_parts= $2;
LEX *lex= Lex;
- if (num_parts == 0)
+ if (unlikely(num_parts == 0))
my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "subpartitions"));
lex->part_info->num_subparts= num_parts;
lex->part_info->use_default_num_subpartitions= FALSE;
@@ -5323,10 +5450,10 @@ part_defs:
/* empty */
{
partition_info *part_info= Lex->part_info;
- if (part_info->part_type == RANGE_PARTITION)
+ if (unlikely(part_info->part_type == RANGE_PARTITION))
my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
"RANGE"));
- if (part_info->part_type == LIST_PARTITION)
+ if (unlikely(part_info->part_type == LIST_PARTITION))
my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
"LIST"));
}
@@ -5336,8 +5463,8 @@ part_defs:
uint count_curr_parts= part_info->partitions.elements;
if (part_info->num_parts != 0)
{
- if (part_info->num_parts !=
- count_curr_parts)
+ if (unlikely(part_info->num_parts !=
+ count_curr_parts))
{
thd->parse_error(ER_PARTITION_WRONG_NO_PART_ERROR);
MYSQL_YYABORT;
@@ -5362,13 +5489,12 @@ part_definition:
partition_info *part_info= Lex->part_info;
partition_element *p_elem= new (thd->mem_root) partition_element();
- if (!p_elem ||
- part_info->partitions.push_back(p_elem, thd->mem_root))
- {
- mem_alloc_error(sizeof(partition_element));
+ if (unlikely(!p_elem) ||
+ unlikely(part_info->partitions.push_back(p_elem, thd->mem_root)))
MYSQL_YYABORT;
- }
+
p_elem->part_state= PART_NORMAL;
+ p_elem->id= part_info->partitions.elements - 1;
part_info->curr_part_elem= p_elem;
part_info->current_partition= p_elem;
part_info->use_default_partitions= FALSE;
@@ -5386,7 +5512,7 @@ part_name:
{
partition_info *part_info= Lex->part_info;
partition_element *p_elem= part_info->curr_part_elem;
- if (check_ident_length(&$1))
+ if (unlikely(check_ident_length(&$1)))
MYSQL_YYABORT;
p_elem->partition_name= $1.str;
}
@@ -5399,12 +5525,12 @@ opt_part_values:
partition_info *part_info= lex->part_info;
if (! lex->is_partition_management())
{
- if (part_info->part_type == RANGE_PARTITION)
- my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "RANGE", "LESS THAN"));
- if (part_info->part_type == LIST_PARTITION)
- my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "LIST", "IN"));
+ if (unlikely(part_info->error_if_requires_values()))
+ MYSQL_YYABORT;
+ if (unlikely(part_info->part_type == VERSIONING_PARTITION))
+ my_yyabort_error((ER_VERS_WRONG_PARTS, MYF(0),
+ lex->create_last_non_select_table->
+ table_name.str));
}
else
part_info->part_type= HASH_PARTITION;
@@ -5415,7 +5541,7 @@ opt_part_values:
partition_info *part_info= lex->part_info;
if (! lex->is_partition_management())
{
- if (part_info->part_type != RANGE_PARTITION)
+ if (unlikely(part_info->part_type != RANGE_PARTITION))
my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN"));
}
@@ -5429,7 +5555,7 @@ opt_part_values:
partition_info *part_info= lex->part_info;
if (! lex->is_partition_management())
{
- if (part_info->part_type != LIST_PARTITION)
+ if (unlikely(part_info->part_type != LIST_PARTITION))
my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN"));
}
@@ -5437,26 +5563,32 @@ opt_part_values:
part_info->part_type= LIST_PARTITION;
}
part_values_in {}
+ | CURRENT_SYM
+ {
+ if (Lex->part_values_current(thd))
+ MYSQL_YYABORT;
+ }
+ | HISTORY_SYM
+ {
+ if (Lex->part_values_history(thd))
+ MYSQL_YYABORT;
+ }
| DEFAULT
{
LEX *lex= Lex;
partition_info *part_info= lex->part_info;
if (! lex->is_partition_management())
{
- if (part_info->part_type != LIST_PARTITION)
+ if (unlikely(part_info->part_type != LIST_PARTITION))
my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "DEFAULT"));
}
else
part_info->part_type= LIST_PARTITION;
- if (part_info->init_column_part(thd))
- {
+ if (unlikely(part_info->init_column_part(thd)))
MYSQL_YYABORT;
- }
- if (part_info->add_max_value(thd))
- {
+ if (unlikely(part_info->add_max_value(thd)))
MYSQL_YYABORT;
- }
}
;
@@ -5465,8 +5597,8 @@ part_func_max:
{
partition_info *part_info= Lex->part_info;
- if (part_info->num_columns &&
- part_info->num_columns != 1U)
+ if (unlikely(part_info->num_columns &&
+ part_info->num_columns != 1U))
{
part_info->print_debug("Kilroy II", NULL);
thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
@@ -5474,14 +5606,10 @@ part_func_max:
}
else
part_info->num_columns= 1U;
- if (part_info->init_column_part(thd))
- {
+ if (unlikely(part_info->init_column_part(thd)))
MYSQL_YYABORT;
- }
- if (part_info->add_max_value(thd))
- {
+ if (unlikely(part_info->add_max_value(thd)))
MYSQL_YYABORT;
- }
}
| part_value_item {}
;
@@ -5495,9 +5623,9 @@ part_values_in:
if (part_info->num_columns != 1U)
{
- if (!lex->is_partition_management() ||
- part_info->num_columns == 0 ||
- part_info->num_columns > MAX_REF_PARTS)
+ if (unlikely(!lex->is_partition_management() ||
+ part_info->num_columns == 0 ||
+ part_info->num_columns > MAX_REF_PARTS))
{
part_info->print_debug("Kilroy III", NULL);
thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
@@ -5510,16 +5638,14 @@ part_values_in:
we ADD or REORGANIZE partitions. Also can only happen
for LIST partitions.
*/
- if (part_info->reorganize_into_single_field_col_val(thd))
- {
+ if (unlikely(part_info->reorganize_into_single_field_col_val(thd)))
MYSQL_YYABORT;
- }
}
}
| '(' part_value_list ')'
{
partition_info *part_info= Lex->part_info;
- if (part_info->num_columns < 2U)
+ if (unlikely(part_info->num_columns < 2U))
{
thd->parse_error(ER_ROW_SINGLE_PARTITION_FIELD_ERROR);
MYSQL_YYABORT;
@@ -5538,12 +5664,10 @@ part_value_item:
partition_info *part_info= Lex->part_info;
part_info->print_debug("( part_value_item", NULL);
/* Initialisation code needed for each list of value expressions */
- if (!(part_info->part_type == LIST_PARTITION &&
- part_info->num_columns == 1U) &&
- part_info->init_column_part(thd))
- {
+ if (unlikely(!(part_info->part_type == LIST_PARTITION &&
+ part_info->num_columns == 1U) &&
+ part_info->init_column_part(thd)))
MYSQL_YYABORT;
- }
}
part_value_item_list {}
')'
@@ -5552,7 +5676,7 @@ part_value_item:
part_info->print_debug(") part_value_item", NULL);
if (part_info->num_columns == 0)
part_info->num_columns= part_info->curr_list_object;
- if (part_info->num_columns != part_info->curr_list_object)
+ if (unlikely(part_info->num_columns != part_info->curr_list_object))
{
/*
All value items lists must be of equal length, in some cases
@@ -5578,15 +5702,13 @@ part_value_expr_item:
MAXVALUE_SYM
{
partition_info *part_info= Lex->part_info;
- if (part_info->part_type == LIST_PARTITION)
+ if (unlikely(part_info->part_type == LIST_PARTITION))
{
thd->parse_error(ER_MAXVALUE_IN_VALUES_IN);
MYSQL_YYABORT;
}
- if (part_info->add_max_value(thd))
- {
+ if (unlikely(part_info->add_max_value(thd)))
MYSQL_YYABORT;
- }
}
| bit_expr
{
@@ -5594,15 +5716,13 @@ part_value_expr_item:
partition_info *part_info= lex->part_info;
Item *part_expr= $1;
- if (!lex->safe_to_cache_query)
+ if (unlikely(!lex->safe_to_cache_query))
{
thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT;
}
- if (part_info->add_column_list_value(thd, part_expr))
- {
+ if (unlikely(part_info->add_column_list_value(thd, part_expr)))
MYSQL_YYABORT;
- }
}
;
@@ -5611,8 +5731,8 @@ opt_sub_partition:
/* empty */
{
partition_info *part_info= Lex->part_info;
- if (part_info->num_subparts != 0 &&
- !part_info->use_default_subpartitions)
+ if (unlikely(part_info->num_subparts != 0 &&
+ !part_info->use_default_subpartitions))
{
/*
We come here when we have defined subpartitions on the first
@@ -5627,8 +5747,8 @@ opt_sub_partition:
partition_info *part_info= Lex->part_info;
if (part_info->num_subparts != 0)
{
- if (part_info->num_subparts !=
- part_info->count_curr_subparts)
+ if (unlikely(part_info->num_subparts !=
+ part_info->count_curr_subparts))
{
thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT;
@@ -5636,7 +5756,7 @@ opt_sub_partition:
}
else if (part_info->count_curr_subparts > 0)
{
- if (part_info->partitions.elements > 1)
+ if (unlikely(part_info->partitions.elements > 1))
{
thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT;
@@ -5659,8 +5779,8 @@ sub_part_definition:
partition_element *curr_part= part_info->current_partition;
partition_element *sub_p_elem= new (thd->mem_root)
partition_element(curr_part);
- if (part_info->use_default_subpartitions &&
- part_info->partitions.elements >= 2)
+ if (unlikely(part_info->use_default_subpartitions &&
+ part_info->partitions.elements >= 2))
{
/*
create table t1 (a int)
@@ -5676,12 +5796,11 @@ sub_part_definition:
thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT;
}
- if (!sub_p_elem ||
- curr_part->subpartitions.push_back(sub_p_elem, thd->mem_root))
- {
- mem_alloc_error(sizeof(partition_element));
+ if (unlikely(!sub_p_elem) ||
+ unlikely(curr_part->subpartitions.push_back(sub_p_elem, thd->mem_root)))
MYSQL_YYABORT;
- }
+
+ sub_p_elem->id= curr_part->subpartitions.elements - 1;
part_info->curr_part_elem= sub_p_elem;
part_info->use_default_subpartitions= FALSE;
part_info->use_default_num_subpartitions= FALSE;
@@ -5693,7 +5812,7 @@ sub_part_definition:
sub_name:
ident_or_text
{
- if (check_ident_length(&$1))
+ if (unlikely(check_ident_length(&$1)))
MYSQL_YYABORT;
Lex->part_info->curr_part_elem->partition_name= $1.str;
}
@@ -5738,6 +5857,50 @@ opt_part_option:
{ Lex->part_info->curr_part_elem->part_comment= $3.str; }
;
+opt_versioning_rotation:
+ /* empty */ {}
+ | INTERVAL_SYM expr interval opt_versioning_interval_start
+ {
+ partition_info *part_info= Lex->part_info;
+ if (unlikely(part_info->vers_set_interval($2, $3, $4)))
+ {
+ my_error(ER_PART_WRONG_VALUE, MYF(0),
+ Lex->create_last_non_select_table->table_name.str,
+ "INTERVAL");
+ MYSQL_YYABORT;
+ }
+ }
+ | LIMIT ulonglong_num
+ {
+ partition_info *part_info= Lex->part_info;
+ if (unlikely(part_info->vers_set_limit($2)))
+ {
+ my_error(ER_PART_WRONG_VALUE, MYF(0),
+ Lex->create_last_non_select_table->table_name.str,
+ "LIMIT");
+ MYSQL_YYABORT;
+ }
+ }
+ ;
+
+
+opt_versioning_interval_start:
+ /* empty */
+ {
+ $$= thd->query_start();
+ }
+ | STARTS_SYM ulong_num
+ {
+ /* only allowed from mysql_unpack_partition() */
+ if (unlikely(!Lex->part_info->table))
+ {
+ thd->parse_error(ER_SYNTAX_ERROR, $1.pos());
+ MYSQL_YYABORT;
+ }
+ $$= (ulong)$2;
+ }
+ ;
+
/*
End of partition parser part
*/
@@ -5969,7 +6132,7 @@ create_table_option:
larger values. 65535 pages, 16kb each means to sample 1GB, which
is impractical. If at some point this needs to be extended, then
we can store the higher bits from stats_sample_pages in .frm too. */
- if ($3 == 0 || $3 > 0xffff)
+ if (unlikely($3 == 0 || $3 > 0xffff))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -6074,43 +6237,70 @@ create_table_option:
}
| IDENT_sys equal TEXT_STRING_sys
{
- if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH))
my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
- new (thd->mem_root)
- engine_option_value($1, $3, true, &Lex->create_info.option_list,
- &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, true,
+ &Lex->create_info.option_list,
+ &Lex->option_list_last);
}
| IDENT_sys equal ident
{
- if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH))
my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
- new (thd->mem_root)
- engine_option_value($1, $3, false, &Lex->create_info.option_list,
- &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, false,
+ &Lex->create_info.option_list,
+ &Lex->option_list_last);
}
| IDENT_sys equal real_ulonglong_num
{
- new (thd->mem_root)
- engine_option_value($1, $3, &Lex->create_info.option_list,
- &Lex->option_list_last, thd->mem_root);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, &Lex->create_info.option_list,
+ &Lex->option_list_last, thd->mem_root);
}
| IDENT_sys equal DEFAULT
{
- new (thd->mem_root)
- engine_option_value($1, &Lex->create_info.option_list,
- &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, &Lex->create_info.option_list,
+ &Lex->option_list_last);
}
| SEQUENCE_SYM opt_equal choice
{
Lex->create_info.used_fields|= HA_CREATE_USED_SEQUENCE;
Lex->create_info.sequence= ($3 == HA_CHOICE_YES);
+ }
+ | versioning_option
+ ;
+
+opt_versioning_option:
+ /* empty */
+ | versioning_option
+ ;
+
+versioning_option:
+ WITH_SYSTEM_SYM VERSIONING_SYM
+ {
+ if (unlikely(Lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
+ {
+ if (DBUG_EVALUATE_IF("sysvers_force", 0, 1))
+ {
+ my_error(ER_VERS_TEMPORARY, MYF(0));
+ MYSQL_YYABORT;
+ }
+ }
+ else
+ {
+ Lex->alter_info.flags|= ALTER_ADD_SYSTEM_VERSIONING;
+ Lex->create_info.options|= HA_VERSIONED_TABLE;
+ }
}
;
default_charset:
opt_default charset opt_equal charset_name_or_default
{
- if (Lex->create_info.add_table_option_default_charset($4))
+ if (unlikely(Lex->create_info.add_table_option_default_charset($4)))
MYSQL_YYABORT;
}
;
@@ -6119,13 +6309,11 @@ default_collation:
opt_default COLLATE_SYM opt_equal collation_name_or_default
{
HA_CREATE_INFO *cinfo= &Lex->create_info;
- if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
- cinfo->default_table_charset && $4 &&
- !($4= merge_charset_and_collation(cinfo->default_table_charset,
- $4)))
- {
+ if (unlikely((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
+ cinfo->default_table_charset && $4 &&
+ !($4= merge_charset_and_collation(cinfo->default_table_charset,
+ $4))))
MYSQL_YYABORT;
- }
Lex->create_info.default_table_charset= $4;
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
@@ -6138,7 +6326,7 @@ storage_engines:
plugin_ref plugin= ha_resolve_by_name(thd, &$1,
thd->lex->create_info.tmp_table());
- if (plugin)
+ if (likely(plugin))
$$= plugin_hton(plugin);
else
{
@@ -6157,7 +6345,7 @@ known_storage_engines:
ident_or_text
{
plugin_ref plugin;
- if ((plugin= ha_resolve_by_name(thd, &$1, false)))
+ if (likely((plugin= ha_resolve_by_name(thd, &$1, false))))
$$= plugin_hton(plugin);
else
my_yyabort_error((ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str));
@@ -6204,6 +6392,7 @@ field_list_item:
column_def { }
| key_def
| constraint_def
+ | period_for_system_time
;
column_def:
@@ -6217,28 +6406,28 @@ key_def:
key_or_index opt_if_not_exists opt_ident opt_USING_key_algorithm
{
Lex->option_list= NULL;
- if (Lex->add_key(Key::MULTIPLE, &$3, $4, $2))
+ if (unlikely(Lex->add_key(Key::MULTIPLE, &$3, $4, $2)))
MYSQL_YYABORT;
}
'(' key_list ')' normal_key_options { }
| key_or_index opt_if_not_exists ident TYPE_SYM btree_or_rtree
{
Lex->option_list= NULL;
- if (Lex->add_key(Key::MULTIPLE, &$3, $5, $2))
+ if (unlikely(Lex->add_key(Key::MULTIPLE, &$3, $5, $2)))
MYSQL_YYABORT;
}
'(' key_list ')' normal_key_options { }
| fulltext opt_key_or_index opt_if_not_exists opt_ident
{
Lex->option_list= NULL;
- if (Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3))
+ if (unlikely(Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3)))
MYSQL_YYABORT;
}
'(' key_list ')' fulltext_key_options { }
| spatial opt_key_or_index opt_if_not_exists opt_ident
{
Lex->option_list= NULL;
- if (Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3))
+ if (unlikely(Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3)))
MYSQL_YYABORT;
}
'(' key_list ')' spatial_key_options { }
@@ -6247,7 +6436,7 @@ key_def:
opt_USING_key_algorithm
{
Lex->option_list= NULL;
- if (Lex->add_key($2, $4.str ? &$4 : &$1, $5, $3))
+ if (unlikely(Lex->add_key($2, $4.str ? &$4 : &$1, $5, $3)))
MYSQL_YYABORT;
}
'(' key_list ')' normal_key_options { }
@@ -6255,16 +6444,17 @@ key_def:
TYPE_SYM btree_or_rtree
{
Lex->option_list= NULL;
- if (Lex->add_key($2, $4.str ? &$4 : &$1, $6, $3))
+ if (unlikely(Lex->add_key($2, $4.str ? &$4 : &$1, $6, $3)))
MYSQL_YYABORT;
}
'(' key_list ')' normal_key_options { }
| opt_constraint FOREIGN KEY_SYM opt_if_not_exists opt_ident
{
- if (Lex->check_add_key($4) ||
- !(Lex->last_key= (new (thd->mem_root)
- Key(Key::MULTIPLE, $1.str ? &$1 : &$5,
- HA_KEY_ALG_UNDEF, true, $4))))
+ if (unlikely(Lex->check_add_key($4)) ||
+ unlikely(!(Lex->last_key= (new (thd->mem_root)
+ Key(Key::MULTIPLE,
+ $1.str ? &$1 : &$5,
+ HA_KEY_ALG_UNDEF, true, $4)))))
MYSQL_YYABORT;
Lex->option_list= NULL;
}
@@ -6281,7 +6471,7 @@ key_def:
lex->fk_update_opt,
lex->fk_match_option,
$4));
- if (key == NULL)
+ if (unlikely(key == NULL))
MYSQL_YYABORT;
/*
handle_if_exists_options() expectes the two keys in this order:
@@ -6303,6 +6493,15 @@ constraint_def:
}
;
+period_for_system_time:
+ // If FOR_SYM is followed by SYSTEM_TIME_SYM then they are merged to: FOR_SYSTEM_TIME_SYM .
+ PERIOD_SYM FOR_SYSTEM_TIME_SYM '(' ident ',' ident ')'
+ {
+ Vers_parse_info &info= Lex->vers_get_info();
+ info.set_system_time($4, $6);
+ }
+ ;
+
opt_check_constraint:
/* empty */ { $$= (Virtual_column_info*) 0; }
| check_constraint { $$= $1;}
@@ -6311,12 +6510,9 @@ opt_check_constraint:
check_constraint:
CHECK_SYM '(' expr ')'
{
- Virtual_column_info *v=
- add_virtual_expression(thd, $3);
- if (!v)
- {
+ Virtual_column_info *v= add_virtual_expression(thd, $3);
+ if (unlikely(!v))
MYSQL_YYABORT;
- }
$$= v;
}
;
@@ -6336,11 +6532,11 @@ field_spec:
LEX *lex=Lex;
Create_field *f= new (thd->mem_root) Create_field();
- if (check_string_char_length(&$1, 0, NAME_CHAR_LEN,
- system_charset_info, 1))
+ if (unlikely(check_string_char_length(&$1, 0, NAME_CHAR_LEN,
+ system_charset_info, 1)))
my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str));
- if (!f)
+ if (unlikely(!f))
MYSQL_YYABORT;
lex->init_last_field(f, &$1, NULL);
@@ -6353,7 +6549,7 @@ field_spec:
$$->check_constraint= $4;
- if ($$->check(thd))
+ if (unlikely($$->check(thd)))
MYSQL_YYABORT;
lex->alter_info.create_list.push_back($$, thd->mem_root);
@@ -6388,6 +6584,15 @@ opt_serial_attribute_list:
| serial_attribute
;
+opt_asrow_attribute:
+ /* empty */ {}
+ | opt_asrow_attribute_list {}
+ ;
+
+opt_asrow_attribute_list:
+ opt_asrow_attribute_list asrow_attribute {}
+ | asrow_attribute
+ ;
field_def:
opt_attribute
@@ -6397,6 +6602,16 @@ field_def:
Lex->last_field->flags&= ~NOT_NULL_FLAG; // undo automatic NOT NULL for timestamps
}
vcol_opt_specifier vcol_opt_attribute
+ | opt_generated_always AS ROW_SYM START_SYM opt_asrow_attribute
+ {
+ if (Lex->last_field_generated_always_as_row_start())
+ MYSQL_YYABORT;
+ }
+ | opt_generated_always AS ROW_SYM END opt_asrow_attribute
+ {
+ if (Lex->last_field_generated_always_as_row_end())
+ MYSQL_YYABORT;
+ }
;
opt_generated_always:
@@ -6466,7 +6681,7 @@ parse_vcol_expr:
expr
{
Virtual_column_info *v= add_virtual_expression(thd, $3);
- if (!v)
+ if (unlikely(!v))
MYSQL_YYABORT;
Lex->last_field->vcol_info= v;
}
@@ -6476,7 +6691,7 @@ parenthesized_expr:
subselect
{
$$= new (thd->mem_root) Item_singlerow_subselect(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| expr
@@ -6484,7 +6699,7 @@ parenthesized_expr:
{
$3->push_front($1, thd->mem_root);
$$= new (thd->mem_root) Item_row(thd, *$3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -6494,10 +6709,8 @@ virtual_column_func:
{
Virtual_column_info *v=
add_virtual_expression(thd, $2);
- if (!v)
- {
+ if (unlikely(!v))
MYSQL_YYABORT;
- }
$$= v;
}
;
@@ -6508,7 +6721,7 @@ column_default_expr:
virtual_column_func
| expr_or_literal
{
- if (!($$= add_virtual_expression(thd, $1)))
+ if (unlikely(!($$= add_virtual_expression(thd, $1))))
MYSQL_YYABORT;
}
;
@@ -6541,7 +6754,7 @@ field_type_numeric:
{
int err;
ulonglong tmp_length= my_strtoll10($2.length(), NULL, &err);
- if (err || tmp_length > PRECISION_FOR_DOUBLE)
+ if (unlikely(err || tmp_length > PRECISION_FOR_DOUBLE))
my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
Lex->last_field->field_name.str));
if (tmp_length > PRECISION_FOR_FLOAT)
@@ -6925,29 +7138,42 @@ attribute:
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
{
Item *item= new (thd->mem_root) Item_func_now_local(thd, $4);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
Lex->last_field->on_update= item;
}
| AUTO_INC { Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
| SERIAL_SYM DEFAULT VALUE_SYM
- {
+ {
LEX *lex=Lex;
lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_KEY_FLAG;
lex->alter_info.flags|= ALTER_ADD_INDEX;
}
| COLLATE_SYM collation_name
{
- if (Lex->charset && !my_charset_same(Lex->charset,$2))
+ if (unlikely(Lex->charset && !my_charset_same(Lex->charset,$2)))
my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$2->name,Lex->charset->csname));
Lex->last_field->charset= $2;
}
+ | COMPRESSED_SYM opt_compression_method
+ {
+ if (unlikely(Lex->last_field->set_compressed($2)))
+ MYSQL_YYABORT;
+ }
| serial_attribute
;
-serial_attribute:
- not NULL_SYM { Lex->last_field->flags|= NOT_NULL_FLAG; }
+opt_compression_method:
+ /* empty */ { $$= NULL; }
+ | equal ident { $$= $2.str; }
+ ;
+
+asrow_attribute:
+ not NULL_SYM
+ {
+ Lex->last_field->flags|= NOT_NULL_FLAG;
+ }
| opt_primary KEY_SYM
{
LEX *lex=Lex;
@@ -6955,32 +7181,59 @@ serial_attribute:
lex->alter_info.flags|= ALTER_ADD_INDEX;
}
| vcol_attribute
+ ;
+
+serial_attribute:
+ asrow_attribute
| IDENT_sys equal TEXT_STRING_sys
{
- if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH))
my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
- new (thd->mem_root)
- engine_option_value($1, $3, true, &Lex->last_field->option_list,
- &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, true,
+ &Lex->last_field->option_list,
+ &Lex->option_list_last);
}
| IDENT_sys equal ident
{
- if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH))
my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
- new (thd->mem_root)
- engine_option_value($1, $3, false, &Lex->last_field->option_list,
- &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, false,
+ &Lex->last_field->option_list,
+ &Lex->option_list_last);
}
| IDENT_sys equal real_ulonglong_num
{
- new (thd->mem_root)
- engine_option_value($1, $3, &Lex->last_field->option_list,
- &Lex->option_list_last, thd->mem_root);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, &Lex->last_field->option_list,
+ &Lex->option_list_last, thd->mem_root);
}
| IDENT_sys equal DEFAULT
{
- new (thd->mem_root)
- engine_option_value($1, &Lex->last_field->option_list, &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, &Lex->last_field->option_list,
+ &Lex->option_list_last);
+ }
+ | with_or_without_system VERSIONING_SYM
+ {
+ Lex->last_field->versioning= $1;
+ Lex->create_info.options|= HA_VERSIONED_TABLE;
+ }
+ ;
+
+with_or_without_system:
+ WITH_SYSTEM_SYM
+ {
+ Lex->alter_info.flags|= ALTER_COLUMN_UNVERSIONED;
+ Lex->create_info.vers_info.versioned_fields= true;
+ $$= Column_definition::WITH_VERSIONING;
+ }
+ | WITHOUT SYSTEM
+ {
+ Lex->alter_info.flags|= ALTER_COLUMN_UNVERSIONED;
+ Lex->create_info.vers_info.unversioned_fields= true;
+ $$= Column_definition::WITHOUT_VERSIONING;
}
;
@@ -6992,7 +7245,7 @@ type_with_opt_collate:
if ($2)
{
- if (!(Lex->charset= merge_charset_and_collation(Lex->charset, $2)))
+ if (unlikely(!(Lex->charset= merge_charset_and_collation(Lex->charset, $2))))
MYSQL_YYABORT;
}
Lex->last_field->set_attributes($1, Lex->charset);
@@ -7005,7 +7258,7 @@ sp_param_type_with_opt_collate:
$$= $1;
if ($2)
{
- if (!(Lex->charset= merge_charset_and_collation(Lex->charset, $2)))
+ if (unlikely(!(Lex->charset= merge_charset_and_collation(Lex->charset, $2))))
MYSQL_YYABORT;
}
Lex->last_field->set_attributes($1, Lex->charset);
@@ -7020,7 +7273,7 @@ charset:
charset_name:
ident_or_text
{
- if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
+ if (unlikely(!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0)))))
my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str));
}
| BINARY { $$= &my_charset_bin; }
@@ -7039,8 +7292,9 @@ opt_load_data_charset:
old_or_new_charset_name:
ident_or_text
{
- if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
- !($$=get_old_charset_by_name($1.str)))
+ if (unlikely(!($$=get_charset_by_csname($1.str,
+ MY_CS_PRIMARY,MYF(0))) &&
+ !($$=get_old_charset_by_name($1.str))))
my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str));
}
| BINARY { $$= &my_charset_bin; }
@@ -7054,7 +7308,7 @@ old_or_new_charset_name_or_default:
collation_name:
ident_or_text
{
- if (!($$= mysqld_collation_get_by_name($1.str)))
+ if (unlikely(!($$= mysqld_collation_get_by_name($1.str))))
MYSQL_YYABORT;
}
;
@@ -7079,7 +7333,7 @@ charset_or_alias:
| ASCII_SYM { $$= &my_charset_latin1; }
| UNICODE_SYM
{
- if (!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0))))
+ if (unlikely(!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0)))))
my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2"));
}
;
@@ -7100,7 +7354,7 @@ opt_bin_mod:
ws_nweights:
'(' real_ulong_num
{
- if ($2 == 0)
+ if (unlikely($2 == 0))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -7191,14 +7445,14 @@ ref_list:
ref_list ',' ident
{
Key_part_spec *key= new (thd->mem_root) Key_part_spec(&$3, 0);
- if (key == NULL)
+ if (unlikely(key == NULL))
MYSQL_YYABORT;
Lex->ref_list.push_back(key, thd->mem_root);
}
| ident
{
Key_part_spec *key= new (thd->mem_root) Key_part_spec(&$1, 0);
- if (key == NULL)
+ if (unlikely(key == NULL))
MYSQL_YYABORT;
LEX *lex= Lex;
lex->ref_list.empty();
@@ -7352,37 +7606,38 @@ key_using_alg:
all_key_opt:
KEY_BLOCK_SIZE opt_equal ulong_num
{
- Lex->create_info.used_fields|= HA_USES_BLOCK_SIZE;
- Lex->create_info.key_block_size= $3;
- }
+ Lex->last_key->key_create_info.block_size= $3;
+ Lex->last_key->key_create_info.flags|= HA_USES_BLOCK_SIZE;
+ }
| COMMENT_SYM TEXT_STRING_sys
{ Lex->last_key->key_create_info.comment= $2; }
| IDENT_sys equal TEXT_STRING_sys
{
- if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH))
my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
- new (thd->mem_root)
- engine_option_value($1, $3, true, &Lex->option_list,
- &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, true, &Lex->option_list,
+ &Lex->option_list_last);
}
| IDENT_sys equal ident
{
- if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH))
my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
- new (thd->mem_root)
- engine_option_value($1, $3, false, &Lex->option_list,
- &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, false, &Lex->option_list,
+ &Lex->option_list_last);
}
| IDENT_sys equal real_ulonglong_num
{
- new (thd->mem_root)
- engine_option_value($1, $3, &Lex->option_list,
- &Lex->option_list_last, thd->mem_root);
+ (void) new (thd->mem_root)
+ engine_option_value($1, $3, &Lex->option_list,
+ &Lex->option_list_last, thd->mem_root);
}
| IDENT_sys equal DEFAULT
{
- new (thd->mem_root)
- engine_option_value($1, &Lex->option_list, &Lex->option_list_last);
+ (void) new (thd->mem_root)
+ engine_option_value($1, &Lex->option_list,
+ &Lex->option_list_last);
}
;
@@ -7399,7 +7654,7 @@ fulltext_key_opt:
all_key_opt
| WITH PARSER_SYM IDENT_sys
{
- if (plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN))
+ if (likely(plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN)))
Lex->last_key->key_create_info.parser_name= $3;
else
my_yyabort_error((ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str));
@@ -7427,16 +7682,16 @@ key_part:
ident
{
$$= new (thd->mem_root) Key_part_spec(&$1, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| ident '(' NUM ')'
{
int key_part_len= atoi($3.str);
- if (!key_part_len)
+ if (unlikely(!key_part_len))
my_yyabort_error((ER_KEY_PART_0, MYF(0), $1.str));
$$= new (thd->mem_root) Key_part_spec(&$1, (uint) key_part_len);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -7478,21 +7733,21 @@ alter:
}
alter_options TABLE_SYM table_ident opt_lock_wait_timeout
{
- if (!Lex->select_lex.add_table_to_list(thd, $5, NULL,
- TL_OPTION_UPDATING,
- TL_READ_NO_INSERT,
- MDL_SHARED_UPGRADABLE))
+ if (unlikely(!Lex->select_lex.add_table_to_list(thd, $5, NULL,
+ TL_OPTION_UPDATING,
+ TL_READ_NO_INSERT,
+ MDL_SHARED_UPGRADABLE)))
MYSQL_YYABORT;
Lex->select_lex.db= (Lex->select_lex.table_list.first)->db;
Lex->create_last_non_select_table= Lex->last_table();
}
alter_commands
{
- if (!Lex->m_sql_cmd)
+ if (likely(!Lex->m_sql_cmd))
{
/* Create a generic ALTER TABLE statment. */
Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_table();
- if (Lex->m_sql_cmd == NULL)
+ if (unlikely(Lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
}
@@ -7506,13 +7761,14 @@ alter:
LEX *lex=Lex;
lex->sql_command=SQLCOM_ALTER_DB;
lex->name= $3;
- if (lex->name.str == NULL && lex->copy_db_to(&lex->name))
+ if (lex->name.str == NULL &&
+ unlikely(lex->copy_db_to(&lex->name)))
MYSQL_YYABORT;
}
| ALTER DATABASE ident UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM
{
LEX *lex= Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "DATABASE"));
lex->sql_command= SQLCOM_ALTER_DB_UPGRADE;
lex->name= $3;
@@ -7521,7 +7777,7 @@ alter:
{
LEX *lex= Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
lex->sp_chistics.init();
}
@@ -7536,7 +7792,7 @@ alter:
{
LEX *lex= Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
lex->sp_chistics.init();
}
@@ -7549,7 +7805,7 @@ alter:
}
| ALTER view_algorithm definer_opt opt_view_suid VIEW_SYM table_ident
{
- if (Lex->add_alter_view(thd, $2, $4, $6))
+ if (unlikely(Lex->add_alter_view(thd, $2, $4, $6)))
MYSQL_YYABORT;
}
view_list_opt AS view_select
@@ -7561,7 +7817,7 @@ alter:
with the ALTER EVENT below.
*/
{
- if (Lex->add_alter_view(thd, VIEW_ALGORITHM_INHERIT, $3, $5))
+ if (unlikely(Lex->add_alter_view(thd, VIEW_ALGORITHM_INHERIT, $3, $5)))
MYSQL_YYABORT;
}
view_list_opt AS view_select
@@ -7576,7 +7832,7 @@ alter:
Event_parse_data.
*/
- if (!(Lex->event_parse_data= Event_parse_data::new_instance(thd)))
+ if (unlikely(!(Lex->event_parse_data= Event_parse_data::new_instance(thd))))
MYSQL_YYABORT;
Lex->event_parse_data->identifier= $5;
@@ -7589,7 +7845,7 @@ alter:
opt_ev_comment
opt_ev_sql_stmt
{
- if (!($7 || $8 || $9 || $10 || $11))
+ if (unlikely(!($7 || $8 || $9 || $10 || $11)))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -7647,18 +7903,19 @@ alter:
table_ident
{
LEX *lex= Lex;
- if (!(lex->create_info.seq_create_info= new (thd->mem_root)
- sequence_definition()) ||
- !lex->select_lex.add_table_to_list(thd, $5, NULL,
- TL_OPTION_SEQUENCE,
- TL_WRITE, MDL_EXCLUSIVE))
+ if (unlikely(!(lex->create_info.seq_create_info=
+ new (thd->mem_root) sequence_definition())) ||
+ unlikely(!lex->select_lex.add_table_to_list(thd, $5, NULL,
+ TL_OPTION_SEQUENCE,
+ TL_WRITE,
+ MDL_EXCLUSIVE)))
MYSQL_YYABORT;
}
sequence_defs
{
/* Create a generic ALTER SEQUENCE statment. */
Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence($3);
- if (Lex->m_sql_cmd == NULL)
+ if (unlikely(Lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
;
@@ -7689,8 +7946,8 @@ opt_ev_sql_stmt:
;
ident_or_empty:
- /* empty */ { $$= null_clex_str; }
- | ident { $$= $1; }
+ /* empty */ { $$= Lex_ident_sys(); }
+ | ident
;
alter_commands:
@@ -7700,7 +7957,7 @@ alter_commands:
Lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_discard_import_tablespace(
Sql_cmd_discard_import_tablespace::DISCARD_TABLESPACE);
- if (Lex->m_sql_cmd == NULL)
+ if (unlikely(Lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
| IMPORT TABLESPACE
@@ -7708,7 +7965,7 @@ alter_commands:
Lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_discard_import_tablespace(
Sql_cmd_discard_import_tablespace::IMPORT_TABLESPACE);
- if (Lex->m_sql_cmd == NULL)
+ if (unlikely(Lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
| alter_list
@@ -7747,7 +8004,7 @@ alter_commands:
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_alter_table_optimize_partition();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
opt_no_write_to_binlog
@@ -7760,7 +8017,7 @@ alter_commands:
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_alter_table_analyze_partition();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
| CHECK_SYM PARTITION_SYM all_or_alt_part_name_list
@@ -7770,7 +8027,7 @@ alter_commands:
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_alter_table_check_partition();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
opt_mi_check_type
@@ -7783,7 +8040,7 @@ alter_commands:
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_alter_table_repair_partition();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
opt_mi_repair_type
@@ -7801,7 +8058,7 @@ alter_commands:
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_alter_table_truncate_partition();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
| reorg_partition_rule
@@ -7811,21 +8068,19 @@ alter_commands:
LEX *lex= thd->lex;
lex->select_lex.db= $6->db;
if (lex->select_lex.db.str == NULL &&
- lex->copy_db_to(&lex->select_lex.db))
- {
+ unlikely(lex->copy_db_to(&lex->select_lex.db)))
MYSQL_YYABORT;
- }
lex->name= $6->table;
lex->alter_info.partition_flags|= ALTER_PARTITION_EXCHANGE;
- if (!lex->select_lex.add_table_to_list(thd, $6, NULL,
- TL_OPTION_UPDATING,
- TL_READ_NO_INSERT,
- MDL_SHARED_NO_WRITE))
+ if (unlikely(!lex->select_lex.add_table_to_list(thd, $6, NULL,
+ TL_OPTION_UPDATING,
+ TL_READ_NO_INSERT,
+ MDL_SHARED_NO_WRITE)))
MYSQL_YYABORT;
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root)
Sql_cmd_alter_table_exchange_partition();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
;
@@ -7851,11 +8106,9 @@ add_partition_rule:
{
LEX *lex= Lex;
lex->part_info= new (thd->mem_root) partition_info();
- if (!lex->part_info)
- {
- mem_alloc_error(sizeof(partition_info));
+ if (unlikely(!lex->part_info))
MYSQL_YYABORT;
- }
+
lex->alter_info.partition_flags|= ALTER_PARTITION_ADD;
DBUG_ASSERT(!Lex->create_info.if_not_exists());
lex->create_info.set($3);
@@ -7883,11 +8136,9 @@ reorg_partition_rule:
{
LEX *lex= Lex;
lex->part_info= new (thd->mem_root) partition_info();
- if (!lex->part_info)
- {
- mem_alloc_error(sizeof(partition_info));
+ if (unlikely(!lex->part_info))
MYSQL_YYABORT;
- }
+
lex->no_write_to_binlog= $3;
}
reorg_parts_rule
@@ -7917,12 +8168,9 @@ alt_part_name_list:
alt_part_name_item:
ident
{
- if (Lex->alter_info.partition_names.push_back($1.str,
- thd->mem_root))
- {
- mem_alloc_error(1);
+ if (unlikely(Lex->alter_info.partition_names.push_back($1.str,
+ thd->mem_root)))
MYSQL_YYABORT;
- }
}
;
@@ -7952,6 +8200,10 @@ alter_list_item:
Lex->create_last_non_select_table= Lex->last_table();
Lex->alter_info.flags|= ALTER_ADD_INDEX;
}
+ | ADD period_for_system_time
+ {
+ Lex->alter_info.flags|= ALTER_ADD_PERIOD;
+ }
| add_column '(' create_field_list ')'
{
LEX *lex=Lex;
@@ -7989,7 +8241,7 @@ alter_list_item:
LEX *lex=Lex;
Alter_drop *ad= (new (thd->mem_root)
Alter_drop(Alter_drop::COLUMN, $4.str, $3));
- if (ad == NULL)
+ if (unlikely(ad == NULL))
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= ALTER_PARSER_DROP_COLUMN;
@@ -8000,7 +8252,7 @@ alter_list_item:
Alter_drop *ad= (new (thd->mem_root)
Alter_drop(Alter_drop::CHECK_CONSTRAINT,
$4.str, $3));
- if (ad == NULL)
+ if (unlikely(ad == NULL))
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= ALTER_DROP_CHECK_CONSTRAINT;
@@ -8010,7 +8262,7 @@ alter_list_item:
LEX *lex=Lex;
Alter_drop *ad= (new (thd->mem_root)
Alter_drop(Alter_drop::FOREIGN_KEY, $5.str, $4));
- if (ad == NULL)
+ if (unlikely(ad == NULL))
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= ALTER_DROP_FOREIGN_KEY;
@@ -8021,7 +8273,7 @@ alter_list_item:
Alter_drop *ad= (new (thd->mem_root)
Alter_drop(Alter_drop::KEY, primary_key_name,
FALSE));
- if (ad == NULL)
+ if (unlikely(ad == NULL))
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= ALTER_DROP_INDEX;
@@ -8031,7 +8283,7 @@ alter_list_item:
LEX *lex=Lex;
Alter_drop *ad= (new (thd->mem_root)
Alter_drop(Alter_drop::KEY, $4.str, $3));
- if (ad == NULL)
+ if (unlikely(ad == NULL))
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= ALTER_DROP_INDEX;
@@ -8050,12 +8302,13 @@ alter_list_item:
}
| ALTER opt_column opt_if_exists_table_element field_ident SET DEFAULT column_default_expr
{
- if (Lex->add_alter_list($4.str, $7, $3))
+ if (unlikely(Lex->add_alter_list($4.str, $7, $3)))
MYSQL_YYABORT;
}
| ALTER opt_column opt_if_exists_table_element field_ident DROP DEFAULT
{
- if (Lex->add_alter_list($4.str, (Virtual_column_info*) 0, $3))
+ if (unlikely(Lex->add_alter_list($4.str, (Virtual_column_info*) 0,
+ $3)))
MYSQL_YYABORT;
}
| RENAME opt_to table_ident
@@ -8063,12 +8316,11 @@ alter_list_item:
LEX *lex=Lex;
lex->select_lex.db= $3->db;
if (lex->select_lex.db.str == NULL &&
- lex->copy_db_to(&lex->select_lex.db))
- {
+ unlikely(lex->copy_db_to(&lex->select_lex.db)))
MYSQL_YYABORT;
- }
- if (check_table_name($3->table.str,$3->table.length, FALSE) ||
- ($3->db.str && check_db_name((LEX_STRING*) &$3->db)))
+ if (unlikely(check_table_name($3->table.str,$3->table.length,
+ FALSE)) ||
+ ($3->db.str && unlikely(check_db_name((LEX_STRING*) &$3->db))))
my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3->table.str));
lex->name= $3->table;
lex->alter_info.flags|= ALTER_RENAME;
@@ -8080,10 +8332,10 @@ alter_list_item:
$4= thd->variables.collation_database;
}
$5= $5 ? $5 : $4;
- if (!my_charset_same($4,$5))
+ if (unlikely(!my_charset_same($4,$5)))
my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$5->name, $4->csname));
- if (Lex->create_info.add_alter_list_item_convert_to_charset($5))
+ if (unlikely(Lex->create_info.add_alter_list_item_convert_to_charset($5)))
MYSQL_YYABORT;
Lex->alter_info.flags|= ALTER_OPTIONS;
}
@@ -8108,6 +8360,19 @@ alter_list_item:
}
| alter_algorithm_option
| alter_lock_option
+ | ADD SYSTEM VERSIONING_SYM
+ {
+ Lex->alter_info.flags|= ALTER_ADD_SYSTEM_VERSIONING;
+ Lex->create_info.options|= HA_VERSIONED_TABLE;
+ }
+ | DROP SYSTEM VERSIONING_SYM
+ {
+ Lex->alter_info.flags|= ALTER_DROP_SYSTEM_VERSIONING;
+ }
+ | DROP PERIOD_SYM FOR_SYSTEM_TIME_SYM
+ {
+ Lex->alter_info.flags|= ALTER_DROP_PERIOD;
+ }
;
opt_index_lock_algorithm:
@@ -8125,7 +8390,7 @@ alter_algorithm_option:
}
| ALGORITHM_SYM opt_equal ident
{
- if (Lex->alter_info.set_requested_algorithm(&$3))
+ if (unlikely(Lex->alter_info.set_requested_algorithm(&$3)))
my_yyabort_error((ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $3.str));
}
;
@@ -8138,13 +8403,13 @@ alter_lock_option:
}
| LOCK_SYM opt_equal ident
{
- if (Lex->alter_info.set_requested_lock(&$3))
+ if (unlikely(Lex->alter_info.set_requested_lock(&$3)))
my_yyabort_error((ER_UNKNOWN_ALTER_LOCK, MYF(0), $3.str));
}
;
opt_column:
- /* empty */ {}
+ /* empty */ {} %prec PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE
| COLUMN_SYM {}
;
@@ -8244,8 +8509,8 @@ start:
LEX *lex= Lex;
lex->sql_command= SQLCOM_BEGIN;
/* READ ONLY and READ WRITE are mutually exclusive. */
- if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) &&
- ($3 & MYSQL_START_TRANS_OPT_READ_ONLY))
+ if (unlikely(($3 & MYSQL_START_TRANS_OPT_READ_WRITE) &&
+ ($3 & MYSQL_START_TRANS_OPT_READ_ONLY)))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -8313,10 +8578,10 @@ slave_until:
| UNTIL_SYM slave_until_opts
{
LEX *lex=Lex;
- if (((lex->mi.log_file_name || lex->mi.pos) &&
- (lex->mi.relay_log_name || lex->mi.relay_log_pos)) ||
- !((lex->mi.log_file_name && lex->mi.pos) ||
- (lex->mi.relay_log_name && lex->mi.relay_log_pos)))
+ if (unlikely(((lex->mi.log_file_name || lex->mi.pos) &&
+ (lex->mi.relay_log_name || lex->mi.relay_log_pos)) ||
+ !((lex->mi.log_file_name && lex->mi.pos) ||
+ (lex->mi.relay_log_name && lex->mi.relay_log_pos))))
my_yyabort_error((ER_BAD_SLAVE_UNTIL_COND, MYF(0)));
}
| UNTIL_SYM MASTER_GTID_POS_SYM '=' TEXT_STRING_sys
@@ -8371,7 +8636,7 @@ repair:
LEX* lex= thd->lex;
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_repair_table();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
;
@@ -8413,7 +8678,7 @@ analyze:
LEX* lex= thd->lex;
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_analyze_table();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
;
@@ -8448,7 +8713,7 @@ persistent_column_stat_spec:
{
LEX* lex= thd->lex;
lex->column_list= new (thd->mem_root) List<LEX_STRING>;
- if (lex->column_list == NULL)
+ if (unlikely(lex->column_list == NULL))
MYSQL_YYABORT;
}
table_column_list
@@ -8461,7 +8726,7 @@ persistent_index_stat_spec:
{
LEX* lex= thd->lex;
lex->index_list= new (thd->mem_root) List<LEX_STRING>;
- if (lex->index_list == NULL)
+ if (unlikely(lex->index_list == NULL))
MYSQL_YYABORT;
}
table_index_list
@@ -8535,11 +8800,11 @@ check: CHECK_SYM
check_view_or_table
{
LEX* lex= thd->lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "CHECK"));
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_check_table();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
;
@@ -8584,7 +8849,7 @@ optimize:
LEX* lex= thd->lex;
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_optimize_table();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
;
@@ -8611,14 +8876,14 @@ rename:
rename_list:
user TO_SYM user
{
- if (Lex->users_list.push_back($1, thd->mem_root) ||
- Lex->users_list.push_back($3, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($1, thd->mem_root) ||
+ Lex->users_list.push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
| rename_list ',' user TO_SYM user
{
- if (Lex->users_list.push_back($3, thd->mem_root) ||
- Lex->users_list.push_back($5, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($3, thd->mem_root) ||
+ Lex->users_list.push_back($5, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -8633,10 +8898,12 @@ table_to_table:
{
LEX *lex=Lex;
SELECT_LEX *sl= lex->current_select;
- if (!sl->add_table_to_list(thd, $1,NULL,TL_OPTION_UPDATING,
- TL_IGNORE, MDL_EXCLUSIVE) ||
- !sl->add_table_to_list(thd, $4, NULL, TL_OPTION_UPDATING,
- TL_IGNORE, MDL_EXCLUSIVE))
+ if (unlikely(!sl->add_table_to_list(thd, $1,NULL,
+ TL_OPTION_UPDATING,
+ TL_IGNORE, MDL_EXCLUSIVE)) ||
+ unlikely(!sl->add_table_to_list(thd, $4, NULL,
+ TL_OPTION_UPDATING,
+ TL_IGNORE, MDL_EXCLUSIVE)))
MYSQL_YYABORT;
}
;
@@ -8667,9 +8934,10 @@ keycache_list:
assign_to_keycache:
table_ident cache_keys_spec
{
- if (!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ,
- MDL_SHARED_READ,
- Select->pop_index_hints()))
+ if (unlikely(!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ,
+ MDL_SHARED_READ,
+ Select->
+ pop_index_hints())))
MYSQL_YYABORT;
}
;
@@ -8677,9 +8945,10 @@ assign_to_keycache:
assign_to_keycache_parts:
table_ident adm_partition cache_keys_spec
{
- if (!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ,
- MDL_SHARED_READ,
- Select->pop_index_hints()))
+ if (unlikely(!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ,
+ MDL_SHARED_READ,
+ Select->
+ pop_index_hints())))
MYSQL_YYABORT;
}
;
@@ -8713,9 +8982,10 @@ preload_list:
preload_keys:
table_ident cache_keys_spec opt_ignore_leaves
{
- if (!Select->add_table_to_list(thd, $1, NULL, $3, TL_READ,
- MDL_SHARED_READ,
- Select->pop_index_hints()))
+ if (unlikely(!Select->add_table_to_list(thd, $1, NULL, $3, TL_READ,
+ MDL_SHARED_READ,
+ Select->
+ pop_index_hints())))
MYSQL_YYABORT;
}
;
@@ -8723,9 +8993,10 @@ preload_keys:
preload_keys_parts:
table_ident adm_partition cache_keys_spec opt_ignore_leaves
{
- if (!Select->add_table_to_list(thd, $1, NULL, $4, TL_READ,
- MDL_SHARED_READ,
- Select->pop_index_hints()))
+ if (unlikely(!Select->add_table_to_list(thd, $1, NULL, $4, TL_READ,
+ MDL_SHARED_READ,
+ Select->
+ pop_index_hints())))
MYSQL_YYABORT;
}
;
@@ -8774,6 +9045,9 @@ select:
select_init:
SELECT_SYM select_options_and_item_list select_init3
+ | table_value_constructor
+ | table_value_constructor union_list
+ | table_value_constructor union_order_or_limit
| '(' select_paren ')'
| '(' select_paren ')' union_list
| '(' select_paren ')' union_order_or_limit
@@ -8781,6 +9055,9 @@ select_init:
union_list_part2:
SELECT_SYM select_options_and_item_list select_init3_union_query_term
+ | table_value_constructor
+ | table_value_constructor union_list
+ | table_value_constructor union_order_or_limit
| '(' select_paren_union_query_term ')'
| '(' select_paren_union_query_term ')' union_list
| '(' select_paren_union_query_term ')' union_order_or_limit
@@ -8788,6 +9065,14 @@ union_list_part2:
select_paren:
{
+ Lex->current_select->set_braces(true);
+ }
+ table_value_constructor
+ {
+ DBUG_ASSERT(Lex->current_select->braces);
+ }
+ |
+ {
/*
In order to correctly parse UNION's global ORDER BY we need to
set braces before parsing the clause.
@@ -8839,6 +9124,15 @@ select_paren_derived:
{
Lex->current_select->set_braces(true);
}
+ table_value_constructor
+ {
+ DBUG_ASSERT(Lex->current_select->braces);
+ $$= Lex->current_select->master_unit()->first_select();
+ }
+ |
+ {
+ Lex->current_select->set_braces(true);
+ }
SELECT_SYM select_part2_derived
opt_table_expression
opt_order_clause
@@ -8992,11 +9286,76 @@ select_options:
/* empty*/
| select_option_list
{
- if (Select->options & SELECT_DISTINCT && Select->options & SELECT_ALL)
+ if (unlikely((Select->options & SELECT_DISTINCT) &&
+ (Select->options & SELECT_ALL)))
my_yyabort_error((ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"));
}
;
+opt_history_unit:
+ /* empty*/ %prec PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE
+ {
+ $$= VERS_UNDEFINED;
+ }
+ | TRANSACTION_SYM
+ {
+ $$= VERS_TRX_ID;
+ }
+ | TIMESTAMP
+ {
+ $$= VERS_TIMESTAMP;
+ }
+ ;
+
+history_point:
+ TIMESTAMP TEXT_STRING
+ {
+ Item *item;
+ if (!(item= create_temporal_literal(thd, $2.str, $2.length, YYCSCL,
+ MYSQL_TYPE_DATETIME, true)))
+ MYSQL_YYABORT;
+ $$= Vers_history_point(VERS_TIMESTAMP, item);
+ }
+ | function_call_keyword_timestamp
+ {
+ $$= Vers_history_point(VERS_TIMESTAMP, $1);
+ }
+ | opt_history_unit bit_expr
+ {
+ $$= Vers_history_point($1, $2);
+ }
+ ;
+
+opt_for_system_time_clause:
+ /* empty */
+ {
+ $$= false;
+ }
+ | FOR_SYSTEM_TIME_SYM system_time_expr
+ {
+ $$= true;
+ }
+ ;
+
+system_time_expr:
+ AS OF_SYM history_point
+ {
+ Lex->vers_conditions.init(SYSTEM_TIME_AS_OF, $3);
+ }
+ | ALL
+ {
+ Lex->vers_conditions.init(SYSTEM_TIME_ALL);
+ }
+ | FROM history_point TO_SYM history_point
+ {
+ Lex->vers_conditions.init(SYSTEM_TIME_FROM_TO, $2, $4);
+ }
+ | BETWEEN_SYM history_point AND_SYM history_point
+ {
+ Lex->vers_conditions.init(SYSTEM_TIME_BETWEEN, $2, $4);
+ }
+ ;
+
select_option_list:
select_option_list select_option
| select_option
@@ -9010,11 +9369,11 @@ select_option:
Allow this flag only on the first top-level SELECT statement, if
SQL_CACHE wasn't specified, and only once per query.
*/
- if (Lex->current_select != &Lex->select_lex)
+ if (unlikely(Lex->current_select != &Lex->select_lex))
my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_NO_CACHE"));
- if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
+ if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE))
my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_CACHE", "SQL_NO_CACHE"));
- if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
+ if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_NO_CACHE"));
Lex->safe_to_cache_query=0;
@@ -9027,11 +9386,11 @@ select_option:
Allow this flag only on the first top-level SELECT statement, if
SQL_NO_CACHE wasn't specified, and only once per query.
*/
- if (Lex->current_select != &Lex->select_lex)
+ if (unlikely(Lex->current_select != &Lex->select_lex))
my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_CACHE"));
- if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
+ if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE))
my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_NO_CACHE", "SQL_CACHE"));
- if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
+ if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_CACHE"));
Lex->safe_to_cache_query=1;
@@ -9067,30 +9426,30 @@ select_item_list:
Item *item= new (thd->mem_root)
Item_field(thd, &thd->lex->current_select->context,
NULL, NULL, &star_clex_str);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
- if (add_item_to_list(thd, item))
+ if (unlikely(add_item_to_list(thd, item)))
MYSQL_YYABORT;
(thd->lex->current_select->with_wild)++;
}
;
select_item:
- remember_name table_wild remember_end
+ remember_name select_sublist_qualified_asterisk remember_end
{
- if (add_item_to_list(thd, $2))
+ if (unlikely(add_item_to_list(thd, $2)))
MYSQL_YYABORT;
}
| remember_name expr remember_end select_alias
{
DBUG_ASSERT($1 < $3);
- if (add_item_to_list(thd, $2))
+ if (unlikely(add_item_to_list(thd, $2)))
MYSQL_YYABORT;
if ($4.str)
{
- if (Lex->sql_command == SQLCOM_CREATE_VIEW &&
- check_column_name($4.str))
+ if (unlikely(Lex->sql_command == SQLCOM_CREATE_VIEW &&
+ check_column_name($4.str)))
my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), $4.str));
$2->is_autogenerated_name= FALSE;
$2->set_name(thd, $4.str, $4.length, system_charset_info);
@@ -9210,7 +9569,7 @@ expr:
{
/* X OR Y */
$$= new (thd->mem_root) Item_cond_or(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
}
@@ -9218,7 +9577,7 @@ expr:
{
/* XOR is a proprietary extension */
$$= new (thd->mem_root) Item_func_xor(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| expr and expr %prec AND_SYM
@@ -9260,84 +9619,84 @@ expr:
{
/* X AND Y */
$$= new (thd->mem_root) Item_cond_and(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
}
| NOT_SYM expr %prec NOT_SYM
{
$$= negate_expression(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri IS TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_istrue(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri IS not TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnottrue(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri IS FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isfalse(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri IS not FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotfalse(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri IS UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri IS not UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | bool_pri
+ | bool_pri %prec PREC_BELOW_NOT
;
bool_pri:
bool_pri IS NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri IS not NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
{
$$= new (thd->mem_root) Item_func_equal(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri comp_op predicate %prec '='
{
$$= (*$2)(0)->create(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bool_pri comp_op all_or_any '(' subselect ')' %prec '='
{
$$= all_any_subquery_creator(thd, $1, $2, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| predicate
@@ -9347,22 +9706,22 @@ predicate:
bit_expr IN_SYM '(' subselect ')'
{
$$= new (thd->mem_root) Item_in_subselect(thd, $1, $4);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr not IN_SYM '(' subselect ')'
{
Item *item= new (thd->mem_root) Item_in_subselect(thd, $1, $5);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= negate_expression(thd, item);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr IN_SYM '(' expr ')'
{
$$= handle_sql2003_note184_exception(thd, $1, true, $4);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr IN_SYM '(' expr ',' expr_list ')'
@@ -9370,13 +9729,13 @@ predicate:
$6->push_front($4, thd->mem_root);
$6->push_front($1, thd->mem_root);
$$= new (thd->mem_root) Item_func_in(thd, *$6);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr not IN_SYM '(' expr ')'
{
$$= handle_sql2003_note184_exception(thd, $1, false, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr not IN_SYM '(' expr ',' expr_list ')'
@@ -9384,21 +9743,21 @@ predicate:
$7->push_front($5, thd->mem_root);
$7->push_front($1, thd->mem_root);
Item_func_in *item= new (thd->mem_root) Item_func_in(thd, *$7);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= item->neg_transformer(thd);
}
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
{
$$= new (thd->mem_root) Item_func_between(thd, $1, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
{
Item_func_between *item;
item= new (thd->mem_root) Item_func_between(thd, $1, $4, $6);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= item->neg_transformer(thd);
}
@@ -9406,125 +9765,151 @@ predicate:
{
Item *item1= new (thd->mem_root) Item_func_soundex(thd, $1);
Item *item4= new (thd->mem_root) Item_func_soundex(thd, $4);
- if ((item1 == NULL) || (item4 == NULL))
+ if (unlikely(item1 == NULL) || unlikely(item4 == NULL))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_func_eq(thd, item1, item4);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | bit_expr LIKE simple_expr opt_escape
+ | bit_expr LIKE mysql_concatenation_expr opt_escape
{
$$= new (thd->mem_root) Item_func_like(thd, $1, $3, $4,
Lex->escape_used);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | bit_expr not LIKE simple_expr opt_escape
+ | bit_expr not LIKE mysql_concatenation_expr opt_escape
{
Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, $5,
Lex->escape_used);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= item->neg_transformer(thd);
}
| bit_expr REGEXP bit_expr
{
$$= new (thd->mem_root) Item_func_regex(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr not REGEXP bit_expr
{
Item *item= new (thd->mem_root) Item_func_regex(thd, $1, $4);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= negate_expression(thd, item);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | bit_expr
+ | bit_expr %prec PREC_BELOW_NOT
;
bit_expr:
bit_expr '|' bit_expr %prec '|'
{
$$= new (thd->mem_root) Item_func_bit_or(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '&' bit_expr %prec '&'
{
$$= new (thd->mem_root) Item_func_bit_and(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
{
$$= new (thd->mem_root) Item_func_shift_left(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
{
$$= new (thd->mem_root) Item_func_shift_right(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | bit_expr ORACLE_CONCAT_SYM bit_expr
+ {
+ $$= new (thd->mem_root) Item_func_concat_operator_oracle(thd,
+ $1, $3);
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '+' bit_expr %prec '+'
{
$$= new (thd->mem_root) Item_func_plus(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '-' bit_expr %prec '-'
{
$$= new (thd->mem_root) Item_func_minus(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '+' INTERVAL_SYM expr interval %prec '+'
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $1, $4, $5, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '-' INTERVAL_SYM expr interval %prec '-'
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $1, $4, $5, 1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | INTERVAL_SYM expr interval '+' expr
+ /* we cannot put interval before - */
+ {
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $5, $2, $3, 0);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | '+' INTERVAL_SYM expr interval '+' expr %prec NEG
+ {
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $6, $3, $4, 0);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | '-' INTERVAL_SYM expr interval '+' expr %prec NEG
+ {
+ $$= new (thd->mem_root) Item_date_add_interval(thd, $6, $3, $4, 1);
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '*' bit_expr %prec '*'
{
$$= new (thd->mem_root) Item_func_mul(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '/' bit_expr %prec '/'
{
$$= new (thd->mem_root) Item_func_div(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr DIV_SYM bit_expr %prec DIV_SYM
{
$$= new (thd->mem_root) Item_func_int_div(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr MOD_SYM bit_expr %prec MOD_SYM
{
$$= new (thd->mem_root) Item_func_mod(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| bit_expr '^' bit_expr
{
$$= new (thd->mem_root) Item_func_bit_xor(thd, $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | simple_expr
+ | mysql_concatenation_expr %prec '^'
;
or:
@@ -9611,7 +9996,7 @@ dyncall_create_element:
LEX *lex= Lex;
$$= (DYNCALL_CREATE_DEF *)
alloc_root(thd->mem_root, sizeof(DYNCALL_CREATE_DEF));
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
$$->key= $1;
$$->value= $3;
@@ -9631,7 +10016,7 @@ dyncall_create_list:
dyncall_create_element
{
$$= new (thd->mem_root) List<DYNCALL_CREATE_DEF>;
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
$$->push_back($1, thd->mem_root);
}
@@ -9647,8 +10032,8 @@ sp_cursor_name_and_offset:
{
LEX *lex= Lex;
$$.name= $1;
- if (!lex->spcont ||
- !lex->spcont->find_cursor(&$1, &$$.offset, false))
+ if (unlikely(!lex->spcont ||
+ !lex->spcont->find_cursor(&$1, &$$.offset, false)))
my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $1.str));
}
;
@@ -9656,26 +10041,26 @@ sp_cursor_name_and_offset:
explicit_cursor_attr:
sp_cursor_name_and_offset '%' ISOPEN_SYM
{
- if (!($$= new (thd->mem_root)
- Item_func_cursor_isopen(thd, &$1.name, $1.offset)))
+ if (unlikely(!($$= new (thd->mem_root)
+ Item_func_cursor_isopen(thd, &$1.name, $1.offset))))
MYSQL_YYABORT;
}
| sp_cursor_name_and_offset '%' FOUND_SYM
{
- if (!($$= new (thd->mem_root)
- Item_func_cursor_found(thd, &$1.name, $1.offset)))
+ if (unlikely(!($$= new (thd->mem_root)
+ Item_func_cursor_found(thd, &$1.name, $1.offset))))
MYSQL_YYABORT;
}
| sp_cursor_name_and_offset '%' NOTFOUND_SYM
{
- if (!($$= new (thd->mem_root)
- Item_func_cursor_notfound(thd, &$1.name, $1.offset)))
+ if (unlikely(!($$= new (thd->mem_root)
+ Item_func_cursor_notfound(thd, &$1.name, $1.offset))))
MYSQL_YYABORT;
}
| sp_cursor_name_and_offset '%' ROWCOUNT_SYM
{
- if (!($$= new (thd->mem_root)
- Item_func_cursor_rowcount(thd, &$1.name, $1.offset)))
+ if (unlikely(!($$= new (thd->mem_root)
+ Item_func_cursor_rowcount(thd, &$1.name, $1.offset))))
MYSQL_YYABORT;
}
;
@@ -9735,18 +10120,18 @@ column_default_non_parenthesized_expr:
{
$5->push_front($3, thd->mem_root);
$$= new (thd->mem_root) Item_row(thd, *$5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| EXISTS '(' subselect ')'
{
$$= new (thd->mem_root) Item_exists_subselect(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| '{' ident expr '}'
{
- if (!($$= $3->make_odbc_literal(thd, &$2)))
+ if (unlikely(!($$= $3->make_odbc_literal(thd, &$2))))
MYSQL_YYABORT;
}
| MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
@@ -9754,64 +10139,64 @@ column_default_non_parenthesized_expr:
$2->push_front($5, thd->mem_root);
Item_func_match *i1= new (thd->mem_root) Item_func_match(thd, *$2,
$6);
- if (i1 == NULL)
+ if (unlikely(i1 == NULL))
MYSQL_YYABORT;
Select->add_ftfunc_to_list(thd, i1);
$$= i1;
}
| CAST_SYM '(' expr AS cast_type ')'
{
- if (!($$= $5.create_typecast_item(thd, $3, Lex->charset)))
+ if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset))))
MYSQL_YYABORT;
}
| CASE_SYM when_list_opt_else END
{
- if (!($$= new(thd->mem_root) Item_func_case_searched(thd, *$2)))
+ if (unlikely(!($$= new(thd->mem_root) Item_func_case_searched(thd, *$2))))
MYSQL_YYABORT;
}
| CASE_SYM expr when_list_opt_else END
{
$3->push_front($2, thd->mem_root);
- if (!($$= new (thd->mem_root) Item_func_case_simple(thd, *$3)))
+ if (unlikely(!($$= new (thd->mem_root) Item_func_case_simple(thd, *$3))))
MYSQL_YYABORT;
}
| CONVERT_SYM '(' expr ',' cast_type ')'
{
- if (!($$= $5.create_typecast_item(thd, $3, Lex->charset)))
+ if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset))))
MYSQL_YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
{
$$= new (thd->mem_root) Item_func_conv_charset(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DATE_FORMAT_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_date_format(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DATE_FORMAT_SYM '(' expr ',' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_date_format(thd, $3, $5, $7);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DECODE_SYM '(' expr ',' decode_when_list ')'
{
$5->push_front($3, thd->mem_root);
- if (!($$= new (thd->mem_root) Item_func_decode_oracle(thd, *$5)))
+ if (unlikely(!($$= new (thd->mem_root) Item_func_decode_oracle(thd, *$5))))
MYSQL_YYABORT;
}
| DEFAULT '(' simple_ident ')'
{
Item_splocal *il= $3->get_item_splocal();
- if (il)
+ if (unlikely(il))
my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str));
$$= new (thd->mem_root) Item_default_value(thd, Lex->current_context(),
$3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->default_used= TRUE;
}
@@ -9819,66 +10204,67 @@ column_default_non_parenthesized_expr:
{
$$= new (thd->mem_root) Item_insert_value(thd, Lex->current_context(),
$3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| NEXT_SYM VALUE_SYM FOR_SYM table_ident
{
- if (!($$= Lex->create_item_func_nextval(thd, $4)))
+ if (unlikely(!($$= Lex->create_item_func_nextval(thd, $4))))
MYSQL_YYABORT;
}
| NEXTVAL_SYM '(' table_ident ')'
{
- if (!($$= Lex->create_item_func_nextval(thd, $3)))
+ if (unlikely(!($$= Lex->create_item_func_nextval(thd, $3))))
MYSQL_YYABORT;
}
| PREVIOUS_SYM VALUE_SYM FOR_SYM table_ident
{
- if (!($$= Lex->create_item_func_lastval(thd, $4)))
+ if (unlikely(!($$= Lex->create_item_func_lastval(thd, $4))))
MYSQL_YYABORT;
}
| LASTVAL_SYM '(' table_ident ')'
{
- if (!($$= Lex->create_item_func_lastval(thd, $3)))
+ if (unlikely(!($$= Lex->create_item_func_lastval(thd, $3))))
MYSQL_YYABORT;
}
| SETVAL_SYM '(' table_ident ',' longlong_num ')'
{
- if (!($$= Lex->create_item_func_setval(thd, $3, $5, 0, 1)))
+ if (unlikely(!($$= Lex->create_item_func_setval(thd, $3, $5, 0, 1))))
MYSQL_YYABORT;
}
| SETVAL_SYM '(' table_ident ',' longlong_num ',' bool ')'
{
- if (!($$= Lex->create_item_func_setval(thd, $3, $5, 0, $7)))
+ if (unlikely(!($$= Lex->create_item_func_setval(thd, $3, $5, 0, $7))))
MYSQL_YYABORT;
}
| SETVAL_SYM '(' table_ident ',' longlong_num ',' bool ',' ulonglong_num ')'
{
- if (!($$= Lex->create_item_func_setval(thd, $3, $5, $9, $7)))
+ if (unlikely(!($$= Lex->create_item_func_setval(thd, $3, $5, $9, $7))))
MYSQL_YYABORT;
}
;
-simple_expr:
+primary_expr:
column_default_non_parenthesized_expr
| explicit_cursor_attr
- | simple_expr COLLATE_SYM collation_name %prec NEG
- {
- if (!($$= new (thd->mem_root) Item_func_set_collation(thd, $1, $3)))
- MYSQL_YYABORT;
- }
| '(' parenthesized_expr ')' { $$= $2; }
- | BINARY simple_expr %prec NEG
+ ;
+
+string_factor_expr:
+ primary_expr
+ | string_factor_expr COLLATE_SYM collation_name
{
- Type_cast_attributes at(&my_charset_bin);
- if (!($$= type_handler_long_blob.create_typecast_item(thd, $2, at)))
+ if (unlikely(!($$= new (thd->mem_root) Item_func_set_collation(thd, $1, $3))))
MYSQL_YYABORT;
}
- | simple_expr OR_OR_SYM simple_expr
+ ;
+
+simple_expr:
+ string_factor_expr %prec NEG
+ | BINARY simple_expr
{
- $$= new (thd->mem_root) Item_func_concat_operator_oracle(thd,
- $1, $3);
- if ($$ == NULL)
+ Type_cast_attributes at(&my_charset_bin);
+ if (unlikely(!($$= type_handler_long_blob.create_typecast_item(thd, $2, at))))
MYSQL_YYABORT;
}
| '+' simple_expr %prec NEG
@@ -9888,30 +10274,48 @@ simple_expr:
| '-' simple_expr %prec NEG
{
$$= $2->neg(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| '~' simple_expr %prec NEG
{
$$= new (thd->mem_root) Item_func_bit_neg(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| not2 simple_expr %prec NEG
{
$$= negate_expression(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
- /* we cannot put interval before - */
+ ;
+
+mysql_concatenation_expr:
+ simple_expr
+ | mysql_concatenation_expr MYSQL_CONCAT_SYM simple_expr
{
- $$= new (thd->mem_root) Item_date_add_interval(thd, $5, $2, $3, 0);
- if ($$ == NULL)
+ $$= new (thd->mem_root) Item_func_concat(thd, $1, $3);
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
+function_call_keyword_timestamp:
+ TIMESTAMP '(' expr ')'
+ {
+ $$= new (thd->mem_root) Item_datetime_typecast(thd, $3,
+ AUTO_SEC_PART_DIGITS);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ | TIMESTAMP '(' expr ',' expr ')'
+ {
+ $$= new (thd->mem_root) Item_func_add_time(thd, $3, $5, 1, 0);
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ }
+ ;
/*
Function call syntax using official SQL 2003 keywords.
Because the function name is an official token,
@@ -9922,20 +10326,20 @@ function_call_keyword:
CHAR_SYM '(' expr_list ')'
{
$$= new (thd->mem_root) Item_func_char(thd, *$3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| CHAR_SYM '(' expr_list USING charset_name ')'
{
$$= new (thd->mem_root) Item_func_char(thd, *$3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| CURRENT_USER optional_braces
{
$$= new (thd->mem_root) Item_func_current_user(thd,
Lex->current_context());
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
Lex->safe_to_cache_query= 0;
@@ -9944,7 +10348,7 @@ function_call_keyword:
{
$$= new (thd->mem_root) Item_func_current_role(thd,
Lex->current_context());
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
Lex->safe_to_cache_query= 0;
@@ -9952,86 +10356,87 @@ function_call_keyword:
| DATE_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_date_typecast(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DAY_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_dayofmonth(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| HOUR_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_hour(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| INSERT '(' expr ',' expr ',' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_insert(thd, $3, $5, $7, $9);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
+ | INTERVAL_SYM '(' expr ',' expr ')'
{
List<Item> *list= new (thd->mem_root) List<Item>;
- if (list == NULL)
+ if (unlikely(list == NULL))
+ MYSQL_YYABORT;
+ if (unlikely(list->push_front($5, thd->mem_root)) ||
+ unlikely(list->push_front($3, thd->mem_root)))
MYSQL_YYABORT;
- list->push_front($5, thd->mem_root);
- list->push_front($3, thd->mem_root);
Item_row *item= new (thd->mem_root) Item_row(thd, *list);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_func_interval(thd, item);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
+ | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')'
{
$7->push_front($5, thd->mem_root);
$7->push_front($3, thd->mem_root);
Item_row *item= new (thd->mem_root) Item_row(thd, *$7);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_func_interval(thd, item);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| LEFT '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_left(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| MINUTE_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_minute(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| MONTH_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_month(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| RIGHT '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_right(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SECOND_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_second(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SQL_SYM '%' ROWCOUNT_SYM
{
$$= new (thd->mem_root) Item_func_oracle_sql_rowcount(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
Lex->safe_to_cache_query= 0;
@@ -10040,31 +10445,22 @@ function_call_keyword:
{
$$= new (thd->mem_root) Item_time_typecast(thd, $3,
AUTO_SEC_PART_DIGITS);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TIMESTAMP '(' expr ')'
- {
- $$= new (thd->mem_root) Item_datetime_typecast(thd, $3,
- AUTO_SEC_PART_DIGITS);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | TIMESTAMP '(' expr ',' expr ')'
+ | function_call_keyword_timestamp
{
- $$= new (thd->mem_root) Item_func_add_time(thd, $3, $5, 1, 0);
- if ($$ == NULL)
- MYSQL_YYABORT;
+ $$= $1;
}
| TRIM '(' trim_operands ')'
{
- if (!($$= $3.make_item_func_trim(thd)))
+ if (unlikely(!($$= $3.make_item_func_trim(thd))))
MYSQL_YYABORT;
}
| USER_SYM '(' ')'
{
$$= new (thd->mem_root) Item_func_user(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
Lex->safe_to_cache_query=0;
@@ -10072,7 +10468,7 @@ function_call_keyword:
| YEAR_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_year(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -10094,99 +10490,97 @@ function_call_nonkeyword:
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $5,
INTERVAL_DAY, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| CURDATE optional_braces
{
$$= new (thd->mem_root) Item_func_curdate_local(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| CURTIME opt_time_precision
{
$$= new (thd->mem_root) Item_func_curtime_local(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
- %prec INTERVAL_SYM
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
- %prec INTERVAL_SYM
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| EXTRACT_SYM '(' interval FROM expr ')'
{
$$=new (thd->mem_root) Item_extract(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| GET_FORMAT '(' date_time_type ',' expr ')'
{
$$= new (thd->mem_root) Item_func_get_format(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| NOW_SYM opt_time_precision
{
$$= new (thd->mem_root) Item_func_now_local(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| POSITION_SYM '(' bit_expr IN_SYM expr ')'
{
$$= new (thd->mem_root) Item_func_locate(thd, $5, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SUBDATE_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $5,
INTERVAL_DAY, 1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SUBSTRING '(' expr ',' expr ',' expr ')'
{
- if (!($$= Lex->make_item_func_substr(thd, $3, $5, $7)))
+ if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7))))
MYSQL_YYABORT;
}
| SUBSTRING '(' expr ',' expr ')'
{
- if (!($$= Lex->make_item_func_substr(thd, $3, $5)))
+ if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5))))
MYSQL_YYABORT;
}
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
{
- if (!($$= Lex->make_item_func_substr(thd, $3, $5, $7)))
+ if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7))))
MYSQL_YYABORT;
}
| SUBSTRING '(' expr FROM expr ')'
{
- if (!($$= Lex->make_item_func_substr(thd, $3, $5)))
+ if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5))))
MYSQL_YYABORT;
}
| SYSDATE opt_time_precision
@@ -10203,45 +10597,45 @@ function_call_nonkeyword:
$$= new (thd->mem_root) Item_func_sysdate_local(thd, $2);
else
$$= new (thd->mem_root) Item_func_now_local(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $7, $5, $3, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_timestamp_diff(thd, $5, $7, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| TRIM_ORACLE '(' trim_operands ')'
{
- if (!($$= $3.make_item_func_trim_oracle(thd)))
+ if (unlikely(!($$= $3.make_item_func_trim_oracle(thd))))
MYSQL_YYABORT;
}
| UTC_DATE_SYM optional_braces
{
$$= new (thd->mem_root) Item_func_curdate_utc(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| UTC_TIME_SYM opt_time_precision
{
$$= new (thd->mem_root) Item_func_curtime_utc(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| UTC_TIMESTAMP_SYM opt_time_precision
{
$$= new (thd->mem_root) Item_func_now_utc(thd, $2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
@@ -10249,28 +10643,28 @@ function_call_nonkeyword:
COLUMN_ADD_SYM '(' expr ',' dyncall_create_list ')'
{
$$= create_func_dyncol_add(thd, $3, *$5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
COLUMN_DELETE_SYM '(' expr ',' expr_list ')'
{
$$= create_func_dyncol_delete(thd, $3, *$5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
COLUMN_CHECK_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_dyncol_check(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
COLUMN_CREATE_SYM '(' dyncall_create_list ')'
{
$$= create_func_dyncol_create(thd, *$3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
@@ -10280,7 +10674,7 @@ function_call_nonkeyword:
$$= create_func_dyncol_get(thd, $3, $5, $7.type_handler(),
$7.length(), $7.dec(),
lex->charset);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -10294,50 +10688,50 @@ function_call_conflict:
ASCII_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_ascii(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| CHARSET '(' expr ')'
{
$$= new (thd->mem_root) Item_func_charset(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| COALESCE '(' expr_list ')'
{
$$= new (thd->mem_root) Item_func_coalesce(thd, *$3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| COLLATION_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_collation(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DATABASE '(' ')'
{
$$= new (thd->mem_root) Item_func_database(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->safe_to_cache_query=0;
}
| IF_SYM '(' expr ',' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_if(thd, $3, $5, $7);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| FORMAT_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_format(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| FORMAT_SYM '(' expr ',' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_format(thd, $3, $5, $7);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
/* LAST_VALUE here conflicts with the definition for window functions.
@@ -10346,75 +10740,75 @@ function_call_conflict:
| LAST_VALUE '(' expr ')'
{
List<Item> *list= new (thd->mem_root) List<Item>;
- if (list == NULL)
+ if (unlikely(list == NULL))
MYSQL_YYABORT;
list->push_back($3, thd->mem_root);
$$= new (thd->mem_root) Item_func_last_value(thd, *list);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| LAST_VALUE '(' expr_list ',' expr ')'
{
$3->push_back($5, thd->mem_root);
$$= new (thd->mem_root) Item_func_last_value(thd, *$3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| MICROSECOND_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_microsecond(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| MOD_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_mod(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| OLD_PASSWORD_SYM '(' expr ')'
{
$$= new (thd->mem_root)
Item_func_password(thd, $3, Item_func_password::OLD);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| PASSWORD_SYM '(' expr ')'
{
Item* i1;
i1= new (thd->mem_root) Item_func_password(thd, $3);
- if (i1 == NULL)
+ if (unlikely(i1 == NULL))
MYSQL_YYABORT;
$$= i1;
}
| QUARTER_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_quarter(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| REPEAT_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_repeat(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| REPLACE '(' expr ',' expr ',' expr ')'
{
- if (!($$= Lex->make_item_func_replace(thd, $3, $5, $7)))
+ if (unlikely(!($$= Lex->make_item_func_replace(thd, $3, $5, $7))))
MYSQL_YYABORT;
}
| REVERSE_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_reverse(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| ROW_COUNT_SYM '(' ')'
{
$$= new (thd->mem_root) Item_func_row_count(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
Lex->safe_to_cache_query= 0;
@@ -10422,25 +10816,25 @@ function_call_conflict:
| TRUNCATE_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_round(thd, $3, $5, 1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| WEEK_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_func_week(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| WEEK_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_week(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr opt_ws_levels ')'
{
$$= new (thd->mem_root) Item_func_weight_string(thd, $3, 0, 0, $4);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')'
@@ -10448,26 +10842,26 @@ function_call_conflict:
$$= new (thd->mem_root)
Item_func_weight_string(thd, $3, 0, $6,
$7 | MY_STRXFRM_PAD_WITH_SPACE);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')'
{
Item *item= new (thd->mem_root) Item_char_typecast(thd, $3, $6,
&my_charset_bin);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= new (thd->mem_root)
Item_func_weight_string(thd, item, 0, $6,
MY_STRXFRM_PAD_WITH_SPACE);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| WEIGHT_STRING_SYM '(' expr ',' ulong_num ',' ulong_num ',' ulong_num ')'
{
$$= new (thd->mem_root) Item_func_weight_string(thd, $3, $5, $7,
$9);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| geometry_function
@@ -10475,7 +10869,7 @@ function_call_conflict:
#ifdef HAVE_SPATIAL
$$= $1;
/* $1 may be NULL, GEOM_NEW not tested for out of memory */
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
#else
my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
@@ -10537,6 +10931,11 @@ geometry_function:
Geometry::wkb_polygon,
Geometry::wkb_linestring));
}
+ | WITHIN '(' expr ',' expr ')'
+ {
+ $$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5,
+ Item_func::SP_WITHIN_FUNC));
+ }
;
/*
@@ -10558,7 +10957,7 @@ function_call_generic:
(udf= find_udf($1.str, $1.length)) &&
udf->type == UDFTYPE_AGGREGATE)
{
- if (lex->current_select->inc_in_sum_expr())
+ if (unlikely(lex->current_select->inc_in_sum_expr()))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -10573,10 +10972,8 @@ function_call_generic:
Create_func *builder;
Item *item= NULL;
- if (check_routine_name(&$1))
- {
+ if (unlikely(check_routine_name(&$1)))
MYSQL_YYABORT;
- }
/*
Implementation note:
@@ -10616,45 +11013,13 @@ function_call_generic:
}
}
- if (! ($$= item))
- {
+ if (unlikely(! ($$= item)))
MYSQL_YYABORT;
- }
}
- | ident '.' ident '(' opt_expr_list ')'
+ | ident_cli '.' ident_cli '(' opt_expr_list ')'
{
- Create_qfunc *builder;
- Item *item= NULL;
-
- /*
- The following in practice calls:
- <code>Create_sp_func::create()</code>
- and builds a stored function.
-
- However, it's important to maintain the interface between the
- parser and the implementation in item_create.cc clean,
- since this will change with WL#2128 (SQL PATH):
- - INFORMATION_SCHEMA.version() is the SQL 99 syntax for the native
- function version(),
- - MySQL.version() is the SQL 2003 syntax for the native function
- version() (a vendor can specify any schema).
- */
-
- if (!$1.str || check_db_name((LEX_STRING*) &$1))
- my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
- if (check_routine_name(&$3))
- {
+ if (unlikely(!($$= Lex->make_item_func_call_generic(thd, &$1, &$3, $5))))
MYSQL_YYABORT;
- }
-
- builder= find_qualified_function_builder(thd);
- DBUG_ASSERT(builder);
- item= builder->create_with_db(thd, &$1, &$3, true, $5);
-
- if (! ($$= item))
- {
- MYSQL_YYABORT;
- }
}
;
@@ -10684,7 +11049,7 @@ udf_expr_list:
udf_expr
{
$$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
$$->push_back($1, thd->mem_root);
}
@@ -10726,46 +11091,46 @@ sum_expr:
AVG_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_avg(thd, $3, FALSE);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| AVG_SYM '(' DISTINCT in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_avg(thd, $4, TRUE);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| BIT_AND '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_and(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| BIT_OR '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_or(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| BIT_XOR '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_xor(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| COUNT_SYM '(' opt_all '*' ')'
{
Item *item= new (thd->mem_root) Item_int(thd, (int32) 0L, 1);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_sum_count(thd, item);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| COUNT_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_count(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| COUNT_SYM '(' DISTINCT
@@ -10775,13 +11140,13 @@ sum_expr:
')'
{
$$= new (thd->mem_root) Item_sum_count(thd, *$5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| MIN_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_min(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
/*
@@ -10792,55 +11157,55 @@ sum_expr:
| MIN_SYM '(' DISTINCT in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_min(thd, $4);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| MAX_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_max(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| MAX_SYM '(' DISTINCT in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_max(thd, $4);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| STD_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_std(thd, $3, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| VARIANCE_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_variance(thd, $3, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| STDDEV_SAMP_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_std(thd, $3, 1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| VAR_SAMP_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_variance(thd, $3, 1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SUM_SYM '(' in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_sum(thd, $3, FALSE);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SUM_SYM '(' DISTINCT in_sum_expr ')'
{
$$= new (thd->mem_root) Item_sum_sum(thd, $4, TRUE);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| GROUP_CONCAT_SYM '(' opt_distinct
@@ -10857,7 +11222,7 @@ sum_expr:
sel->gorder_list, $7, $8,
sel->select_limit,
sel->offset_limit);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
sel->select_limit= NULL;
sel->offset_limit= NULL;
@@ -10871,25 +11236,25 @@ window_func_expr:
window_func OVER_SYM window_name
{
$$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
- if (Select->add_window_func((Item_window_func *) $$))
+ if (unlikely(Select->add_window_func((Item_window_func *) $$)))
MYSQL_YYABORT;
}
|
window_func OVER_SYM window_spec
{
LEX *lex= Lex;
- if (Select->add_window_spec(thd, lex->win_ref,
- Select->group_list,
- Select->order_list,
- lex->win_frame))
+ if (unlikely(Select->add_window_spec(thd, lex->win_ref,
+ Select->group_list,
+ Select->order_list,
+ lex->win_frame)))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1,
thd->lex->win_spec);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
- if (Select->add_window_func((Item_window_func *) $$))
+ if (unlikely(Select->add_window_func((Item_window_func *) $$)))
MYSQL_YYABORT;
}
;
@@ -10907,63 +11272,63 @@ simple_window_func:
ROW_NUMBER_SYM '(' ')'
{
$$= new (thd->mem_root) Item_sum_row_number(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
RANK_SYM '(' ')'
{
$$= new (thd->mem_root) Item_sum_rank(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
DENSE_RANK_SYM '(' ')'
{
$$= new (thd->mem_root) Item_sum_dense_rank(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
PERCENT_RANK_SYM '(' ')'
{
$$= new (thd->mem_root) Item_sum_percent_rank(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
CUME_DIST_SYM '(' ')'
{
$$= new (thd->mem_root) Item_sum_cume_dist(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
NTILE_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_sum_ntile(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
FIRST_VALUE_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_sum_first_value(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
LAST_VALUE '(' expr ')'
{
$$= new (thd->mem_root) Item_sum_last_value(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
NTH_VALUE_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_sum_nth_value(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
@@ -10971,17 +11336,17 @@ simple_window_func:
{
/* No second argument defaults to 1. */
Item* item_offset= new (thd->mem_root) Item_uint(thd, 1);
- if (item_offset == NULL)
+ if (unlikely(item_offset == NULL))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_sum_lead(thd, $3, item_offset);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
LEAD_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_sum_lead(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
@@ -10989,35 +11354,38 @@ simple_window_func:
{
/* No second argument defaults to 1. */
Item* item_offset= new (thd->mem_root) Item_uint(thd, 1);
- if (item_offset == NULL)
+ if (unlikely(item_offset == NULL))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_sum_lag(thd, $3, item_offset);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
|
LAG_SYM '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_sum_lag(thd, $3, $5);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
+
+
+
inverse_distribution_function:
percentile_function OVER_SYM
'(' opt_window_partition_clause ')'
{
LEX *lex= Lex;
- if (Select->add_window_spec(thd, lex->win_ref,
- Select->group_list,
- Select->order_list,
- NULL))
+ if (unlikely(Select->add_window_spec(thd, lex->win_ref,
+ Select->group_list,
+ Select->order_list,
+ NULL)))
MYSQL_YYABORT;
$$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1,
thd->lex->win_spec);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
- if (Select->add_window_func((Item_window_func *) $$))
+ if (unlikely(Select->add_window_func((Item_window_func *) $$)))
MYSQL_YYABORT;
}
;
@@ -11033,14 +11401,14 @@ percentile_function:
{
Item *args= new (thd->mem_root) Item_decimal(thd, "0.5", 3,
thd->charset());
- if (($$ == NULL) || (thd->is_error()))
- {
+ if (unlikely(args == NULL) || unlikely(thd->is_error()))
+ MYSQL_YYABORT;
+ Select->prepare_add_window_spec(thd);
+ if (unlikely(add_order_to_list(thd, $3,FALSE)))
MYSQL_YYABORT;
- }
- if (add_order_to_list(thd, $3,FALSE)) MYSQL_YYABORT;
$$= new (thd->mem_root) Item_sum_percentile_cont(thd, args);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -11049,27 +11417,31 @@ inverse_distribution_function_def:
PERCENTILE_CONT_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_sum_percentile_cont(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| PERCENTILE_DISC_SYM '(' expr ')'
{
$$= new (thd->mem_root) Item_sum_percentile_disc(thd, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
order_by_single_element_list:
ORDER_SYM BY order_ident order_dir
- { if (add_order_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; }
+ {
+ if (unlikely(add_order_to_list(thd, $3,(bool) $4)))
+ MYSQL_YYABORT;
+ }
;
+
window_name:
ident
{
$$= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING));
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -11077,7 +11449,7 @@ window_name:
variable:
'@'
{
- if (! Lex->parsing_options.allows_variable)
+ if (unlikely(! Lex->parsing_options.allows_variable))
my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0)));
}
variable_aux
@@ -11091,7 +11463,7 @@ variable_aux:
{
Item_func_set_user_var *item;
$$= item= new (thd->mem_root) Item_func_set_user_var(thd, &$1, $3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
LEX *lex= Lex;
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
@@ -11100,7 +11472,7 @@ variable_aux:
| ident_or_text
{
$$= new (thd->mem_root) Item_func_get_user_var(thd, &$1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
LEX *lex= Lex;
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
@@ -11108,12 +11480,12 @@ variable_aux:
| '@' opt_var_ident_type ident_or_text opt_component
{
/* disallow "SELECT @@global.global.variable" */
- if ($3.str && $4.str && check_reserved_words(&$3))
+ if (unlikely($3.str && $4.str && check_reserved_words(&$3)))
{
thd->parse_error();
MYSQL_YYABORT;
}
- if (!($$= get_system_var(thd, $2, &$3, &$4)))
+ if (unlikely(!($$= get_system_var(thd, $2, &$3, &$4))))
MYSQL_YYABORT;
if (!((Item_func_get_system_var*) $$)->is_written_to_binlog())
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE);
@@ -11129,7 +11501,7 @@ opt_gconcat_separator:
/* empty */
{
$$= new (thd->mem_root) String(",", 1, &my_charset_latin1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| SEPARATOR_SYM text_string { $$ = $2; }
@@ -11142,9 +11514,15 @@ opt_gorder_clause:
gorder_list:
gorder_list ',' order_ident order_dir
- { if (add_gorder_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; }
+ {
+ if (unlikely(add_gorder_to_list(thd, $3,(bool) $4)))
+ MYSQL_YYABORT;
+ }
| order_ident order_dir
- { if (add_gorder_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; }
+ {
+ if (unlikely(add_gorder_to_list(thd, $1,(bool) $2)))
+ MYSQL_YYABORT;
+ }
;
opt_glimit_clause:
@@ -11187,11 +11565,13 @@ glimit_options:
}
;
+
+
in_sum_expr:
opt_all
{
LEX *lex= Lex;
- if (lex->current_select->inc_in_sum_expr())
+ if (unlikely(lex->current_select->inc_in_sum_expr()))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -11253,9 +11633,9 @@ expr_list:
expr
{
$$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
+ if (unlikely($$ == NULL) ||
+ unlikely($$->push_back($1, thd->mem_root)))
MYSQL_YYABORT;
- $$->push_back($1, thd->mem_root);
}
| expr_list ',' expr
{
@@ -11273,9 +11653,9 @@ ident_list:
simple_ident
{
$$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
+ if (unlikely($$ == NULL) ||
+ unlikely($$->push_back($1, thd->mem_root)))
MYSQL_YYABORT;
- $$->push_back($1, thd->mem_root);
}
| ident_list ',' simple_ident
{
@@ -11288,25 +11668,27 @@ when_list:
WHEN_SYM expr THEN_SYM expr
{
$$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
+ MYSQL_YYABORT;
+ if (unlikely($$->push_back($2, thd->mem_root) ||
+ $$->push_back($4, thd->mem_root)))
MYSQL_YYABORT;
- $$->push_back($2, thd->mem_root);
- $$->push_back($4, thd->mem_root);
}
| when_list WHEN_SYM expr THEN_SYM expr
{
- $1->push_back($3, thd->mem_root);
- $1->push_back($5, thd->mem_root);
+ if (unlikely($1->push_back($3, thd->mem_root) ||
+ $1->push_back($5, thd->mem_root)))
+ MYSQL_YYABORT;
$$= $1;
}
;
-
when_list_opt_else:
when_list
| when_list ELSE expr
{
- $1->push_back($3, thd->mem_root);
+ if (unlikely($1->push_back($3, thd->mem_root)))
+ MYSQL_YYABORT;
$$= $1;
}
;
@@ -11315,15 +11697,17 @@ decode_when_list:
expr ',' expr
{
$$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
+ if (unlikely($$ == NULL) ||
+ unlikely($$->push_back($1, thd->mem_root)) ||
+ unlikely($$->push_back($3, thd->mem_root)))
MYSQL_YYABORT;
- $$->push_back($1, thd->mem_root);
- $$->push_back($3, thd->mem_root);
+
}
| decode_when_list ',' expr
{
$$= $1;
- $$->push_back($3, thd->mem_root);
+ if (unlikely($$->push_back($3, thd->mem_root)))
+ MYSQL_YYABORT;
}
;
@@ -11335,7 +11719,7 @@ table_ref:
| join_table
{
LEX *lex= Lex;
- if (!($$= lex->current_select->nest_last_join(thd)))
+ if (unlikely(!($$= lex->current_select->nest_last_join(thd))))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -11390,7 +11774,7 @@ join_table:
{
MYSQL_YYABORT_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */
- if (push_new_name_resolution_context(thd, $1, $3))
+ if (unlikely(push_new_name_resolution_context(thd, $1, $3)))
MYSQL_YYABORT;
Select->parsing_place= IN_ON;
}
@@ -11407,7 +11791,7 @@ join_table:
MYSQL_YYABORT_UNLESS($1 && $3);
}
'(' using_list ')'
- {
+ {
$3->straight=$2;
add_join_natural($1,$3,$7,Select);
$$=$3;
@@ -11425,7 +11809,7 @@ join_table:
{
MYSQL_YYABORT_UNLESS($1 && $5);
/* Change the current name resolution context to a local context. */
- if (push_new_name_resolution_context(thd, $1, $5))
+ if (unlikely(push_new_name_resolution_context(thd, $1, $5)))
MYSQL_YYABORT;
Select->parsing_place= IN_ON;
}
@@ -11461,14 +11845,14 @@ join_table:
{
MYSQL_YYABORT_UNLESS($1 && $5);
/* Change the current name resolution context to a local context. */
- if (push_new_name_resolution_context(thd, $1, $5))
+ if (unlikely(push_new_name_resolution_context(thd, $1, $5)))
MYSQL_YYABORT;
Select->parsing_place= IN_ON;
}
expr
{
LEX *lex= Lex;
- if (!($$= lex->current_select->convert_right_join()))
+ if (unlikely(!($$= lex->current_select->convert_right_join())))
MYSQL_YYABORT;
add_join_on(thd, $$, $8);
Lex->pop_context();
@@ -11481,7 +11865,7 @@ join_table:
USING '(' using_list ')'
{
LEX *lex= Lex;
- if (!($$= lex->current_select->convert_right_join()))
+ if (unlikely(!($$= lex->current_select->convert_right_join())))
MYSQL_YYABORT;
add_join_natural($$,$5,$9,Select);
}
@@ -11490,7 +11874,7 @@ join_table:
MYSQL_YYABORT_UNLESS($1 && $6);
add_join_natural($6,$1,NULL,Select);
LEX *lex= Lex;
- if (!($$= lex->current_select->convert_right_join()))
+ if (unlikely(!($$= lex->current_select->convert_right_join())))
MYSQL_YYABORT;
}
;
@@ -11538,19 +11922,23 @@ table_factor:
table_primary_ident:
{
+ DBUG_ASSERT(Select);
SELECT_LEX *sel= Select;
sel->table_join_options= 0;
}
- table_ident opt_use_partition opt_table_alias opt_key_definition
+ table_ident opt_use_partition opt_for_system_time_clause opt_table_alias opt_key_definition
{
- if (!($$= Select->add_table_to_list(thd, $2, $4,
- Select->get_table_join_options(),
- YYPS->m_lock_type,
- YYPS->m_mdl_type,
- Select->pop_index_hints(),
- $3)))
+ if (unlikely(!($$= Select->add_table_to_list(thd, $2, $5,
+ Select->get_table_join_options(),
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type,
+ Select->
+ pop_index_hints(),
+ $3))))
MYSQL_YYABORT;
Select->add_joined_table($$);
+ if ($4)
+ $$->vers_conditions= Lex->vers_conditions;
}
;
@@ -11573,11 +11961,11 @@ table_primary_ident:
*/
table_primary_derived:
- '(' get_select_lex select_derived_union ')' opt_table_alias
+ '(' get_select_lex select_derived_union ')' opt_for_system_time_clause opt_table_alias
{
/* Use $2 instead of Lex->current_select as derived table will
alter value of Lex->current_select. */
- if (!($3 || $5) && $2->embedding &&
+ if (!($3 || $6) && $2->embedding &&
!$2->embedding->nested_join->join_list.elements)
{
/* we have a derived table ($3 == NULL) but no alias,
@@ -11597,18 +11985,18 @@ table_primary_derived:
SELECT_LEX_UNIT *unit= sel->master_unit();
lex->current_select= sel= unit->outer_select();
Table_ident *ti= new (thd->mem_root) Table_ident(unit);
- if (ti == NULL)
+ if (unlikely(ti == NULL))
MYSQL_YYABORT;
- if (!($$= sel->add_table_to_list(thd,
- ti, $5, 0,
- TL_READ, MDL_SHARED_READ)))
-
+ if (unlikely(!($$= sel->add_table_to_list(thd,
+ ti, $6, 0,
+ TL_READ,
+ MDL_SHARED_READ))))
MYSQL_YYABORT;
sel->add_joined_table($$);
lex->pop_context();
lex->nest_level--;
}
- else if ($5 != NULL)
+ else if (unlikely($6 != NULL))
{
/*
Tables with or without joins within parentheses cannot
@@ -11632,25 +12020,33 @@ table_primary_derived:
if ($$ && $$->derived &&
!$$->derived->first_select()->next_select())
$$->select_lex->add_where_field($$->derived->first_select());
+ if ($5)
+ {
+ MYSQL_YYABORT_UNLESS(!$3);
+ $$->vers_conditions= Lex->vers_conditions;
+ }
}
/* Represents derived table with WITH clause */
| '(' get_select_lex subselect_start
with_clause query_expression_body
- subselect_end ')' opt_table_alias
+ subselect_end ')' opt_for_system_time_clause opt_table_alias
{
LEX *lex=Lex;
SELECT_LEX *sel= $2;
SELECT_LEX_UNIT *unit= $5->master_unit();
Table_ident *ti= new (thd->mem_root) Table_ident(unit);
- if (ti == NULL)
+ if (unlikely(ti == NULL))
MYSQL_YYABORT;
$5->set_with_clause($4);
lex->current_select= sel;
- if (!($$= sel->add_table_to_list(lex->thd,
- ti, $8, 0,
- TL_READ, MDL_SHARED_READ)))
+ if (unlikely(!($$= sel->add_table_to_list(lex->thd,
+ ti, $9, 0,
+ TL_READ,
+ MDL_SHARED_READ))))
MYSQL_YYABORT;
sel->add_joined_table($$);
+ if ($8)
+ $$->vers_conditions= Lex->vers_conditions;
}
;
@@ -11677,7 +12073,7 @@ select_derived_union:
select_derived
| select_derived union_order_or_limit
{
- if ($1)
+ if (unlikely($1))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -11685,16 +12081,16 @@ select_derived_union:
}
| select_derived union_head_non_top
{
- if ($1)
+ if (unlikely($1))
{
thd->parse_error();
MYSQL_YYABORT;
}
}
union_list_derived_part2
- | derived_query_specification opt_select_lock_type
- | derived_query_specification order_or_limit opt_select_lock_type
- | derived_query_specification opt_select_lock_type union_list_derived
+ | derived_simple_table opt_select_lock_type
+ | derived_simple_table order_or_limit opt_select_lock_type
+ | derived_simple_table opt_select_lock_type union_list_derived
;
union_list_derived_part2:
@@ -11739,9 +12135,9 @@ select_derived:
/* for normal joins, $2 != NULL and end_nested_join() != NULL,
for derived tables, both must equal NULL */
- if (!($$= $1->end_nested_join(lex->thd)) && $2)
+ if (unlikely(!($$= $1->end_nested_join(lex->thd)) && $2))
MYSQL_YYABORT;
- if (!$2 && $$)
+ if (unlikely(!$2 && $$))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -11749,6 +12145,10 @@ select_derived:
}
;
+derived_simple_table:
+ derived_query_specification { $$= $1; }
+ | derived_table_value_constructor { $$= $1; }
+ ;
/*
Similar to query_specification, but for derived tables.
Example: the inner parenthesized SELECT in this query:
@@ -11763,18 +12163,32 @@ derived_query_specification:
}
;
+derived_table_value_constructor:
+ VALUES
+ {
+ Lex->tvc_start();
+ }
+ values_list
+ {
+ if (Lex->tvc_finalize_derived())
+ MYSQL_YYABORT;
+ $$= NULL;
+ }
+ ;
+
+
select_derived2:
{
LEX *lex= Lex;
lex->derived_tables|= DERIVED_SUBQUERY;
- if (!lex->expr_allows_subselect ||
- lex->sql_command == (int)SQLCOM_PURGE)
+ if (unlikely(!lex->expr_allows_subselect ||
+ lex->sql_command == (int)SQLCOM_PURGE))
{
thd->parse_error();
MYSQL_YYABORT;
}
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
- mysql_new_select(lex, 1, NULL))
+ unlikely(mysql_new_select(lex, 1, NULL)))
MYSQL_YYABORT;
mysql_init_select(lex);
lex->current_select->linkage= DERIVED_TABLE_TYPE;
@@ -11795,7 +12209,7 @@ get_select_lex_derived:
get_select_lex
{
LEX *lex= Lex;
- if ($1->init_nested_join(lex->thd))
+ if (unlikely($1->init_nested_join(lex->thd)))
MYSQL_YYABORT;
}
;
@@ -11879,12 +12293,12 @@ key_usage_list:
using_list:
ident
{
- if (!($$= new (thd->mem_root) List<String>))
+ if (unlikely(!($$= new (thd->mem_root) List<String>)))
MYSQL_YYABORT;
String *s= new (thd->mem_root) String((const char *) $1.str,
$1.length,
system_charset_info);
- if (s == NULL)
+ if (unlikely(unlikely(s == NULL)))
MYSQL_YYABORT;
$$->push_back(s, thd->mem_root);
}
@@ -11893,9 +12307,10 @@ using_list:
String *s= new (thd->mem_root) String((const char *) $3.str,
$3.length,
system_charset_info);
- if (s == NULL)
+ if (unlikely(unlikely(s == NULL)))
+ MYSQL_YYABORT;
+ if (unlikely($1->push_back(s, thd->mem_root)))
MYSQL_YYABORT;
- $1->push_back(s, thd->mem_root);
$$= $1;
}
;
@@ -11942,10 +12357,10 @@ table_alias:
opt_table_alias:
/* empty */ { $$=0; }
- | table_alias ident
+ | table_alias ident_table_alias
{
$$= (LEX_CSTRING*) thd->memdup(&$2,sizeof(LEX_STRING));
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -11999,7 +12414,7 @@ opt_escape:
$$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
new (thd->mem_root) Item_string_ascii(thd, "", 0) :
new (thd->mem_root) Item_string_ascii(thd, "\\", 1));
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -12015,9 +12430,15 @@ opt_group_clause:
group_list:
group_list ',' order_ident order_dir
- { if (add_group_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; }
+ {
+ if (unlikely(add_group_to_list(thd, $3,(bool) $4)))
+ MYSQL_YYABORT;
+ }
| order_ident order_dir
- { if (add_group_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; }
+ {
+ if (unlikely(add_group_to_list(thd, $1,(bool) $2)))
+ MYSQL_YYABORT;
+ }
;
olap_opt:
@@ -12032,7 +12453,7 @@ olap_opt:
SQL-2003: GROUP BY ... CUBE(col1, col2, col3)
*/
LEX *lex=Lex;
- if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
+ if (unlikely(lex->current_select->linkage == GLOBAL_OPTIONS_TYPE))
my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH CUBE",
"global union parameters"));
lex->current_select->olap= CUBE_TYPE;
@@ -12049,7 +12470,7 @@ olap_opt:
SQL-2003: GROUP BY ... ROLLUP(col1, col2, col3)
*/
LEX *lex= Lex;
- if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
+ if (unlikely(lex->current_select->linkage == GLOBAL_OPTIONS_TYPE))
my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
"global union parameters"));
lex->current_select->olap= ROLLUP_TYPE;
@@ -12077,10 +12498,10 @@ window_def:
window_name AS window_spec
{
LEX *lex= Lex;
- if (Select->add_window_def(thd, $1, lex->win_ref,
- Select->group_list,
- Select->order_list,
- lex->win_frame))
+ if (unlikely(Select->add_window_def(thd, $1, lex->win_ref,
+ Select->group_list,
+ Select->order_list,
+ lex->win_frame)))
MYSQL_YYABORT;
}
;
@@ -12098,7 +12519,7 @@ opt_window_ref:
| ident
{
thd->lex->win_ref= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING));
- if (thd->lex->win_ref == NULL)
+ if (unlikely(thd->lex->win_ref == NULL))
MYSQL_YYABORT;
}
@@ -12122,7 +12543,7 @@ opt_window_frame_clause:
lex->frame_top_bound,
lex->frame_bottom_bound,
$3);
- if (lex->win_frame == NULL)
+ if (unlikely(lex->win_frame == NULL))
MYSQL_YYABORT;
}
;
@@ -12140,7 +12561,7 @@ window_frame_extent:
lex->frame_bottom_bound=
new (thd->mem_root)
Window_frame_bound(Window_frame_bound::CURRENT, NULL);
- if (lex->frame_bottom_bound == NULL)
+ if (unlikely(lex->frame_bottom_bound == NULL))
MYSQL_YYABORT;
}
| BETWEEN_SYM window_frame_bound AND_SYM window_frame_bound
@@ -12156,21 +12577,21 @@ window_frame_start:
{
$$= new (thd->mem_root)
Window_frame_bound(Window_frame_bound::PRECEDING, NULL);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| CURRENT_SYM ROW_SYM
{
$$= new (thd->mem_root)
Window_frame_bound(Window_frame_bound::CURRENT, NULL);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| literal PRECEDING_SYM
{
$$= new (thd->mem_root)
Window_frame_bound(Window_frame_bound::PRECEDING, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -12181,14 +12602,14 @@ window_frame_bound:
{
$$= new (thd->mem_root)
Window_frame_bound(Window_frame_bound::FOLLOWING, NULL);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| literal FOLLOWING_SYM
{
$$= new (thd->mem_root)
Window_frame_bound(Window_frame_bound::FOLLOWING, $1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -12222,7 +12643,7 @@ alter_order_item:
simple_ident_nospvar order_dir
{
bool ascending= ($2 == 1) ? true : false;
- if (add_order_to_list(thd, $1, ascending))
+ if (unlikely(add_order_to_list(thd, $1, ascending)))
MYSQL_YYABORT;
}
;
@@ -12242,9 +12663,9 @@ order_clause:
LEX *lex=Lex;
SELECT_LEX *sel= lex->current_select;
SELECT_LEX_UNIT *unit= sel-> master_unit();
- if (sel->linkage != GLOBAL_OPTIONS_TYPE &&
- sel->olap != UNSPECIFIED_OLAP_TYPE &&
- (sel->linkage != UNION_TYPE || sel->braces))
+ if (unlikely(sel->linkage != GLOBAL_OPTIONS_TYPE &&
+ sel->olap != UNSPECIFIED_OLAP_TYPE &&
+ (sel->linkage != UNION_TYPE || sel->braces)))
{
my_error(ER_WRONG_USAGE, MYF(0),
"CUBE/ROLLUP", "ORDER BY");
@@ -12258,14 +12679,14 @@ order_clause:
executed in the same way as the query
SELECT ... ORDER BY order_list
unless the SELECT construct contains ORDER BY or LIMIT clauses.
- Otherwise we create a fake SELECT_LEX if it has not been created
- yet.
+ Otherwise we create a fake SELECT_LEX if it has not been
+ created yet.
*/
SELECT_LEX *first_sl= unit->first_select();
- if (!unit->is_unit_op() &&
- (first_sl->order_list.elements ||
- first_sl->select_limit) &&
- unit->add_fake_select_lex(thd))
+ if (unlikely(!unit->is_unit_op() &&
+ (first_sl->order_list.elements ||
+ first_sl->select_limit) &&
+ unit->add_fake_select_lex(thd)))
MYSQL_YYABORT;
}
if (sel->master_unit()->is_unit_op() && !sel->braces)
@@ -12288,9 +12709,15 @@ order_clause:
order_list:
order_list ',' order_ident order_dir
- { if (add_order_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; }
+ {
+ if (unlikely(add_order_to_list(thd, $3,(bool) $4)))
+ MYSQL_YYABORT;
+ }
| order_ident order_dir
- { if (add_order_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; }
+ {
+ if (unlikely(add_order_to_list(thd, $1,(bool) $2)))
+ MYSQL_YYABORT;
+ }
;
order_dir:
@@ -12361,42 +12788,36 @@ limit_options:
;
limit_option:
- ident_with_tok_start
- {
- LEX *lex= thd->lex;
- Lex_input_stream *lip= & thd->m_parser_state->m_lip;
- if (!($$= lex->create_item_limit(thd, &$1,
- $1.m_pos, lip->get_tok_end())))
- MYSQL_YYABORT;
- }
- | ident_with_tok_start '.' ident
- {
- LEX *lex= thd->lex;
- Lex_input_stream *lip= & thd->m_parser_state->m_lip;
- if (!($$= lex->create_item_limit(thd, &$1, &$3,
- $1.m_pos, lip->get_ptr())))
- MYSQL_YYABORT;
- }
+ ident_cli
+ {
+ if (unlikely(!($$= Lex->create_item_limit(thd, &$1))))
+ MYSQL_YYABORT;
+ }
+ | ident_cli '.' ident_cli
+ {
+ if (unlikely(!($$= Lex->create_item_limit(thd, &$1, &$3))))
+ MYSQL_YYABORT;
+ }
| param_marker
- {
- $1->limit_clause_param= TRUE;
- }
+ {
+ $1->limit_clause_param= TRUE;
+ }
| ULONGLONG_NUM
{
$$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| LONG_NUM
{
$$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| NUM
{
$$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -12508,9 +12929,9 @@ procedure_clause:
Item_field *item= new (thd->mem_root)
Item_field(thd, &lex->current_select->context,
NULL, NULL, &$2);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
- if (add_proc_to_list(thd, item))
+ if (unlikely(add_proc_to_list(thd, item)))
MYSQL_YYABORT;
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
@@ -12542,7 +12963,7 @@ procedure_list2:
procedure_item:
remember_name expr remember_end
{
- if (add_proc_to_list(thd, $2))
+ if (unlikely(add_proc_to_list(thd, $2)))
MYSQL_YYABORT;
if (!$2->name.str || $2->name.str == item_empty_name)
$2->set_name(thd, $1, (uint) ($3 - $1), thd->charset());
@@ -12553,7 +12974,8 @@ select_var_list_init:
{
LEX *lex=Lex;
if (!lex->describe &&
- (!(lex->result= new (thd->mem_root) select_dumpvar(thd))))
+ unlikely((!(lex->result= new (thd->mem_root)
+ select_dumpvar(thd)))))
MYSQL_YYABORT;
}
select_var_list
@@ -12569,7 +12991,7 @@ select_var_ident: select_outvar
{
if (Lex->result)
{
- if ($1 == NULL)
+ if (unlikely($1 == NULL))
MYSQL_YYABORT;
((select_dumpvar *)Lex->result)->var_list.push_back($1, thd->mem_root);
}
@@ -12591,12 +13013,12 @@ select_outvar:
}
| ident_or_text
{
- if (!($$= Lex->create_outvar(thd, &$1)) && Lex->result)
+ if (unlikely(!($$= Lex->create_outvar(thd, &$1)) && Lex->result))
MYSQL_YYABORT;
}
| ident '.' ident
{
- if (!($$= Lex->create_outvar(thd, &$1, &$3)) && Lex->result)
+ if (unlikely(!($$= Lex->create_outvar(thd, &$1, &$3)) && Lex->result))
MYSQL_YYABORT;
}
;
@@ -12610,10 +13032,11 @@ into_destination:
{
LEX *lex= Lex;
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- if (!(lex->exchange=
- new (thd->mem_root) sql_exchange($2.str, 0)) ||
- !(lex->result=
- new (thd->mem_root) select_export(thd, lex->exchange)))
+ if (unlikely(!(lex->exchange=
+ new (thd->mem_root) sql_exchange($2.str, 0))) ||
+ unlikely(!(lex->result=
+ new (thd->mem_root)
+ select_export(thd, lex->exchange))))
MYSQL_YYABORT;
}
opt_load_data_charset
@@ -12625,10 +13048,12 @@ into_destination:
if (!lex->describe)
{
lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
- if (!(lex->exchange= new (thd->mem_root) sql_exchange($2.str,1)))
+ if (unlikely(!(lex->exchange=
+ new (thd->mem_root) sql_exchange($2.str,1))))
MYSQL_YYABORT;
- if (!(lex->result=
- new (thd->mem_root) select_dump(thd, lex->exchange)))
+ if (unlikely(!(lex->result=
+ new (thd->mem_root)
+ select_dump(thd, lex->exchange))))
MYSQL_YYABORT;
}
}
@@ -12674,16 +13099,16 @@ drop:
LEX *lex=Lex;
Alter_drop *ad= (new (thd->mem_root)
Alter_drop(Alter_drop::KEY, $4.str, $3));
- if (ad == NULL)
+ if (unlikely(ad == NULL))
MYSQL_YYABORT;
lex->sql_command= SQLCOM_DROP_INDEX;
lex->alter_info.reset();
lex->alter_info.flags= ALTER_DROP_INDEX;
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
- if (!lex->current_select->add_table_to_list(thd, $6, NULL,
- TL_OPTION_UPDATING,
- TL_READ_NO_INSERT,
- MDL_SHARED_UPGRADABLE))
+ if (unlikely(!lex->current_select->
+ add_table_to_list(thd, $6, NULL, TL_OPTION_UPDATING,
+ TL_READ_NO_INSERT,
+ MDL_SHARED_UPGRADABLE)))
MYSQL_YYABORT;
}
| DROP DATABASE opt_if_exists ident
@@ -12696,7 +13121,7 @@ drop:
{
LEX *lex= Lex;
lex->set_command(SQLCOM_DROP_PACKAGE, $3);
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PACKAGE"));
lex->spname= $4;
}
@@ -12704,7 +13129,7 @@ drop:
{
LEX *lex= Lex;
lex->set_command(SQLCOM_DROP_PACKAGE_BODY, $4);
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PACKAGE BODY"));
lex->spname= $5;
}
@@ -12712,13 +13137,13 @@ drop:
{
LEX *lex= thd->lex;
sp_name *spname;
- if ($4.str && check_db_name((LEX_STRING*) &$4))
- my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $4.str));
- if (lex->sphead)
+ if (unlikely($4.str && check_db_name((LEX_STRING*) &$4)))
+ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $4.str));
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
lex->set_command(SQLCOM_DROP_FUNCTION, $3);
spname= new (thd->mem_root) sp_name(&$4, &$6, true);
- if (spname == NULL)
+ if (unlikely(spname == NULL))
MYSQL_YYABORT;
lex->spname= spname;
}
@@ -12727,20 +13152,20 @@ drop:
LEX *lex= thd->lex;
LEX_CSTRING db= {0, 0};
sp_name *spname;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
- if (thd->db.str && lex->copy_db_to(&db))
+ if (thd->db.str && unlikely(lex->copy_db_to(&db)))
MYSQL_YYABORT;
lex->set_command(SQLCOM_DROP_FUNCTION, $3);
spname= new (thd->mem_root) sp_name(&db, &$4, false);
- if (spname == NULL)
+ if (unlikely(spname == NULL))
MYSQL_YYABORT;
lex->spname= spname;
}
| DROP PROCEDURE_SYM opt_if_exists sp_name
{
LEX *lex=Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
lex->set_command(SQLCOM_DROP_PROCEDURE, $3);
lex->spname= $4;
@@ -12809,10 +13234,10 @@ table_list:
table_name:
table_ident
{
- if (!Select->add_table_to_list(thd, $1, NULL,
- TL_OPTION_UPDATING,
- YYPS->m_lock_type,
- YYPS->m_mdl_type))
+ if (unlikely(!Select->add_table_to_list(thd, $1, NULL,
+ TL_OPTION_UPDATING,
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type)))
MYSQL_YYABORT;
}
;
@@ -12820,12 +13245,12 @@ table_name:
table_name_with_opt_use_partition:
table_ident opt_use_partition
{
- if (!Select->add_table_to_list(thd, $1, NULL,
- TL_OPTION_UPDATING,
- YYPS->m_lock_type,
- YYPS->m_mdl_type,
- NULL,
- $2))
+ if (unlikely(!Select->add_table_to_list(thd, $1, NULL,
+ TL_OPTION_UPDATING,
+ YYPS->m_lock_type,
+ YYPS->m_mdl_type,
+ NULL,
+ $2)))
MYSQL_YYABORT;
}
;
@@ -12838,10 +13263,12 @@ table_alias_ref_list:
table_alias_ref:
table_ident_opt_wild
{
- if (!Select->add_table_to_list(thd, $1, NULL,
- TL_OPTION_UPDATING | TL_OPTION_ALIAS,
+ if (unlikely(!Select->
+ add_table_to_list(thd, $1, NULL,
+ (TL_OPTION_UPDATING |
+ TL_OPTION_ALIAS),
YYPS->m_lock_type,
- YYPS->m_mdl_type))
+ YYPS->m_mdl_type)))
MYSQL_YYABORT;
}
;
@@ -12926,10 +13353,9 @@ insert_lock_option:
| LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; }
| DELAYED_SYM
{
- Lex->keyword_delayed_begin_offset= (uint)(YYLIP->get_tok_start() -
- thd->query());
- Lex->keyword_delayed_end_offset= Lex->keyword_delayed_begin_offset +
- YYLIP->yyLength() + 1;
+ // QQ: why was +1?
+ Lex->keyword_delayed_begin_offset= (uint)($1.pos() - thd->query());
+ Lex->keyword_delayed_end_offset= (uint)($1.end() - thd->query());
$$= TL_WRITE_DELAYED;
}
| HIGH_PRIORITY { $$= TL_WRITE; }
@@ -12939,10 +13365,8 @@ replace_lock_option:
opt_low_priority { $$= $1; }
| DELAYED_SYM
{
- Lex->keyword_delayed_begin_offset= (uint)(YYLIP->get_tok_start() -
- thd->query());
- Lex->keyword_delayed_end_offset= Lex->keyword_delayed_begin_offset +
- YYLIP->yyLength() + 1;
+ Lex->keyword_delayed_begin_offset= (uint)($1.pos() - thd->query());
+ Lex->keyword_delayed_end_offset= (uint)($1.end() - thd->query());
$$= TL_WRITE_DELAYED;
}
;
@@ -12968,8 +13392,9 @@ insert_field_spec:
| SET
{
LEX *lex=Lex;
- if (!(lex->insert_list= new (thd->mem_root) List_item) ||
- lex->many_values.push_back(lex->insert_list, thd->mem_root))
+ if (unlikely(!(lex->insert_list= new (thd->mem_root) List_item)) ||
+ unlikely(lex->many_values.push_back(lex->insert_list,
+ thd->mem_root)))
MYSQL_YYABORT;
}
ident_eq_list
@@ -13001,8 +13426,8 @@ ident_eq_value:
simple_ident_nospvar equal expr_or_default
{
LEX *lex=Lex;
- if (lex->field_list.push_back($1, thd->mem_root) ||
- lex->insert_list->push_back($3, thd->mem_root))
+ if (unlikely(lex->field_list.push_back($1, thd->mem_root)) ||
+ unlikely(lex->insert_list->push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -13030,13 +13455,14 @@ opt_by:
no_braces:
'('
{
- if (!(Lex->insert_list= new (thd->mem_root) List_item))
- MYSQL_YYABORT;
+ if (unlikely(!(Lex->insert_list= new (thd->mem_root) List_item)))
+ MYSQL_YYABORT;
}
opt_values ')'
{
LEX *lex=Lex;
- if (lex->many_values.push_back(lex->insert_list, thd->mem_root))
+ if (unlikely(lex->many_values.push_back(lex->insert_list,
+ thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -13049,12 +13475,12 @@ opt_values:
values:
values ',' expr_or_default
{
- if (Lex->insert_list->push_back($3, thd->mem_root))
+ if (unlikely(Lex->insert_list->push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
| expr_or_default
{
- if (Lex->insert_list->push_back($1, thd->mem_root))
+ if (unlikely(Lex->insert_list->push_back($1, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -13064,13 +13490,13 @@ expr_or_default:
| DEFAULT
{
$$= new (thd->mem_root) Item_default_value(thd, Lex->current_context());
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| IGNORE_SYM
{
$$= new (thd->mem_root) Item_ignore_value(thd, Lex->current_context());
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -13104,7 +13530,7 @@ update:
LEX *lex= Lex;
if (lex->select_lex.table_list.elements > 1)
lex->sql_command= SQLCOM_UPDATE_MULTI;
- else if (lex->select_lex.get_table_list()->derived)
+ else if (unlikely(lex->select_lex.get_table_list()->derived))
{
/* it is single table update and it is update of derived table */
my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
@@ -13129,7 +13555,8 @@ update_list:
update_elem:
simple_ident_nospvar equal expr_or_default
{
- if (add_item_to_list(thd, $1) || add_value_to_list(thd, $3))
+ if (unlikely(add_item_to_list(thd, $1)) ||
+ unlikely(add_value_to_list(thd, $3)))
MYSQL_YYABORT;
}
;
@@ -13143,8 +13570,8 @@ insert_update_elem:
simple_ident_nospvar equal expr_or_default
{
LEX *lex= Lex;
- if (lex->update_list.push_back($1, thd->mem_root) ||
- lex->value_list.push_back($3, thd->mem_root))
+ if (unlikely(lex->update_list.push_back($1, thd->mem_root)) ||
+ unlikely(lex->value_list.push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -13168,23 +13595,48 @@ delete:
lex->ignore= 0;
lex->select_lex.init_order();
}
- opt_delete_options single_multi
+ delete_part2
+ ;
+
+opt_delete_system_time:
+ /* empty */
+ {
+ Lex->vers_conditions.init(SYSTEM_TIME_ALL);
+ }
+ | BEFORE_SYM SYSTEM_TIME_SYM history_point
+ {
+ Lex->vers_conditions.init(SYSTEM_TIME_BEFORE, $3);
+ }
+ ;
+
+delete_part2:
+ opt_delete_options single_multi {}
+ | HISTORY_SYM delete_single_table opt_delete_system_time
+ {
+ Lex->last_table()->vers_conditions= Lex->vers_conditions;
+ }
;
-single_multi:
+delete_single_table:
FROM table_ident opt_use_partition
{
- if (!Select->add_table_to_list(thd, $2, NULL, TL_OPTION_UPDATING,
+ if (unlikely(!Select->
+ add_table_to_list(thd, $2, NULL, TL_OPTION_UPDATING,
YYPS->m_lock_type,
YYPS->m_mdl_type,
NULL,
- $3))
+ $3)))
MYSQL_YYABORT;
YYPS->m_lock_type= TL_READ_DEFAULT;
YYPS->m_mdl_type= MDL_SHARED_READ;
}
- opt_where_clause opt_order_clause
- delete_limit_clause {}
+ ;
+
+single_multi:
+ delete_single_table
+ opt_where_clause
+ opt_order_clause
+ delete_limit_clause
opt_select_expressions {}
| table_wild_list
{
@@ -13194,7 +13646,7 @@ single_multi:
}
FROM join_table_list opt_where_clause
{
- if (multi_delete_set_locks_and_link_aux_tables(Lex))
+ if (unlikely(multi_delete_set_locks_and_link_aux_tables(Lex)))
MYSQL_YYABORT;
}
| FROM table_alias_ref_list
@@ -13205,7 +13657,7 @@ single_multi:
}
USING join_table_list opt_where_clause
{
- if (multi_delete_set_locks_and_link_aux_tables(Lex))
+ if (unlikely(multi_delete_set_locks_and_link_aux_tables(Lex)))
MYSQL_YYABORT;
}
;
@@ -13224,27 +13676,31 @@ table_wild_one:
ident opt_wild
{
Table_ident *ti= new (thd->mem_root) Table_ident(&$1);
- if (ti == NULL)
+ if (unlikely(ti == NULL))
MYSQL_YYABORT;
- if (!Select->add_table_to_list(thd,
+ if (unlikely(!Select->
+ add_table_to_list(thd,
ti,
NULL,
- TL_OPTION_UPDATING | TL_OPTION_ALIAS,
+ (TL_OPTION_UPDATING |
+ TL_OPTION_ALIAS),
YYPS->m_lock_type,
- YYPS->m_mdl_type))
+ YYPS->m_mdl_type)))
MYSQL_YYABORT;
}
| ident '.' ident opt_wild
{
Table_ident *ti= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0);
- if (ti == NULL)
+ if (unlikely(ti == NULL))
MYSQL_YYABORT;
- if (!Select->add_table_to_list(thd,
+ if (unlikely(!Select->
+ add_table_to_list(thd,
ti,
NULL,
- TL_OPTION_UPDATING | TL_OPTION_ALIAS,
+ (TL_OPTION_UPDATING |
+ TL_OPTION_ALIAS),
YYPS->m_lock_type,
- YYPS->m_mdl_type))
+ YYPS->m_mdl_type)))
MYSQL_YYABORT;
}
;
@@ -13266,7 +13722,7 @@ opt_delete_option:
;
truncate:
- TRUNCATE_SYM opt_table_sym
+ TRUNCATE_SYM
{
LEX* lex= Lex;
lex->sql_command= SQLCOM_TRUNCATE;
@@ -13277,12 +13733,12 @@ truncate:
YYPS->m_lock_type= TL_WRITE;
YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
- table_name opt_lock_wait_timeout
+ opt_table_sym table_name opt_lock_wait_timeout
{
LEX* lex= thd->lex;
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_truncate_table();
- if (lex->m_sql_cmd == NULL)
+ if (unlikely(lex->m_sql_cmd == NULL))
MYSQL_YYABORT;
}
opt_truncate_table_storage_clause { }
@@ -13380,7 +13836,7 @@ show_param:
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_DATABASES;
- if (prepare_schema_table(thd, lex, 0, SCH_SCHEMATA))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_SCHEMATA)))
MYSQL_YYABORT;
}
| opt_full TABLES opt_db wild_and_where
@@ -13388,7 +13844,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_TABLES;
lex->select_lex.db= $3;
- if (prepare_schema_table(thd, lex, 0, SCH_TABLE_NAMES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_TABLE_NAMES)))
MYSQL_YYABORT;
}
| opt_full TRIGGERS_SYM opt_db wild_and_where
@@ -13396,7 +13852,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_TRIGGERS;
lex->select_lex.db= $3;
- if (prepare_schema_table(thd, lex, 0, SCH_TRIGGERS))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_TRIGGERS)))
MYSQL_YYABORT;
}
| EVENTS_SYM opt_db wild_and_where
@@ -13404,7 +13860,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_EVENTS;
lex->select_lex.db= $2;
- if (prepare_schema_table(thd, lex, 0, SCH_EVENTS))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_EVENTS)))
MYSQL_YYABORT;
}
| TABLE_SYM STATUS_SYM opt_db wild_and_where
@@ -13412,7 +13868,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
lex->select_lex.db= $3;
- if (prepare_schema_table(thd, lex, 0, SCH_TABLES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_TABLES)))
MYSQL_YYABORT;
}
| OPEN_SYM TABLES opt_db wild_and_where
@@ -13420,27 +13876,27 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
lex->select_lex.db= $3;
- if (prepare_schema_table(thd, lex, 0, SCH_OPEN_TABLES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_OPEN_TABLES)))
MYSQL_YYABORT;
}
| PLUGINS_SYM
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_PLUGINS;
- if (prepare_schema_table(thd, lex, 0, SCH_PLUGINS))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PLUGINS)))
MYSQL_YYABORT;
}
| PLUGINS_SYM SONAME_SYM TEXT_STRING_sys
{
Lex->ident= $3;
Lex->sql_command= SQLCOM_SHOW_PLUGINS;
- if (prepare_schema_table(thd, Lex, 0, SCH_ALL_PLUGINS))
+ if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_ALL_PLUGINS)))
MYSQL_YYABORT;
}
| PLUGINS_SYM SONAME_SYM wild_and_where
{
Lex->sql_command= SQLCOM_SHOW_PLUGINS;
- if (prepare_schema_table(thd, Lex, 0, SCH_ALL_PLUGINS))
+ if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_ALL_PLUGINS)))
MYSQL_YYABORT;
}
| ENGINE_SYM known_storage_engines show_engine_param
@@ -13453,7 +13909,7 @@ show_param:
lex->sql_command= SQLCOM_SHOW_FIELDS;
if ($5.str)
$4->change_db(&$5);
- if (prepare_schema_table(thd, lex, $4, SCH_COLUMNS))
+ if (unlikely(prepare_schema_table(thd, lex, $4, SCH_COLUMNS)))
MYSQL_YYABORT;
}
| master_or_binary LOGS_SYM
@@ -13481,14 +13937,14 @@ show_param:
lex->sql_command= SQLCOM_SHOW_KEYS;
if ($4.str)
$3->change_db(&$4);
- if (prepare_schema_table(thd, lex, $3, SCH_STATISTICS))
+ if (unlikely(prepare_schema_table(thd, lex, $3, SCH_STATISTICS)))
MYSQL_YYABORT;
}
| opt_storage ENGINES_SYM
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
- if (prepare_schema_table(thd, lex, 0, SCH_ENGINES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_ENGINES)))
MYSQL_YYABORT;
}
| AUTHORS_SYM
@@ -13526,7 +13982,7 @@ show_param:
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_PROFILE;
- if (prepare_schema_table(thd, lex, NULL, SCH_PROFILES) != 0)
+ if (unlikely(prepare_schema_table(thd, lex, NULL, SCH_PROFILES)))
MYSQL_YYABORT;
}
| opt_var_type STATUS_SYM wild_and_where
@@ -13534,7 +13990,7 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS;
lex->option_type= $1;
- if (prepare_schema_table(thd, lex, 0, SCH_SESSION_STATUS))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_SESSION_STATUS)))
MYSQL_YYABORT;
}
| opt_full PROCESSLIST_SYM
@@ -13544,27 +14000,28 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_VARIABLES;
lex->option_type= $1;
- if (prepare_schema_table(thd, lex, 0, SCH_SESSION_VARIABLES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_SESSION_VARIABLES)))
MYSQL_YYABORT;
}
| charset wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_CHARSETS;
- if (prepare_schema_table(thd, lex, 0, SCH_CHARSETS))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_CHARSETS)))
MYSQL_YYABORT;
}
| COLLATION_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_COLLATIONS;
- if (prepare_schema_table(thd, lex, 0, SCH_COLLATIONS))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_COLLATIONS)))
MYSQL_YYABORT;
}
| GRANTS
{
Lex->sql_command= SQLCOM_SHOW_GRANTS;
- if (!(Lex->grant_user= (LEX_USER*)thd->alloc(sizeof(LEX_USER))))
+ if (unlikely(!(Lex->grant_user=
+ (LEX_USER*)thd->alloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
Lex->grant_user->user= current_user_and_current_role;
}
@@ -13583,7 +14040,7 @@ show_param:
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE;
- if (!lex->select_lex.add_table_to_list(thd, $3, NULL,0))
+ if (unlikely(!lex->select_lex.add_table_to_list(thd, $3, NULL,0)))
MYSQL_YYABORT;
lex->create_info.storage_media= HA_SM_DEFAULT;
}
@@ -13591,7 +14048,7 @@ show_param:
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE;
- if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0))
+ if (unlikely(!lex->select_lex.add_table_to_list(thd, $3, NULL, 0)))
MYSQL_YYABORT;
lex->table_type= TABLE_TYPE_VIEW;
}
@@ -13599,7 +14056,7 @@ show_param:
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE;
- if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0))
+ if (unlikely(!lex->select_lex.add_table_to_list(thd, $3, NULL, 0)))
MYSQL_YYABORT;
lex->table_type= TABLE_TYPE_SEQUENCE;
}
@@ -13659,7 +14116,8 @@ show_param:
| CREATE USER_SYM
{
Lex->sql_command= SQLCOM_SHOW_CREATE_USER;
- if (!(Lex->grant_user= (LEX_USER*)thd->alloc(sizeof(LEX_USER))))
+ if (unlikely(!(Lex->grant_user=
+ (LEX_USER*)thd->alloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
Lex->grant_user->user= current_user;
}
@@ -13672,28 +14130,28 @@ show_param:
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_PROC;
- if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
| FUNCTION_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_FUNC;
- if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
| PACKAGE_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE;
- if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
| PACKAGE_SYM BODY_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE_BODY;
- if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))
+ if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES)))
MYSQL_YYABORT;
}
| PROCEDURE_SYM CODE_SYM sp_name
@@ -13719,7 +14177,7 @@ show_param:
| describe_command FOR_SYM expr
{
Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
- if (prepare_schema_table(thd, Lex, 0, SCH_EXPLAIN))
+ if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_EXPLAIN)))
MYSQL_YYABORT;
add_value_to_list(thd, $3);
}
@@ -13729,17 +14187,17 @@ show_param:
bool in_plugin;
lex->sql_command= SQLCOM_SHOW_GENERIC;
ST_SCHEMA_TABLE *table= find_schema_table(thd, &$1, &in_plugin);
- if (!table || !table->old_format || !in_plugin)
+ if (unlikely(!table || !table->old_format || !in_plugin))
{
thd->parse_error(ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT;
}
- if (lex->wild && table->idx_field1 < 0)
+ if (unlikely(lex->wild && table->idx_field1 < 0))
{
thd->parse_error(ER_SYNTAX_ERROR, $3);
MYSQL_YYABORT;
}
- if (make_schema_select(thd, Lex->current_select, table))
+ if (unlikely(make_schema_select(thd, Lex->current_select, table)))
MYSQL_YYABORT;
}
;
@@ -13794,7 +14252,7 @@ wild_and_where:
{
Lex->wild= new (thd->mem_root) String($3.str, $3.length,
system_charset_info);
- if (Lex->wild == NULL)
+ if (unlikely(Lex->wild == NULL))
MYSQL_YYABORT;
$$= $2;
}
@@ -13817,7 +14275,7 @@ describe:
lex->sql_command= SQLCOM_SHOW_FIELDS;
lex->select_lex.db= null_clex_str;
lex->verbose= 0;
- if (prepare_schema_table(thd, lex, $2, SCH_COLUMNS))
+ if (unlikely(prepare_schema_table(thd, lex, $2, SCH_COLUMNS)))
MYSQL_YYABORT;
}
opt_describe_column
@@ -13863,9 +14321,9 @@ opt_format_json:
/* empty */ {}
| FORMAT_SYM '=' ident_or_text
{
- if (!my_strcasecmp(system_charset_info, $3.str, "JSON"))
+ if (lex_string_eq(&$3, STRING_WITH_LEN("JSON")))
Lex->explain_json= true;
- else if (!my_strcasecmp(system_charset_info, $3.str, "TRADITIONAL"))
+ else if (lex_string_eq(&$3, STRING_WITH_LEN("TRADITIONAL")))
DBUG_ASSERT(Lex->explain_json==false);
else
my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), "EXPLAIN",
@@ -13881,7 +14339,7 @@ opt_describe_column:
Lex->wild= new (thd->mem_root) String((const char*) $1.str,
$1.length,
system_charset_info);
- if (Lex->wild == NULL)
+ if (unlikely(Lex->wild == NULL))
MYSQL_YYABORT;
}
;
@@ -13938,8 +14396,9 @@ flush_lock:
{ Lex->type|= REFRESH_READ_LOCK | $4; }
| FOR_SYM
{
- if (Lex->query_tables == NULL) // Table list can't be empty
+ if (unlikely(Lex->query_tables == NULL))
{
+ // Table list can't be empty
thd->parse_error(ER_NO_TABLES_USED);
MYSQL_YYABORT;
}
@@ -13962,12 +14421,12 @@ flush_option:
{ Lex->type|= REFRESH_GENERAL_LOG; }
| SLOW LOGS_SYM
{ Lex->type|= REFRESH_SLOW_LOG; }
- | BINARY LOGS_SYM
+ | BINARY LOGS_SYM opt_delete_gtid_domain
{ Lex->type|= REFRESH_BINARY_LOG; }
| RELAY LOGS_SYM optional_connection_name
{
LEX *lex= Lex;
- if (lex->type & REFRESH_RELAY_LOG)
+ if (unlikely(lex->type & REFRESH_RELAY_LOG))
my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH", "RELAY LOGS"));
lex->type|= REFRESH_RELAY_LOG;
lex->relay_log_connection_name= lex->mi.connection_name;
@@ -13988,7 +14447,7 @@ flush_option:
| SLAVE optional_connection_name
{
LEX *lex= Lex;
- if (lex->type & REFRESH_SLAVE)
+ if (unlikely(lex->type & REFRESH_SLAVE))
my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH","SLAVE"));
lex->type|= REFRESH_SLAVE;
lex->reset_slave_info.all= false;
@@ -14003,14 +14462,15 @@ flush_option:
{
Lex->type|= REFRESH_GENERIC;
ST_SCHEMA_TABLE *table= find_schema_table(thd, &$1);
- if (!table || !table->reset_table)
+ if (unlikely(!table || !table->reset_table))
{
thd->parse_error(ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT;
}
- Lex->view_list.push_back((LEX_CSTRING*)
- thd->memdup(&$1, sizeof(LEX_CSTRING)),
- thd->mem_root);
+ if (unlikely(Lex->view_list.push_back((LEX_CSTRING*)
+ thd->memdup(&$1, sizeof(LEX_CSTRING)),
+ thd->mem_root)))
+ MYSQL_YYABORT;
}
;
@@ -14019,6 +14479,24 @@ opt_table_list:
| table_list {}
;
+opt_delete_gtid_domain:
+ /* empty */ {}
+ | DELETE_DOMAIN_ID_SYM '=' '(' delete_domain_id_list ')'
+ {}
+ ;
+delete_domain_id_list:
+ /* Empty */
+ | delete_domain_id
+ | delete_domain_id_list ',' delete_domain_id
+ ;
+
+delete_domain_id:
+ ulong_num
+ {
+ insert_dynamic(&Lex->delete_gtid_domain, (uchar*) &($1));
+ }
+ ;
+
optional_flush_tables_arguments:
/* empty */ {$$= 0;}
| AND_SYM DISABLE_SYM CHECKPOINT_SYM {$$= REFRESH_CHECKPOINT; }
@@ -14161,7 +14639,7 @@ load:
{
LEX *lex= thd->lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
{
my_error(ER_SP_BADSTATEMENT, MYF(0),
$2 == FILETYPE_CSV ? "LOAD DATA" : "LOAD XML");
@@ -14175,14 +14653,17 @@ load:
lex->local_file= $5;
lex->duplicates= DUP_ERROR;
lex->ignore= 0;
- if (!(lex->exchange= new (thd->mem_root) sql_exchange($7.str, 0, $2)))
+ if (unlikely(!(lex->exchange= new (thd->mem_root)
+ sql_exchange($7.str, 0, $2))))
MYSQL_YYABORT;
}
opt_duplicate INTO TABLE_SYM table_ident opt_use_partition
{
LEX *lex=Lex;
- if (!Select->add_table_to_list(thd, $12, NULL, TL_OPTION_UPDATING,
- $4, MDL_SHARED_WRITE, NULL, $13))
+ if (unlikely(!Select->add_table_to_list(thd, $12, NULL,
+ TL_OPTION_UPDATING,
+ $4, MDL_SHARED_WRITE,
+ NULL, $13)))
MYSQL_YYABORT;
lex->field_list.empty();
lex->update_list.empty();
@@ -14320,7 +14801,7 @@ field_or_var:
| '@' ident_or_text
{
$$= new (thd->mem_root) Item_user_var_as_out_param(thd, &$2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -14339,8 +14820,8 @@ load_data_set_elem:
simple_ident_nospvar equal remember_name expr_or_default remember_end
{
LEX *lex= Lex;
- if (lex->update_list.push_back($1, thd->mem_root) ||
- lex->value_list.push_back($4, thd->mem_root))
+ if (unlikely(lex->update_list.push_back($1, thd->mem_root)) ||
+ unlikely(lex->value_list.push_back($4, thd->mem_root)))
MYSQL_YYABORT;
$4->set_name_no_truncate(thd, $3, (uint) ($5 - $3), thd->charset());
}
@@ -14351,22 +14832,22 @@ load_data_set_elem:
text_literal:
TEXT_STRING
{
- if (!($$= thd->make_string_literal($1)))
+ if (unlikely(!($$= thd->make_string_literal($1))))
MYSQL_YYABORT;
}
| NCHAR_STRING
{
- if (!($$= thd->make_string_literal_nchar($1)))
+ if (unlikely(!($$= thd->make_string_literal_nchar($1))))
MYSQL_YYABORT;
}
| UNDERSCORE_CHARSET TEXT_STRING
{
- if (!($$= thd->make_string_literal_charset($2, $1)))
+ if (unlikely(!($$= thd->make_string_literal_charset($2, $1))))
MYSQL_YYABORT;
}
| text_literal TEXT_STRING_literal
{
- if (!($$= $1->make_string_literal_concat(thd, &$2)))
+ if (unlikely(!($$= $1->make_string_literal_concat(thd, &$2))))
MYSQL_YYABORT;
}
;
@@ -14377,7 +14858,7 @@ text_string:
$$= new (thd->mem_root) String($1.str,
$1.length,
thd->variables.collation_connection);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| hex_or_bin_String { $$= $1; }
@@ -14389,7 +14870,7 @@ hex_or_bin_String:
{
Item *tmp= new (thd->mem_root) Item_hex_hybrid(thd, $1.str,
$1.length);
- if (tmp == NULL)
+ if (unlikely(tmp == NULL))
MYSQL_YYABORT;
/*
it is OK only emulate fix_fields, because we need only
@@ -14402,7 +14883,7 @@ hex_or_bin_String:
{
Item *tmp= new (thd->mem_root) Item_hex_string(thd, $1.str,
$1.length);
- if (tmp == NULL)
+ if (unlikely(tmp == NULL))
MYSQL_YYABORT;
tmp->quick_fix_field();
$$= tmp->val_str((String*) 0);
@@ -14411,7 +14892,7 @@ hex_or_bin_String:
{
Item *tmp= new (thd->mem_root) Item_bin_string(thd, $1.str,
$1.length);
- if (tmp == NULL)
+ if (unlikely(tmp == NULL))
MYSQL_YYABORT;
/*
it is OK only emulate fix_fields, because we need only
@@ -14425,21 +14906,21 @@ hex_or_bin_String:
param_marker:
PARAM_MARKER
{
- if (!($$= Lex->add_placeholder(thd, &param_clex_str,
- YYLIP->get_tok_start(),
- YYLIP->get_tok_start() + 1)))
+ if (unlikely(!($$= Lex->add_placeholder(thd, &param_clex_str,
+ YYLIP->get_tok_start(),
+ YYLIP->get_tok_start() + 1))))
MYSQL_YYABORT;
}
- | colon_with_pos ident
+ | colon_with_pos ident_cli
{
- if (!($$= Lex->add_placeholder(thd, &null_clex_str,
- $1, YYLIP->get_tok_end())))
+ if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str,
+ $1, $2.end()))))
MYSQL_YYABORT;
}
| colon_with_pos NUM
{
- if (!($$= Lex->add_placeholder(thd, &null_clex_str,
- $1, YYLIP->get_ptr())))
+ if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str,
+ $1, YYLIP->get_ptr()))))
MYSQL_YYABORT;
}
;
@@ -14467,38 +14948,38 @@ literal:
*/
YYLIP->reduce_digest_token(TOK_GENERIC_VALUE, NULL_SYM);
$$= new (thd->mem_root) Item_null(thd);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
YYLIP->next_state= MY_LEX_OPERATOR_OR_IDENT;
}
| FALSE_SYM
{
$$= new (thd->mem_root) Item_bool(thd, (char*) "FALSE",0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| TRUE_SYM
{
$$= new (thd->mem_root) Item_bool(thd, (char*) "TRUE",1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| HEX_NUM
{
$$= new (thd->mem_root) Item_hex_hybrid(thd, $1.str, $1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| HEX_STRING
{
$$= new (thd->mem_root) Item_hex_string(thd, $1.str, $1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| BIN_NUM
{
$$= new (thd->mem_root) Item_bin_string(thd, $1.str, $1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| UNDERSCORE_CHARSET hex_or_bin_String
@@ -14511,7 +14992,8 @@ literal:
item_str= new (thd->mem_root)
Item_string_with_introducer(thd, NULL, $2->ptr(), $2->length(),
$1);
- if (!item_str || !item_str->check_well_formed_result(true))
+ if (unlikely(!item_str ||
+ !item_str->check_well_formed_result(true)))
MYSQL_YYABORT;
$$= item_str;
@@ -14526,7 +15008,7 @@ NUM_literal:
Item_int(thd, $1.str,
(longlong) my_strtoll10($1.str, NULL, &error),
$1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| LONG_NUM
@@ -14536,31 +15018,27 @@ NUM_literal:
Item_int(thd, $1.str,
(longlong) my_strtoll10($1.str, NULL, &error),
$1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| ULONGLONG_NUM
{
$$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DECIMAL_NUM
{
$$= new (thd->mem_root) Item_decimal(thd, $1.str, $1.length,
thd->charset());
- if (($$ == NULL) || (thd->is_error()))
- {
+ if (unlikely($$ == NULL) || unlikely(thd->is_error()))
MYSQL_YYABORT;
- }
}
| FLOAT_NUM
{
$$= new (thd->mem_root) Item_float(thd, $1.str, $1.length);
- if (($$ == NULL) || (thd->is_error()))
- {
+ if (unlikely($$ == NULL) || unlikely(thd->is_error()))
MYSQL_YYABORT;
- }
}
;
@@ -14568,20 +15046,26 @@ NUM_literal:
temporal_literal:
DATE_SYM TEXT_STRING
{
- if (!($$= create_temporal_literal(thd, $2.str, $2.length, YYCSCL,
- MYSQL_TYPE_DATE, true)))
+ if (unlikely(!($$= create_temporal_literal(thd, $2.str, $2.length,
+ YYCSCL,
+ MYSQL_TYPE_DATE,
+ true))))
MYSQL_YYABORT;
}
| TIME_SYM TEXT_STRING
{
- if (!($$= create_temporal_literal(thd, $2.str, $2.length, YYCSCL,
- MYSQL_TYPE_TIME, true)))
+ if (unlikely(!($$= create_temporal_literal(thd, $2.str, $2.length,
+ YYCSCL,
+ MYSQL_TYPE_TIME,
+ true))))
MYSQL_YYABORT;
}
| TIMESTAMP TEXT_STRING
{
- if (!($$= create_temporal_literal(thd, $2.str, $2.length, YYCSCL,
- MYSQL_TYPE_DATETIME, true)))
+ if (unlikely(!($$= create_temporal_literal(thd, $2.str, $2.length,
+ YYCSCL,
+ MYSQL_TYPE_DATETIME,
+ true))))
MYSQL_YYABORT;
}
;
@@ -14601,7 +15085,7 @@ with_clause:
{
With_clause *with_clause=
new With_clause($2, Lex->curr_with_clause);
- if (with_clause == NULL)
+ if (unlikely(with_clause == NULL))
MYSQL_YYABORT;
Lex->derived_tables|= DERIVED_WITH;
Lex->curr_with_clause= with_clause;
@@ -14632,16 +15116,17 @@ with_list_element:
opt_with_column_list
{
$2= new List<LEX_CSTRING> (Lex->with_column_list);
- if ($2 == NULL)
+ if (unlikely($2 == NULL))
MYSQL_YYABORT;
Lex->with_column_list.empty();
}
AS '(' remember_name subselect remember_end ')'
{
With_element *elem= new With_element($1, *$2, $7->master_unit());
- if (elem == NULL || Lex->curr_with_clause->add_with_element(elem))
+ if (unlikely(elem == NULL) ||
+ unlikely(Lex->curr_with_clause->add_with_element(elem)))
MYSQL_YYABORT;
- if (elem->set_unparsed_spec(thd, $6+1, $8))
+ if (unlikely(elem->set_unparsed_spec(thd, $6+1, $8)))
MYSQL_YYABORT;
}
;
@@ -14673,7 +15158,7 @@ query_name:
ident
{
$$= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING));
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -14692,24 +15177,26 @@ insert_ident:
table_wild:
ident '.' '*'
{
- SELECT_LEX *sel= Select;
- $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
- NullS, $1.str, &star_clex_str);
- if ($$ == NULL)
+ if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1))))
MYSQL_YYABORT;
- sel->with_wild++;
}
| ident '.' ident '.' '*'
{
- SELECT_LEX *sel= Select;
- const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
- NullS : $1.str;
- $$= new (thd->mem_root) Item_field(thd, Lex->current_context(),
- schema,
- $3.str, &star_clex_str);
- if ($$ == NULL)
+ if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1, &$3))))
+ MYSQL_YYABORT;
+ }
+ ;
+
+select_sublist_qualified_asterisk:
+ ident_cli '.' '*'
+ {
+ if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1))))
+ MYSQL_YYABORT;
+ }
+ | ident_cli '.' ident_cli '.' '*'
+ {
+ if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1, &$3))))
MYSQL_YYABORT;
- sel->with_wild++;
}
;
@@ -14717,21 +15204,32 @@ order_ident:
expr { $$=$1; }
;
+
simple_ident:
- ident
+ ident_cli
{
- Lex_input_stream *lip= YYLIP;
- if (!($$= Lex->create_item_ident(thd, &$1,
- lip->get_tok_start_prev(),
- lip->get_tok_end())))
+ if (unlikely(!($$= Lex->create_item_ident(thd, &$1))))
MYSQL_YYABORT;
}
- | simple_ident_q2
- | ident '.' ident
+ | ident_cli '.' ident_cli
{
- LEX *lex= thd->lex;
- if (!($$= lex->create_item_ident(thd, &$1, &$3,
- $1.m_pos, YYLIP->get_tok_end())))
+ if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3))))
+ MYSQL_YYABORT;
+ }
+ | '.' ident_cli '.' ident_cli
+ {
+ Lex_ident_cli empty($2.pos(), 0);
+ if (unlikely(!($$= Lex->create_item_ident(thd, &empty, &$2, &$4))))
+ MYSQL_YYABORT;
+ }
+ | ident_cli '.' ident_cli '.' ident_cli
+ {
+ if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3, &$5))))
+ MYSQL_YYABORT;
+ }
+ | colon_with_pos ident_cli '.' ident_cli
+ {
+ if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4))))
MYSQL_YYABORT;
}
;
@@ -14739,47 +15237,28 @@ simple_ident:
simple_ident_nospvar:
ident
{
- if (!($$= Lex->create_item_ident_nosp(thd, &$1)))
+ if (unlikely(!($$= Lex->create_item_ident_nosp(thd, &$1))))
MYSQL_YYABORT;
}
- | simple_ident_q { $$= $1; }
- ;
-
-simple_ident_q:
- ident '.' ident
+ | ident '.' ident
{
- if (!($$= Lex->create_item_ident_nospvar(thd, &$1, &$3)))
+ if (unlikely(!($$= Lex->create_item_ident_nospvar(thd, &$1, &$3))))
MYSQL_YYABORT;
}
- | simple_ident_q2
- ;
-
-simple_ident_q2:
- colon_with_pos ident '.' ident
+ | colon_with_pos ident_cli '.' ident_cli
{
- LEX *lex= Lex;
- if (lex->is_trigger_new_or_old_reference(&$2))
- {
- bool new_row= ($2.str[0]=='N' || $2.str[0]=='n');
- if (!($$= lex->create_and_link_Item_trigger_field(thd,
- &$4,
- new_row)))
- MYSQL_YYABORT;
- }
- else
- {
- thd->parse_error();
+ if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4))))
MYSQL_YYABORT;
- }
}
| '.' ident '.' ident
{
- if (!($$= Lex->create_item_ident(thd, &null_clex_str, &$2, &$4)))
+ Lex_ident_sys none;
+ if (unlikely(!($$= Lex->create_item_ident(thd, &none, &$2, &$4))))
MYSQL_YYABORT;
}
| ident '.' ident '.' ident
{
- if (!($$= Lex->create_item_ident(thd, &$1, &$3, &$5)))
+ if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3, &$5))))
MYSQL_YYABORT;
}
;
@@ -14789,17 +15268,19 @@ field_ident:
| ident '.' ident '.' ident
{
TABLE_LIST *table= Select->table_list.first;
- if (my_strcasecmp(table_alias_charset, $1.str, table->db.str))
+ if (unlikely(my_strcasecmp(table_alias_charset, $1.str,
+ table->db.str)))
my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
- if (my_strcasecmp(table_alias_charset, $3.str,
- table->table_name.str))
+ if (unlikely(my_strcasecmp(table_alias_charset, $3.str,
+ table->table_name.str)))
my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3.str));
$$=$5;
}
| ident '.' ident
{
TABLE_LIST *table= Select->table_list.first;
- if (my_strcasecmp(table_alias_charset, $1.str, table->alias.str))
+ if (unlikely(my_strcasecmp(table_alias_charset, $1.str,
+ table->alias.str)))
my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $1.str));
$$=$3;
}
@@ -14810,20 +15291,20 @@ table_ident:
ident
{
$$= new (thd->mem_root) Table_ident(&$1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| ident '.' ident
{
$$= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| '.' ident
{
/* For Delphi */
$$= new (thd->mem_root) Table_ident(&$2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -14832,13 +15313,13 @@ table_ident_opt_wild:
ident opt_wild
{
$$= new (thd->mem_root) Table_ident(&$1);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| ident '.' ident opt_wild
{
$$= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -14848,150 +15329,93 @@ table_ident_nodb:
{
LEX_CSTRING db={(char*) any_db,3};
$$= new (thd->mem_root) Table_ident(thd, &db, &$1, 0);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
-IDENT_sys:
- IDENT { $$= $1; }
+IDENT_cli:
+ IDENT
+ | IDENT_QUOTED
+ ;
+
+ident_cli:
+ IDENT
| IDENT_QUOTED
+ | keyword { $$= $1; }
+ ;
+
+IDENT_sys:
+ IDENT_cli
{
- if (thd->charset_is_system_charset)
- {
- CHARSET_INFO *cs= system_charset_info;
- size_t wlen= Well_formed_prefix(cs, $1.str, $1.length).length();
- if (wlen < $1.length)
- {
- ErrConvString err($1.str, $1.length, &my_charset_bin);
- my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
- cs->csname, err.ptr());
- MYSQL_YYABORT;
- }
- $$= $1;
- }
- else
- {
- LEX_STRING to;
- if (thd->convert_with_error(system_charset_info, &to,
- thd->charset(), $1.str, $1.length))
- MYSQL_YYABORT;
- $$.str= to.str;
- $$.length= to.length;
- }
+ if (unlikely(thd->to_ident_sys_alloc(&$$, &$1)))
+ MYSQL_YYABORT;
}
;
TEXT_STRING_sys:
TEXT_STRING
{
- if (thd->charset_is_system_charset)
- $$= $1;
- else
- {
- LEX_STRING to;
- if (thd->convert_string(&to, system_charset_info,
- $1.str, $1.length, thd->charset()))
- MYSQL_YYABORT;
- $$.str= to.str;
- $$.length= to.length;
- }
+ if (thd->make_text_string_sys(&$$, &$1))
+ MYSQL_YYABORT;
}
;
TEXT_STRING_literal:
TEXT_STRING
{
- if (thd->charset_is_collation_connection)
- $$= $1;
- else
- {
- LEX_STRING to;
- if (thd->convert_string(&to, thd->variables.collation_connection,
- $1.str, $1.length, thd->charset()))
- MYSQL_YYABORT;
- $$.str= to.str;
- $$.length= to.length;
- }
+ if (thd->make_text_string_connection(&$$, &$1))
+ MYSQL_YYABORT;
}
;
TEXT_STRING_filesystem:
TEXT_STRING
{
- if (thd->charset_is_character_set_filesystem)
- $$= $1;
- else
- {
- LEX_STRING to;
- if (thd->convert_string(&to,
- thd->variables.character_set_filesystem,
- $1.str, $1.length, thd->charset()))
- MYSQL_YYABORT;
- $$.str= to.str;
- $$.length= to.length;
- }
+ if (thd->make_text_string_filesystem(&$$, &$1))
+ MYSQL_YYABORT;
}
;
-ident:
+ident_table_alias:
IDENT_sys
+ | keyword_alias
{
- (LEX_CSTRING &)$$= $1;
- $$.m_pos= (char *) YYLIP->get_tok_start_prev();
- }
- | keyword
- {
- $$.str= thd->strmake($1.str, $1.length);
- if ($$.str == NULL)
+ if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
- $$.length= $1.length;
- $$.m_pos= (char *) YYLIP->get_tok_start_prev();
}
;
-ident_with_tok_start:
+ident:
IDENT_sys
- {
- (LEX_CSTRING &)$$= $1;
- $$.m_pos= (char *) YYLIP->get_tok_start();
- }
| keyword
{
- if (!($$.str= thd->strmake($1.str, $1.length)))
+ if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
- $$.length= $1.length;
- $$.m_pos= (char *) YYLIP->get_tok_start();
}
;
ident_directly_assignable:
- IDENT_sys { $$=$1; }
+ IDENT_sys
| keyword_directly_assignable
{
- $$.str= thd->strmake($1.str, $1.length);
- if ($$.str == NULL)
+ if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
- $$.length= $1.length;
}
| keyword_sp
{
- $$.str= thd->strmake($1.str, $1.length);
- if ($$.str == NULL)
+ if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
- $$.length= $1.length;
}
;
label_ident:
- IDENT_sys { $$=$1; }
+ IDENT_sys
| keyword_sp
{
- $$.str= thd->strmake($1.str, $1.length);
- if ($$.str == NULL)
+ if ($$.copy_keyword(thd, &$1))
MYSQL_YYABORT;
- $$.length= $1.length;
}
;
@@ -15003,7 +15427,7 @@ labels_declaration_oracle:
label_declaration_oracle:
SHIFT_LEFT label_ident SHIFT_RIGHT
{
- if (Lex->sp_push_goto_label(thd, &$2))
+ if (unlikely(Lex->sp_push_goto_label(thd, &$2)))
MYSQL_YYABORT;
$$= $2;
}
@@ -15018,28 +15442,28 @@ ident_or_text:
user_maybe_role:
ident_or_text
{
- if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))
+ if (unlikely(!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
$$->user = $1;
$$->host= null_clex_str; // User or Role, see get_current_user()
$$->reset_auth();
- if (check_string_char_length(&$$->user, ER_USERNAME,
- username_char_length,
- system_charset_info, 0))
+ if (unlikely(check_string_char_length(&$$->user, ER_USERNAME,
+ username_char_length,
+ system_charset_info, 0)))
MYSQL_YYABORT;
}
| ident_or_text '@' ident_or_text
{
- if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))
+ if (unlikely(!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
$$->user = $1; $$->host=$3;
$$->reset_auth();
- if (check_string_char_length(&$$->user, ER_USERNAME,
- username_char_length,
- system_charset_info, 0) ||
- check_host_name(&$$->host))
+ if (unlikely(check_string_char_length(&$$->user, ER_USERNAME,
+ username_char_length,
+ system_charset_info, 0)) ||
+ unlikely(check_host_name(&$$->host)))
MYSQL_YYABORT;
if ($$->host.str[0])
{
@@ -15061,7 +15485,7 @@ user_maybe_role:
}
| CURRENT_USER optional_braces
{
- if (!($$=(LEX_USER*)thd->calloc(sizeof(LEX_USER))))
+ if (unlikely(!($$=(LEX_USER*)thd->calloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
$$->user= current_user;
$$->plugin= empty_clex_str;
@@ -15079,70 +15503,79 @@ user: user_maybe_role
}
;
-/* Keyword that we allow for identifiers (except SP labels) */
-keyword:
- keyword_sp {}
- | keyword_directly_assignable {}
- | keyword_directly_not_assignable {}
+/* Keywords which we allow as table aliases. */
+keyword_alias:
+ keyword_sp
+ | keyword_directly_assignable
+ | keyword_directly_not_assignable
;
+/* Keyword that we allow for identifiers (except SP labels) */
+keyword: keyword_alias | WINDOW_SYM;
+
/*
Keywords that we allow in Oracle-style direct assignments:
xxx := 10;
*/
keyword_directly_assignable:
- ASCII_SYM {}
- | BACKUP_SYM {}
- | BINLOG_SYM {}
- | BYTE_SYM {}
- | CACHE_SYM {}
- | CHECKSUM_SYM {}
- | CHECKPOINT_SYM {}
- | COLUMN_ADD_SYM {}
- | COLUMN_CHECK_SYM {}
- | COLUMN_CREATE_SYM {}
- | COLUMN_DELETE_SYM {}
- | COLUMN_GET_SYM {}
- | DEALLOCATE_SYM {}
- | EXAMINED_SYM {}
- | EXCLUDE_SYM {}
- | EXECUTE_SYM {}
- | FLUSH_SYM {}
- | FOLLOWING_SYM {}
- | FORMAT_SYM {}
- | GET_SYM {}
- | HELP_SYM {}
- | HOST_SYM {}
- | INSTALL_SYM {}
- | OPTION {}
- | OPTIONS_SYM {}
- | OWNER_SYM {}
- | PARSER_SYM {}
- | PORT_SYM {}
- | PRECEDING_SYM {}
- | PREPARE_SYM {}
- | REMOVE_SYM {}
- | RESET_SYM {}
- | RESTORE_SYM {}
- | SECURITY_SYM {}
- | SERVER_SYM {}
- | SIGNED_SYM {}
- | SOCKET_SYM {}
- | SLAVE {}
- | SLAVES {}
- | SONAME_SYM {}
- | START_SYM {}
- | STOP_SYM {}
- | STORED_SYM {}
- | TIES_SYM {}
- | UNICODE_SYM {}
- | UNINSTALL_SYM {}
- | UNBOUNDED_SYM {}
- | WITHIN {}
- | WRAPPER_SYM {}
- | XA_SYM {}
- | UPGRADE_SYM {}
+ ASCII_SYM
+ | BACKUP_SYM
+ | BINLOG_SYM
+ | BYTE_SYM
+ | CACHE_SYM
+ | CHECKSUM_SYM
+ | CHECKPOINT_SYM
+ | COLUMN_ADD_SYM
+ | COLUMN_CHECK_SYM
+ | COLUMN_CREATE_SYM
+ | COLUMN_DELETE_SYM
+ | COLUMN_GET_SYM
+ | DEALLOCATE_SYM
+ | EXAMINED_SYM
+ | EXCLUDE_SYM
+ | EXECUTE_SYM
+ | FLUSH_SYM
+ | FOLLOWING_SYM
+ | FORMAT_SYM
+ | GET_SYM
+ | HELP_SYM
+ | HISTORY_SYM
+ | HOST_SYM
+ | INSTALL_SYM
+ | OPTION
+ | OPTIONS_SYM
+ | OWNER_SYM
+ | PARSER_SYM
+ | PERIOD_SYM
+ | PORT_SYM
+ | PRECEDING_SYM
+ | PREPARE_SYM
+ | REMOVE_SYM
+ | RESET_SYM
+ | RESTORE_SYM
+ | SECURITY_SYM
+ | SERVER_SYM
+ | SIGNED_SYM
+ | SOCKET_SYM
+ | SLAVE
+ | SLAVES
+ | SONAME_SYM
+ | START_SYM
+ | STOP_SYM
+ | STORED_SYM
+ | SYSTEM
+ | SYSTEM_TIME_SYM
+ | TIES_SYM
+ | UNICODE_SYM
+ | UNINSTALL_SYM
+ | UNBOUNDED_SYM
+ | VERSIONING_SYM
+ | WITHIN
+ | WITHOUT
+ | WRAPPER_SYM
+ | XA_SYM
+ | UPGRADE_SYM
;
/*
@@ -15182,13 +15615,13 @@ keyword_directly_assignable:
CREATE TRIGGER .. FOR EACH ROW FOLLOWS tr1 a:= 10;
*/
keyword_directly_not_assignable:
- CONTAINS_SYM { /* SP characteristic */ }
- | LANGUAGE_SYM { /* SP characteristic */ }
- | NO_SYM { /* SP characteristic */ }
- | CHARSET { /* SET CHARSET utf8; */ }
- | FOLLOWS_SYM { /* Conflicts with assignment in FOR EACH */}
- | PRECEDES_SYM { /* Conflicts with assignment in FOR EACH */}
- | keyword_sp_verb_clause { }
+ CONTAINS_SYM /* SP characteristic */
+ | LANGUAGE_SYM /* SP characteristic */
+ | NO_SYM /* SP characteristic */
+ | CHARSET /* SET CHARSET utf8; */
+ | FOLLOWS_SYM /* Conflicts with assignment in FOR EACH */
+ | PRECEDES_SYM /* Conflicts with assignment in FOR EACH */
+ | keyword_sp_verb_clause
;
/*
@@ -15200,7 +15633,7 @@ keyword_directly_not_assignable:
keyword_sp:
keyword_sp_data_type
| keyword_sp_not_data_type
- | FUNCTION_SYM { /* Oracle-PLSQL-R */}
+ | FUNCTION_SYM /* Oracle-PLSQL-R */
;
@@ -15212,19 +15645,19 @@ keyword_sp:
xxx:=10
*/
keyword_sp_verb_clause:
- BEGIN_SYM { /* Compound. Reserved in Oracle */ }
- | CLOSE_SYM { /* Verb clause. Reserved in Oracle */ }
- | COMMIT_SYM { /* Verb clause. Reserved in Oracle */ }
- | EXCEPTION_SYM { /* EXCEPTION section in SP blocks */ }
- | DO_SYM { /* Verb clause */ }
- | END { /* Compound. Reserved in Oracle */ }
- | HANDLER_SYM { /* Verb clause */ }
- | OPEN_SYM { /* Verb clause. Reserved in Oracle */ }
- | REPAIR { /* Verb clause */ }
- | ROLLBACK_SYM { /* Verb clause. Reserved in Oracle */ }
- | SAVEPOINT_SYM { /* Verb clause. Reserved in Oracle */ }
- | SHUTDOWN { /* Verb clause */ }
- | TRUNCATE_SYM { /* Verb clause. Reserved in Oracle */ }
+ BEGIN_SYM /* Compound. Reserved in Oracle */
+ | CLOSE_SYM /* Verb clause. Reserved in Oracle */
+ | COMMIT_SYM /* Verb clause. Reserved in Oracle */
+ | EXCEPTION_SYM /* EXCEPTION section in SP blocks */
+ | DO_SYM /* Verb clause */
+ | END /* Compound. Reserved in Oracle */
+ | HANDLER_SYM /* Verb clause */
+ | OPEN_SYM /* Verb clause. Reserved in Oracle */
+ | REPAIR /* Verb clause */
+ | ROLLBACK_SYM /* Verb clause. Reserved in Oracle */
+ | SAVEPOINT_SYM /* Verb clause. Reserved in Oracle */
+ | SHUTDOWN /* Verb clause */
+ | TRUNCATE_SYM /* Verb clause. Reserved in Oracle */
;
@@ -15233,349 +15666,352 @@ keyword_sp_verb_clause:
but not allowed as non-delimited SP variable names in sql_mode=ORACLE.
*/
keyword_sp_data_type:
- BIT_SYM {}
- | BOOLEAN_SYM {} /* PLSQL-R */
- | BOOL_SYM {}
- | CLOB {}
- | DATE_SYM {} /* Oracle-R, PLSQL-R */
- | DATETIME {}
- | ENUM {}
- | FIXED_SYM {}
- | GEOMETRYCOLLECTION {}
- | GEOMETRY_SYM {}
- | JSON_SYM {}
- | LINESTRING {}
- | MEDIUM_SYM {}
- | MULTILINESTRING {}
- | MULTIPOINT {}
- | MULTIPOLYGON {}
- | NATIONAL_SYM {}
- | NCHAR_SYM {}
- | NUMBER_SYM {} /* Oracle-R, PLSQL-R */
- | NVARCHAR_SYM {}
- | POINT_SYM {}
- | POLYGON {}
- | RAW {} /* Oracle-R */
- | ROW_SYM {}
- | SERIAL_SYM {}
- | TEXT_SYM {}
- | TIMESTAMP {}
- | TIME_SYM {} /* Oracle-R */
- | VARCHAR2 {} /* Oracle-R, PLSQL-R */
- | YEAR_SYM {}
+ BIT_SYM
+ | BOOLEAN_SYM
+ | BOOL_SYM
+ | CLOB
+ | DATE_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
+ | DATETIME
+ | ENUM
+ | FIXED_SYM
+ | GEOMETRYCOLLECTION
+ | GEOMETRY_SYM
+ | JSON_SYM
+ | LINESTRING
+ | MEDIUM_SYM
+ | MULTILINESTRING
+ | MULTIPOINT
+ | MULTIPOLYGON
+ | NATIONAL_SYM
+ | NCHAR_SYM
+ | NUMBER_SYM
+ | NVARCHAR_SYM
+ | POINT_SYM
+ | POLYGON
+ | RAW
+ | ROW_SYM
+ | SERIAL_SYM
+ | TEXT_SYM
+ | TIMESTAMP %prec PREC_BELOW_CONTRACTION_TOKEN2
+ | TIME_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
+ | VARCHAR2
+ | YEAR_SYM
;
keyword_sp_not_data_type:
- ACTION {}
- | ADDDATE_SYM {}
- | ADMIN_SYM {}
- | AFTER_SYM {}
- | AGAINST {}
- | AGGREGATE_SYM {}
- | ALGORITHM_SYM {}
- | ALWAYS_SYM {}
- | ANY_SYM {}
- | AT_SYM {}
- | ATOMIC_SYM {}
- | AUTHORS_SYM {}
- | AUTO_INC {}
- | AUTOEXTEND_SIZE_SYM {}
- | AUTO_SYM {}
- | AVG_ROW_LENGTH {}
- | AVG_SYM {}
- | BLOCK_SYM {}
- | BTREE_SYM {}
- | CASCADED {}
- | CATALOG_NAME_SYM {}
- | CHAIN_SYM {}
- | CHANGED {}
- | CIPHER_SYM {}
- | CLIENT_SYM {}
- | CLASS_ORIGIN_SYM {}
- | COALESCE {}
- | CODE_SYM {}
- | COLLATION_SYM {}
- | COLUMN_NAME_SYM {}
- | COLUMNS {}
- | COMMITTED_SYM {}
- | COMPACT_SYM {}
- | COMPLETION_SYM {}
- | COMPRESSED_SYM {}
- | CONCURRENT {}
- | CONNECTION_SYM {}
- | CONSISTENT_SYM {}
- | CONSTRAINT_CATALOG_SYM {}
- | CONSTRAINT_SCHEMA_SYM {}
- | CONSTRAINT_NAME_SYM {}
- | CONTEXT_SYM {}
- | CONTRIBUTORS_SYM {}
- | CURRENT_POS_SYM {}
- | CPU_SYM {}
- | CUBE_SYM {}
+ ACTION
+ | ADDDATE_SYM
+ | ADMIN_SYM
+ | AFTER_SYM
+ | AGAINST
+ | AGGREGATE_SYM
+ | ALGORITHM_SYM
+ | ALWAYS_SYM
+ | ANY_SYM
+ | AT_SYM
+ | ATOMIC_SYM
+ | AUTHORS_SYM
+ | AUTO_INC
+ | AUTOEXTEND_SIZE_SYM
+ | AUTO_SYM
+ | AVG_ROW_LENGTH
+ | AVG_SYM
+ | BLOCK_SYM
+ | BTREE_SYM
+ | CASCADED
+ | CATALOG_NAME_SYM
+ | CHAIN_SYM
+ | CHANGED
+ | CIPHER_SYM
+ | CLIENT_SYM
+ | CLASS_ORIGIN_SYM
+ | COALESCE
+ | CODE_SYM
+ | COLLATION_SYM
+ | COLUMN_NAME_SYM
+ | COLUMNS
+ | COMMITTED_SYM
+ | COMPACT_SYM
+ | COMPLETION_SYM
+ | COMPRESSED_SYM
+ | CONCURRENT
+ | CONNECTION_SYM
+ | CONSISTENT_SYM
+ | CONSTRAINT_CATALOG_SYM
+ | CONSTRAINT_SCHEMA_SYM
+ | CONSTRAINT_NAME_SYM
+ | CONTEXT_SYM
+ | CONTRIBUTORS_SYM
+ | CURRENT_POS_SYM
+ | CPU_SYM
+ | CUBE_SYM
/*
Although a reserved keyword in SQL:2003 (and :2008),
not reserved in MySQL per WL#2111 specification.
*/
- | CURRENT_SYM {}
- | CURSOR_NAME_SYM {}
- | CYCLE_SYM {}
- | DATA_SYM {}
- | DATAFILE_SYM {}
- | DATE_FORMAT_SYM {}
- | DAY_SYM {}
- | DECODE_SYM {}
- | DEFINER_SYM {}
- | DELAY_KEY_WRITE_SYM {}
- | DES_KEY_FILE {}
- | DIAGNOSTICS_SYM {}
- | DIRECTORY_SYM {}
- | DISABLE_SYM {}
- | DISCARD {}
- | DISK_SYM {}
- | DUMPFILE {}
- | DUPLICATE_SYM {}
- | DYNAMIC_SYM {}
- | ENDS_SYM {}
- | ENGINE_SYM {}
- | ENGINES_SYM {}
- | ERROR_SYM {}
- | ERRORS {}
- | ESCAPE_SYM {}
- | EVENT_SYM {}
- | EVENTS_SYM {}
- | EVERY_SYM {}
- | EXCHANGE_SYM {}
- | EXPANSION_SYM {}
- | EXPORT_SYM {}
- | EXTENDED_SYM {}
- | EXTENT_SIZE_SYM {}
- | FAULTS_SYM {}
- | FAST_SYM {}
- | FOUND_SYM {}
- | ENABLE_SYM {}
- | FULL {}
- | FILE_SYM {}
- | FIRST_SYM {}
- | GENERAL {}
- | GENERATED_SYM {}
- | GET_FORMAT {}
- | GRANTS {}
- | GLOBAL_SYM {}
- | HASH_SYM {}
- | HARD_SYM {}
- | INVISIBLE_SYM {}
- | HOSTS_SYM {}
- | HOUR_SYM {}
- | ID_SYM {}
- | IDENTIFIED_SYM {}
- | IGNORE_SERVER_IDS_SYM {}
- | INCREMENT_SYM {}
- | IMMEDIATE_SYM {} /* SQL-2003-R */
- | INVOKER_SYM {}
- | IMPORT {}
- | INDEXES {}
- | INITIAL_SIZE_SYM {}
- | IO_SYM {}
- | IPC_SYM {}
- | ISOLATION {}
- | ISOPEN_SYM {}
- | ISSUER_SYM {}
- | INSERT_METHOD {}
- | KEY_BLOCK_SIZE {}
- | LAST_VALUE {}
- | LAST_SYM {}
- | LASTVAL_SYM {}
- | LEAVES {}
- | LESS_SYM {}
- | LEVEL_SYM {}
- | LIST_SYM {}
- | LOCAL_SYM {}
- | LOCKS_SYM {}
- | LOGFILE_SYM {}
- | LOGS_SYM {}
- | MAX_ROWS {}
- | MASTER_SYM {}
- | MASTER_HEARTBEAT_PERIOD_SYM {}
- | MASTER_GTID_POS_SYM {}
- | MASTER_HOST_SYM {}
- | MASTER_PORT_SYM {}
- | MASTER_LOG_FILE_SYM {}
- | MASTER_LOG_POS_SYM {}
- | MASTER_USER_SYM {}
- | MASTER_USE_GTID_SYM {}
- | MASTER_PASSWORD_SYM {}
- | MASTER_SERVER_ID_SYM {}
- | MASTER_CONNECT_RETRY_SYM {}
- | MASTER_DELAY_SYM {}
- | MASTER_SSL_SYM {}
- | MASTER_SSL_CA_SYM {}
- | MASTER_SSL_CAPATH_SYM {}
- | MASTER_SSL_CERT_SYM {}
- | MASTER_SSL_CIPHER_SYM {}
- | MASTER_SSL_CRL_SYM {}
- | MASTER_SSL_CRLPATH_SYM {}
- | MASTER_SSL_KEY_SYM {}
- | MAX_CONNECTIONS_PER_HOUR {}
- | MAX_QUERIES_PER_HOUR {}
- | MAX_SIZE_SYM {}
- | MAX_STATEMENT_TIME_SYM {}
- | MAX_UPDATES_PER_HOUR {}
- | MAX_USER_CONNECTIONS_SYM {}
- | MEMORY_SYM {}
- | MERGE_SYM {}
- | MESSAGE_TEXT_SYM {}
- | MICROSECOND_SYM {}
- | MIGRATE_SYM {}
- | MINUTE_SYM {}
- | MINVALUE_SYM {}
- | MIN_ROWS {}
- | MODIFY_SYM {}
- | MODE_SYM {}
- | MONTH_SYM {}
- | MUTEX_SYM {}
- | MYSQL_SYM {}
- | MYSQL_ERRNO_SYM {}
- | NAME_SYM {}
- | NAMES_SYM {}
- | NEXT_SYM {}
- | NEXTVAL_SYM {}
- | NEW_SYM {}
- | NOCACHE_SYM {}
- | NOCYCLE_SYM {}
- | NOMINVALUE_SYM {}
- | NOMAXVALUE_SYM {}
- | NO_WAIT_SYM {}
- | NOWAIT_SYM {}
- | NODEGROUP_SYM {}
- | NONE_SYM {}
- | NOTFOUND_SYM {}
- | OF_SYM {} /* SQL-1999-R, Oracle-R */
- | OFFSET_SYM {}
- | OLD_PASSWORD_SYM {}
- | ONE_SYM {}
- | ONLINE_SYM {}
- | ONLY_SYM {}
- | PACK_KEYS_SYM {}
- | PAGE_SYM {}
- | PARTIAL {}
- | PARTITIONING_SYM {}
- | PARTITIONS_SYM {}
- | PASSWORD_SYM {}
- | PERSISTENT_SYM {}
- | PHASE_SYM {}
- | PLUGIN_SYM {}
- | PLUGINS_SYM {}
- | PRESERVE_SYM {}
- | PREV_SYM {}
- | PREVIOUS_SYM {}
- | PRIVILEGES {}
- | PROCESS {}
- | PROCESSLIST_SYM {}
- | PROFILE_SYM {}
- | PROFILES_SYM {}
- | PROXY_SYM {}
- | QUARTER_SYM {}
- | QUERY_SYM {}
- | QUICK {}
- | READ_ONLY_SYM {}
- | REBUILD_SYM {}
- | RECOVER_SYM {}
- | REDO_BUFFER_SIZE_SYM {}
- | REDOFILE_SYM {}
- | REDUNDANT_SYM {}
- | RELAY {}
- | RELAYLOG_SYM {}
- | RELAY_LOG_FILE_SYM {}
- | RELAY_LOG_POS_SYM {}
- | RELAY_THREAD {}
- | RELOAD {}
- | REORGANIZE_SYM {}
- | REPEATABLE_SYM {}
- | REPLICATION {}
- | RESOURCES {}
- | RESTART_SYM {}
- | RESUME_SYM {}
- | RETURNED_SQLSTATE_SYM {}
- | RETURNS_SYM {}
- | REUSE_SYM {}
- | REVERSE_SYM {}
- | ROLE_SYM {}
- | ROLLUP_SYM {}
- | ROUTINE_SYM {}
- | ROWCOUNT_SYM {}
- | ROW_COUNT_SYM {}
- | ROW_FORMAT_SYM {}
- | RTREE_SYM {}
- | SCHEDULE_SYM {}
- | SCHEMA_NAME_SYM {}
- | SECOND_SYM {}
- | SEQUENCE_SYM {}
- | SERIALIZABLE_SYM {}
- | SESSION_SYM {}
- | SETVAL_SYM {}
- | SIMPLE_SYM {}
- | SHARE_SYM {}
- | SLAVE_POS_SYM {}
- | SLOW {}
- | SNAPSHOT_SYM {}
- | SOFT_SYM {}
- | SOUNDS_SYM {}
- | SOURCE_SYM {}
- | SQL_CACHE_SYM {}
- | SQL_BUFFER_RESULT {}
- | SQL_NO_CACHE_SYM {}
- | SQL_THREAD {}
- | STARTS_SYM {}
- | STATEMENT_SYM {}
- | STATUS_SYM {}
- | STORAGE_SYM {}
- | STRING_SYM {}
- | SUBCLASS_ORIGIN_SYM {}
- | SUBDATE_SYM {}
- | SUBJECT_SYM {}
- | SUBPARTITION_SYM {}
- | SUBPARTITIONS_SYM {}
- | SUPER_SYM {}
- | SUSPEND_SYM {}
- | SWAPS_SYM {}
- | SWITCHES_SYM {}
- | TABLE_NAME_SYM {}
- | TABLES {}
- | TABLE_CHECKSUM_SYM {}
- | TABLESPACE {}
- | TEMPORARY {}
- | TEMPTABLE_SYM {}
- | THAN_SYM {}
- | TRANSACTION_SYM {}
- | TRANSACTIONAL_SYM {}
- | TRIGGERS_SYM {}
- | TRIM_ORACLE {}
- | TIMESTAMP_ADD {}
- | TIMESTAMP_DIFF {}
- | TYPES_SYM {}
- | TYPE_SYM {}
- | UDF_RETURNS_SYM {}
- | UNCOMMITTED_SYM {}
- | UNDEFINED_SYM {}
- | UNDO_BUFFER_SIZE_SYM {}
- | UNDOFILE_SYM {}
- | UNKNOWN_SYM {}
- | UNTIL_SYM {}
- | USER_SYM {}
- | USE_FRM {}
- | VARIABLES {}
- | VIEW_SYM {}
- | VIRTUAL_SYM {}
- | VALUE_SYM {}
- | WARNINGS {}
- | WAIT_SYM {}
- | WEEK_SYM {}
- | WEIGHT_STRING_SYM {}
- | WORK_SYM {}
- | X509_SYM {}
- | XML_SYM {}
- | VIA_SYM {}
+ | CURRENT_SYM
+ | CURSOR_NAME_SYM
+ | CYCLE_SYM
+ | DATA_SYM
+ | DATAFILE_SYM
+ | DATE_FORMAT_SYM
+ | DAY_SYM
+ | DECODE_SYM
+ | DEFINER_SYM
+ | DELAY_KEY_WRITE_SYM
+ | DES_KEY_FILE
+ | DIAGNOSTICS_SYM
+ | DIRECTORY_SYM
+ | DISABLE_SYM
+ | DISCARD
+ | DISK_SYM
+ | DUMPFILE
+ | DUPLICATE_SYM
+ | DYNAMIC_SYM
+ | ENDS_SYM
+ | ENGINE_SYM
+ | ENGINES_SYM
+ | ERROR_SYM
+ | ERRORS
+ | ESCAPE_SYM
+ | EVENT_SYM
+ | EVENTS_SYM
+ | EVERY_SYM
+
+ | EXCHANGE_SYM
+ | EXPANSION_SYM
+ | EXPORT_SYM
+ | EXTENDED_SYM
+ | EXTENT_SIZE_SYM
+ | FAULTS_SYM
+ | FAST_SYM
+ | FOUND_SYM
+ | ENABLE_SYM
+ | FULL
+ | FILE_SYM
+ | FIRST_SYM
+ | GENERAL
+ | GENERATED_SYM
+ | GET_FORMAT
+ | GRANTS
+ | GLOBAL_SYM
+ | HASH_SYM
+ | HARD_SYM
+ | HOSTS_SYM
+ | HOUR_SYM
+ | ID_SYM
+ | IDENTIFIED_SYM
+ | IGNORE_SERVER_IDS_SYM
+ | INCREMENT_SYM
+ | IMMEDIATE_SYM
+ | INVOKER_SYM
+ | IMPORT
+ | INDEXES
+ | INITIAL_SIZE_SYM
+ | IO_SYM
+ | IPC_SYM
+ | ISOLATION
+ | ISOPEN_SYM
+ | ISSUER_SYM
+ | INSERT_METHOD
+ | INVISIBLE_SYM
+ | KEY_BLOCK_SIZE
+ | LAST_VALUE
+ | LAST_SYM
+ | LASTVAL_SYM
+ | LEAVES
+ | LESS_SYM
+ | LEVEL_SYM
+ | LIST_SYM
+ | LOCAL_SYM
+ | LOCKS_SYM
+ | LOGFILE_SYM
+ | LOGS_SYM
+ | MAX_ROWS
+ | MASTER_SYM
+ | MASTER_HEARTBEAT_PERIOD_SYM
+ | MASTER_GTID_POS_SYM
+ | MASTER_HOST_SYM
+ | MASTER_PORT_SYM
+ | MASTER_LOG_FILE_SYM
+ | MASTER_LOG_POS_SYM
+ | MASTER_USER_SYM
+ | MASTER_USE_GTID_SYM
+ | MASTER_PASSWORD_SYM
+ | MASTER_SERVER_ID_SYM
+ | MASTER_CONNECT_RETRY_SYM
+ | MASTER_DELAY_SYM
+ | MASTER_SSL_SYM
+ | MASTER_SSL_CA_SYM
+ | MASTER_SSL_CAPATH_SYM
+ | MASTER_SSL_CERT_SYM
+ | MASTER_SSL_CIPHER_SYM
+ | MASTER_SSL_CRL_SYM
+ | MASTER_SSL_CRLPATH_SYM
+ | MASTER_SSL_KEY_SYM
+ | MAX_CONNECTIONS_PER_HOUR
+ | MAX_QUERIES_PER_HOUR
+ | MAX_SIZE_SYM
+ | MAX_STATEMENT_TIME_SYM
+ | MAX_UPDATES_PER_HOUR
+ | MAX_USER_CONNECTIONS_SYM
+ | MEMORY_SYM
+ | MERGE_SYM
+ | MESSAGE_TEXT_SYM
+ | MICROSECOND_SYM
+ | MIGRATE_SYM
+ | MINUTE_SYM
+ | MINVALUE_SYM
+ | MIN_ROWS
+ | MODIFY_SYM
+ | MODE_SYM
+ | MONTH_SYM
+ | MUTEX_SYM
+ | MYSQL_SYM
+ | MYSQL_ERRNO_SYM
+ | NAME_SYM
+ | NAMES_SYM
+ | NEXT_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
+ | NEXTVAL_SYM
+ | NEW_SYM
+ | NOCACHE_SYM
+ | NOCYCLE_SYM
+ | NOMINVALUE_SYM
+ | NOMAXVALUE_SYM
+ | NO_WAIT_SYM
+ | NOWAIT_SYM
+ | NODEGROUP_SYM
+ | NONE_SYM
+ | NOTFOUND_SYM
+ | OF_SYM
+ | OFFSET_SYM
+ | OLD_PASSWORD_SYM
+ | ONE_SYM
+ | ONLINE_SYM
+ | ONLY_SYM
+
+ | PACK_KEYS_SYM
+ | PAGE_SYM
+ | PARTIAL
+ | PARTITIONING_SYM
+ | PARTITIONS_SYM
+ | PASSWORD_SYM
+ | PERSISTENT_SYM
+ | PHASE_SYM
+ | PLUGIN_SYM
+ | PLUGINS_SYM
+ | PRESERVE_SYM
+ | PREV_SYM
+ | PREVIOUS_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
+ | PRIVILEGES
+ | PROCESS
+ | PROCESSLIST_SYM
+ | PROFILE_SYM
+ | PROFILES_SYM
+ | PROXY_SYM
+ | QUARTER_SYM
+ | QUERY_SYM
+ | QUICK
+
+ | READ_ONLY_SYM
+ | REBUILD_SYM
+ | RECOVER_SYM
+ | REDO_BUFFER_SIZE_SYM
+ | REDOFILE_SYM
+ | REDUNDANT_SYM
+ | RELAY
+ | RELAYLOG_SYM
+ | RELAY_LOG_FILE_SYM
+ | RELAY_LOG_POS_SYM
+ | RELAY_THREAD
+ | RELOAD
+ | REORGANIZE_SYM
+ | REPEATABLE_SYM
+ | REPLICATION
+ | RESOURCES
+ | RESTART_SYM
+ | RESUME_SYM
+ | RETURNED_SQLSTATE_SYM
+ | RETURNS_SYM
+ | REUSE_SYM
+ | REVERSE_SYM
+ | ROLE_SYM
+ | ROLLUP_SYM
+ | ROUTINE_SYM
+ | ROWCOUNT_SYM
+ | ROW_COUNT_SYM
+ | ROW_FORMAT_SYM
+ | RTREE_SYM
+ | SCHEDULE_SYM
+ | SCHEMA_NAME_SYM
+ | SECOND_SYM
+ | SEQUENCE_SYM
+ | SERIALIZABLE_SYM
+ | SESSION_SYM
+ | SETVAL_SYM
+ | SIMPLE_SYM
+ | SHARE_SYM
+ | SLAVE_POS_SYM
+ | SLOW
+ | SNAPSHOT_SYM
+ | SOFT_SYM
+ | SOUNDS_SYM
+ | SOURCE_SYM
+ | SQL_CACHE_SYM
+ | SQL_BUFFER_RESULT
+ | SQL_NO_CACHE_SYM
+ | SQL_THREAD
+ | STARTS_SYM
+ | STATEMENT_SYM
+ | STATUS_SYM
+ | STORAGE_SYM
+ | STRING_SYM
+ | SUBCLASS_ORIGIN_SYM
+ | SUBDATE_SYM
+ | SUBJECT_SYM
+ | SUBPARTITION_SYM
+ | SUBPARTITIONS_SYM
+ | SUPER_SYM
+ | SUSPEND_SYM
+ | SWAPS_SYM
+ | SWITCHES_SYM
+ | TABLE_NAME_SYM
+ | TABLES
+ | TABLE_CHECKSUM_SYM
+ | TABLESPACE
+ | TEMPORARY
+ | TEMPTABLE_SYM
+ | THAN_SYM
+ | TRANSACTION_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
+ | TRANSACTIONAL_SYM
+ | TRIGGERS_SYM
+ | TRIM_ORACLE
+ | TIMESTAMP_ADD
+ | TIMESTAMP_DIFF
+ | TYPES_SYM
+ | TYPE_SYM
+ | UDF_RETURNS_SYM
+ | UNCOMMITTED_SYM
+ | UNDEFINED_SYM
+ | UNDO_BUFFER_SIZE_SYM
+ | UNDOFILE_SYM
+ | UNKNOWN_SYM
+ | UNTIL_SYM
+ | USER_SYM
+ | USE_FRM
+ | VARIABLES
+ | VIEW_SYM
+ | VIRTUAL_SYM
+ | VALUE_SYM
+ | WARNINGS
+ | WAIT_SYM
+ | WEEK_SYM
+ | WEIGHT_STRING_SYM
+ | WORK_SYM
+ | X509_SYM
+ | XML_SYM
+ | VIA_SYM
;
/*
@@ -15602,7 +16038,7 @@ set:
set_stmt_option_value_following_option_type_list
{
LEX *lex= Lex;
- if (lex->table_or_sp_used())
+ if (unlikely(lex->table_or_sp_used()))
my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT"));
lex->stmt_var_list= lex->var_list;
lex->var_list.empty();
@@ -15621,8 +16057,8 @@ set_assign:
}
set_expr_or_default
{
- if (Lex->set_variable(&$1, $4) ||
- sp_create_assignment_instr(thd, yychar == YYEMPTY))
+ if (unlikely(Lex->set_variable(&$1, $4)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| ident_directly_assignable '.' ident SET_VAR
@@ -15636,14 +16072,14 @@ set_assign:
{
LEX *lex= Lex;
DBUG_ASSERT(lex->var_list.is_empty());
- if (lex->set_variable(&$1, &$3, $6) ||
- lex->sphead->restore_lex(thd))
+ if (unlikely(lex->set_variable(&$1, &$3, $6)) ||
+ unlikely(lex->sphead->restore_lex(thd)))
MYSQL_YYABORT;
}
| colon_with_pos ident '.' ident SET_VAR
{
LEX *lex= Lex;
- if (!lex->is_trigger_new_or_old_reference(&$2))
+ if (unlikely(!lex->is_trigger_new_or_old_reference(&$2)))
{
thd->parse_error(ER_SYNTAX_ERROR, $1);
MYSQL_YYABORT;
@@ -15655,8 +16091,8 @@ set_assign:
set_expr_or_default
{
LEX_CSTRING tmp= { $2.str, $2.length };
- if (Lex->set_trigger_field(&tmp, &$4, $7) ||
- sp_create_assignment_instr(thd, yychar == YYEMPTY))
+ if (unlikely(Lex->set_trigger_field(&tmp, &$4, $7)) ||
+ unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
;
@@ -15675,7 +16111,7 @@ set_stmt_option_value_following_option_type_list:
start_option_value_list:
option_value_no_option_type
{
- if (sp_create_assignment_instr(thd, yychar == YYEMPTY))
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
option_value_list_continued
@@ -15685,7 +16121,7 @@ start_option_value_list:
}
transaction_characteristics
{
- if (sp_create_assignment_instr(thd, yychar == YYEMPTY))
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
MYSQL_YYABORT;
}
| option_type
@@ -15700,14 +16136,14 @@ start_option_value_list:
start_option_value_list_following_option_type:
option_value_following_option_type
{
- if (sp_create_assignment_instr(thd, yychar == YYEMPTY))
- MYSQL_YYABORT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
option_value_list_continued
| TRANSACTION_SYM transaction_characteristics
{
- if (sp_create_assignment_instr(thd, yychar == YYEMPTY))
- MYSQL_YYABORT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
;
@@ -15724,8 +16160,8 @@ option_value_list:
}
option_value
{
- if (sp_create_assignment_instr(thd, yychar == YYEMPTY))
- MYSQL_YYABORT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
| option_value_list ','
{
@@ -15733,8 +16169,8 @@ option_value_list:
}
option_value
{
- if (sp_create_assignment_instr(thd, yychar == YYEMPTY))
- MYSQL_YYABORT;
+ if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ MYSQL_YYABORT;
}
;
@@ -15772,17 +16208,17 @@ opt_var_ident_type:
option_value_following_option_type:
ident equal set_expr_or_default
{
- if (Lex->set_system_variable(Lex->option_type, &$1, $3))
+ if (unlikely(Lex->set_system_variable(Lex->option_type, &$1, $3)))
MYSQL_YYABORT;
}
| ident '.' ident equal set_expr_or_default
{
- if (Lex->set_system_variable(thd, Lex->option_type, &$1, &$3, $5))
+ if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &$1, &$3, $5)))
MYSQL_YYABORT;
}
| DEFAULT '.' ident equal set_expr_or_default
{
- if (Lex->set_default_system_variable(Lex->option_type, &$3, $5))
+ if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $5)))
MYSQL_YYABORT;
}
;
@@ -15791,37 +16227,37 @@ option_value_following_option_type:
option_value_no_option_type:
ident equal set_expr_or_default
{
- if (Lex->set_variable(&$1, $3))
+ if (unlikely(Lex->set_variable(&$1, $3)))
MYSQL_YYABORT;
}
| ident '.' ident equal set_expr_or_default
{
- if (Lex->set_variable(&$1, &$3, $5))
+ if (unlikely(Lex->set_variable(&$1, &$3, $5)))
MYSQL_YYABORT;
}
| DEFAULT '.' ident equal set_expr_or_default
{
- if (Lex->set_default_system_variable(Lex->option_type, &$3, $5))
+ if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $5)))
MYSQL_YYABORT;
}
| '@' ident_or_text equal expr
{
- if (Lex->set_user_variable(thd, &$2, $4))
+ if (unlikely(Lex->set_user_variable(thd, &$2, $4)))
MYSQL_YYABORT;
}
| '@' '@' opt_var_ident_type ident equal set_expr_or_default
{
- if (Lex->set_system_variable($3, &$4, $6))
+ if (unlikely(Lex->set_system_variable($3, &$4, $6)))
MYSQL_YYABORT;
}
| '@' '@' opt_var_ident_type ident '.' ident equal set_expr_or_default
{
- if (Lex->set_system_variable(thd, $3, &$4, &$6, $8))
+ if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8)))
MYSQL_YYABORT;
}
| '@' '@' opt_var_ident_type DEFAULT '.' ident equal set_expr_or_default
{
- if (Lex->set_default_system_variable($3, &$6, $8))
+ if (unlikely(Lex->set_default_system_variable($3, &$6, $8)))
MYSQL_YYABORT;
}
| charset old_or_new_charset_name_or_default
@@ -15834,7 +16270,7 @@ option_value_no_option_type:
set_var_collation_client(cs2,
thd->variables.collation_database,
cs2));
- if (var == NULL)
+ if (unlikely(var == NULL))
MYSQL_YYABORT;
lex->var_list.push_back(var, thd->mem_root);
}
@@ -15843,7 +16279,7 @@ option_value_no_option_type:
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
LEX_CSTRING names= { STRING_WITH_LEN("names") };
- if (spc && spc->find_variable(&names, false))
+ if (unlikely(spc && spc->find_variable(&names, false)))
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
else
thd->parse_error();
@@ -15856,7 +16292,7 @@ option_value_no_option_type:
CHARSET_INFO *cs3;
cs2= $2 ? $2 : global_system_variables.character_set_client;
cs3= $3 ? $3 : cs2;
- if (!my_charset_same(cs2, cs3))
+ if (unlikely(!my_charset_same(cs2, cs3)))
{
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
cs3->name, cs2->csname);
@@ -15864,23 +16300,24 @@ option_value_no_option_type:
}
set_var_collation_client *var;
var= new (thd->mem_root) set_var_collation_client(cs3, cs3, cs3);
- if (var == NULL)
+ if (unlikely(var == NULL) ||
+ unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
- lex->var_list.push_back(var, thd->mem_root);
}
| DEFAULT ROLE_SYM grant_role
{
LEX *lex = Lex;
LEX_USER *user;
- if (!(user=(LEX_USER *) thd->calloc(sizeof(LEX_USER))))
+ if (unlikely(!(user=(LEX_USER *) thd->calloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
user->user= current_user;
set_var_default_role *var= (new (thd->mem_root)
set_var_default_role(user,
$3->user));
- if (var == NULL)
+ if (unlikely(var == NULL) ||
+ unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
- lex->var_list.push_back(var, thd->mem_root);
+
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
@@ -15890,9 +16327,9 @@ option_value_no_option_type:
LEX *lex = Lex;
set_var_default_role *var= (new (thd->mem_root)
set_var_default_role($5, $3->user));
- if (var == NULL)
+ if (unlikely(var == NULL) ||
+ unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
- lex->var_list.push_back(var, thd->mem_root);
thd->lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
@@ -15901,18 +16338,18 @@ option_value_no_option_type:
{
LEX *lex = Lex;
set_var_role *var= new (thd->mem_root) set_var_role($2);
- if (var == NULL)
+ if (unlikely(var == NULL) ||
+ unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
- lex->var_list.push_back(var, thd->mem_root);
}
| PASSWORD_SYM opt_for_user text_or_password
{
LEX *lex = Lex;
set_var_password *var= (new (thd->mem_root)
set_var_password(lex->definer));
- if (var == NULL)
+ if (unlikely(var == NULL) ||
+ unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
- lex->var_list.push_back(var, thd->mem_root);
lex->autocommit= TRUE;
if (lex->sphead)
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
@@ -15932,16 +16369,17 @@ transaction_access_mode:
{
LEX *lex=Lex;
Item *item= new (thd->mem_root) Item_int(thd, (int32) $1);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
set_var *var= (new (thd->mem_root)
set_var(thd, lex->option_type,
find_sys_var(thd, "tx_read_only"),
&null_clex_str,
item));
- if (var == NULL)
+ if (unlikely(var == NULL))
+ MYSQL_YYABORT;
+ if (unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
- lex->var_list.push_back(var, thd->mem_root);
}
;
@@ -15950,16 +16388,16 @@ isolation_level:
{
LEX *lex=Lex;
Item *item= new (thd->mem_root) Item_int(thd, (int32) $3);
- if (item == NULL)
+ if (unlikely(item == NULL))
MYSQL_YYABORT;
set_var *var= (new (thd->mem_root)
set_var(thd, lex->option_type,
find_sys_var(thd, "tx_isolation"),
&null_clex_str,
item));
- if (var == NULL)
+ if (unlikely(var == NULL) ||
+ unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
- lex->var_list.push_back(var, thd->mem_root);
}
;
@@ -15982,9 +16420,10 @@ opt_for_user:
sp_pcontext *spc= lex->spcont;
LEX_CSTRING pw= { STRING_WITH_LEN("password") };
- if (spc && spc->find_variable(&pw, false))
+ if (unlikely(spc && spc->find_variable(&pw, false)))
my_yyabort_error((ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str));
- if (!(lex->definer= (LEX_USER*) thd->calloc(sizeof(LEX_USER))))
+ if (unlikely(!(lex->definer= (LEX_USER*)
+ thd->calloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
lex->definer->user= current_user;
lex->definer->plugin= empty_clex_str;
@@ -16011,19 +16450,19 @@ set_expr_or_default:
| ON
{
$$=new (thd->mem_root) Item_string_sys(thd, "ON", 2);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| ALL
{
$$=new (thd->mem_root) Item_string_sys(thd, "ALL", 3);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| BINARY
{
$$=new (thd->mem_root) Item_string_sys(thd, "binary", 6);
- if ($$ == NULL)
+ if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
;
@@ -16035,7 +16474,7 @@ lock:
{
LEX *lex= Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "LOCK"));
lex->sql_command= SQLCOM_LOCK_TABLES;
}
@@ -16048,14 +16487,14 @@ opt_lock_wait_timeout:
{}
| WAIT_SYM ulong_num
{
- if (set_statement_var_if_exists(thd, STRING_WITH_LEN("lock_wait_timeout"), $2) ||
- set_statement_var_if_exists(thd, STRING_WITH_LEN("innodb_lock_wait_timeout"), $2))
+ if (unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("lock_wait_timeout"), $2)) ||
+ unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("innodb_lock_wait_timeout"), $2)))
MYSQL_YYABORT;
}
| NOWAIT_SYM
{
- if (set_statement_var_if_exists(thd, STRING_WITH_LEN("lock_wait_timeout"), 0) ||
- set_statement_var_if_exists(thd, STRING_WITH_LEN("innodb_lock_wait_timeout"), 0))
+ if (unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("lock_wait_timeout"), 0)) ||
+ unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("innodb_lock_wait_timeout"), 0)))
MYSQL_YYABORT;
}
;
@@ -16075,12 +16514,13 @@ table_lock:
{
thr_lock_type lock_type= (thr_lock_type) $3;
bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE);
- if (!Select->add_table_to_list(thd, $1, $2, 0, lock_type,
+ if (unlikely(!Select->
+ add_table_to_list(thd, $1, $2, 0, lock_type,
(lock_for_write ?
lock_type == TL_WRITE_CONCURRENT_INSERT ?
MDL_SHARED_WRITE :
MDL_SHARED_NO_READ_WRITE :
- MDL_SHARED_READ)))
+ MDL_SHARED_READ))))
MYSQL_YYABORT;
}
;
@@ -16102,7 +16542,7 @@ unlock:
{
LEX *lex= Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "UNLOCK"));
lex->sql_command= SQLCOM_UNLOCK_TABLES;
}
@@ -16118,43 +16558,46 @@ handler:
HANDLER_SYM table_ident OPEN_SYM opt_table_alias
{
LEX *lex= Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
lex->sql_command = SQLCOM_HA_OPEN;
- if (!lex->current_select->add_table_to_list(thd, $2, $4, 0))
+ if (unlikely(!lex->current_select->add_table_to_list(thd, $2, $4,
+ 0)))
MYSQL_YYABORT;
}
| HANDLER_SYM table_ident_nodb CLOSE_SYM
{
LEX *lex= Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
lex->sql_command = SQLCOM_HA_CLOSE;
- if (!lex->current_select->add_table_to_list(thd, $2, 0, 0))
+ if (unlikely(!lex->current_select->add_table_to_list(thd, $2, 0,
+ 0)))
MYSQL_YYABORT;
}
| HANDLER_SYM table_ident_nodb READ_SYM
{
LEX *lex=Lex;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
lex->expr_allows_subselect= FALSE;
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
Item *one= new (thd->mem_root) Item_int(thd, (int32) 1);
- if (one == NULL)
+ if (unlikely(one == NULL))
MYSQL_YYABORT;
lex->current_select->select_limit= one;
lex->current_select->offset_limit= 0;
lex->limit_rows_examined= 0;
- if (!lex->current_select->add_table_to_list(thd, $2, 0, 0))
+ if (unlikely(!lex->current_select->add_table_to_list(thd, $2, 0,
+ 0)))
MYSQL_YYABORT;
}
handler_read_or_scan opt_where_clause opt_limit_clause
{
Lex->expr_allows_subselect= TRUE;
/* Stored functions are not supported for HANDLER READ. */
- if (Lex->uses_stored_routines())
+ if (unlikely(Lex->uses_stored_routines()))
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"stored functions in HANDLER ... READ");
@@ -16183,7 +16626,7 @@ handler_rkey_function:
LEX *lex=Lex;
lex->ha_read_mode = RKEY;
lex->ha_rkey_mode=$1;
- if (!(lex->insert_list= new (thd->mem_root) List_item))
+ if (unlikely(!(lex->insert_list= new (thd->mem_root) List_item)))
MYSQL_YYABORT;
}
'(' values ')'
@@ -16214,24 +16657,26 @@ revoke_command:
}
| grant_privileges ON FUNCTION_SYM grant_ident FROM user_and_role_list
{
- if (Lex->add_grant_command(thd, SQLCOM_REVOKE, TYPE_ENUM_FUNCTION))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
+ TYPE_ENUM_FUNCTION)))
MYSQL_YYABORT;
}
| grant_privileges ON PROCEDURE_SYM grant_ident FROM user_and_role_list
{
- if (Lex->add_grant_command(thd, SQLCOM_REVOKE, TYPE_ENUM_PROCEDURE))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
+ TYPE_ENUM_PROCEDURE)))
MYSQL_YYABORT;
}
| grant_privileges ON PACKAGE_SYM grant_ident FROM user_and_role_list
{
- if (Lex->add_grant_command(thd, SQLCOM_REVOKE,
- TYPE_ENUM_PACKAGE))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
+ TYPE_ENUM_PACKAGE)))
MYSQL_YYABORT;
}
| grant_privileges ON PACKAGE_SYM BODY_SYM grant_ident FROM user_and_role_list
{
- if (Lex->add_grant_command(thd, SQLCOM_REVOKE,
- TYPE_ENUM_PACKAGE_BODY))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE,
+ TYPE_ENUM_PACKAGE_BODY)))
MYSQL_YYABORT;
}
| ALL opt_privileges ',' GRANT OPTION FROM user_and_role_list
@@ -16248,7 +16693,7 @@ revoke_command:
| admin_option_for_role FROM user_and_role_list
{
Lex->sql_command= SQLCOM_REVOKE_ROLE;
- if (Lex->users_list.push_front($1, thd->mem_root))
+ if (unlikely(Lex->users_list.push_front($1, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -16276,27 +16721,29 @@ grant_command:
| grant_privileges ON FUNCTION_SYM grant_ident TO_SYM grant_list
opt_require_clause opt_grant_options
{
- if (Lex->add_grant_command(thd, SQLCOM_GRANT, TYPE_ENUM_FUNCTION))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
+ TYPE_ENUM_FUNCTION)))
MYSQL_YYABORT;
}
| grant_privileges ON PROCEDURE_SYM grant_ident TO_SYM grant_list
opt_require_clause opt_grant_options
{
- if (Lex->add_grant_command(thd, SQLCOM_GRANT, TYPE_ENUM_PROCEDURE))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
+ TYPE_ENUM_PROCEDURE)))
MYSQL_YYABORT;
}
| grant_privileges ON PACKAGE_SYM grant_ident TO_SYM grant_list
opt_require_clause opt_grant_options
{
- if (Lex->add_grant_command(thd, SQLCOM_GRANT,
- TYPE_ENUM_PACKAGE))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
+ TYPE_ENUM_PACKAGE)))
MYSQL_YYABORT;
}
| grant_privileges ON PACKAGE_SYM BODY_SYM grant_ident TO_SYM grant_list
opt_require_clause opt_grant_options
{
- if (Lex->add_grant_command(thd, SQLCOM_GRANT,
- TYPE_ENUM_PACKAGE_BODY))
+ if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT,
+ TYPE_ENUM_PACKAGE_BODY)))
MYSQL_YYABORT;
}
| PROXY_SYM ON user TO_SYM grant_list opt_grant_option
@@ -16311,7 +16758,7 @@ grant_command:
LEX *lex= Lex;
lex->sql_command= SQLCOM_GRANT_ROLE;
/* The first role is the one that is granted */
- if (Lex->users_list.push_front($1, thd->mem_root))
+ if (unlikely(Lex->users_list.push_front($1, thd->mem_root)))
MYSQL_YYABORT;
}
@@ -16328,12 +16775,12 @@ opt_with_admin_option:
role_list:
grant_role
{
- if (Lex->users_list.push_back($1, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($1, thd->mem_root)))
MYSQL_YYABORT;
}
| role_list ',' grant_role
{
- if (Lex->users_list.push_back($3, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -16341,7 +16788,7 @@ role_list:
current_role:
CURRENT_ROLE optional_braces
{
- if (!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER))))
+ if (unlikely(!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
$$->user= current_role;
$$->reset_auth();
@@ -16355,17 +16802,17 @@ grant_role:
/* trim end spaces (as they'll be lost in mysql.user anyway) */
$1.length= cs->cset->lengthsp(cs, $1.str, $1.length);
((char*) $1.str)[$1.length] = '\0';
- if ($1.length == 0)
+ if (unlikely($1.length == 0))
my_yyabort_error((ER_INVALID_ROLE, MYF(0), ""));
- if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))
+ if (unlikely(!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))))
MYSQL_YYABORT;
$$->user= $1;
$$->host= empty_clex_str;
$$->reset_auth();
- if (check_string_char_length(&$$->user, ER_USERNAME,
- username_char_length,
- cs, 0))
+ if (unlikely(check_string_char_length(&$$->user, ER_USERNAME,
+ username_char_length,
+ cs, 0)))
MYSQL_YYABORT;
}
| current_role
@@ -16434,6 +16881,7 @@ object_privilege:
| EVENT_SYM { Lex->grant |= EVENT_ACL;}
| TRIGGER_SYM { Lex->grant |= TRIGGER_ACL; }
| CREATE TABLESPACE { Lex->grant |= CREATE_TABLESPACE_ACL; }
+ | DELETE_SYM HISTORY_SYM { Lex->grant |= DELETE_HISTORY_ACL; }
;
opt_and:
@@ -16450,21 +16898,21 @@ require_list_element:
SUBJECT_SYM TEXT_STRING
{
LEX *lex=Lex;
- if (lex->x509_subject)
+ if (unlikely(lex->x509_subject))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SUBJECT"));
lex->x509_subject=$2.str;
}
| ISSUER_SYM TEXT_STRING
{
LEX *lex=Lex;
- if (lex->x509_issuer)
+ if (unlikely(lex->x509_issuer))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "ISSUER"));
lex->x509_issuer=$2.str;
}
| CIPHER_SYM TEXT_STRING
{
LEX *lex=Lex;
- if (lex->ssl_cipher)
+ if (unlikely(lex->ssl_cipher))
my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CIPHER"));
lex->ssl_cipher=$2.str;
}
@@ -16474,11 +16922,11 @@ grant_ident:
'*'
{
LEX *lex= Lex;
- if (lex->copy_db_to(&lex->current_select->db))
+ if (unlikely(lex->copy_db_to(&lex->current_select->db)))
MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS)
lex->grant = DB_ACLS & ~GRANT_ACL;
- else if (lex->columns.elements)
+ else if (unlikely(lex->columns.elements))
my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
}
| ident '.' '*'
@@ -16487,7 +16935,7 @@ grant_ident:
lex->current_select->db= $1;
if (lex->grant == GLOBAL_ACLS)
lex->grant = DB_ACLS & ~GRANT_ACL;
- else if (lex->columns.elements)
+ else if (unlikely(lex->columns.elements))
my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
}
| '*' '.' '*'
@@ -16496,14 +16944,15 @@ grant_ident:
lex->current_select->db= null_clex_str;
if (lex->grant == GLOBAL_ACLS)
lex->grant= GLOBAL_ACLS & ~GRANT_ACL;
- else if (lex->columns.elements)
+ else if (unlikely(lex->columns.elements))
my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
}
| table_ident
{
LEX *lex=Lex;
- if (!lex->current_select->add_table_to_list(thd, $1,NULL,
- TL_OPTION_UPDATING))
+ if (unlikely(!lex->current_select->
+ add_table_to_list(thd, $1,NULL,
+ TL_OPTION_UPDATING)))
MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS)
lex->grant = TABLE_ACLS & ~GRANT_ACL;
@@ -16513,12 +16962,12 @@ grant_ident:
user_list:
user
{
- if (Lex->users_list.push_back($1, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($1, thd->mem_root)))
MYSQL_YYABORT;
}
| user_list ',' user
{
- if (Lex->users_list.push_back($3, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -16526,12 +16975,12 @@ user_list:
grant_list:
grant_user
{
- if (Lex->users_list.push_back($1, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($1, thd->mem_root)))
MYSQL_YYABORT;
}
| grant_list ',' grant_user
{
- if (Lex->users_list.push_back($3, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -16539,12 +16988,12 @@ grant_list:
user_and_role_list:
user_or_role
{
- if (Lex->users_list.push_back($1, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($1, thd->mem_root)))
MYSQL_YYABORT;
}
| user_and_role_list ',' user_or_role
{
- if (Lex->users_list.push_back($3, thd->mem_root))
+ if (unlikely(Lex->users_list.push_back($3, thd->mem_root)))
MYSQL_YYABORT;
}
;
@@ -16557,7 +17006,7 @@ grant_user:
{
$$= $1;
$1->pwtext= $4;
- if (Lex->sql_command == SQLCOM_REVOKE)
+ if (unlikely(Lex->sql_command == SQLCOM_REVOKE))
MYSQL_YYABORT;
}
| user IDENTIFIED_SYM BY PASSWORD_SYM TEXT_STRING
@@ -16599,7 +17048,7 @@ column_list_id:
ident
{
String *new_str= new (thd->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
- if (new_str == NULL)
+ if (unlikely(new_str == NULL))
MYSQL_YYABORT;
List_iterator <LEX_COLUMN> iter(Lex->columns);
class LEX_COLUMN *point;
@@ -16617,7 +17066,7 @@ column_list_id:
{
LEX_COLUMN *col= (new (thd->mem_root)
LEX_COLUMN(*new_str,lex->which_columns));
- if (col == NULL)
+ if (unlikely(col == NULL))
MYSQL_YYABORT;
lex->columns.push_back(col, thd->mem_root);
}
@@ -16816,7 +17265,7 @@ union_clause:
union_list:
unit_type_decl union_option
{
- if (Lex->add_select_to_union_list((bool)$2, $1, TRUE))
+ if (unlikely(Lex->add_select_to_union_list((bool)$2, $1, TRUE)))
MYSQL_YYABORT;
}
union_list_part2
@@ -16832,7 +17281,7 @@ union_list:
union_list_view:
unit_type_decl union_option
{
- if (Lex->add_select_to_union_list((bool)$2, $1, TRUE))
+ if (unlikely(Lex->add_select_to_union_list((bool)$2, $1, TRUE)))
MYSQL_YYABORT;
}
query_expression_body_view
@@ -16873,7 +17322,7 @@ order_or_limit:
union_head_non_top:
unit_type_decl union_option
{
- if (Lex->add_select_to_union_list((bool)$2, $1, FALSE))
+ if (unlikely(Lex->add_select_to_union_list((bool)$2, $1, FALSE)))
MYSQL_YYABORT;
}
;
@@ -16884,6 +17333,24 @@ union_option:
| ALL { $$=0; }
;
+simple_table:
+ query_specification { $$= $1; }
+ | table_value_constructor { $$= $1; }
+ ;
+
+table_value_constructor:
+ VALUES
+ {
+ Lex->tvc_start();
+ }
+ values_list
+ {
+ $$= Lex->current_select;
+ if (Lex->tvc_finalize())
+ MYSQL_YYABORT;
+ }
+ ;
+
/*
Corresponds to the SQL Standard
<query specification> ::=
@@ -16901,13 +17368,13 @@ query_specification:
;
query_term_union_not_ready:
- query_specification order_or_limit opt_select_lock_type { $$= $1; }
+ simple_table order_or_limit opt_select_lock_type { $$= $1; }
| '(' select_paren_derived ')' union_order_or_limit { $$= $2; }
;
query_term_union_ready:
- query_specification opt_select_lock_type { $$= $1; }
- | '(' select_paren_derived ')' { $$= $2; }
+ simple_table opt_select_lock_type { $$= $1; }
+ | '(' select_paren_derived ')' { $$= $2; }
;
query_expression_body:
@@ -16928,8 +17395,8 @@ subselect:
subselect_start:
{
LEX *lex=Lex;
- if (!lex->expr_allows_subselect ||
- lex->sql_command == (int)SQLCOM_PURGE)
+ if (unlikely(!lex->expr_allows_subselect ||
+ lex->sql_command == (int)SQLCOM_PURGE))
{
thd->parse_error();
MYSQL_YYABORT;
@@ -16941,7 +17408,7 @@ subselect_start:
(SELECT .. ) UNION ... becomes
SELECT * FROM ((SELECT ...) UNION ...)
*/
- if (mysql_new_select(Lex, 1, NULL))
+ if (unlikely(mysql_new_select(Lex, 1, NULL)))
MYSQL_YYABORT;
}
;
@@ -16986,7 +17453,7 @@ query_expression_option:
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
| HIGH_PRIORITY
{
- if (check_simple_select())
+ if (unlikely(Lex->check_simple_select(&$1)))
MYSQL_YYABORT;
YYPS->m_lock_type= TL_READ_HIGH_PRIORITY;
YYPS->m_mdl_type= MDL_SHARED_READ;
@@ -16998,13 +17465,13 @@ query_expression_option:
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
| SQL_BUFFER_RESULT
{
- if (check_simple_select())
+ if (unlikely(Lex->check_simple_select(&$1)))
MYSQL_YYABORT;
Select->options|= OPTION_BUFFER_RESULT;
}
| SQL_CALC_FOUND_ROWS
{
- if (check_simple_select())
+ if (unlikely(Lex->check_simple_select(&$1)))
MYSQL_YYABORT;
Select->options|= OPTION_FOUND_ROWS;
}
@@ -17116,6 +17583,9 @@ view_select:
*/
query_expression_body_view:
SELECT_SYM select_options_and_item_list select_init3_view
+ | table_value_constructor
+ | table_value_constructor union_order_or_limit
+ | table_value_constructor union_list_view
| '(' select_paren_view ')'
| '(' select_paren_view ')' union_order_or_limit
| '(' select_paren_view ')' union_list_view
@@ -17160,7 +17630,7 @@ trigger_tail:
remember_name
opt_if_not_exists
{
- if (Lex->add_create_options_with_check($2))
+ if (unlikely(Lex->add_create_options_with_check($2)))
MYSQL_YYABORT;
}
sp_name
@@ -17187,7 +17657,7 @@ trigger_tail:
LEX *lex= thd->lex;
Lex_input_stream *lip= YYLIP;
- if (lex->sphead)
+ if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER"));
lex->stmt_definition_begin= $1;
@@ -17197,7 +17667,7 @@ trigger_tail:
(*static_cast<st_trg_execution_order*>(&lex->trg_chistics))= ($17);
lex->trg_chistics.ordering_clause_end= lip->get_cpp_ptr();
- if (!lex->make_sp_head(thd, $4, &sp_handler_trigger))
+ if (unlikely(!lex->make_sp_head(thd, $4, &sp_handler_trigger)))
MYSQL_YYABORT;
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
@@ -17206,14 +17676,14 @@ trigger_tail:
{ /* $20 */
LEX *lex= Lex;
sp_head *sp= lex->sphead;
- if (sp->check_unresolved_goto())
+ if (unlikely(sp->check_unresolved_goto()))
MYSQL_YYABORT;
lex->sql_command= SQLCOM_CREATE_TRIGGER;
sp->set_stmt_end(thd);
sp->restore_thd_mem_root(thd);
- if (sp->is_not_allowed_in_function("trigger"))
+ if (unlikely(sp->is_not_allowed_in_function("trigger")))
MYSQL_YYABORT;
/*
@@ -17221,11 +17691,11 @@ trigger_tail:
sp_proc_stmt alternatives are not saving/restoring LEX, so
lex->query_tables can be wiped out.
*/
- if (!lex->select_lex.add_table_to_list(thd, $10,
- (LEX_CSTRING*) 0,
- TL_OPTION_UPDATING,
- TL_READ_NO_INSERT,
- MDL_SHARED_NO_WRITE))
+ if (unlikely(!lex->select_lex.
+ add_table_to_list(thd, $10, (LEX_CSTRING*) 0,
+ TL_OPTION_UPDATING,
+ TL_READ_NO_INSERT,
+ MDL_SHARED_NO_WRITE)))
MYSQL_YYABORT;
}
;
@@ -17241,9 +17711,9 @@ udf_tail:
RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
{
LEX *lex= thd->lex;
- if (lex->add_create_options_with_check($1))
+ if (unlikely(lex->add_create_options_with_check($1)))
MYSQL_YYABORT;
- if (is_native_function(thd, & $2))
+ if (unlikely(is_native_function(thd, & $2)))
my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $2.str));
lex->sql_command= SQLCOM_CREATE_FUNCTION;
lex->udf.name= $2;
@@ -17263,7 +17733,8 @@ sf_return_type:
}
sp_param_type_with_opt_collate
{
- if (Lex->sphead->fill_field_definition(thd, Lex->last_field))
+ if (unlikely(Lex->sphead->fill_field_definition(thd,
+ Lex->last_field)))
MYSQL_YYABORT;
}
;
@@ -17273,8 +17744,8 @@ sf_tail:
sp_name
{
Lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
- if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
- &sp_handler_function))
+ if (unlikely(!Lex->make_sp_head_no_recursive(thd, $1, $2,
+ &sp_handler_function)))
MYSQL_YYABORT;
}
opt_sp_parenthesized_fdparam_list
@@ -17290,9 +17761,9 @@ sf_tail:
sp_tail_is
sp_body
{
- if (Lex->sp_body_finalize_function(thd))
+ if (unlikely(Lex->sp_body_finalize_function(thd)))
MYSQL_YYABORT;
- if (Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR)
+ if (unlikely(Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR))
{
my_yyabort_error((ER_NOT_AGGREGATE_FUNCTION, MYF(0)));
}
@@ -17304,8 +17775,8 @@ sp_tail:
opt_if_not_exists sp_name
{
Lex->sql_command= SQLCOM_CREATE_PROCEDURE;
- if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
- &sp_handler_procedure))
+ if (unlikely(!Lex->make_sp_head_no_recursive(thd, $1, $2,
+ &sp_handler_procedure)))
MYSQL_YYABORT;
}
opt_sp_parenthesized_pdparam_list
@@ -17317,7 +17788,7 @@ sp_tail:
sp_tail_is
sp_body
{
- if (Lex->sp_body_finalize_procedure(thd))
+ if (unlikely(Lex->sp_body_finalize_procedure(thd)))
MYSQL_YYABORT;
}
;
@@ -17325,7 +17796,7 @@ sp_tail:
sf_tail_standalone:
sf_tail opt_sp_name
{
- if ($2 && !$2->eq(Lex->sphead))
+ if (unlikely($2 && !$2->eq(Lex->sphead)))
my_yyabort_error((ER_END_IDENTIFIER_DOES_NOT_MATCH, MYF(0),
ErrConvDQName($2).ptr(),
ErrConvDQName(Lex->sphead).ptr()));
@@ -17335,7 +17806,7 @@ sf_tail_standalone:
sp_tail_standalone:
sp_tail opt_sp_name
{
- if ($2 && !$2->eq(Lex->sphead))
+ if (unlikely($2 && !$2->eq(Lex->sphead)))
my_yyabort_error((ER_END_IDENTIFIER_DOES_NOT_MATCH, MYF(0),
ErrConvDQName($2).ptr(),
ErrConvDQName(Lex->sphead).ptr()));
@@ -17386,37 +17857,38 @@ opt_format_xid:
/* empty */ { $$= false; }
| FORMAT_SYM '=' ident_or_text
{
- if (!my_strcasecmp(system_charset_info, $3.str, "SQL"))
+ if (lex_string_eq(&$3, STRING_WITH_LEN("SQL")))
$$= true;
- else if (!my_strcasecmp(system_charset_info, $3.str, "RAW"))
+ else if (lex_string_eq(&$3, STRING_WITH_LEN("RAW")))
$$= false;
else
{
- my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), "XA RECOVER", $3.str));
+ my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0),
+ "XA RECOVER", $3.str));
$$= false;
}
- }
- ;
+ }
+ ;
xid:
text_string
{
MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE);
- if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
+ if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))))
MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0);
}
| text_string ',' text_string
{
MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
- if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
+ if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))))
MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
}
| text_string ',' text_string ',' ulong_num
{
MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
- if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
+ if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID)))))
MYSQL_YYABORT;
Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
}