summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
Commit message (Collapse)AuthorAgeFilesLines
* Bug#29363867: LOST CONNECTION TO MYSQL SERVER DURING QUERYbb-10.2-BUG29363867Oleksandr Byelkin2021-04-281-4/+24
| | | | | | | | | | | | The problem is that sharing default expression among set instruction leads to attempt access result field of function created in other instruction runtime MEM_ROOT and already freed (a bit different then MySQL problem). Fix is the same as in MySQL (but no optimisation for constant), turn DECLARE a, b, c type DEFAULT expr; to DECLARE a type DEFAULT expr, b type DEFAULT a, c type DEFAULT a;
* don't allow `KILL QUERY ID USER xxx`Sergei Golubchik2021-01-241-7/+11
|
* MDEV-12161 Can't specify collation for virtual columnsSergei Golubchik2021-01-111-20/+22
| | | | | | | | | | | sql standard (2016) allows <collate clause> in two places in the <column definition> - as a part of the <data type> or at the very end. Let's do that too. Side effect: in column/SP declaration `COLLATE cs_coll` automatically implies `CHARACTER SET cs` (unless charset was specified explicitly). See changes in sp-ucs2.result
* MDEV-24194 View definition corruptionSergei Golubchik2020-12-101-10/+6
| | | | fix parsing of "1 IS NULL = 2"
* precedence bugfixingSergei Golubchik2020-10-231-55/+60
| | | | | | | | | | | | | | | fix printing precedence for BETWEEN, LIKE/ESCAPE, REGEXP, IN don't use precedence for printing CASE/WHEN/THEN/ELSE/END fix parsing precedence of BETWEEN, LIKE/ESCAPE, REGEXP, IN support predicate arguments for IN, BETWEEN, SOUNDS LIKE, LIKE/ESCAPE, REGEXP use %nonassoc for unary operators fix parsing of IS TRUE/FALSE/UNKNOWN/NULL remove parser_precedence test as superseded by the precedence test
* MDEV-18163 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type ↵Oleksandr Byelkin2020-10-061-0/+2
| | | | | | != 2' failed in handler::ha_rnd_next(); / Assertion `table_list->table' failed in find_field_in_table_ref / ERROR 1901 (on optimized builds) Add the same check for altering DEFAULT used as for CREATE TABLE.
* MDEV-17941 ALTER USER IF EXISTS does not work, although documentation says ↵Alexey Botchkov2020-02-111-2/+2
| | | | | | | it should. Mistake in syntax definition fixed - should be ALTER USER IF EXISTS, not ALTER IF EXISTS USER.
* Merge branch '10.1' into 10.2Sergei Petrunia2020-01-171-1/+1
|\ | | | | | | | | | | | | # Conflicts: # sql/sp_head.cc # sql/sql_select.cc # sql/sql_trigger.cc
| * MDEV-21341: Fix UBSAN failures: Issue SixSergei Petrunia2020-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (Variant #2 of the patch, which keeps the sp_head object inside the MEM_ROOT that sp_head object owns) (10.3 requires extra work due to sp_package, will commit a separate patch for it) sp_head::operator new() and operator delete() were dereferencing sp_head* pointers to memory that didn't hold a valid sp_head object (it was not created/already destroyed). This caused UBSan to crash when looking up type information. Fixed by providing static sp_head::create() and sp_head::destroy() methods.
* | MDEV-19679 - CREATE SERVER needs tweaks for compatibility with CONNECT engineAnel Husakovic2019-09-201-1/+0
| |
* | Adding missing semicolons to sql_yacc.yy (10.2)Alexander Barkov2019-09-111-16/+38
| |
* | Merge branch '10.1' into 10.2Oleksandr Byelkin2019-07-261-16/+19
|\ \ | |/
| * Merge branch '5.5' into 10.1Oleksandr Byelkin2019-07-251-16/+19
| |\
| | * MDEV-19421 Basic 3-way join queries are not parsed.Igor Babaev2019-07-111-24/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser returned a syntax error message for the queries with join expressions like this t1 JOIN t2 [LEFT | RIGHT] JOIN t3 ON ... ON ... when the second operand of the outer JOIN operation with ON clause was another join expression with ON clause. In this expression the JOIN operator is right-associative, i.e. expression has to be parsed as the expression t1 JOIN (t2 [LEFT | RIGHT] JOIN t3 ON ... ) ON ... Such join expressions are hard to parse because the outer JOIN is left-associative if there is no ON clause for the first outer JOIN operator. The patch implements the solution when the JOIN operator is always parsed as right-associative and builds first the right-associative tree. If it happens that there is no corresponding ON clause for this operator the tree is converted to left-associative. The idea of the solution was taken from the patch by Martin Hansson "WL#8083: Fixed the join_table rule" from MySQL-8.0 code line. As the grammar rules related to join expressions in MySQL-8.0 and MariaDB-5.5+ are quite different MariaDB solution could not borrow any code from the MySQL-8.0 solution.
* | | Merge 10.1 into 10.2Marko Mäkelä2019-06-121-33/+19
|\ \ \ | |/ /
| * | MDEV-19653 Add class Sql_cmd_create_tableAlexander Barkov2019-05-311-33/+19
| | |
* | | 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 '10.1' into 10.2Oleksandr Byelkin2019-05-041-17/+20
|\ \ \ | |/ /
| * | Merge branch '5.5' into 10.1Sergei Golubchik2019-04-261-17/+20
| |\ \ | | |/
| | * MDEV-18507 can't update temporary table when joined with table with triggers ↵Sergei Golubchik2019-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on read-only triggers are opened and tables used in triggers are prelocked in open_tables(). But multi-update can detect what tables will actually be updated only later, after all main tables are opened. Meaning, if a table is used in multi-update, but is not actually updated, its on-update treggers will be opened and tables will be prelocked, even if it's unnecessary. This can cause more tables to be write-locked than needed, causing read_only errors, privilege errors and lock waits. Fix: don't open/prelock triggers unless table->updating is true. In multi-update after setting table->updating=true, do a second open_tables() for newly added tables, if any.
| | * bugfix: multi-update checked privileges on views incorrectlySergei Golubchik2019-04-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it always required UPDATE privilege on views, not being able to detect when a views was not actually updated in multi-update. fix: instead of marking all tables as "updating" by default, only set "updating" on tables that will actually be updated by multi-update. And mark the view "updating" if any of the view's tables is.
| | * cleanupSergei Golubchik2019-04-241-13/+16
| | |
* | | Merge branch '10.1' into 10.2Sergei Golubchik2019-03-151-2/+3
|\ \ \ | |/ /
| * | fix gcc 8 compiler warningsSergei Golubchik2019-03-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two newly enabled warnings: 1. cast for a function pointers. Affected sql_analyse.h, mi_write.c and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc 2. memcpy/memset of nontrivial structures. Fixed as: * the warning disabled for InnoDB * TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which does the bzero(), which is safe for these classes, but any other bzero() will still cause a warning * Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial) instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to bzero now. * added casts in debug_sync.cc and sql_select.cc (for JOIN) * move assignment method for MDL_request instead of memcpy() * PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero() * remove constructor from READ_RECORD() to make it trivial * replace some memcpy() with c++ copy assignments
| * | MDEV-15945 --ps-protocol does not test some queriesSergei Golubchik2019-03-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make mysqltest to use --ps-protocol more use prepared statements for everything that server supports with the exception of CALL (for now). Fix discovered test failures and bugs. tests: * PROCESSLIST shows Execute state, not Query * SHOW STATUS increments status variables more than in text protocol * multi-statements should be avoided (see tests with a wrong delimiter) * performance_schema events have different names in --ps-protocol * --enable_prepare_warnings mysqltest.cc: * make sure run_query_stmt() doesn't crash if there's no active connection (in wait_until_connected_again.inc) * prepare all statements that server supports protocol.h * Protocol_discard::send_result_set_metadata() should not send anything to the client. sql_acl.cc: * extract the functionality of getting the user for SHOW GRANTS from check_show_access(), so that mysql_test_show_grants() could generate the correct column names in the prepare step sql_class.cc: * result->prepare() can fail, don't ignore its return value * use correct number of decimals for EXPLAIN columns sql_parse.cc: * discard profiling for SHOW PROFILE. In text protocol it's done in prepare_schema_table(), but in --ps it is called on prepare only, so nothing was discarding profiling during execute. * move the permission checking code for SHOW CREATE VIEW to mysqld_show_create_get_fields(), so that it would be called during prepare step too. * only set sel_result when it was created here and needs to be destroyed in the same block. Avoid destroying lex->result. * use the correct number of tables in check_show_access(). Saying "as many as possible" doesn't work when first_not_own_table isn't set yet. sql_prepare.cc: * use correct user name for SHOW GRANTS columns * don't ignore verbose flag for SHOW SLAVE STATUS * support preparing REVOKE ALL and ROLLBACK TO SAVEPOINT * don't ignore errors from thd->prepare_explain_fields() * use select_send result for sending ANALYZE and EXPLAIN, but don't overwrite lex->result, because it might be needed to issue execute-time errors (select_dumpvar - too many rows) sql_show.cc: * check grants for SHOW CREATE VIEW here, not in mysql_execute_command sql_view.cc: * use the correct function to check privileges. Old code was doing check_access() for thd->security_ctx, which is invoker's sctx, not definer's sctx. Hide various view related errors from the invoker. sql_yacc.yy: * initialize lex->select_lex for LOAD, otherwise it'll contain garbage data that happen to fail tests with views in --ps (but not otherwise).
* | | the opt_constraint_no_id should not have the lex_str type.Alexey Botchkov2019-02-061-1/+1
| | |
* | | MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.Alexey Botchkov2019-02-051-2/+7
| | | | | | | | | | | | | | | The list of table constraints doesn't include foreign keys and uniques. So we replace DROP CONSTRAINT with DROP [FOREIGN] KEY in this case.
* | | Merge 10.1 into 10.2Marko Mäkelä2019-02-031-10/+12
|\ \ \ | |/ / | | | | | | | | | | | | Temporarily disable a test for commit 2175bfce3e9da8332f10ab0e0286dc93915533a2 because fixing it in 10.2 requires updating libmariadb.
| * | Merge 10.1 into 10.1Marko Mäkelä2019-02-021-10/+12
| |\ \ | | | | | | | | | | | | This is joint work with Oleksandr Byelkin.
| | * \ Merge branch '5.5' into 10.0Oleksandr Byelkin2019-01-281-10/+12
| | |\ \ | | | |/
| | | * Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERYSreeharsha Ramanavarapu2019-01-231-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: ------ When a subquery contains UNION the count of the number of subquery columns is calculated incorrectly. Only the first query block in the subquery's UNION is considered and an array indexing goes out-of-bounds, and this is caught by an assert. Solution: --------- Sum up the columns from all query blocks of the query expression. Change specific to 5.6/5.5: --------------------------- The "child" points to the last query block of the UNION (as opposed to 5.7+ where it points to the first member of UNION). So "child->master_unit()->first_select()" is used to reach the first query block of UNION.
* | | | Merge 10.1 into 10.2Marko Mäkelä2019-02-021-1/+10
|\ \ \ \ | |/ / /
| * | | MDEV-10963 Fragmented BINLOG queryAndrei Elkin2019-01-241-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was originally stated in http://bugs.mysql.com/bug.php?id=82212 The size of an base64-encoded Rows_log_event exceeds its vanilla byte representation in 4/3 times. When a binlogged event size is about 1GB mysqlbinlog generates a BINLOG query that can't be send out due to its size. It is fixed with fragmenting the BINLOG argument C-string into (approximate) halves when the base64 encoded event is over 1GB size. The mysqlbinlog in such case puts out SET @binlog_fragment_0='base64-encoded-fragment_0'; SET @binlog_fragment_1='base64-encoded-fragment_1'; BINLOG @binlog_fragment_0, @binlog_fragment_1; to represent a big BINLOG. For prompt memory release BINLOG handler is made to reset the BINLOG argument user variables in the middle of processing, as if @binlog_fragment_{0,1} = NULL is assigned. Notice the 2 fragments are enough, though the client and server still may need to tweak their @@max_allowed_packet to satisfy to the fragment size (which they would have to do anyway with greater number of fragments, should that be desired). On the lower level the following changes are made: Log_event::print_base64() remains to call encoder and store the encoded data into a cache but now *without* doing any formatting. The latter is left for time when the cache is copied to an output file (e.g mysqlbinlog output). No formatting behavior is also reflected by the change in the meaning of the last argument which specifies whether to cache the encoded data. Rows_log_event::print_helper() is made to invoke a specialized fragmented cache-to-file copying function which is copy_cache_to_file_wrapped() that takes care of fragmenting also optionally wraps encoded strings (fragments) into SQL stanzas. my_b_copy_to_file() is refactored to into my_b_copy_all_to_file(). The former function is generalized to accepts more a limit argument to constraint the copying and does not reinitialize anymore the cache into reading mode. The limit does not do any effect on the fully read cache.
* | | | Merge 10.1 into 10.2Marko Mäkelä2018-11-071-0/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.0 into 10.1Marko Mäkelä2018-11-071-0/+1
| |\ \ \ | | |/ /
| | * | Merge 5.5 into 10.0Marko Mäkelä2018-11-071-0/+1
| | |\ \ | | | |/
| | | * MDEV-17377 invalid gap in auto-increment values after LOAD DATASergei Golubchik2018-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | reset lex->many_values for LOAD DATA, as it's used for auto-inc range size estimation.
* | | | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-2/+11
|\ \ \ \ | |/ / /
| * | | MDEV-14431 binlog.binlog_flush_binlogs_delete_domain failed in buildbotAndrei Elkin2018-10-161-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test and also rpl_gtid_delete_domain failed on PPC64 platform due to an incorrectly specified actual key for searching in a gtid domain system hash. While the correct size is 32 bits the supplied value was 8 bytes of long int size on the platform. The problem became evident thanks to the big endiness which cut off the *least* significant part of the value field. Fixed with correcting a dynamic array initialization to hold now uint32 values as well as the values extraction for searching in the gtid domain system hash. A new added test ensures no overflowed values are accepted for deletion which prevents inadvertent action. Notice though MariaDB [test]> set @@session.gtid_domain_id=(1 << 32) + 1; MariaDB [test]> show warnings; +---------+------+--------------------------------------------------------+ | Level | Code | Message | +---------+------+--------------------------------------------------------+ | Warning | 1292 | Truncated incorrect gtid_domain_id value: '4294967297' | +---------+------+--------------------------------------------------------+ MariaDB [test]> select @@session.gtid_domain_id; +--------------------------+ | @@session.gtid_domain_id | +--------------------------+ | 4294967295 | +--------------------------+
| * | | Merge branch '11.0' into 10.1Oleksandr Byelkin2018-09-061-19/+19
| |\ \ \ | | |/ /
| | * | compilation failureSergei Golubchik2018-09-041-9/+9
| | | |
| | * | cleanup: FOREIGN_KEY_INFOSergei Golubchik2018-09-041-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of returning strings for CASCADE/RESTRICT from every storage engine, use enum values Backport of a3614d33e8a
* | | | Fixed a compiler warning.Igor Babaev2018-09-151-1/+1
| | | |
* | | | MDEV-17154 Multiple selects from parametrized CTE fails with syntax errorIgor Babaev2018-09-141-12/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fills a serious flaw in the implementation of common table expressions. Before this patch an attempt to prepare a statement from a query with a parameter marker in a CTE that was used more than once in the query ended up with a bogus error message. Similarly if a statement in a stored procedure contained a CTE whose specification used a local variables and this CTE was referred to more than once in the statement then the server failed to execute the stored procedure returning a bogus error message on a non-existing field. The problems appeared due to incorrect handling of parameter markers / local variables in CTEs that were referred more than once. This patch fixes the problems by differentiating between the original occurrences of a parameter marker / local variable used in the specification of a CTE and the corresponding occurrences used in copies of this specification. These copies are substituted instead of non-first references to the CTE. The idea of the fix and even some code were taken from the MySQL implementation of the common table expressions.
* | | | MDEV-15581 Incorrect result (missing row) with UNION DISTINCT in anchor partsIgor Babaev2018-05-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The current code does not support recursive CTEs whose specifications contain a mix of ALL UNION and DISTINCT UNION operations. This patch catches such specifications and reports errors for them.
* | | | Merge branch '10.1' into 10.2Vicențiu Ciorbaru2018-04-101-0/+5
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Vicențiu Ciorbaru2018-04-071-0/+5
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2018-04-031-0/+5
| | |\ \ | | | |/