summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authoranozdrin/alik@booka. <>2006-07-28 02:49:18 +0400
committeranozdrin/alik@booka. <>2006-07-28 02:49:18 +0400
commit2d082d86c958998328dd969366537c5c98330eeb (patch)
treec10c09a840456bf62d7906ab2295f10857cf900b /sql/sql_view.cc
parentb7f403b546b83f40ff48479c9dd909e38ae9eb26 (diff)
downloadmariadb-git-2d082d86c958998328dd969366537c5c98330eeb.tar.gz
Fix for BUG#20438: CREATE statements for views, stored routines and triggers
can be not replicable. Now CREATE statements for writing in the binlog are created as follows: - the beginning of the statement is re-created; - the rest of the statement is copied from the original query. The problem appears when there is a version-specific comment (produced by mysqldump), started in the re-created part of the statement and closed in the copied part -- there is closing comment-parenthesis, but there is no opening one. The proper fix could be to re-create original statement, but we can not implement it in 5.0. So, for 5.0 the fix is just to cut closing comment-parenthesis. This technique is also used for SHOW CREATE PROCEDURE statement (so we are able to reuse existing code).
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 1561ade78af..80cb8970049 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -671,8 +671,10 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view->query.str= (char*)str.ptr();
view->query.length= str.length()-1; // we do not need last \0
view->source.str= thd->query + thd->lex->create_view_select_start;
- view->source.length= (thd->query_length -
- thd->lex->create_view_select_start);
+ view->source.length= (char *)skip_rear_comments((uchar *)view->source.str,
+ (uchar *)thd->query +
+ thd->query_length) -
+ view->source.str;
view->file_version= 1;
view->calc_md5(md5);
view->md5.str= md5;