You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
delete() ignores a dj.Top restriction and deletes every matching row #1589
dj.Top is an ORDER BY ... LIMIT, kept in the expression's _top, not in its WHERE clause. Diagram.cascade builds the seed from table_expr.restriction only, and delete_quick uses where_clause() only, so both drop the Top. With no other condition, the whole table is deleted, along with its descendants. Diagram.trace has the same seed problem.
Workaround until the fix ships: restrict by the keys instead, (Item & (Item & dj.Top(2, order_by="item_id")).keys()).delete(). The delete prompt also shows the row counts before anything is deleted.
Fix: a seed restricted by Top is replaced by the primary keys it selects, in cascade, trace and delete_quick.
Activity