resultset.set ignores slice, modifying data it shouldn't

Bug #820290 reported by Stuart Bishop
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
New
Undecided
Unassigned

Bug Description

This is a potential data loss bug.

For a result set foo, foo[:n].set(...) updated all rows selected by the foo result set, not just the sliced rows.

>>> bugs = store.find(Bug)
>>> limited_bugs = bugs[:3]
>>> list(limited_bugs)
SELECT Bug.date_last_message, Bug.date_last_updated, Bug.date_made_private, Bug.datecreated, Bug.description, Bug.duplicateof, Bug.heat, Bug.heat_last_updated, Bug.id, Bug.latest_patch_uploaded, Bug.message_count, Bug.name, Bug.number_of_duplicates, Bug.owner, Bug.private, Bug.security_related, Bug.title, Bug.users_affected_count, Bug.users_unaffected_count, Bug.who_made_private FROM Bug ORDER BY Bug.id DESC LIMIT 3
----------------------------------------------------------------------
[<Bug at 0x791fb90>, <Bug at 0x791fa10>, <Bug at 0x791f890>]
>>> limited_bugs.set(heat_last_updated=None)
UPDATE Bug SET heat_last_updated=NULL
----------------------------------------------------------------------

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.