From: Matt S Trout Date: Fri, 20 Apr 2012 03:20:25 +0000 (+0000) Subject: introduce internal prune_multiplying to de-hack some code X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d35a4e048a7999e59f66c54a21eb12515e01fd42;p=dbsrgits%2FDBIx-Class-Historic.git introduce internal prune_multiplying to de-hack some code --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index b491e6a..43c06fb 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1901,7 +1901,7 @@ sub _rs_update_delete { # make a new $rs selecting only the PKs (that's all we really need for the subq) delete @{$attrs}{qw/collapse select _prefetch_selector_range as/}; $attrs->{columns} = [ map { "$attrs->{alias}.$_" } @$idcols ]; - #$attrs->{group_by} = []; # FIXME - this is an evil hack, it causes the optimiser to kick in and throw away the LEFT joins + $attrs->{prune_multiplying} = 1; my $subrs = (ref $self)->new($rsrc, $attrs); if (@$idcols == 1) { diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index 32c26a0..a5ce102 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -39,7 +39,8 @@ sub _prune_unused_joins { # a grouped set will not be affected by amount of rows. Thus any # {multiplying} joins can go - delete $aliastypes->{multiplying} if $attrs->{group_by}; + delete $aliastypes->{multiplying} + if $attrs->{group_by} or $attrs->{prune_multiplying}; my @newfrom = $from->[0]; # FROM head is always present @@ -115,7 +116,7 @@ sub _adjust_select_args_for_complex_prefetch { local $self->{_use_join_optimizer} = 1; my $inner_from = $self->_prune_unused_joins ($from, $inner_select, $where, { - group_by => ['dummy'], %$inner_attrs, + prune_multiplying => 1, %$inner_attrs, }); my $inner_aliastypes =