fix desc detection for genericsubq
Matt S Trout [Sat, 18 Aug 2012 12:25:57 +0000 (13:25 +0100)]
lib/Data/Query/Renderer/SQL/Slice/GenericSubquery.pm

index c01c48c..c637729 100644 (file)
@@ -23,8 +23,11 @@ sub _render_slice {
     [ Operator({ 'SQL.Naive' => 'apply' }, [ Identifier('COUNT'), Identifier('*') ]) ],
     Where(
       Operator(
-        { 'SQL.Naive' => ($first_order->{reverse} ? '>' : '<') },
-        [ Identifier($count_alias, $count_col), $first_order ]
+        { 'SQL.Naive' => ($remapped{inside_order}[0]{reverse} ? '>' : '<') },
+        [
+          Identifier($count_alias, $count_col),
+          $remapped{outside_order}[0]{by}
+        ]
       ),
       Alias($count_alias, $first_from)
     )