# 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) {
# 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
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 =