summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorunknown <mattiasj@client-10-129-10-147.upp.off.mysql.com>2008-05-08 09:41:22 +0200
committerunknown <mattiasj@client-10-129-10-147.upp.off.mysql.com>2008-05-08 09:41:22 +0200
commita6f7fa35b1e7c97b16c27673aeb2846d23c2a342 (patch)
treec6e00b5ca989b9532860864921fde4f36d9357c0 /sql/sql_view.cc
parent6aadc3e2b9fa0f8795772f8158efef822c0060f0 (diff)
downloadmariadb-git-a6f7fa35b1e7c97b16c27673aeb2846d23c2a342.tar.gz
Bug#32575 - Parse error of stmt with extended comments on slave side
Problem was that mysql_create_view did not remove all comments characters when writing to binlog, resulting in parse error of stmt on slave side. Solution was to use the recreated select clause and add a generated CHECK OPTION clause if needed. mysql-test/r/rpl_sp.result: Bug#32575 - Parse error of stmt with extended comments on slave side Updated test result mysql-test/r/rpl_view.result: Bug#32575 - Parse error of stmt with extended comments on slave side Updated test result mysql-test/t/rpl_view.test: Bug#32575 - Parse error of stmt with extended comments on slave side Added test case sql/sql_view.cc: Bug#32575 - Parse error of stmt with extended comments on slave side Problem was that mysql_create_view did not remove all comments characters when writing to binlog, resulting in parse error of stmt on slave side. Solution was to use the recreated select clause and generate 'WITH {LOCAL|CASCADED} CHECK OPTION'.
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 4c8e6e80c41..de92d6dc3b9 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -649,7 +649,11 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
buff.append(')');
}
buff.append(STRING_WITH_LEN(" AS "));
- buff.append(views->source.str, views->source.length);
+ buff.append(views->query.str, views->query.length);
+ if (views->with_check == VIEW_CHECK_LOCAL)
+ buff.append(STRING_WITH_LEN(" WITH LOCAL CHECK OPTION"));
+ else if (views->with_check == VIEW_CHECK_CASCADED)
+ buff.append(STRING_WITH_LEN(" WITH CASCADED CHECK OPTION"));
Query_log_event qinfo(thd, buff.ptr(), buff.length(), 0, FALSE);
mysql_bin_log.write(&qinfo);
@@ -926,8 +930,6 @@ loop_out:
}
DBUG_RETURN(0);
err:
- view->query.str= NULL;
- view->query.length= 0;
view->md5.str= NULL;
view->md5.length= 0;
DBUG_RETURN(error);