MySQL: "LIMIT 5" generates warnings

I ran the following query in the MySQL console:

INSERT INTO pixel_window 
   SELECT id 
      FROM pixels 
         WHERE pixel_id='type2' 
            ORDER BY id DESC 
               LIMIT 5;

And received:

Query OK, 5 rows affected, 1 warning (0.00 sec)
Records: 5  Duplicates: 0  Warnings: 0

mysql> SHOW WARNINGS\G
*************************** 1. row ***************************
  Level: Note
   Code: 1592
Message: Statement may not be safe to log in statement format.
1 row in set (0.00 sec)

I played around a bit with the request and found out that when I skipped, the LIMITwarning disappears.

What does this warning mean? Why is the LIMITproblem in this subquery?

+5
source share
1 answer

He considered a mistake.

A warning may be triggered if you do not specify the order by offer in your update. In your case, this is considered safe, since you order by ID (id id - unique identifier?)

Read more about bugreport here: http://bugs.mysql.com/bug.php?id=42415

+6
source

All Articles