summaryrefslogtreecommitdiff
path: root/sql/sql_tvc.h
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-14347 CREATE PROCEDURE returns no error when using an unknown variableAlexander Barkov2020-06-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CREATE PROCEDURE did not detect unknown SP variables in assignments like this: SET var=a_long_var_name_with_a_typo; The error happened only during the SP execution time, and only of the control flow reaches the erroneous statement. Fixing most expressions to detect unknown identifiers. This includes simple subqueries without tables: - Query specification: SELECT list, WHERE, HAVING (inside aggregate functions) clauses, e.g. SET var= (SELECT unknown_ident+1); SET var= (SELECT 1 WHERE unknown_identifier); SET var= (SELECT 1 HAVING SUM(unknown_identifier); - Table value constructor: VALUES clause, e.g.: SET var= (VALUES(unknown_ident)); Note, in some more complex subquery cases unknown variables are still not detected (this will be fixed separately): - Derived tables: SET a=(SELECT unknown_ident FROM (SELECT 1 AS alias) t1); SET res=(SELECT * FROM t1 LEFT OUTER JOIN (SELECT unknown_ident) t2 USING (c1)); - CTE: SET a=(WITH cte1 (a) AS (SELECT unknown_ident) SELECT * FROM cte1); SET a=(WITH cte1 (a,b) AS (VALUES (unknown,2),(3,4)) SELECT * FROM cte1); SET a=(WITH cte1 (a,b) AS (VALUES (1,2),(3,4)) SELECT unknown_ident FROM cte1); - SELECT .. GROUP BY unknown_identifier - SELECT .. ORDER BY unknown_identifier - HAVING with an unknown identifier outside of any aggregate functions: SELECT .. HAVING unknown_identifier;
* MDEV-17894 Assertion `(thd->lex)->current_select' failed in MYSQLparse(),Igor Babaev2019-05-081-0/+5
| | | | | | | | | | query with VALUES() A table value constructor can be used in all contexts where a select can be used. In particular an ORDER BY clause or a LIMIT clause or both of them can be attached to a table value constructor to produce a new query. Unfortunately execution of such queries was not supported. This patch fixes the problem.
* MDEV-17017 Explain for query using derived table specified with a tableIgor Babaev2018-08-211-0/+2
| | | | | | | | | | value constructor shows wrong number of rows If the specification of a derived table contained a table value constructor then the optimizer incorrectly estimated the number of rows in the derived table. This happened because the optimizer did not take into account the number of rows in the constructor. The wrong estimate could lead to choosing inefficient execution plans.
* Less dependencies in include filesMichael Widenius2017-11-231-2/+2
|
* Handle failures from mallocMichael Widenius2017-11-171-1/+1
| | | | | | | | | | | | | | | Most "new" failures fixed in the following files: - sql_select.cc - item.cc - item_func.cc - opt_subselect.cc Other things: - Allocate udf_handler strings in mem_root - Required changes in sql_string.h - Add mem_root as argument to some new [] calls - Mark udf_handler strings as thread specific - Removed some comment blocks with code
* Fixed compilation failuresMonty2017-11-021-1/+16
| | | | - Also added missing copyright notices
* Summarized results of two previous commits (26 July, 25 August)Galina Shalygina2017-08-291-8/+27
|
* Mistakes corrected, test file corrected.Galina Shalygina2017-06-301-0/+4
|
* New structure Table Value Constructor added in grammar.Galina Shalygina2017-06-291-0/+27
TVC can be used in UNION-statement, in view and in subquery. Files where TVC is defined and its methods are stored added. Methods exec and prepare for TVC added. Tests for TVC added.