X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBIHacks.pm;h=cb75f142ecd3d28e7f549519fc45d5a8c4606062;hb=946f626022c63fd269d9d985c2abeabb52871027;hp=3efd4884a39813da053863b9b494c13038ee5dfe;hpb=908aa1bb761ec1da5c061fe9f687598e3f1934bc;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index 3efd488..cb75f14 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -72,7 +72,6 @@ sub _adjust_select_args_for_complex_prefetch { $self->throw_exception ('Complex prefetches are not supported on resultsets with a custom from attribute') if (ref $from ne 'ARRAY' || ref $from->[0] ne 'HASH' || ref $from->[1] ne 'ARRAY'); - # generate inner/outer attribute lists, remove stuff that doesn't apply my $outer_attrs = { %$attrs }; delete $outer_attrs->{$_} for qw/where bind rows offset group_by having/; @@ -80,6 +79,9 @@ sub _adjust_select_args_for_complex_prefetch { my $inner_attrs = { %$attrs, _is_internal_subuery => 1 }; delete $inner_attrs->{$_} for qw/for collapse _prefetch_selector_range select as/; + # if the user did not request it, there is no point using it inside + delete $inner_attrs->{order_by} if delete $inner_attrs->{_order_is_artificial}; + # generate the inner/outer select lists # for inside we consider only stuff *not* brought in by the prefetch # on the outside we substitute any function for its alias