Test NULLS FIRST/LAST for limit dialects that mangle ordering
Dagfinn Ilmari Mannsåker [Fri, 22 Mar 2013 23:21:36 +0000 (23:21 +0000)]
t/sqlmaker/limit_dialects/fetch_first.t
t/sqlmaker/limit_dialects/toplimit.t

index b867086..6a1dd7c 100644 (file)
@@ -114,6 +114,17 @@ for my $ord_set (
     exselect_outer => 'ORDER__BY__001, ORDER__BY__002, ORDER__BY__003',
     exselect_inner => 'title AS ORDER__BY__001, bar AS ORDER__BY__002, sensors AS ORDER__BY__003',
   },
+  {
+    order_by => [
+        { -asc => 'title', -nulls => 'first' },
+        { -desc => 'bar', -nulls => 'last' },
+    ],
+    order_inner => 'title NULLS FIRST, bar DESC NULLS LAST',
+    order_outer => 'ORDER__BY__001 DESC NULLS LAST, ORDER__BY__002 NULLS FIRST',
+    order_req => 'ORDER__BY__001 NULLS FIRST, ORDER__BY__002 DESC NULLS LAST',
+    exselect_outer => 'ORDER__BY__001, ORDER__BY__002',
+    exselect_inner => 'title AS ORDER__BY__001, bar AS ORDER__BY__002',
+  },
 ) {
   my $o_sel = $ord_set->{exselect_outer}
     ? ', ' . $ord_set->{exselect_outer}
index a4e7836..6374588 100644 (file)
@@ -153,6 +153,17 @@ for my $ord_set (
     exselect_outer => 'ORDER__BY__001, ORDER__BY__002, ORDER__BY__003',
     exselect_inner => 'title AS ORDER__BY__001, bar AS ORDER__BY__002, sensors AS ORDER__BY__003',
   },
+  {
+    order_by => [
+        { -asc => 'title', -nulls => 'first' },
+        { -desc => 'bar', -nulls => 'last' },
+    ],
+    order_inner => 'title NULLS FIRST, bar DESC NULLS LAST',
+    order_outer => 'ORDER__BY__001 DESC NULLS LAST, ORDER__BY__002 NULLS FIRST',
+    order_req => 'ORDER__BY__001 NULLS FIRST, ORDER__BY__002 DESC NULLS LAST',
+    exselect_outer => 'ORDER__BY__001, ORDER__BY__002',
+    exselect_inner => 'title AS ORDER__BY__001, bar AS ORDER__BY__002',
+  },
 ) {
   my $o_sel = $ord_set->{exselect_outer}
     ? ', ' . $ord_set->{exselect_outer}