# Request for Review: Ticket #10686

**URL:** <https://discuss.rubyonrails.org/t/request-for-review-ticket-10686/22646>\
**Category:** rubyonrails-core\
**Created:** [January 3, 2008, 11:07pm UTC](https://discuss.rubyonrails.org/t/request-for-review-ticket-10686/22646 "2008-01-03T23:07:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brendan\_Ribera](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@Brendan\_Ribera](https://discuss.rubyonrails.org/u/Brendan_Ribera)\
**Post date:** [January 3, 2008, 11:07pm UTC](https://discuss.rubyonrails.org/t/request-for-review-ticket-10686/22646/1 "2008-01-03T23:07:54Z")

</div>

[http://dev.rubyonrails.org/ticket/10686](http://dev.rubyonrails.org/ticket/10686)

I'd really appreciate it if a few people would test patch this out and give feedback.

It changes the SQL generated by update\_all so that passing :limit or :order options will work with non-MySQL adapters. The SQL currently generated creates SQL Exceptions for non-MySQL adapters.

Added tests pass for MySQL, PostgreSQL, and Sqlite3; I'm working on tests to run (period) for other adapters, so testing those would be most helpful.

Verification, comments, and +1s would be appreciated!

Thanks! Brendan

---

<div class="post-metadata">

**Author:** ![bitsweat](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bitsweat/32/591_2.png) [@bitsweat](https://discuss.rubyonrails.org/u/bitsweat)\
**Post date:** [January 4, 2008, 12:49am UTC](https://discuss.rubyonrails.org/t/request-for-review-ticket-10686/22646/2 "2008-01-04T00:49:36Z")

</div>

The :limit and :order options are meant to apply to the UPDATE statement directly -- simply don't use them with databases that don't support it.

The issue you're seeing is that :limit and :order are being pulled from the association scope -- this is a bug, IMO, and should be fixed rather than adding roundabout support for a niche feature.

See [MySQL :: MySQL 8.0 Reference Manual :: 13.2.13 UPDATE Statement](http://dev.mysql.com/doc/refman/5.1/en/update.html) for why you sometimes want to use UPDATE ... ORDER BY with MySQL. It works around duplicate key errors.

Best, jeremy
