0

I got the following warning running the simple statement and I was curious as to why I got it:

UPDATE `Table1` 
SET `City`='Miami', 
    `ExpDate`='201227', 
    `User`='JDoe', 
    `UpdDate`='2015-02-17 16:11:25' 
WHERE `id` = 61`

Here is the Table1 structure:

CREATE TABLE `Table1` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `User` varchar(10) COLLATE utf8_bin DEFAULT NULL,
  `City` varchar(25) COLLATE utf8_bin DEFAULT NULL,
  `ExpDate` varchar(10) COLLATE utf8_bin DEFAULT NULL,
  `UpdDate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `Unique_Index` (`User`,`City`),
  UNIQUE KEY `id` (`id`),
  KEY `ALT1_IDX_Table1` (`User`,`City`)
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

Full Error from log:

2015-02-17 16:10:08 1548 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. Statement: UPDATETable1 SETCity='Miami', ExpDate='201227', User='JDoe', UpdDate='2015-02-17 16:11:25' WHEREid= 61

xaisoft
  • 3,343
  • 8
  • 44
  • 72

1 Answers1

1

Finally, the error show exactly what's wrong here. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column The error is not in the table itself, the error is in a trigger or procedure that fires when this table get's updated.

Brain Foo Long
  • 2,057
  • 23
  • 28
  • You are right. I looked and there are like 5 triggers. I am not too familiar with mySQL. I guess a DBA should be able to solve the problem. I have noticed a lot of people using Mixed Mode instead of Binary. – xaisoft Feb 18 '15 at 14:55
  • Maybe your DB was not fairly optimized for replications. Maybe there is some work to re-build, depends on your specific db structure. You should ask someone that made this database. – Brain Foo Long Feb 18 '15 at 14:57