summaryrefslogtreecommitdiff
path: root/sql/set_var.h
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-12684 Show what config file a sysvar got a value fromSergei Golubchik2019-10-141-1/+2
| | | | | Show the config file in I_S.SYSTEM_VARIABLES But only if the user has FILE privilege
* Merge branch '10.3' into 10.4Sergei Golubchik2019-09-061-0/+1
|\
| * Merge 10.2 (up to commit ef00ac4c86daf3294c46a45358da636763fb0049) into 10.3Alexander Barkov2019-09-041-0/+1
| |\
| | * MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, false)' in ↵Alexander Barkov2019-09-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH This change takes into account a column's GENERATED ALWAYS AS expression dependcy on sql_mode's PAD_CHAR_TO_FULL_LENGTH and NO_UNSIGNED_SUBTRACTION flags. Indexed virtual columns as well as persistent generated columns are now not allowed to have such dependencies to avoid inconsistent data or index files on sql_mode changes. So an error is now returned in cases like this: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT -- CHAR->VARCHAR or CHAR->TEXT = ERROR ); Functions RPAD() and RTRIM() can now remove dependency on PAD_CHAR_TO_FULL_LENGTH. So this can be used instead: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT ); Note, unlike CHAR->VARCHAR and CHAR->TEXT this still works, not RPAD(a) is needed: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v CHAR(5) AS (a) PERSISTENT -- CHAR->CHAR is OK ); More sql_mode flags may affect values of generated columns. They will be addressed separately. See comments in sql_mode.h for implementation details.
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ | | |/
| | * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-05-051-1/+2
|\ \ \ \ \ | |/ / / /
| * | | | Adieu find_sys_var_ex()Sergey Vojtovich2019-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only take LOCK_plugin for plugin system variables. Reverted optimisation that was originally done for session tracker: it makes much less sense now. Specifically only if connections would want to track plugin session variables changes and these changes would actually happen frequently. If this ever becomes an issue, there're much better ways to optimise this workload. Part of MDEV-14984 - regression in connect performance
* | | | | MDEV-6111 Optimizer TraceVarun Gupta2019-02-131-0/+9
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This task involves the implementation for the optimizer trace. This feature produces a trace for any SELECT/UPDATE/DELETE/, which contains information about decisions taken by the optimizer during the optimization phase (choice of table access method, various costs, transformations, etc). This feature would help to tell why some decisions were taken by the optimizer and why some were rejected. Trace is session-local, controlled by the @@optimizer_trace variable. To enable optimizer trace we need to write: set @@optimizer_trace variable= 'enabled=on'; To display the trace one can run: SELECT trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; This task also involves: MDEV-18489: Limit the memory used by the optimizer trace introduces a switch optimizer_trace_max_mem_size which limits the memory used by the optimizer trace. This was implemented by Sergei Petrunia.
* | | | Merge branch '10.2' into 10.3Sergei Golubchik2018-06-301-2/+10
|\ \ \ \ | |/ / /
| * | | Optimize charset tracking a bit.bb-10.2-MDEV-15477Oleksandr Byelkin2018-06-251-1/+3
| | | |
| * | | MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtidOleksandr Byelkin2018-06-251-1/+1
| | | | | | | | | | | | | | | | register changes of last_gtid
| * | | Merge branch '10.1' into 10.2Sergei Golubchik2018-06-211-0/+1
| |\ \ \ | | |/ /
| | * | Fix wsrep.variables test caseVicențiu Ciorbaru2018-06-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Correctly port 09b25f85966f44aae933e86b84b4ebe59ded47c3 from 10.0. Expose check_is_super via include file to allow wsrep_on_check to use it.
| * | | MDEV-11917 enum/set command-line options aren't respecting max-*Alexey Botchkov2018-06-201-0/+6
| | | | | | | | | | | | | | | | settings.
* | | | Merge remote-tracking branch '10.2' into 10.3Vicențiu Ciorbaru2018-04-121-0/+10
|\ \ \ \ | |/ / /
| * | | Merge branch '10.1' into 10.2Vicențiu Ciorbaru2018-04-101-0/+10
| |\ \ \ | | |/ /
| | * | Adjust table_open_cache to avoid getting error 24 (too many open files)Monty2018-03-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV--15609 engines/funcs.crash_manytables_number crashes with error 24 (too many open files) MDEV-10286 Adjustment of table_open_cache according to system limits does not work when open-files-limit option is provided Fixed by adjusting tc_size downwards if there is not enough file descriptors to use. Other changes: - Ensure that there is 30 (was 10) extra file descriptors for other usage - Decrease TABLE_OPEN_CACHE_MIN to 200 as it's better to have a smaller table cache than getting error 24 - Increase minimum of max_connections and table_open_cache from 1 to 10 as 1 is not usable for any real application, only for testing.
* | | | MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a triggerAlexander Barkov2018-03-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem resided in this branch of the "option_value_no_option_type" rule: | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default Summary: 1. internal_variable_name initialized tmp.var to trg_new_row_fake_var (0x01). 2. The condition "if (tmp.var == NULL)" did not check the special case with trg_new_row_fake_var, so Lex->set_system_variable(&tmp, $3, $6) was called with tmp.var pointing to trg_new_row_fake_var, which created a sys_var instance pointing to 0x01 instead of a real system variable. 3. Later, at the trigger invocation time, this method was called: sys_var::do_deprecated_warning (this=0x1, thd=0x7ffe6c000a98) Notice, "this" is equal to trg_new_row_fake_var (0x01) Solution: The old implementation with separate rules internal_variable_name (in sql_yacc.yy and sql_yacc_ora.yy) and internal_variable_name_directly_assignable (in sql_yacc_ora.yy only) was too complex and hard to follow. Rewriting the code in a more straightforward way. 1. Changing LEX::set_system_variable() from: bool set_system_variable(struct sys_var_with_base *, enum_var_type, Item *); to: bool set_system_variable(enum_var_type, sys_var *, const LEX_CSTRING *, Item *); 2. Adding new methods in LEX, which operate with variable names: bool set_trigger_field(const LEX_CSTRING *, const LEX_CSTRING *, Item *); bool set_system_variable(enum_var_type var_type, const LEX_CSTRING *name, Item *val); bool set_system_variable(THD *thd, enum_var_type var_type, const LEX_CSTRING *name1, const LEX_CSTRING *name2, Item *val); bool set_default_system_variable(enum_var_type var_type, const LEX_CSTRING *name, Item *val); bool set_variable(const LEX_CSTRING *name, Item *item); 3. Changing the grammar to call the new methods directly in option_value_no_option_type, Removing rules internal_variable_name and internal_variable_name_directly_assignable. 4. Removing "struct sys_var_with_base" and trg_new_row_fake_var. Good side effect: - The code in /sql reduced from 314 to 183 lines. - MDEV-15615 Unexpected syntax error instead of "Unknown system variable" ... was also fixed automatically
* | | | SQL: sysvar versioning_asof_timestamp [fixes #292, #279]Aleksey Midenkov2017-11-131-7/+0
| | | |
* | | | System Versioning pre0.12Aleksey Midenkov2017-11-071-0/+7
|\ \ \ \ | | | | | | | | | | | | | | | Merge remote-tracking branch 'origin/archive/2017-10-17' into 10.3
| * | | | SQL: vers_current_time refactoring [closes #117]Aleksey Midenkov2017-05-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * session sysvars; * moved value parsing to set variable phase; * renamed 'temporal_current_timestamp' to 'vers_current_time'.
* | | | | New option for slow logging (log_slow_disable_statements)Monty2017-08-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes MDEV-7742 and MDEV-8305 (Allow user to specify if stored procedures should be logged in the slow and general log) New functionality: - Added new variables log_slow_disable_statements and log_disable_statements that can be used to disable logging of certain queries to slow and general log. Currently supported options are 'admin', 'call', 'slave' and 'sp'. Defaults are as before. Only 'sp' (stored procedure statements) is disabled for slow and general_log. - Slow log to files now includes the following new information: - When logging stored procedure statements the name of stored procedure is logged. - Number of created tmp_tables, tmp_disk_tables and the space used by temporary tables. - When logging 'call', the logged status now contains the sum of all included statements. Before only 'time' was correct. - Added filsort_priority_queue as an option for log_slow_filter (this variable existed before, but was not exposed) - Added support for BIT types in my_getopt() Mapped some old variables to bitmaps (old variables can still be used) - Variable 'log_queries_not_using_indexes' is mapped to log_slow_filter='not_using_index' - Variable 'log_slow_slave_statements' is mapped to log_slow_disabled_statements='slave' - Variable 'log_slow_admin_statements' is mapped to log_slow_disabled_statements='admin' - All the above variables are changed to session variables from global variables Other things: - Simplified LOGGER::log_command. We don't need to check for super if OPTION_LOG_OFF is set as this flag can only be set if one is a super user. - Removed some setting of enable_slow_log as it's guaranteed to be set by mysql_parse() - mysql_admin_table() now sets thd->enable_slow_log - Added prepare_logs_for_admin_command() to reset thd->enable_slow_log if needed. - Added new functions to store, restore and add slow query status - Added new functions to store and restore query start time - Reorganized Sub_statement_state according to types - Added code in dispatch_command() to ensure that thd->reset_for_next_command() is always called for a query. - Added thd->last_sql_command to simplify checking of what was the type of the last command. Needed when logging to slow log as lex->sql_command may have changed before slow logging is called. - Moved QPLAN_TMP_... to where status for tmp tables are updated - Added new THD variable, affected_rows, to be able to correctly log number of affected rows to slow log.
* | | | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-07-031-0/+7
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Merge into MariaDB 10.3.
| * | | | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Fix engine list lifetime for sys_var_pluginlist. The Sys_var class assumes that some operations can be done without explicitly freeing resources, for example default_value_ptr(). Thus, methods (like Sys_var_pluginlist::do_check) need to generally work with temporary lists, which are registered in the THD to be freed/unlocked automatically. And do_update() needs to make a permanent copy to store in the global variable.
| * | | | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Ignore unknown engines in --gtid-pos-auto-engines command-line options (but not SET GLOBAL). This seems useful, to allow a default that auto-creates the gtid pos table for engines like TokuDB and MyRocks (which greatly benefit from such), but does not prevent server startup when those engines are not available.
| * | | | | MDEV-12179: Per-engine mysql.gtid_slave_pos tableKristian Nielsen2017-04-211-0/+5
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intermediate commit. Implement a --gtid-pos-auto-engines system variable. The variable is a list of engines for which mysql.gtid_slave_pos_ENGINE should be auto-created if needed. This commit only implements the option variable. It is not yet used to actually auto-create any tables, nor is there a corresponding command-line version of the option yet.
* | | | | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-13/+14
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* | | | MDEV-10411 Providing compatibility for basic PL/SQL constructsAlexander Barkov2017-04-051-0/+1
|/ / / | | | | | | | | | | | | | | | Part6: assignment operator var:= 10;
* | | Use sql_mode_t for sql_mode.Monty2016-10-051-1/+1
| | | | | | | | | | | | This fixed several cases where we where using just ulong for sql_mode
* | | MDEV-6112 multiple triggers per tableMonty2016-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is similar to MysQL Worklog 3253, but with a different implementation. The disk format and SQL syntax is identical with MySQL 5.7. Fetures supported: - "Any" ammount of any trigger - Supports FOLLOWS and PRECEDES to be able to put triggers in a certain execution order. Implementation details: - Class Trigger added to hold information about a trigger. Before this trigger information was stored in a set of lists in Table_triggers_list and in Table_triggers_list::bodies - Each Trigger has a next field that poinst to the next Trigger with the same action and time. - When accessing a trigger, we now always access all linked triggers - The list are now only used to load and save trigger files. - MySQL trigger test case (trigger_wl3253) added and we execute these identically. - Even more gracefully handling of wrong trigger files than before. This is useful if a trigger file uses functions or syntax not provided by the server. - Each trigger now has a "Created" field that shows when the trigger was created, with 2 decimals. Other comments: - Many of the changes in test files was done because of the new "Created" field in the trigger file. This shows up in SHOW ... TRIGGER and when using information_schema.trigger. - Don't check if all memory is released if on uses --gdb; This is needed to be able to get a list from safemalloc of not freed memory while debugging. - Added option to trim_whitespace() to know how many prefix characters was skipped. - Changed a few ulonglong sql_mode to sql_mode_t, to find some wrong usage of sql_mode.
* | | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-2/+0
| | | | | | | | | | | | Transaction tracker
* | | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-0/+7
| | | | | | | | | | | | System variables tracking
* | | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-1/+1
| | | | | | | | | | | | initial commit to test
* | | CleanupsMonty2016-04-281-0/+1
|/ / | | | | | | | | | | | | | | - Avoid some realloc() during startup - Ensure that file_key_management_plugin frees it's memory early, even if it's linked statically. - Fixed compiler warnings from unused variables and missing destructors - Fixed wrong indentation
* | MDEV-9516 type error when setting session variableAlexander Barkov2016-03-221-2/+4
| | | | | | | | Allowing assigning of DECIMAL(N,0) values to INT-alike system variables.
* | MDEV-8466 CAST works differently for DECIMAL/INT vs DOUBLE for empty stringsAlexander Barkov2015-09-171-1/+1
| | | | | | | | MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
* | MDEV-6066: Merge new defaults from 5.6 and 5.7Sergei Golubchik2015-09-041-6/+0
| | | | | | | | cosmetic fixes. test fixes.
* | MDEV-6066: Merge new defaults from 5.6 and 5.7 (autoset)Oleksandr Byelkin2015-09-041-3/+16
| | | | | | | | --autoset- command line prefix added
* | Stage 2 of MDEV-6152:Monty2015-08-211-17/+1
| | | | | | | | | | | | | | | | - Added mem_root to all calls to new Item - Added private method operator new(size_t size) to Item to ensure that we always use a mem_root when creating an item. This saves use once call to current_thd per Item creation
* | MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)Sergey Vojtovich2015-08-211-2/+3
| | | | | | | | | | | | | | Added mandatory thd parameter to Item (and all derivative classes) constructor. Added thd parameter to all routines that may create items. Also removed "current_thd" from Item::Item. This reduced number of pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
* | SET STATEMENT timestamp=xxx ....Sergei Golubchik2015-04-091-3/+9
| | | | | | | | | | | | | | | | | | | | | | fix sys_var->is_default() method (that was using default_val property in a global sys_var object to track per-session state): * move timestamp to a dedicated Sys_var_timestamp class (in fact, rename Sys_var_session_special_double to Sys_var_timestamp) * make session_is_default a virtual method with a special implementation for timestamps * other variables don't have a special behavior for default values and can have session_is_default() to be always false.
* | MDEV-6960 Server crashes in check_alter_user on setting a default role via PSSergei Golubchik2015-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two issues: * set_var_default_role::user was overwritten with a new value, allocated in the thd->mem_root, which is reset between executions. That was causing the crash. Solved by introducing set_var_default_role::real_user * when privilege tables were opened on EXECUTE, the reprepare_observer would abort the statement (as privilege tables are opened using the local TABLE_LIST that doesn't preserve metadata from PREPARE, so reprepare_observer thought they're changed). This issue also applied to SET PASSWORD. Solved by disabling reprepare_observer.
* | validate SET PASSWORDSergei Golubchik2014-12-041-3/+1
| |
* | MDEV-5231: Per query variables from Percona Server (rewritten)Oleksandr Byelkin2014-11-111-2/+9
| |
* | Merge 10.0.14 into 10.1Sergei Golubchik2014-10-151-3/+1
|\ \
| * | Using more Item_string_sysAlexander Barkov2014-09-041-3/+1
| | |