This project is archived and is in readonly mode.
update_all ignores conditions, when :orders and :limit options are supplied
-
Neeraj Singh
- State changed from new to open
- Assigned user set to Neeraj Singh
- Importance changed from to Low
looking into it.
-
Neeraj Singh
Attached is a failing test.
Relation is being built right. Look like issue is with Arel. Studying the code. Patch might take a while :-)
-
rails
- Tag changed from 3.0.2, arel, update_all to 302, arel, update_all
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails
- State changed from open to stale
-
Howard Yeh
- State changed from stale to open
[state:open]
this problem persists for 3.0.5.
Ruby 1.9.2
Adapter: postgres -
Hugo Peixoto
Looks like the bug is in ARel indeed. When a subquery is generated, all other WHERE clauses are dropped.
I attached a patch that fixes this bug and adds a test case.
-
Hugo Peixoto
The previous patch kept the where conditions on the UPDATE statement. That is not the correct behavior, as the order/limit clauses wouldn't be applied with the WHERE clauses in mind.
This one passes the WHERE clauses to the generated subquery.
-
Santiago Pastorino
- Assigned user changed from Neeraj Singh to Aaron Patterson
-
Aaron Patterson
@Hugo I've applied this patch to ARel master which is the unreleased 2.1.0 version.
Would you mind backporting this to 2.0.x?
-
Hugo Peixoto
2.0.x backported patch attached.
