2012-12-14 20 views
1
121214 11:54:30 [Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave. Statement: update db_ds_pax p 
     set p.mbp_id = 8861912, updated_ts = now() 
     where p.flight_id = 2506912 
     and p.logically_deleted = 0 
     and (
      exists (
        select * from db_bkg_passenger bkgp 
        where bkgp.bkg_pax_id = p.bkg_pax_id 
        and bkgp.ticket_num = '2202326623256' 
        and bkgp.logically_deleted = 0) 
      or exists (
        select * from db_dcs_pax dcsp 
        where dcsp.dcs_pax_id = p.dcs_pax_id 
        and dcsp.ticket_num = '2202326623256' 
        and dcsp.logically_deleted = 0)) 

這是什麼不安全的聲明?我沒有插入任何東西,只是更新。實際上,我甚至沒有選擇任何用於更新的東西。爲什麼這是不安全的mysql複製

我試圖用左連接重寫,但它仍然抱怨。我也認爲updated_ts = now()是罪魁禍首,並將其設置爲固定時間,但仍然是相同的警告。

服務器是Oracle的5.5.27

+1

。 – zerkms

+0

但我沒有插入我的選擇的內容,它只是用作支票 –

回答

0

語句從另一個表中選擇後自動遞增列寫入表是不安全的,因爲在其中檢索行的順序確定哪些(如果有的話)行將寫出來。此訂單無法預測,並可能在主人和從屬上有所不同

我什麼都沒做,只是複製粘貼了警告消息中的解釋。

所以好像UPDATE被視爲如果你向右滾動,你會看到警告信息說明「寫入表」

+0

是的,但在我的情況下,這種解釋沒有任何意義。 –

+1

@Aleksandar Ivanisevic:好的,好像mysql不會對你選擇的是什麼進行深入的分析。 – zerkms

相關問題