summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-03-25 23:41:16 +0400
committerRamil Kalimullin <ramil@mysql.com>2009-03-25 23:41:16 +0400
commitaca1a83fedd916492c97f77557d27c79ae54da43 (patch)
tree7aa34f58ecccff62834f2f5bd96104233a64261f /sql/sql_parse.cc
parent4f5f7f353ac4783fae7aa0bff891d1325177cc82 (diff)
parenteccad3f252e0263249eee45d3d76987d4fc0d4e2 (diff)
downloadmariadb-git-aca1a83fedd916492c97f77557d27c79ae54da43.tar.gz
Manual merge.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index d1296c4127d..2974dff9ea9 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2558,6 +2558,43 @@ mysql_execute_command(THD *thd)
{
select_result *result;
+ /*
+ If:
+ a) we inside an SP and there was NAME_CONST substitution,
+ b) binlogging is on (STMT mode),
+ c) we log the SP as separate statements
+ raise a warning, as it may cause problems
+ (see 'NAME_CONST issues' in 'Binary Logging of Stored Programs')
+ */
+ if (thd->query_name_consts &&
+ mysql_bin_log.is_open() &&
+ thd->variables.binlog_format == BINLOG_FORMAT_STMT &&
+ !mysql_bin_log.is_query_in_union(thd, thd->query_id))
+ {
+ List_iterator_fast<Item> it(select_lex->item_list);
+ Item *item;
+ uint splocal_refs= 0;
+ /* Count SP local vars in the top-level SELECT list */
+ while ((item= it++))
+ {
+ if (item->is_splocal())
+ splocal_refs++;
+ }
+ /*
+ If it differs from number of NAME_CONST substitution applied,
+ we may have a SOME_FUNC(NAME_CONST()) in the SELECT list,
+ that may cause a problem with binary log (see BUG#35383),
+ raise a warning.
+ */
+ if (splocal_refs != thd->query_name_consts)
+ push_warning(thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_UNKNOWN_ERROR,
+"Invoked routine ran a statement that may cause problems with "
+"binary log, see 'NAME_CONST issues' in 'Binary Logging of Stored Programs' "
+"section of the manual.");
+ }
+
select_lex->options|= SELECT_NO_UNLOCK;
unit->set_limit(select_lex);