Bug #105984 CREATE database|table|etc IF NOT EXISTS should always be written to the binlogs
Submitted: 27 Dec 2021 12:18 Modified: 28 Jan 2022 21:52
Reporter: Alex Ivanov Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Utilities: Binlog Events Severity:S3 (Non-critical)
Version:8.0 OS:Ubuntu (20.04)
Assigned to: MySQL Verification Team CPU Architecture:x86
Tags: mysqlbinlog

[27 Dec 2021 12:18] Alex Ivanov
Description:
mysqlbinlog <some_binlog_file> |grep dep2
CREATE TABLE `dep2` (

where missing <IF NOT EXISTS> in create table statement

How to repeat:
CREATE TABLE dep2 (
  `dept_no` char(4) NOT NULL,
  `dept_name` varchar(40) NOT NULL
)

mysqlbinlog <some_binlog_file> |grep dep2
CREATE TABLE `dep2` (

versus

CREATE TABLE if not exists dep3 (
  `dept_no` char(4) NOT NULL,
  `dept_name` varchar(40) NOT NULL
)

mysqlbinlog <some_binlog_file> |grep dep3
CREATE TABLE if not exists dep3 (

Suggested fix:
It's should be as option in mysqlbinlog utility - if database, table, etc created without <IF NOT EXISTS>
For example, mysqlbinlog utility with option
 --create-if-not-exists [all|database|table|etc]
[28 Dec 2021 21:52] MySQL Verification Team
Hi,

But in your "how to reproduce" you did not create the table with "if not exists", why would you expect binlog to add "if not exists" then?
[29 Jan 2022 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".