Bug #48799 CREATE VIEW is binlogged even if it fails
Submitted: 16 Nov 2009 11:29 Modified: 16 Nov 2009 12:26
Reporter: Sven Sandberg Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Triage: Triaged: D4 (Minor)

[16 Nov 2009 11:29] Sven Sandberg
Description:
If t is a base table or a view, then 'CREATE VIEW t...' fails (as is expected) but is still written to the binlog. It would be better if nothing was logged (as is the case for other queries that fail).

Note that this does not cause replication to break, because the error code is written to the binlog. When the slave executes the query and sees that the error code is the same as on the master, it will accept that the query fails and continue replication.

So this is mainly a cosmetic fix. Other similar failing queries are not logged, so the behavior is inconsistent.

How to repeat:
--source include/have_binlog_format_row.inc
CREATE TABLE t (a INT);
--error ER_TABLE_EXISTS_ERROR
CREATE VIEW t AS SELECT 1;
SHOW BINLOG EVENTS;
[16 Nov 2009 12:26] Miguel Solorzano
Thank you for the bug report.