Hi, Sriram! On Jun 19, sriram patil wrote:
Hi All,
I was checking the behavior of bin logging in various methods. I found out CREATE VIEW differs a little bit than others in bin logging.
The query is written into bin log if query is executed successfully. If there is any error the query is not logged. This behavior is observed across all the commands.
In case of CREATE VIEW (method: mysql_create_view file: sql/sql_view.cc), while the bin logging is skipped for most of the errors by jumping to "err" label, it is not skipped ... Is there a specific reason why it is logged even though an error occurs? Or is it a bug?
Looks like a bug to me too. It's easy to see in the history - git blame shows that this binlog-writing chunk was added in commit e6eef5c1a765d27e1a8d1c7d707fb416dfa0ec2f. Commit comment and changes to other files in the same commit show that the goal was to move binlogging code inside mysql_create_view (and other similar functions), it was outside before. And before that commit no binlogging was done if mysql_create_view() failed. So, apparently that commit has introduced a bug that you've now found. Good job :) Regards, Sergei