From ecbe0c373c166ca05e805f1a459751b5a1040577 Mon Sep 17 00:00:00 2001 From: Alexander Hartmaier Date: Mon, 11 Oct 2010 16:29:08 +0200 Subject: [PATCH] only limit resultset if there are related rows left --- lib/DBIx/Class/ResultSet/RecursiveUpdate.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm index 2d3efb8..c0be5cd 100644 --- a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm +++ b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm @@ -299,7 +299,6 @@ sub _update_relation { #warn "\tcreated and updated related rows\n"; - my @cond; my @related_pks = $related_resultset->result_source->primary_columns; my $rs_rel_delist = $object->$name; @@ -315,6 +314,7 @@ sub _update_relation { # foreign table has multiple pk columns else { + my @cond; for my $obj (@updated_objs) { my %cond_for_obj; for my $col (@related_pks) { @@ -322,7 +322,10 @@ sub _update_relation { } push @cond, \%cond_for_obj; } - $rs_rel_delist = $rs_rel_delist->search_rs( { -not => [@cond] } ); + # only limit resultset if there are related rows left + if (scalar @cond) { + $rs_rel_delist = $rs_rel_delist->search_rs( { -not => [@cond] } ); + } } #warn "\tCOND: " . Dumper(\%cond); -- 2.43.0