chill117 / express-mysql-session

A MySQL session store for the express framework in node
MIT License
313 stars 109 forks source link

Drop LIMIT 1 clause from UPDATE query #82

Closed gcampax closed 6 years ago

gcampax commented 6 years ago

Using LIMIT 1 causes MySQL to warn in certain configurations:

[Warning] Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. Statement: UPDATE sessions SET expires = 1524671478 WHERE session_id = '.......' LIMIT 1

The LIMIT clause is unnecessary anyway because session_id is PRIMARY KEY so the SQL optimizer knows there can be at most only one row touched.

chill117 commented 6 years ago

This issue has been addressed by commit 2e21653