Changed the parser test for wildcards in hostname to checking for empty
strings instead (analogous with the test in default_view_definer()),
since wildcards do appear in the definer's host-part sometimes.
The cause for the bug is that the priorities of all rules/terminals
that process the FROM clause are not fully specified, and the
parser generator produces a parser that doesn't always parse
the FROM clause so that JOINs are left-associative. As a result
the final join tree produced by the parser is incorrect, which
is the cause for subsequent name resolution to fail.
ESCAPE has length of 1 if specified and sql_mode is NO_BACKSLASH_ESCAPES
or has length of 0 or 1 in every other situation.
(approved patch applied on a up-to-date tree re-commit)
New syntax: CHAR(x USING charset)
Adding test case.
sql_yacc.yy:
New syntax: CHAR(x USING charset)
Adding new parser rule.
item_strfunc.h:
New syntax: CHAR(x USING charset)
Adding a new constructor.
Disallow conflicting use of variables named "password" and "names". If such
a variable is declared, and "SET ... = ..." is used for them, an error is
returned; the user must resolve the conflict by either using `var` (indicating
that the local variable is set) or by renaming the variable.
This is necessary since setting "password" and "names" are treated as special
cases by the parser.
Second version after review. Allow 'set autocommit' in procedures, but not
functions or triggers. Can return error in run-time (when a function calls
a procedure).
The problem was that in the first production in rule 'join_table', that
processes simple cross joins, the parser was processing the second join operand
before the first one due to unspecified priorities of JOINs. As a result in the
case of cross joins the parser constructed a tree with incorrect nesting:
the expression "t1 join t2 join t3 on some_cond" was interpreted as
"t1 join (t2 join t3 on some_cond)" instead of
"(t1 join t2) join t3 on some_cond".
Because of this incorrect nesting the method make_join_on_context picked an
incorrect table as the first table of the name resolution context.
The solution assignes correct priorities to the related production.
Post merge changes
sql_yacc.yy:
Post merge changes
sql_select.cc:
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
for some expressions (post merge changes).
The function add_key_fields() is modified. There cannot be NOT before
BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
now [NOT]BETWEEN/IN expressions.
OPTIMIZE TABLE statement is forbidden from usage in stored procedures/functions.
NOTE: OPTIMIZE TABLE statement can be useful in stored procedures. The idea is
that the user/administrator can create a stored procedure for admin
tasks (optimizing, backing up, etc). This procedure can be scheduled to run
automatically (by mean of internal cron (WL#1034)). So, once we can make this
statement work, it is worth doing it.
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
for some expressions.
The classes Item_func_between, Item_func_if, Item_func_in are modified.
Item_func_between/in objects can represent now [NOT]BETWEEN/IN expressions.
The class Item_func_opt_neg is added to factor out the functionality
common for the modified classes Item_func_between and Item_func_in.
item_cmpfunc.cc:
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
for some expressions.
Added Item_func_between::fix_fields(), Item_func_if::fix_fields(),
Item_func_in::fix_fields(). They correct generic calculation of
the not_null_tables attribute when it is needed.
Modified Item_func_between::val_int(), Item_func_in::val_int().
opt_range.cc:
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
for some expressions.
The function get_mm_tree() is modified. There cannot be NOT before
BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
now [NOT]BETWEEN/IN expressions.
sql_yacc.yy:
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
for some expressions.
Item_func_between/in objects can represent now [NOT]BETWEEN/IN expresions.
join_outer.result:
Fixed some testcases results (bugs #12101, #12102)
join_outer.test:
Added testcases for bugs #12101, #12102
The idea of the patch is to separate statement processing logic,
such as parsing, validation of the parsed tree, execution and cleanup,
from global query processing logic, such as logging, resetting
priorities of a thread, resetting stored procedure cache, resetting
thread count of errors and warnings.
This makes PREPARE and EXECUTE behave similarly to the rest of SQL
statements and allows their use in stored procedures.
This patch contains a change in behaviour:
until recently for each SQL prepared statement command, 2 queries
were written to the general log, e.g.
[Query] prepare stmt from @stmt_text;
[Prepare] select * from t1 <-- contents of @stmt_text
The chagne was necessary to prevent [Prepare] commands from being written
to the general log when executing a stored procedure with Dynamic SQL.
We should consider whether the old behavior is preferrable and probably
restore it.
This patch refixes Bug#7115, Bug#10975 (partially), Bug#10605 (various bugs
in Dynamic SQL reported before it was disabled).
"Interleaved SPs execution is now binlogged properly, "SELECT spfunc()" is binlogged too.
The known remaining issue is binlogging/replication of "a routine is deleted while it is executed" scenario.