mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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). mysql-test/r/rpl_sp.result: Updated result file. mysql-test/r/rpl_trigger.result: Updated result file. mysql-test/r/rpl_view.result: Updated result file. mysql-test/t/rpl_sp.test: Added test case for BUG#20438. mysql-test/t/rpl_trigger.test: Added test case for BUG#20438. mysql-test/t/rpl_view.test: Added test case for BUG#20438. sql/sp.cc: Trim comments at the end. sql/sp_head.cc: Moved this code to the separate function to be re-used. sql/sql_lex.cc: Added a new function. sql/sql_lex.h: Added a new function. sql/sql_trigger.cc: Trim comments at the end. sql/sql_view.cc: Trim comments at the end.
This commit is contained in:
@ -1054,6 +1054,30 @@ int MYSQLlex(void *arg, void *yythd)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Skip comment in the end of statement.
|
||||
|
||||
SYNOPSIS
|
||||
skip_rear_comments()
|
||||
begin pointer to the beginning of statement
|
||||
end pointer to the end of statement
|
||||
|
||||
DESCRIPTION
|
||||
The function is intended to trim comments at the end of the statement.
|
||||
|
||||
RETURN
|
||||
Pointer to the last non-comment symbol of the statement.
|
||||
*/
|
||||
|
||||
uchar *skip_rear_comments(uchar *begin, uchar *end)
|
||||
{
|
||||
while (begin < end && (end[-1] <= ' ' || end[-1] == '*' ||
|
||||
end[-1] == '/' || end[-1] == ';'))
|
||||
end-= 1;
|
||||
return end;
|
||||
}
|
||||
|
||||
/*
|
||||
st_select_lex structures initialisations
|
||||
*/
|
||||
|
Reference in New Issue
Block a user