2

I'm performing the following query:

        $sql ='UPDATE 
            Atable  A INNER JOIN 
            Btable  B ON A.name=B.name
        SET 
            A.field=1
        WHERE
            B.field="wrong"; '; 

Where B.field is not a Key column. Workbench correctly stops it with a error:

   Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.

But if I perform the above query with Laravel Eloquent:

 $affected = DB::update(DB::raw($sql2));

The query will run, so is there any safe usage from Eloquent I'm missing, or in general you need to be careful because Eloquent will be able to by pass safe update mode?

koalaok
  • 5,075
  • 11
  • 47
  • 91

0 Answers0