From: Matt S Trout Date: Sun, 22 Apr 2012 19:03:26 +0000 (+0000) Subject: restore order_is_artifical check X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=12d981dd9267434f9ec3f8a25075a84a55136648;p=dbsrgits%2FDBIx-Class-Historic.git restore order_is_artifical check --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index ed2a3f3..0367784 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -3593,6 +3593,7 @@ sub _resolved_attrs { # default order for collapsing unless the user asked for something $attrs->{order_by} = [ map { "$alias.$_" } $source->primary_columns ]; $attrs->{_ordered_for_collapse} = 1; + $attrs->{_order_is_artificial} = 1; } # if both page and offset are specified, produce a combined offset diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index d1ffa4e..1c81dc4 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -87,6 +87,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