summaryrefslogtreecommitdiff
path: root/sql/lex.h
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-20122: Deprecate MASTER_USE_GTID=Current_Pos to favor new ↵Brandon Nesterenko2022-07-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | MASTER_DEMOTE_TO_SLAVE option New Feature: ======== This feature adds a safe replacement to the MASTER_USE_GTID=Current_Pos option for CHANGE MASTER TO as MASTER_DEMOTE_TO_SLAVE=<bool>. The use case of Current_Pos is to transition a master to become a slave; however, can break replication state if the slave executes local transactions due to actively updating gtid_current_pos with gtid_binlog_pos and gtid_slave_pos. MASTER_DEMOTE_TO_SLAVE changes this use case by forcing users to set Using_Gtid=Slave_Pos and merging gtid_binlog_pos into gtid_slave_pos once at CHANGE MASTER TO time. Note that if gtid_slave_pos is more recent than gtid_binlog_pos (as in the case of chain replication), the replication state should be preserved. Additionally, deprecate the `Current_Pos` option of MASTER_USE_GTID to suggest the safe alternative option MASTER_DEMOTE_TO_SLAVE=TRUE. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
* MDEV-26681: ROW_NUMBER is not available within compound statement blocksbb-10.7-MDEV-26606Rucha Deodhar2021-10-071-2/+0
| | | | | | | | | | Fixed after patch MDEV-26606 because root cause was same. Analysis: m_current_row_for_warning is reset to 1 during cleanup phase of stored procedure. When we perform a copy because some statement of procedure created warning, this reset value is passed to push _warning(). Fix: Add a parameter in relevant functions to pass correct value of error index and don't use m_current_row_for_warning directly.
* MDEV-26606: ROW_NUMBER property value isn't passed from inside a storedRucha Deodhar2021-10-061-0/+2
| | | | | | | | | | | procedure Analysis: m_current_row_for_warning is reset to 1 during cleanup phase of stored procedure. When we perform a copy because some statement of procedure created warning, this reset value is passed to push_warning(). Hence the output is always 1. Fix: Add a parameter in relevant functions to pass correct value of row_number and don't use m_current_row_for_warning directly.
* MDEV-26611: ERROR_INDEX isn't intuitively clearRucha Deodhar2021-10-051-2/+2
| | | | | | | | | | Fixup for MDEV-10075 Analysis: ERROR_INDEX implemented in MDEV-10075 was not intuitively clear. Fix: changed parser to use ROW_NUMBER instead of ERROR_INDEX. Removed ERROR_INDEX and ERROR_INDEX_SYM from related files. Changed m_error_index to m_row_number.
* MDEV-10075: Provide index of error causing error in array INSERTSergei Golubchik2021-09-161-1/+1
| | | | | | | | use existing Warning_info::m_current_row_for_warning instead of a newly introduced counter. But use m_current_row_for_warning to count rows also in the parser and during prepare.
* MDEV-10075: Provide index of error causing error in array INSERTRucha Deodhar2021-09-151-0/+1
| | | | | | | | | | | | | | | | Extended the parser for GET DIAGNOSTICS to use ERROR_INDEX to get warning/error index. Error information is stored in Sql_condition. So it can be used to store the index of warning/error too. THD::current_insert_index keeps a track of count for each row that is processed or going to be inserted in the table (or first row in case of prepare phase). When an error occurs, first we need to fetch corrected error index (using correct_error_index()) for an error number. This is needed because in prepare phase, the error may not be because of rows/values. In such case, correct value of error_index should be 0. Once correct value if fetched, assign it to Sql_condition::error_index when the object is created during error/warning. This error_index variable is returned when ERROR_INDEX is used in GET DIAGNOSTICS.
* MDEV-26307 multi-source-replication support mysql syntax(for channel)Monty2021-09-141-0/+1
| | | | | Author: woqutech Reviewer: monty@mariadb.org
* Merge 10.5 into 10.6Marko Mäkelä2021-07-021-2/+5
|\
| * Merge 10.4 into 10.5Marko Mäkelä2021-07-021-2/+5
| |\
| | * Merge 10.3 -> 10.4Sergei Petrunia2021-06-301-2/+5
| | |\
| | | * Merge 10.2->10.3Sergei Petrunia2021-06-301-2/+5
| | | |\
| | | | * MDEV-25129 Add KEYWORDS view to the INFORMATION_SCHEMAxing-zhi, jiang2021-06-291-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add KEYWORDS table and SQL_FUNCTIONS table to INFORMATION_SCHEMA. This commits needs some minor changes when propagated upwards (e.g. func_array in item_create.cc has a termination element that doesn't exist in later versions of MariaDB)
| | | | * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-1/+1
| | | | |\
| | | | | * Code comment spellfixesIan Gilfillan2020-07-221-1/+1
| | | | | |
* | | | | | MDEV-20025: ADD_MONTHS() Oracle functionMonty2021-05-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Author: woqutech
* | | | | | MDEV-20021 sql_mode="oracle" does not support MINUS set operatorMonty2021-05-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MINUS is mapped to EXCEPT One consequence of the patch is that MINUS becomes a reserved word in Oracle mode. Author: woqutech
* | | | | | MDEV-24089 support oracle syntax: rownumMonty2021-05-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ROWNUM() function is for SELECT mapped to JOIN->accepted_rows, which is incremented for each accepted rows. For Filesort, update, insert, delete and load data, we map ROWNUM() to internal variables incremented when the table is changed. The connection between the row counter and Item_func_rownum is done in sql_select.cc::fix_items_after_optimize() and sql_insert.cc::fix_rownum_pointers() When ROWNUM() is used anywhere in query, the optimization to ignore ORDER BY in sub queries are disabled. This was done to get the following common Oracle query to work: select * from (select * from t1 order by a desc) as t where rownum() <= 2; MDEV-3926 "Wrong result with GROUP BY ... WITH ROLLUP" contains a discussion about this topic. LIMIT optimization is enabled when in a top level WHERE clause comparing ROWNUM() with a numerical constant using any of the following expressions: - ROWNUM() < # - ROWNUM() <= # - ROWNUM() = 1 ROWNUM() can be also be the right argument to the comparison function. LIMIT optimization is done in two cases: - For the current sub query when the ROWNUM comparison is done on the top level: SELECT * from t1 WHERE rownum() <= 2 AND t1.a > 0 - For an inner sub query, when the upper level has only a ROWNUM comparison in the WHERE clause: SELECT * from (select * from t1) as t WHERE rownum() <= 2 In Oracle mode, one can also use ROWNUM without parentheses. Other things: - Fixed bug where the optimizer tries to optimize away sub queries with RAND_TABLE_BIT set (non-deterministic queries). Now these sub queries will not be converted to joins. This bug fix was also needed to get rownum() working inside subqueries. - In remove_const() remove setting simple_order to FALSE if ROLLUP is USED. This code was disable a long time ago because of wrong assignment in the following code. Instead we set simple_order to false if RAND_TABLE_BIT was used in the SELECT list. This ensures that we don't delete ORDER BY if the result set is not deterministic, like in 'SELECT RAND() AS 'r' FROM t1 ORDER BY r'; - Updated parameters for Sort_param::init_for_filesort() to be able to provide filesort with information where the number of accepted rows should be stored - Reordered fields in class Filesort to optimize storage layout - Added new error messsage to tell that a function can't be used in HAVING - Added field 'with_rownum' to THD to mark that ROWNUM() is used in the query. Co-author: Oleksandr Byelkin <sanja@mariadb.com> LIMIT optimization for sub query
* | | | | | MDEV-19682 sql_mode="oracle" does not support sysdateAlexander Barkov2021-05-191-1/+1
| | | | | |
* | | | | | MDEV-25138 JSON_TABLE: A space between JSON_TABLE and opening bracket causes ↵Alexey Botchkov2021-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syntax error. syntax fixed.
* | | | | | MDEV-17399 Add support for JSON_TABLE.Alexey Botchkov2021-04-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The specific table handler for the table functions was introduced, and used to implement JSON_TABLE.
* | | | | | MDEV-13115: Implement SELECT SKIP LOCKEDDaniel Black2021-04-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds an implementation for SELECT ... FOR UPDATE SKIP LOCKED / SELECT ... LOCK IN SHARED MODE SKIP LOCKED This is implemented only InnoDB at the moment, not in RockDB yet. This adds a new hander flag HA_CAN_SKIP_LOCKED than will be used when the storage engine advertises the flag. When a storage engine indicates this flag it will get TL_WRITE_SKIP_LOCKED and TL_READ_SKIP_LOCKED transaction types. The Lex structure has been updated to store both the FOR UPDATE/LOCK IN SHARE as well as the SKIP LOCKED so the SHOW CREATE VIEW implementation is simplier. "SELECT FOR UPDATE ... SKIP LOCKED" combined with CREATE TABLE AS or INSERT.. SELECT on the result set is not safe for STATEMENT based replication. MIXED replication will replicate this as row based events." Thanks to guidance from Facebook commit https://github.com/facebook/mysql-5.6/commit/193896c466d43fd905a62a60f1d73fd9c551a6e4 This helped verify basic test case, and components that need implementing (even though every part was implemented differently). Thanks Marko for guidance on simplier InnoDB implementation. Reviewers: Marko, Monty
* | | | | | MDEV-25075: Ignorable index makes the resulting CREATE TABLE invalidVarun Gupta2021-03-171-0/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | - The patch itself - More changes to the parser - Fix by Sergei P to make the tests pass with --embedded
* | | | | Added support for VISIBLE attribute for indexes in CREATE TABLEMonty2020-04-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-22199 Add VISIBLE attribute for indexes in CREATE TABLE This was done to make it easier to read in dumps from MySQL 8.0 generated with MySQL workbench
* | | | | MDEV-16978 Application-time periods: WITHOUT OVERLAPSNikita Malyavin2020-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * The overlaps check is implemented on a handler level per row command. It creates a separate cursor (actually, another handler instance) and caches it inside the original handler, when ha_update_row or ha_insert_row is issued. Cursor closes on unlocking the handler. * Containing the same key in index means unique constraint violation even in usual terms. So we fetch left and right neighbours and check that they have same key prefix, excluding from the key only the period part. If it doesnt match, then there's no such neighbour, and the check passes. Otherwise, we check if this neighbour intersects with the considered key. * The check does not introduce new error and fails with ER_DUPP_KEY error. This might break REPLACE workflow and should be fixed separately
* | | | | Added FLUSH THREADSMonty2020-03-241-0/+1
| | | | |
* | | | | MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to ↵Alexander Barkov2020-03-181-0/+1
| | | | | | | | | | | | | | | | | | | | gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id
* | | | | MDEV-21743 Split up SUPER privilege to smaller privilegesAlexander Barkov2020-03-101-0/+2
| | | | |
* | | | | MDEV-20601: Make REPLICA a synonym for SLAVE in SQL statementsSujatha2020-02-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix: === Add "REPLICA" as an alias for "SLAVE". All commands which use "SLAVE" keyword can be used with new alias "REPLICA". List of commands: On Master: ========= SHOW REPLICA HOSTS <--> SHOW SLAVE HOSTS Privilege "SLAVE" <--> "REPLICA" On Slave: ========= START SLAVE <--> START REPLICA START ALL SLAVES <--> START ALL REPLICAS START SLAVE UNTIL <--> START REPLICA UNTIL STOP SLAVE <--> STOP REPLICA STOP ALL SLAVES <--> STOP ALL REPLICAS RESET SLAVE <--> RESET REPLICA RESET SLAVE ALL <--> RESET REPLICA ALL SLAVE_POS <--> REPLICA_POS
* | | | | Merge 10.4 into 10.5Marko Mäkelä2019-12-161-1/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-12-091-1/+1
| |\ \ \ \ | | |/ / /
| | * | | Lintian complains on spelling errorFaustin Lammler2019-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The lintian check complains on spelling error: https://salsa.debian.org/mariadb-team/mariadb-10.3/-/jobs/95739
* | | | | MDEV-16620 JSON_ARRAYAGG and JSON_OBJECTAGG.Alexey Botchkov2019-10-141-0/+1
| | | | | | | | | | | | | | | | | | | | Ison_objectagg implemented.
* | | | | MDEV-16620: Add JSON_ARRAYAGG functionMarkus Mäkelä2019-07-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JSON_ARRAYAGG function extends the GROUP_CONCAT function and provides a method of aggregating JSON results. The current implementation supports DISTINCT and LIMIT but not ORDER BY (Oracle supports GROUP BY). Adding GROUP BY support is possible but it requires some extra work as the grouping appears to be done inside a temporary table that complicates matters. Added test cases that covert aggregation of all JSON types and JSON validation for the generated results.
* | | | | MDEV-19944 Remove GIS data types from keyword list in lex.hAlexander Barkov2019-07-041-8/+0
|/ / / /
* | | | 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 branch '11.0' into 10.1Oleksandr Byelkin2018-09-061-3/+3
| | | |\ \
| | | | * | compilation failureSergei Golubchik2018-09-041-3/+3
| | | | | |
* | | | | | MDEV-7597 Expiration of user passwordsRobert Bindar2019-02-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for expiring user passwords. The following statements are extended: CREATE USER user@localhost PASSWORD EXPIRE [option] ALTER USER user@localhost PASSWORD EXPIRE [option] If no option is specified, the password is expired with immediate effect. If option is DEFAULT, global policy applies according to the default_password_lifetime system var (if 0, password never expires, if N, password expires every N days). If option is NEVER, the password never expires and if option is INTERVAL N DAY, the password expires every N days. The feature also supports the disconnect_on_expired_password system var and the --connect-expired-password client option. Closes #1166
* | | | | | MDEV-16973 Application-time periods: DELETENikita Malyavin2019-02-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * inject portion of time updates into mysql_delete main loop * triggered case emits delete+insert, no updates * PORTION OF `SYSTEM_TIME` is forbidden * `DELETE HISTORY .. FOR PORTION OF ...` is forbidden as well
* | | | | | MDEV-13095 Implement User Account lockingRobert Bindar2019-02-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add server support for user account locking. This patch extends the ALTER/CREATE USER statements for denying a user's subsequent login attempts: ALTER USER user [, user2] ACCOUNT [LOCK | UNLOCK] CREATE USER user [, user2] ACCOUNT [LOCK | UNLOCK] The SHOW CREATE USER statement was updated to display the locking state of an user. Closes #1006
* | | | | | Added syntax and implementation for BACKUP STAGE'sMonty2018-12-091-0/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP - Changed check of Global_only_lock to also include BACKUP lock. - We store latest MDL_BACKUP_DDL lock in thd->mdl_backup_ticket to be able to downgrade lock during copy_data_between_tables()
* | | | | MDEV-17687 Add sql_mode specific tokens for keywords BLOB, CLOB, NUMBER, ↵Alexander Barkov2018-11-121-5/+5
| | | | | | | | | | | | | | | | | | | | RAW, VARCHAR2
* | | | | MDEV-17669 Add sql_mode specific tokens for the keyword DECLAREAlexander Barkov2018-11-121-1/+1
| | | | |
* | | | | MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reservedAlexander Barkov2018-11-121-1/+1
| | | | |
* | | | | A join patch for MDEV-17660 and MDEV-17661Alexander Barkov2018-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | MDEV-17660 sql_mode=ORACLE: Some keywords do not work as label names: history, system, versioning, without MDEV-17661 Add sql_mode specific tokens for the keyword DECODE
* | | | | MDEV-17652 Add sql_mode specific tokens for some keywordsAlexander Barkov2018-11-091-12/+12
| | | | |