/ Check-in [75d665a4]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix problems with window frames that use ORDER BY ... NULLS LAST etc.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nulls-last
Files: files | file ages | folders
SHA3-256: 75d665a494dd7d6e77d5a80af386ee5accc0a53416d5493424dc0fef6c7b01a0
User & Date: dan 2019-08-19 19:59:50
Context
2019-08-20
15:47
Do not pass ORDER BY clauses with non-standard NULL handling to virtual table implementations. check-in: a9a82ee8 user: dan tags: nulls-last
2019-08-19
19:59
Fix problems with window frames that use ORDER BY ... NULLS LAST etc. check-in: 75d665a4 user: dan tags: nulls-last
17:26
Prevent NULLS FIRST/LAST from being used in CREATE INDEX and other statements. check-in: bb9767a2 user: dan tags: nulls-last
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  1397   1397           pNewExpr->pLeft = pPriorSelectCol;
  1398   1398         }
  1399   1399       }
  1400   1400       pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
  1401   1401       pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan);
  1402   1402       pItem->sortFlags = pOldItem->sortFlags;
  1403   1403       pItem->done = 0;
         1404  +    pItem->bNulls = pOldItem->bNulls;
  1404   1405       pItem->bSpanIsTab = pOldItem->bSpanIsTab;
  1405   1406       pItem->bSorterRef = pOldItem->bSorterRef;
  1406   1407       pItem->u = pOldItem->u;
  1407   1408     }
  1408   1409     return pNew;
  1409   1410   }
  1410   1411   

Changes to src/window.c.

  1872   1872   ){
  1873   1873     Parse *pParse = p->pParse;
  1874   1874     Vdbe *v = sqlite3GetVdbe(pParse);
  1875   1875     int reg1 = sqlite3GetTempReg(pParse);
  1876   1876     int reg2 = sqlite3GetTempReg(pParse);
  1877   1877     int arith = OP_Add;
  1878   1878     int addrGe;
         1879  +  ExprList *pOrderBy = p->pMWin->pOrderBy;
  1879   1880   
  1880   1881     int regString = ++pParse->nMem;
  1881   1882   
  1882   1883     assert( op==OP_Ge || op==OP_Gt || op==OP_Le );
  1883         -  assert( p->pMWin->pOrderBy && p->pMWin->pOrderBy->nExpr==1 );
  1884         -  if( p->pMWin->pOrderBy->a[0].sortFlags & KEYINFO_ORDER_DESC ){
         1884  +  assert( pOrderBy && pOrderBy->nExpr==1 );
         1885  +  if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_DESC ){
  1885   1886       switch( op ){
  1886   1887         case OP_Ge: op = OP_Le; break;
  1887   1888         case OP_Gt: op = OP_Lt; break;
  1888   1889         default: assert( op==OP_Le ); op = OP_Ge; break;
  1889   1890       }
  1890   1891       arith = OP_Subtract;
  1891   1892     }
................................................................................
  1897   1898     ** it to the smallest possible string - ''. If it is, jump over the
  1898   1899     ** OP_Add or OP_Subtract operation and proceed directly to the comparison. */
  1899   1900     sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC);
  1900   1901     addrGe = sqlite3VdbeAddOp3(v, OP_Ge, regString, 0, reg1);
  1901   1902     VdbeCoverage(v);
  1902   1903     sqlite3VdbeAddOp3(v, arith, regVal, reg1, reg1);
  1903   1904     sqlite3VdbeJumpHere(v, addrGe);
         1905  +  if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_BIGNULL ){
         1906  +    int addr;
         1907  +    addr = sqlite3VdbeAddOp1(v, OP_NotNull, reg1); VdbeCoverage(v);
         1908  +    switch( op ){
         1909  +      case OP_Ge: sqlite3VdbeAddOp2(v, OP_Goto, 0, lbl); break;
         1910  +      case OP_Gt: sqlite3VdbeAddOp2(v, OP_NotNull, reg2, lbl); break;
         1911  +      case OP_Le: sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); break;
         1912  +      default: assert( op==OP_Lt ); /* no-op */
         1913  +    }
         1914  +    sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
         1915  +    sqlite3VdbeJumpHere(v, addr);
         1916  +    sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); VdbeCoverage(v);
         1917  +    if( op==OP_Gt || op==OP_Ge ){
         1918  +      sqlite3VdbeChangeP2(v, -1, sqlite3VdbeCurrentAddr(v)+1);
         1919  +    }
         1920  +  }
  1904   1921     sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1); VdbeCoverage(v);
  1905   1922     sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);
  1906   1923     assert( op==OP_Ge || op==OP_Gt || op==OP_Lt || op==OP_Le );
  1907   1924     testcase(op==OP_Ge); VdbeCoverageIf(v, op==OP_Ge);
  1908   1925     testcase(op==OP_Lt); VdbeCoverageIf(v, op==OP_Lt);
  1909   1926     testcase(op==OP_Le); VdbeCoverageIf(v, op==OP_Le);
  1910   1927     testcase(op==OP_Gt); VdbeCoverageIf(v, op==OP_Gt);

Changes to test/nulls1.test.

    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   
    14     14   set testdir [file dirname $argv0]
    15     15   source $testdir/tester.tcl
    16     16   set testprefix nulls1
    17     17   
    18         -if 1 {
    19         -
    20     18   do_execsql_test 1.0 {
    21     19     DROP TABLE IF EXISTS t3;
    22     20     CREATE TABLE t3(a INTEGER);
    23     21     INSERT INTO t3 VALUES(NULL), (10), (30), (20), (NULL);
    24     22   } {}
    25     23   
    26     24   for {set a 0} {$a < 3} {incr a} {
................................................................................
    51     49       }
    52     50       1 {
    53     51         execsql { DROP INDEX i1 ; CREATE INDEX i1 ON t3(a DESC) }
    54     52       }
    55     53     }
    56     54   }
    57     55   
    58         -}
    59         -
    60     56   #-------------------------------------------------------------------------
    61     57   reset_db
    62     58   do_execsql_test 2.0 {
    63     59     CREATE TABLE t2(a, b, c);
    64     60     CREATE INDEX i2 ON t2(a, b);
    65     61     INSERT INTO t2 VALUES(1, 1, 1);
    66     62     INSERT INTO t2 VALUES(1, NULL, 2);
................................................................................
    80     76     1 {} 3
    81     77     1 {} 2     
    82     78     1 4 4     
    83     79     1 1 1
    84     80   }
    85     81   
    86     82   #-------------------------------------------------------------------------
           83  +#
    87     84   reset_db
    88     85   do_execsql_test 3.0 {
    89     86     CREATE TABLE t1(a, b, c, d, UNIQUE (b));
    90     87   }
    91     88   foreach {tn sql err}  {
    92     89     1 { CREATE INDEX i1 ON t1(a ASC NULLS LAST) }           LAST
    93     90     2 { CREATE INDEX i1 ON t1(a ASC NULLS FIRST) }          FIRST
................................................................................
   116    113     INSERT INTO first(last, nulls) VALUES(100,200), (300,400), (200,300);
   117    114     SELECT * FROM first ORDER BY nulls;
   118    115   } {
   119    116     200 100
   120    117     300 200
   121    118     400 300
   122    119   }
   123         -
   124    120   
   125    121   finish_test

Changes to test/pg_common.tcl.

    66     66   
    67     67     set ret
    68     68   }
    69     69   
    70     70   proc execsql_test {tn sql} {
    71     71     set res [execsql $sql]
    72     72     set sql [string map {string_agg group_concat} $sql]
    73         -  set sql [string map [list {NULLS FIRST} {}] $sql]
    74         -  set sql [string map [list {NULLS LAST} {}] $sql]
           73  +  # set sql [string map [list {NULLS FIRST} {}] $sql]
           74  +  # set sql [string map [list {NULLS LAST} {}] $sql]
    75     75     puts $::fd "do_execsql_test $tn {"
    76     76     puts $::fd "  [string trim $sql]"
    77     77     puts $::fd "} {$res}"
    78     78     puts $::fd ""
    79     79   }
    80     80   
    81     81   proc errorsql_test {tn sql} {

Changes to test/window7.test.

    37     37       (1, 81), (2, 82), (3, 83), (4, 84), (5, 85), (6, 86), (7, 87), (8, 88), 
    38     38       (9, 89), (0, 90), (1, 91), (2, 92), (3, 93), (4, 94), (5, 95), (6, 96), 
    39     39       (7, 97), (8, 98), (9, 99), (0, 100);
    40     40   } {}
    41     41   
    42     42   do_execsql_test 1.1 {
    43     43     SELECT a, sum(b) FROM t3 GROUP BY a ORDER BY 1;
    44         -} {0 550   1 460   2 470   3 480   4 490   5 500   6 510   7 520   8 530   9 540}
           44  +} {0 550   1 460   2 470   3 480   4 490   5 500   6 510   7 520   8 530
           45  +  9 540}
    45     46   
    46     47   do_execsql_test 1.2 {
    47     48     SELECT a, sum(b) OVER (
    48     49       ORDER BY a GROUPS BETWEEN CURRENT ROW AND CURRENT ROW
    49     50     ) FROM t3 ORDER BY 1;
    50         -} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540}
           51  +} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550
           52  +  0 550   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460
           53  +  1 460   1 460   2 470   2 470   2 470   2 470   2 470   2 470   2 470
           54  +  2 470   2 470   2 470   3 480   3 480   3 480   3 480   3 480   3 480
           55  +  3 480   3 480   3 480   3 480   4 490   4 490   4 490   4 490   4 490
           56  +  4 490   4 490   4 490   4 490   4 490   5 500   5 500   5 500   5 500
           57  +  5 500   5 500   5 500   5 500   5 500   5 500   6 510   6 510   6 510
           58  +  6 510   6 510   6 510   6 510   6 510   6 510   6 510   7 520   7 520
           59  +  7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   8 530
           60  +  8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530
           61  +  9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540
           62  +  9 540}
    51     63   
    52     64   do_execsql_test 1.3 {
    53     65     SELECT a, sum(b) OVER (
    54     66       ORDER BY a GROUPS BETWEEN 0 PRECEDING AND 0 FOLLOWING
    55     67     ) FROM t3 ORDER BY 1;
    56         -} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540}
           68  +} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550
           69  +  0 550   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460
           70  +  1 460   1 460   2 470   2 470   2 470   2 470   2 470   2 470   2 470
           71  +  2 470   2 470   2 470   3 480   3 480   3 480   3 480   3 480   3 480
           72  +  3 480   3 480   3 480   3 480   4 490   4 490   4 490   4 490   4 490
           73  +  4 490   4 490   4 490   4 490   4 490   5 500   5 500   5 500   5 500
           74  +  5 500   5 500   5 500   5 500   5 500   5 500   6 510   6 510   6 510
           75  +  6 510   6 510   6 510   6 510   6 510   6 510   6 510   7 520   7 520
           76  +  7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   8 530
           77  +  8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530
           78  +  9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540
           79  +  9 540}
    57     80   
    58     81   do_execsql_test 1.4 {
    59     82     SELECT a, sum(b) OVER (
    60     83       ORDER BY a GROUPS BETWEEN 2 PRECEDING AND 2 FOLLOWING
    61     84     ) FROM t3 ORDER BY 1;
    62         -} {0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590}
           85  +} {0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480
           86  +  0 1480   0 1480   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960
           87  +  1 1960   1 1960   1 1960   1 1960   2 2450   2 2450   2 2450   2 2450
           88  +  2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   3 2400   3 2400
           89  +  3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400
           90  +  4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450
           91  +  4 2450   4 2450   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500
           92  +  5 2500   5 2500   5 2500   5 2500   6 2550   6 2550   6 2550   6 2550
           93  +  6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   7 2600   7 2600
           94  +  7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600
           95  +  8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100
           96  +  8 2100   8 2100   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590
           97  +  9 1590   9 1590   9 1590   9 1590}
    63     98   
    64     99   do_execsql_test 1.5 {
    65    100     SELECT a, sum(b) OVER (
    66    101       ORDER BY a RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING
    67    102     ) FROM t3 ORDER BY 1;
    68         -} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   2 470   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   3 480   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   4 490   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   5 500   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   6 510   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540}
          103  +} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550
          104  +  0 550   1 460   1 460   1 460   1 460   1 460   1 460   1 460   1 460
          105  +  1 460   1 460   2 470   2 470   2 470   2 470   2 470   2 470   2 470
          106  +  2 470   2 470   2 470   3 480   3 480   3 480   3 480   3 480   3 480
          107  +  3 480   3 480   3 480   3 480   4 490   4 490   4 490   4 490   4 490
          108  +  4 490   4 490   4 490   4 490   4 490   5 500   5 500   5 500   5 500
          109  +  5 500   5 500   5 500   5 500   5 500   5 500   6 510   6 510   6 510
          110  +  6 510   6 510   6 510   6 510   6 510   6 510   6 510   7 520   7 520
          111  +  7 520   7 520   7 520   7 520   7 520   7 520   7 520   7 520   8 530
          112  +  8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530   8 530
          113  +  9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540
          114  +  9 540}
    69    115   
    70    116   do_execsql_test 1.6 {
    71    117     SELECT a, sum(b) OVER (
    72    118       ORDER BY a RANGE BETWEEN 2 PRECEDING AND 2 FOLLOWING
    73    119     ) FROM t3 ORDER BY 1;
    74         -} {0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590}
          120  +} {0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480   0 1480
          121  +  0 1480   0 1480   1 1960   1 1960   1 1960   1 1960   1 1960   1 1960
          122  +  1 1960   1 1960   1 1960   1 1960   2 2450   2 2450   2 2450   2 2450
          123  +  2 2450   2 2450   2 2450   2 2450   2 2450   2 2450   3 2400   3 2400
          124  +  3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400   3 2400
          125  +  4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450   4 2450
          126  +  4 2450   4 2450   5 2500   5 2500   5 2500   5 2500   5 2500   5 2500
          127  +  5 2500   5 2500   5 2500   5 2500   6 2550   6 2550   6 2550   6 2550
          128  +  6 2550   6 2550   6 2550   6 2550   6 2550   6 2550   7 2600   7 2600
          129  +  7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600   7 2600
          130  +  8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100
          131  +  8 2100   8 2100   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590
          132  +  9 1590   9 1590   9 1590   9 1590}
    75    133   
    76    134   do_execsql_test 1.7 {
    77    135     SELECT a, sum(b) OVER (
    78    136       ORDER BY a RANGE BETWEEN 2 PRECEDING AND 1 FOLLOWING
    79    137     ) FROM t3 ORDER BY 1;
    80         -} {0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   1 1480   1 1480   1 1480   1 1480   1 1480   1 1480   1 1480   1 1480   1 1480   1 1480   2 1960   2 1960   2 1960   2 1960   2 1960   2 1960   2 1960   2 1960   2 1960   2 1960   3 1900   3 1900   3 1900   3 1900   3 1900   3 1900   3 1900   3 1900   3 1900   3 1900   4 1940   4 1940   4 1940   4 1940   4 1940   4 1940   4 1940   4 1940   4 1940   4 1940   5 1980   5 1980   5 1980   5 1980   5 1980   5 1980   5 1980   5 1980   5 1980   5 1980   6 2020   6 2020   6 2020   6 2020   6 2020   6 2020   6 2020   6 2020   6 2020   6 2020   7 2060   7 2060   7 2060   7 2060   7 2060   7 2060   7 2060   7 2060   7 2060   7 2060   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590}
          138  +} {0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010
          139  +  0 1010   0 1010   1 1480   1 1480   1 1480   1 1480   1 1480   1 1480
          140  +  1 1480   1 1480   1 1480   1 1480   2 1960   2 1960   2 1960   2 1960
          141  +  2 1960   2 1960   2 1960   2 1960   2 1960   2 1960   3 1900   3 1900
          142  +  3 1900   3 1900   3 1900   3 1900   3 1900   3 1900   3 1900   3 1900
          143  +  4 1940   4 1940   4 1940   4 1940   4 1940   4 1940   4 1940   4 1940
          144  +  4 1940   4 1940   5 1980   5 1980   5 1980   5 1980   5 1980   5 1980
          145  +  5 1980   5 1980   5 1980   5 1980   6 2020   6 2020   6 2020   6 2020
          146  +  6 2020   6 2020   6 2020   6 2020   6 2020   6 2020   7 2060   7 2060
          147  +  7 2060   7 2060   7 2060   7 2060   7 2060   7 2060   7 2060   7 2060
          148  +  8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100   8 2100
          149  +  8 2100   8 2100   9 1590   9 1590   9 1590   9 1590   9 1590   9 1590
          150  +  9 1590   9 1590   9 1590   9 1590}
    81    151   
    82    152   do_execsql_test 1.8.1 {
    83    153     SELECT a, sum(b) OVER (
    84    154       ORDER BY a RANGE BETWEEN 0 PRECEDING AND 1 FOLLOWING
    85    155     ) FROM t3 ORDER BY 1;
    86         -} {0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   1 930   1 930   1 930   1 930   1 930   1 930   1 930   1 930   1 930   1 930   2 950   2 950   2 950   2 950   2 950   2 950   2 950   2 950   2 950   2 950   3 970   3 970   3 970   3 970   3 970   3 970   3 970   3 970   3 970   3 970   4 990   4 990   4 990   4 990   4 990   4 990   4 990   4 990   4 990   4 990   5 1010   5 1010   5 1010   5 1010   5 1010   5 1010   5 1010   5 1010   5 1010   5 1010   6 1030   6 1030   6 1030   6 1030   6 1030   6 1030   6 1030   6 1030   6 1030   6 1030   7 1050   7 1050   7 1050   7 1050   7 1050   7 1050   7 1050   7 1050   7 1050   7 1050   8 1070   8 1070   8 1070   8 1070   8 1070   8 1070   8 1070   8 1070   8 1070   8 1070   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540   9 540}
          156  +} {0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010   0 1010
          157  +  0 1010   0 1010   1 930   1 930   1 930   1 930   1 930   1 930   1 930
          158  +  1 930   1 930   1 930   2 950   2 950   2 950   2 950   2 950   2 950
          159  +  2 950   2 950   2 950   2 950   3 970   3 970   3 970   3 970   3 970
          160  +  3 970   3 970   3 970   3 970   3 970   4 990   4 990   4 990   4 990
          161  +  4 990   4 990   4 990   4 990   4 990   4 990   5 1010   5 1010   5 1010
          162  +  5 1010   5 1010   5 1010   5 1010   5 1010   5 1010   5 1010   6 1030
          163  +  6 1030   6 1030   6 1030   6 1030   6 1030   6 1030   6 1030   6 1030
          164  +  6 1030   7 1050   7 1050   7 1050   7 1050   7 1050   7 1050   7 1050
          165  +  7 1050   7 1050   7 1050   8 1070   8 1070   8 1070   8 1070   8 1070
          166  +  8 1070   8 1070   8 1070   8 1070   8 1070   9 540   9 540   9 540   9 540
          167  +  9 540   9 540   9 540   9 540   9 540   9 540}
    87    168   
    88    169   do_execsql_test 1.8.2 {
    89    170     SELECT a, sum(b) OVER (
    90    171       ORDER BY a DESC RANGE BETWEEN 0 PRECEDING AND 1 FOLLOWING
    91    172     ) FROM t3 ORDER BY 1;
    92         -} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   1 1010   1 1010   1 1010   1 1010   1 1010   1 1010   1 1010   1 1010   1 1010   1 1010   2 930   2 930   2 930   2 930   2 930   2 930   2 930   2 930   2 930   2 930   3 950   3 950   3 950   3 950   3 950   3 950   3 950   3 950   3 950   3 950   4 970   4 970   4 970   4 970   4 970   4 970   4 970   4 970   4 970   4 970   5 990   5 990   5 990   5 990   5 990   5 990   5 990   5 990   5 990   5 990   6 1010   6 1010   6 1010   6 1010   6 1010   6 1010   6 1010   6 1010   6 1010   6 1010   7 1030   7 1030   7 1030   7 1030   7 1030   7 1030   7 1030   7 1030   7 1030   7 1030   8 1050   8 1050   8 1050   8 1050   8 1050   8 1050   8 1050   8 1050   8 1050   8 1050   9 1070   9 1070   9 1070   9 1070   9 1070   9 1070   9 1070   9 1070   9 1070   9 1070}
          173  +} {0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550   0 550
          174  +  0 550   1 1010   1 1010   1 1010   1 1010   1 1010   1 1010   1 1010
          175  +  1 1010   1 1010   1 1010   2 930   2 930   2 930   2 930   2 930   2 930
          176  +  2 930   2 930   2 930   2 930   3 950   3 950   3 950   3 950   3 950
          177  +  3 950   3 950   3 950   3 950   3 950   4 970   4 970   4 970   4 970
          178  +  4 970   4 970   4 970   4 970   4 970   4 970   5 990   5 990   5 990
          179  +  5 990   5 990   5 990   5 990   5 990   5 990   5 990   6 1010   6 1010
          180  +  6 1010   6 1010   6 1010   6 1010   6 1010   6 1010   6 1010   6 1010
          181  +  7 1030   7 1030   7 1030   7 1030   7 1030   7 1030   7 1030   7 1030
          182  +  7 1030   7 1030   8 1050   8 1050   8 1050   8 1050   8 1050   8 1050
          183  +  8 1050   8 1050   8 1050   8 1050   9 1070   9 1070   9 1070   9 1070
          184  +  9 1070   9 1070   9 1070   9 1070   9 1070   9 1070}
    93    185   
    94    186   finish_test

Changes to test/window8.tcl.

   193    193   }
   194    194   
   195    195   execsql_test 4.2.1 {
   196    196     SELECT sum(b) OVER (
   197    197       ORDER BY a RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
   198    198     ) FROM t1 ORDER BY 1 NULLS FIRST;
   199    199   }
   200         -
   201    200   execsql_test 4.2.2 {
          201  +  SELECT sum(b) OVER (
          202  +    ORDER BY a RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
          203  +  ) FROM t1 ORDER BY 1 NULLS LAST;
          204  +}
          205  +
          206  +execsql_test 4.2.3 {
   202    207     SELECT sum(b) OVER (
   203    208       ORDER BY a DESC RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
   204    209     ) FROM t1 ORDER BY 1 NULLS FIRST;
   205    210   }
          211  +execsql_test 4.2.4 {
          212  +  SELECT sum(b) OVER (
          213  +    ORDER BY a DESC RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
          214  +  ) FROM t1 ORDER BY 1 NULLS LAST;
          215  +}
   206    216   
   207    217   execsql_test 4.3.1 {
   208    218     SELECT sum(b) OVER (
   209    219       ORDER BY a NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND 10 FOLLOWING
   210    220     ) FROM t1 ORDER BY 1 NULLS FIRST;
   211    221   }
          222  +execsql_test 4.3.2 {
          223  +  SELECT sum(b) OVER (
          224  +    ORDER BY a NULLS LAST RANGE BETWEEN UNBOUNDED PRECEDING AND 10 FOLLOWING
          225  +  ) FROM t1 ORDER BY 1 NULLS LAST;
          226  +}
   212    227   
   213    228   execsql_test 4.4.1 {
   214    229     SELECT sum(b) OVER (
   215    230       ORDER BY a NULLS FIRST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
   216    231     ) FROM t1 ORDER BY 1 NULLS FIRST;
   217    232   }
   218         -
   219    233   execsql_test 4.4.2 {
          234  +  SELECT sum(b) OVER (
          235  +    ORDER BY a NULLS LAST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
          236  +  ) FROM t1 ORDER BY 1 NULLS LAST;
          237  +}
          238  +
          239  +execsql_test 4.4.3 {
   220    240     SELECT sum(b) OVER (
   221    241       ORDER BY a DESC NULLS LAST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
   222    242     ) FROM t1 ORDER BY 1 NULLS FIRST;
   223    243   }
          244  +execsql_test 4.4.4 {
          245  +  SELECT sum(b) OVER (
          246  +    ORDER BY a DESC NULLS LAST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
          247  +  ) FROM t1 ORDER BY 1 NULLS LAST;
          248  +}
   224    249   
   225    250   ==========
   226    251   
   227    252   execsql_test 5.0 {
   228    253     INSERT INTO t3 VALUES
   229    254       (NULL, 'bb', 355), (NULL, 'cc', 158), (NULL, 'aa', 399), 
   230    255       ('JJ', NULL, 839), ('FF', NULL, 618), ('BB', NULL, 393), 
................................................................................
   244    269       3 { PARTITION BY coalesce(a, '') 
   245    270           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING }
   246    271       4 { ORDER BY a NULLS FIRST GROUPS 6 PRECEDING }
   247    272       5 { ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING }
   248    273       6 { ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING }
   249    274       7 { ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
   250    275           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING }
          276  +
          277  +    8 { RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING }
          278  +    9 { ORDER BY a NULLS LAST 
          279  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING }
          280  +   10 { PARTITION BY coalesce(a, '') 
          281  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING }
          282  +   11 { ORDER BY a NULLS LAST GROUPS 6 PRECEDING }
          283  +   12 { ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING }
          284  +   13 { ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING }
          285  +   14 { ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
          286  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING }
   251    287     } {
   252    288       execsql_test 5.$tn.$tn2.1 "
   253    289         SELECT max(c) OVER win,
   254    290                min(c) OVER win,
   255    291                count(a) OVER win
   256    292         FROM t3
   257    293         WINDOW win AS ( $frame $ex )
................................................................................
   288    324   
   289    325   execsql_test 6.2 {
   290    326     SELECT string_agg(a, '.') OVER (
   291    327       ORDER BY b DESC NULLS LAST RANGE BETWEEN 7 PRECEDING AND 2 PRECEDING
   292    328     )
   293    329     FROM t2
   294    330   }
          331  +
   295    332   
   296    333   
   297    334   finish_test
   298    335   
   299    336   

Changes to test/window8.test.

  3518   3518       ORDER BY a DESC RANGE BETWEEN 5 PRECEDING AND 10 FOLLOWING
  3519   3519     ) FROM t1 ORDER BY 1;
  3520   3520   } {6   6   6   9   9}
  3521   3521   
  3522   3522   do_execsql_test 4.2.1 {
  3523   3523     SELECT sum(b) OVER (
  3524   3524       ORDER BY a RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
  3525         -  ) FROM t1 ORDER BY 1 ;
         3525  +  ) FROM t1 ORDER BY 1 NULLS FIRST;
  3526   3526   } {{}   {}   6   6   6}
  3527   3527   
  3528   3528   do_execsql_test 4.2.2 {
         3529  +  SELECT sum(b) OVER (
         3530  +    ORDER BY a RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
         3531  +  ) FROM t1 ORDER BY 1 NULLS LAST;
         3532  +} {6   6   6   {}   {}}
         3533  +
         3534  +do_execsql_test 4.2.3 {
  3529   3535     SELECT sum(b) OVER (
  3530   3536       ORDER BY a DESC RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
  3531         -  ) FROM t1 ORDER BY 1 ;
         3537  +  ) FROM t1 ORDER BY 1 NULLS FIRST;
  3532   3538   } {{}   {}   6   6   6}
         3539  +
         3540  +do_execsql_test 4.2.4 {
         3541  +  SELECT sum(b) OVER (
         3542  +    ORDER BY a DESC RANGE BETWEEN 5 FOLLOWING AND 10 FOLLOWING
         3543  +  ) FROM t1 ORDER BY 1 NULLS LAST;
         3544  +} {6   6   6   {}   {}}
  3533   3545   
  3534   3546   do_execsql_test 4.3.1 {
  3535   3547     SELECT sum(b) OVER (
  3536         -    ORDER BY a  RANGE BETWEEN UNBOUNDED PRECEDING AND 10 FOLLOWING
  3537         -  ) FROM t1 ORDER BY 1 ;
         3548  +    ORDER BY a NULLS FIRST RANGE BETWEEN UNBOUNDED PRECEDING AND 10 FOLLOWING
         3549  +  ) FROM t1 ORDER BY 1 NULLS FIRST;
  3538   3550   } {6   6   6   15   15}
  3539   3551   
         3552  +do_execsql_test 4.3.2 {
         3553  +  SELECT sum(b) OVER (
         3554  +    ORDER BY a NULLS LAST RANGE BETWEEN UNBOUNDED PRECEDING AND 10 FOLLOWING
         3555  +  ) FROM t1 ORDER BY 1 NULLS LAST;
         3556  +} {9   9   15   15   15}
         3557  +
  3540   3558   do_execsql_test 4.4.1 {
  3541   3559     SELECT sum(b) OVER (
  3542         -    ORDER BY a  ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
  3543         -  ) FROM t1 ORDER BY 1 ;
         3560  +    ORDER BY a NULLS FIRST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
         3561  +  ) FROM t1 ORDER BY 1 NULLS FIRST;
  3544   3562   } {3   6   9   9   12}
  3545   3563   
  3546   3564   do_execsql_test 4.4.2 {
  3547   3565     SELECT sum(b) OVER (
  3548         -    ORDER BY a DESC  ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
  3549         -  ) FROM t1 ORDER BY 1 ;
         3566  +    ORDER BY a NULLS LAST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
         3567  +  ) FROM t1 ORDER BY 1 NULLS LAST;
         3568  +} {5   6   8   9   10}
         3569  +
         3570  +do_execsql_test 4.4.3 {
         3571  +  SELECT sum(b) OVER (
         3572  +    ORDER BY a DESC NULLS LAST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
         3573  +  ) FROM t1 ORDER BY 1 NULLS FIRST;
         3574  +} {5   6   8   9   10}
         3575  +
         3576  +do_execsql_test 4.4.4 {
         3577  +  SELECT sum(b) OVER (
         3578  +    ORDER BY a DESC NULLS LAST ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
         3579  +  ) FROM t1 ORDER BY 1 NULLS LAST;
  3550   3580   } {5   6   8   9   10}
  3551   3581   
  3552   3582   #==========================================================================
  3553   3583   
  3554   3584   do_execsql_test 5.0 {
  3555   3585     INSERT INTO t3 VALUES
  3556   3586       (NULL, 'bb', 355), (NULL, 'cc', 158), (NULL, 'aa', 399), 
................................................................................
  3560   3590   
  3561   3591   do_execsql_test 5.1.1.1 {
  3562   3592     SELECT max(c) OVER win,
  3563   3593                min(c) OVER win,
  3564   3594                count(a) OVER win
  3565   3595         FROM t3
  3566   3596         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3567         -      ORDER BY 1 , 2 , 3
         3597  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3568   3598   } {979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  3569   3599     979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  3570   3600     979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  3571   3601     979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  3572   3602     979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  3573   3603     979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  3574   3604     979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
................................................................................
  3583   3613   
  3584   3614   do_execsql_test 5.1.1.2 {
  3585   3615     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3586   3616                rank() OVER win,
  3587   3617                dense_rank() OVER win
  3588   3618         FROM t3
  3589   3619         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3590         -      ORDER BY 1 , 2 , 3
         3620  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3591   3621   } {23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
  3592   3622     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
  3593   3623     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
  3594   3624     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
  3595   3625     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
  3596   3626     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
  3597   3627     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
................................................................................
  3605   3635     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1}
  3606   3636   
  3607   3637   do_execsql_test 5.1.2.1 {
  3608   3638     SELECT max(c) OVER win,
  3609   3639                min(c) OVER win,
  3610   3640                count(a) OVER win
  3611   3641         FROM t3
  3612         -      WINDOW win AS (  ORDER BY a  
         3642  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  3613   3643           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3614         -      ORDER BY 1 , 2 , 3
         3644  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3615   3645   } {899 113 9   899 113 9   899 113 9   899 113 9   899 113 9   899 113 9
  3616   3646     899 113 9   899 113 9   899 113 9   899 113 16   899 113 16   899 113 16
  3617   3647     899 113 16   899 113 16   899 113 16   899 113 16   979 102 44   979 102 44
  3618   3648     979 102 44   979 102 44   979 102 44   979 102 44   979 102 44   979 102 44
  3619   3649     979 102 44   979 102 44   979 102 44   979 102 49   979 102 49   979 102 49
  3620   3650     979 102 49   979 102 49   979 102 56   979 102 56   979 102 56   979 102 56
  3621   3651     979 102 56   979 102 56   979 102 56   979 102 62   979 102 62   979 102 62
................................................................................
  3629   3659     979 113 33   979 113 33   979 113 33   979 113 33   979 113 33}
  3630   3660   
  3631   3661   do_execsql_test 5.1.2.2 {
  3632   3662     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3633   3663                rank() OVER win,
  3634   3664                dense_rank() OVER win
  3635   3665         FROM t3
  3636         -      WINDOW win AS (  ORDER BY a  
         3666  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  3637   3667           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3638         -      ORDER BY 1 , 2 , 3
         3668  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3639   3669   } {2947 81 11   2947 81 11   2947 81 11   2947 81 11   2947 81 11   2947 81 11
  3640   3670     2947 81 11   2947 81 11   2947 81 11   5287 74 10   5287 74 10   5287 74 10
  3641   3671     5287 74 10   5287 74 10   5287 74 10   5287 74 10   8400 65 9   8400 65 9
  3642   3672     8400 65 9   8400 65 9   8400 65 9   8400 65 9   8400 65 9   8400 65 9
  3643   3673     8400 65 9   9664 57 8   9664 57 8   9664 57 8   9664 57 8   9664 57 8
  3644   3674     9664 57 8   9664 57 8   9664 57 8   10626 46 7   10626 46 7   10626 46 7
  3645   3675     10626 46 7   10626 46 7   10626 46 7   10626 46 7   10626 46 7   10626 46 7
................................................................................
  3655   3685   do_execsql_test 5.1.3.1 {
  3656   3686     SELECT max(c) OVER win,
  3657   3687                min(c) OVER win,
  3658   3688                count(a) OVER win
  3659   3689         FROM t3
  3660   3690         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  3661   3691           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3662         -      ORDER BY 1 , 2 , 3
         3692  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3663   3693   } {777 113 5   777 113 5   777 113 5   777 113 5   777 113 5   805 250 7
  3664   3694     805 250 7   805 250 7   805 250 7   805 250 7   805 250 7   805 250 7
  3665   3695     822 158 6   822 158 6   822 158 6   822 158 6   822 158 6   822 158 6
  3666   3696     840 247 13   840 247 13   840 247 13   840 247 13   840 247 13   840 247 13
  3667   3697     840 247 13   840 247 13   840 247 13   840 247 13   840 247 13   840 247 13
  3668   3698     840 247 13   870 158 0   870 158 0   870 158 0   870 158 0   870 158 0
  3669   3699     870 158 0   899 113 9   899 113 9   899 113 9   899 113 9   899 113 9
................................................................................
  3679   3709   do_execsql_test 5.1.3.2 {
  3680   3710     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3681   3711                rank() OVER win,
  3682   3712                dense_rank() OVER win
  3683   3713         FROM t3
  3684   3714         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  3685   3715           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3686         -      ORDER BY 1 , 2 , 3
         3716  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3687   3717   } {962 1 1   962 1 1   962 1 1   962 1 1   962 1 1   962 1 1   962 1 1
  3688   3718     962 1 1   962 1 1   962 1 1   962 1 1   1264 1 1   1264 1 1   1264 1 1
  3689   3719     1264 1 1   1264 1 1   1264 1 1   1264 1 1   1264 1 1   1366 1 1   1366 1 1
  3690   3720     1366 1 1   1366 1 1   1366 1 1   1366 1 1   1519 1 1   1519 1 1   1519 1 1
  3691   3721     1519 1 1   1519 1 1   1804 1 1   1804 1 1   1804 1 1   1804 1 1   1804 1 1
  3692   3722     1804 1 1   1804 1 1   2050 1 1   2050 1 1   2050 1 1   2050 1 1   2050 1 1
  3693   3723     2050 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1
................................................................................
  3699   3729     3481 1 1   3481 1 1   3481 1 1   3481 1 1   3481 1 1}
  3700   3730   
  3701   3731   do_execsql_test 5.1.4.1 {
  3702   3732     SELECT max(c) OVER win,
  3703   3733                min(c) OVER win,
  3704   3734                count(a) OVER win
  3705   3735         FROM t3
  3706         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE NO OTHERS  )
  3707         -      ORDER BY 1 , 2 , 3
         3736  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE NO OTHERS  )
         3737  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3708   3738   } {870 158 0   870 158 0   870 158 0   870 158 0   870 158 0   870 158 0
  3709   3739     934 158 8   934 158 8   934 158 8   934 158 8   934 158 8   934 158 8
  3710   3740     934 158 8   934 158 8   934 158 21   934 158 21   934 158 21   934 158 21
  3711   3741     934 158 21   934 158 21   934 158 21   934 158 21   934 158 21   934 158 21
  3712   3742     934 158 21   934 158 21   934 158 21   934 158 27   934 158 27   934 158 27
  3713   3743     934 158 27   934 158 27   934 158 27   959 102 50   959 102 50   959 102 50
  3714   3744     959 102 50   959 102 50   959 102 50   959 102 50   959 102 50   959 102 50
................................................................................
  3722   3752     979 102 59   979 102 59   979 102 59   979 102 59   979 102 59}
  3723   3753   
  3724   3754   do_execsql_test 5.1.4.2 {
  3725   3755     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3726   3756                rank() OVER win,
  3727   3757                dense_rank() OVER win
  3728   3758         FROM t3
  3729         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE NO OTHERS  )
  3730         -      ORDER BY 1 , 2 , 3
         3759  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE NO OTHERS  )
         3760  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3731   3761   } {2050 1 1   2050 1 1   2050 1 1   2050 1 1   2050 1 1   2050 1 1   4359 7 2
  3732   3762     4359 7 2   4359 7 2   4359 7 2   4359 7 2   4359 7 2   4359 7 2   4359 7 2
  3733   3763     7840 15 3   7840 15 3   7840 15 3   7840 15 3   7840 15 3   7840 15 3
  3734   3764     7840 15 3   7840 15 3   7840 15 3   7840 15 3   7840 15 3   7840 15 3
  3735   3765     7840 15 3   9206 28 4   9206 28 4   9206 28 4   9206 28 4   9206 28 4
  3736   3766     9206 28 4   11010 34 5   11010 34 5   11010 34 5   11010 34 5   11010 34 5
  3737   3767     11010 34 5   11010 34 5   12368 74 10   12368 74 10   12368 74 10
................................................................................
  3746   3776     13949 81 11}
  3747   3777   
  3748   3778   do_execsql_test 5.1.5.1 {
  3749   3779     SELECT max(c) OVER win,
  3750   3780                min(c) OVER win,
  3751   3781                count(a) OVER win
  3752   3782         FROM t3
  3753         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE NO OTHERS  )
  3754         -      ORDER BY 1 , 2 , 3
         3783  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE NO OTHERS  )
         3784  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3755   3785   } {102 102 1   113 113 2   113 113 2   133 133 1   148 148 1   160 158 2
  3756   3786     160 158 2   160 158 2   208 208 1   224 223 2   224 223 2   239 234 3
  3757   3787     239 234 3   239 234 3   252 247 3   257 247 5   257 247 5   257 250 4
  3758   3788     257 252 3   295 295 1   309 309 1   336 330 3   336 330 3   336 330 3
  3759   3789     346 346 1   355 354 2   355 354 2   355 354 2   399 393 4   399 393 4
  3760   3790     399 393 4   399 393 4   399 393 4   412 412 1   421 421 1   430 430 1
  3761   3791     443 443 1   480 480 2   480 480 2   574 572 2   574 572 2   607 607 1
................................................................................
  3769   3799     938 934 3   938 934 3   963 959 2   963 959 2   979 979 1}
  3770   3800   
  3771   3801   do_execsql_test 5.1.5.2 {
  3772   3802     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3773   3803                rank() OVER win,
  3774   3804                dense_rank() OVER win
  3775   3805         FROM t3
  3776         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE NO OTHERS  )
  3777         -      ORDER BY 1 , 2 , 3
         3806  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE NO OTHERS  )
         3807  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3778   3808   } {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 25 23   {} 34 29
  3779   3809     {} 36 31   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 43 37   {} 43 37
  3780   3810     {} 50 42   {} 60 51   {} 61 52   {} 64 55   {} 64 55   {} 67 57   {} 68 58
  3781   3811     {} 69 59   {} 70 60   {} 72 62   {} 78 67   {} 78 67   {} 78 67   {} 85 72
  3782   3812     {} 85 72   133 4 3   223 10 8   223 11 9   226 2 2   226 2 2   239 12 10
  3783   3813     239 13 11   239 14 12   247 15 13   257 18 16   257 19 17   295 20 18
  3784   3814     309 21 19   335 22 20   335 23 21   335 24 22   421 35 30   443 37 32
................................................................................
  3791   3821     2523 73 63   2523 73 63   2523 75 64   2523 76 65   2523 77 66}
  3792   3822   
  3793   3823   do_execsql_test 5.1.6.1 {
  3794   3824     SELECT max(c) OVER win,
  3795   3825                min(c) OVER win,
  3796   3826                count(a) OVER win
  3797   3827         FROM t3
  3798         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE NO OTHERS  )
  3799         -      ORDER BY 1 , 2 , 3
         3828  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE NO OTHERS  )
         3829  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3800   3830   } {102 102 1   113 113 2   113 113 2   133 133 1   148 148 1   158 158 1
  3801   3831     158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
  3802   3832     238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
  3803   3833     257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
  3804   3834     346 346 1   354 354 1   355 355 1   355 355 1   393 393 2   393 393 2
  3805   3835     398 398 1   399 399 1   399 399 1   412 412 1   421 421 1   430 430 1
  3806   3836     443 443 1   480 480 2   480 480 2   572 572 1   574 574 1   607 607 1
................................................................................
  3814   3844     938 938 2   938 938 2   959 959 1   963 963 1   979 979 1}
  3815   3845   
  3816   3846   do_execsql_test 5.1.6.2 {
  3817   3847     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3818   3848                rank() OVER win,
  3819   3849                dense_rank() OVER win
  3820   3850         FROM t3
  3821         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE NO OTHERS  )
  3822         -      ORDER BY 1 , 2 , 3
         3851  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE NO OTHERS  )
         3852  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3823   3853   } {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 11 9   {} 12 10
  3824   3854     {} 13 11   {} 16 14   {} 17 15   {} 18 16   {} 22 20   {} 24 22   {} 25 23
  3825   3855     {} 26 24   {} 31 27   {} 34 29   {} 36 31   {} 38 33   {} 38 33   {} 40 34
  3826   3856     {} 41 35   {} 43 37   {} 43 37   {} 49 41   {} 50 42   {} 51 43   {} 54 45
  3827   3857     {} 59 50   {} 60 51   {} 61 52   {} 63 54   {} 64 55   {} 64 55   {} 67 57
  3828   3858     {} 68 58   {} 69 59   {} 70 60   {} 72 62   {} 75 64   {} 76 65   {} 78 67
  3829   3859     {} 78 67   {} 78 67   {} 84 71   {} 85 72   {} 85 72   133 4 3   223 10 8
................................................................................
  3836   3866     1334 52 44   1678 73 63   1678 73 63}
  3837   3867   
  3838   3868   do_execsql_test 5.1.7.1 {
  3839   3869     SELECT max(c) OVER win,
  3840   3870                min(c) OVER win,
  3841   3871                count(a) OVER win
  3842   3872         FROM t3
  3843         -      WINDOW win AS (  ORDER BY c , b , a 
         3873  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
  3844   3874           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3845         -      ORDER BY 1 , 2 , 3
         3875  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3846   3876   } {979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  3847   3877     979 102 83   979 113 81   979 113 82   979 133 80   979 148 79   979 158 77
  3848   3878     979 158 78   979 160 77   979 208 76   979 223 75   979 224 74   979 234 73
  3849   3879     979 238 72   979 239 71   979 247 70   979 250 69   979 252 68   979 256 67
  3850   3880     979 257 66   979 295 65   979 309 64   979 330 63   979 335 62   979 336 61
  3851   3881     979 346 60   979 354 59   979 355 58   979 355 58   979 393 56   979 393 57
  3852   3882     979 398 55   979 399 54   979 399 54   979 412 53   979 421 52   979 430 51
................................................................................
  3860   3890     979 870 11   979 870 11   979 899 9   979 911 8   979 929 7}
  3861   3891   
  3862   3892   do_execsql_test 5.1.7.2 {
  3863   3893     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3864   3894                rank() OVER win,
  3865   3895                dense_rank() OVER win
  3866   3896         FROM t3
  3867         -      WINDOW win AS (  ORDER BY c , b , a 
         3897  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
         3898  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         3899  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         3900  +} {3830 89 89   4741 88 88   5640 84 84   5640 85 85   5640 86 86   5640 87 87
         3901  +  6485 81 81   6485 82 82   6485 83 83   7324 80 80   8163 78 78   8163 79 79
         3902  +  8968 73 73   8968 74 74   8968 75 75   8968 76 76   8968 77 77   9745 69 69
         3903  +  9745 70 70   9745 71 71   9745 72 72   10504 65 65   10504 66 66
         3904  +  10504 67 67   10504 68 68   11215 64 64   11920 63 63   12603 62 62
         3905  +  13274 60 60   13274 61 61   13941 59 59   14608 55 55   14608 56 56
         3906  +  14608 57 57   14608 58 58   15241 54 54   15870 53 53   16499 52 52
         3907  +  17126 49 49   17126 50 50   17126 51 51   17733 44 44   17733 45 45
         3908  +  17733 46 46   17733 47 47   17733 48 48   18176 42 42   18176 43 43
         3909  +  18597 40 40   18597 41 41   18996 39 39   19395 37 37   19395 38 38
         3910  +  19788 36 36   20181 35 35   20536 34 34   20891 30 30   20891 31 31
         3911  +  20891 32 32   20891 33 33   21226 28 28   21226 29 29   21535 27 27
         3912  +  21830 26 26   22087 22 22   22087 23 23   22087 24 24   22087 25 25
         3913  +  22334 21 21   22573 17 17   22573 18 18   22573 19 19   22573 20 20
         3914  +  22796 11 11   22796 12 12   22796 13 13   22796 14 14   22796 15 15
         3915  +  22796 16 16   22929 10 10   23042 9 9   23155 1 1   23155 2 2   23155 3 3
         3916  +  23155 4 4   23155 5 5   23155 6 6   23155 7 7   23155 8 8}
         3917  +
         3918  +do_execsql_test 5.1.8.1 {
         3919  +  SELECT max(c) OVER win,
         3920  +             min(c) OVER win,
         3921  +             count(a) OVER win
         3922  +      FROM t3
         3923  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         3924  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         3925  +} {979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3926  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3927  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3928  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3929  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3930  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3931  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3932  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3933  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3934  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3935  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3936  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3937  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3938  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3939  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83}
         3940  +
         3941  +do_execsql_test 5.1.8.2 {
         3942  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         3943  +             rank() OVER win,
         3944  +             dense_rank() OVER win
         3945  +      FROM t3
         3946  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         3947  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         3948  +} {23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3949  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3950  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3951  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3952  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3953  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3954  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3955  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3956  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3957  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3958  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3959  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3960  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3961  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         3962  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1}
         3963  +
         3964  +do_execsql_test 5.1.9.1 {
         3965  +  SELECT max(c) OVER win,
         3966  +             min(c) OVER win,
         3967  +             count(a) OVER win
         3968  +      FROM t3
         3969  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         3970  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         3971  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         3972  +} {870 158 0   870 158 0   870 158 0   870 158 0   870 158 0   870 158 0
         3973  +  899 113 9   899 113 9   899 113 9   899 113 9   899 113 9   899 113 9
         3974  +  899 113 9   899 113 9   899 113 9   899 113 16   899 113 16   899 113 16
         3975  +  899 113 16   899 113 16   899 113 16   899 113 16   979 102 44   979 102 44
         3976  +  979 102 44   979 102 44   979 102 44   979 102 44   979 102 44   979 102 44
         3977  +  979 102 44   979 102 44   979 102 44   979 102 49   979 102 49   979 102 49
         3978  +  979 102 49   979 102 49   979 102 56   979 102 56   979 102 56   979 102 56
         3979  +  979 102 56   979 102 56   979 102 56   979 102 62   979 102 62   979 102 62
         3980  +  979 102 62   979 102 62   979 102 62   979 102 75   979 102 75   979 102 75
         3981  +  979 102 75   979 102 75   979 102 75   979 102 75   979 102 75   979 102 75
         3982  +  979 102 75   979 102 75   979 102 75   979 102 75   979 102 83   979 102 83
         3983  +  979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         3984  +  979 113 25   979 113 25   979 113 25   979 113 25   979 113 25   979 113 25
         3985  +  979 113 25   979 113 25   979 113 25   979 113 33   979 113 33   979 113 33
         3986  +  979 113 33   979 113 33   979 113 33   979 113 33   979 113 33}
         3987  +
         3988  +do_execsql_test 5.1.9.2 {
         3989  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         3990  +             rank() OVER win,
         3991  +             dense_rank() OVER win
         3992  +      FROM t3
         3993  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         3994  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         3995  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         3996  +} {2050 84 11   2050 84 11   2050 84 11   2050 84 11   2050 84 11   2050 84 11
         3997  +  4997 75 10   4997 75 10   4997 75 10   4997 75 10   4997 75 10   4997 75 10
         3998  +  4997 75 10   4997 75 10   4997 75 10   7337 68 9   7337 68 9   7337 68 9
         3999  +  7337 68 9   7337 68 9   7337 68 9   7337 68 9   10450 59 8   10450 59 8
         4000  +  10450 59 8   10450 59 8   10450 59 8   10450 59 8   10450 59 8   10450 59 8
         4001  +  10450 59 8   11714 51 7   11714 51 7   11714 51 7   11714 51 7   11714 51 7
         4002  +  11714 51 7   11714 51 7   11714 51 7   12676 40 6   12676 40 6   12676 40 6
         4003  +  12676 40 6   12676 40 6   12676 40 6   12676 40 6   12676 40 6   12676 40 6
         4004  +  12676 40 6   12676 40 6   14195 35 5   14195 35 5   14195 35 5   14195 35 5
         4005  +  14195 35 5   15999 28 4   15999 28 4   15999 28 4   15999 28 4   15999 28 4
         4006  +  15999 28 4   15999 28 4   17365 22 3   17365 22 3   17365 22 3   17365 22 3
         4007  +  17365 22 3   17365 22 3   20846 9 2   20846 9 2   20846 9 2   20846 9 2
         4008  +  20846 9 2   20846 9 2   20846 9 2   20846 9 2   20846 9 2   20846 9 2
         4009  +  20846 9 2   20846 9 2   20846 9 2   23155 1 1   23155 1 1   23155 1 1
         4010  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1}
         4011  +
         4012  +do_execsql_test 5.1.10.1 {
         4013  +  SELECT max(c) OVER win,
         4014  +             min(c) OVER win,
         4015  +             count(a) OVER win
         4016  +      FROM t3
         4017  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         4018  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         4019  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4020  +} {777 113 5   777 113 5   777 113 5   777 113 5   777 113 5   805 250 7
         4021  +  805 250 7   805 250 7   805 250 7   805 250 7   805 250 7   805 250 7
         4022  +  822 158 6   822 158 6   822 158 6   822 158 6   822 158 6   822 158 6
         4023  +  840 247 13   840 247 13   840 247 13   840 247 13   840 247 13   840 247 13
         4024  +  840 247 13   840 247 13   840 247 13   840 247 13   840 247 13   840 247 13
         4025  +  840 247 13   870 158 0   870 158 0   870 158 0   870 158 0   870 158 0
         4026  +  870 158 0   899 113 9   899 113 9   899 113 9   899 113 9   899 113 9
         4027  +  899 113 9   899 113 9   899 113 9   899 113 9   934 223 8   934 223 8
         4028  +  934 223 8   934 223 8   934 223 8   934 223 8   934 223 8   934 223 8
         4029  +  938 102 11   938 102 11   938 102 11   938 102 11   938 102 11   938 102 11
         4030  +  938 102 11   938 102 11   938 102 11   938 102 11   938 102 11   938 148 8
         4031  +  938 148 8   938 148 8   938 148 8   938 148 8   938 148 8   938 148 8
         4032  +  938 148 8   959 224 7   959 224 7   959 224 7   959 224 7   959 224 7
         4033  +  959 224 7   959 224 7   979 133 9   979 133 9   979 133 9   979 133 9
         4034  +  979 133 9   979 133 9   979 133 9   979 133 9   979 133 9}
         4035  +
         4036  +do_execsql_test 5.1.10.2 {
         4037  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4038  +             rank() OVER win,
         4039  +             dense_rank() OVER win
         4040  +      FROM t3
         4041  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         4042  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         4043  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4044  +} {962 1 1   962 1 1   962 1 1   962 1 1   962 1 1   962 1 1   962 1 1
         4045  +  962 1 1   962 1 1   962 1 1   962 1 1   1264 1 1   1264 1 1   1264 1 1
         4046  +  1264 1 1   1264 1 1   1264 1 1   1264 1 1   1264 1 1   1366 1 1   1366 1 1
         4047  +  1366 1 1   1366 1 1   1366 1 1   1366 1 1   1519 1 1   1519 1 1   1519 1 1
         4048  +  1519 1 1   1519 1 1   1804 1 1   1804 1 1   1804 1 1   1804 1 1   1804 1 1
         4049  +  1804 1 1   1804 1 1   2050 1 1   2050 1 1   2050 1 1   2050 1 1   2050 1 1
         4050  +  2050 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1
         4051  +  2309 1 1   2309 1 1   2340 1 1   2340 1 1   2340 1 1   2340 1 1   2340 1 1
         4052  +  2340 1 1   2340 1 1   2947 1 1   2947 1 1   2947 1 1   2947 1 1   2947 1 1
         4053  +  2947 1 1   2947 1 1   2947 1 1   2947 1 1   3113 1 1   3113 1 1   3113 1 1
         4054  +  3113 1 1   3113 1 1   3113 1 1   3113 1 1   3113 1 1   3113 1 1   3481 1 1
         4055  +  3481 1 1   3481 1 1   3481 1 1   3481 1 1   3481 1 1   3481 1 1   3481 1 1
         4056  +  3481 1 1   3481 1 1   3481 1 1   3481 1 1   3481 1 1}
         4057  +
         4058  +do_execsql_test 5.1.11.1 {
         4059  +  SELECT max(c) OVER win,
         4060  +             min(c) OVER win,
         4061  +             count(a) OVER win
         4062  +      FROM t3
         4063  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE NO OTHERS  )
         4064  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4065  +} {934 158 27   934 158 27   934 158 27   934 158 27   934 158 27   934 158 27
         4066  +  934 223 8   934 223 8   934 223 8   934 223 8   934 223 8   934 223 8
         4067  +  934 223 8   934 223 8   934 223 21   934 223 21   934 223 21   934 223 21
         4068  +  934 223 21   934 223 21   934 223 21   934 223 21   934 223 21   934 223 21
         4069  +  934 223 21   934 223 21   934 223 21   959 102 50   959 102 50   959 102 50
         4070  +  959 102 50   959 102 50   959 102 50   959 102 50   959 102 50   959 102 50
         4071  +  959 102 50   959 102 50   959 102 58   959 102 58   959 102 58   959 102 58
         4072  +  959 102 58   959 102 58   959 102 58   959 102 58   959 113 39   959 113 39
         4073  +  959 113 39   959 113 39   959 113 39   959 158 34   959 158 34   959 158 34
         4074  +  959 158 34   959 158 34   959 158 34   959 158 34   979 102 49   979 102 49
         4075  +  979 102 49   979 102 49   979 102 49   979 102 49   979 102 53   979 102 53
         4076  +  979 102 53   979 102 53   979 102 53   979 102 53   979 102 53   979 102 56
         4077  +  979 102 56   979 102 56   979 102 56   979 102 56   979 102 56   979 102 56
         4078  +  979 102 56   979 102 56   979 102 59   979 102 59   979 102 59   979 102 59
         4079  +  979 102 59   979 102 59   979 102 59   979 102 59   979 102 59}
         4080  +
         4081  +do_execsql_test 5.1.11.2 {
         4082  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4083  +             rank() OVER win,
         4084  +             dense_rank() OVER win
         4085  +      FROM t3
         4086  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE NO OTHERS  )
         4087  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4088  +} {2309 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1   2309 1 1
         4089  +  2309 1 1   5790 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2
         4090  +  5790 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2
         4091  +  7156 22 3   7156 22 3   7156 22 3   7156 22 3   7156 22 3   7156 22 3
         4092  +  8960 28 4   8960 28 4   8960 28 4   8960 28 4   8960 28 4   8960 28 4
         4093  +  8960 28 4   10479 35 5   10479 35 5   10479 35 5   10479 35 5   10479 35 5
         4094  +  11441 40 6   11441 40 6   11441 40 6   11441 40 6   11441 40 6   11441 40 6
         4095  +  11441 40 6   11441 40 6   11441 40 6   11441 40 6   11441 40 6   12368 68 9
         4096  +  12368 68 9   12368 68 9   12368 68 9   12368 68 9   12368 68 9   12368 68 9
         4097  +  12705 51 7   12705 51 7   12705 51 7   12705 51 7   12705 51 7   12705 51 7
         4098  +  12705 51 7   12705 51 7   13509 59 8   13509 59 8   13509 59 8   13509 59 8
         4099  +  13509 59 8   13509 59 8   13509 59 8   13509 59 8   13509 59 8
         4100  +  13949 75 10   13949 75 10   13949 75 10   13949 75 10   13949 75 10
         4101  +  13949 75 10   13949 75 10   13949 75 10   13949 75 10   14195 84 11
         4102  +  14195 84 11   14195 84 11   14195 84 11   14195 84 11   14195 84 11}
         4103  +
         4104  +do_execsql_test 5.1.12.1 {
         4105  +  SELECT max(c) OVER win,
         4106  +             min(c) OVER win,
         4107  +             count(a) OVER win
         4108  +      FROM t3
         4109  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE NO OTHERS  )
         4110  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4111  +} {102 102 1   113 113 2   113 113 2   133 133 1   148 148 1   160 158 2
         4112  +  160 158 2   160 158 2   208 208 1   224 223 2   224 223 2   239 234 3
         4113  +  239 234 3   239 234 3   252 247 3   257 247 5   257 247 5   257 250 4
         4114  +  257 252 3   295 295 1   309 309 1   336 330 3   336 330 3   336 330 3
         4115  +  346 346 1   355 354 2   355 354 2   355 354 2   399 393 4   399 393 4
         4116  +  399 393 4   399 393 4   399 393 4   412 412 1   421 421 1   430 430 1
         4117  +  443 443 1   480 480 2   480 480 2   574 572 2   574 572 2   607 607 1
         4118  +  618 618 2   618 618 2   634 627 4   634 627 4   634 627 4   634 627 4
         4119  +  634 629 3   652 652 1   667 660 2   671 667 3   671 667 3   671 667 3
         4120  +  671 667 3   683 683 1   711 705 2   716 705 3   716 711 2   730 726 2
         4121  +  730 726 2   762 759 2   768 759 4   768 762 3   768 762 3   777 777 1
         4122  +  792 786 3   794 786 4   794 786 4   794 790 3   805 805 1   822 822 1
         4123  +  845 839 5   845 839 5   845 839 5   845 839 5   845 839 5   870 870 2
         4124  +  870 870 2   870 870 2   899 899 1   911 911 1   934 929 2   938 929 4
         4125  +  938 934 3   938 934 3   963 959 2   963 959 2   979 979 1}
         4126  +
         4127  +do_execsql_test 5.1.12.2 {
         4128  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4129  +             rank() OVER win,
         4130  +             dense_rank() OVER win
         4131  +      FROM t3
         4132  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE NO OTHERS  )
         4133  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4134  +} {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 25 23   {} 34 29
         4135  +  {} 36 31   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 43 37   {} 43 37
         4136  +  {} 50 42   {} 60 51   {} 61 52   {} 64 55   {} 64 55   {} 67 57   {} 68 58
         4137  +  {} 69 59   {} 70 60   {} 72 62   {} 78 67   {} 78 67   {} 78 67   {} 85 72
         4138  +  {} 85 72   133 4 3   223 10 8   223 11 9   226 2 2   226 2 2   239 12 10
         4139  +  239 13 11   239 14 12   247 15 13   257 18 16   257 19 17   295 20 18
         4140  +  309 21 19   335 22 20   335 23 21   335 24 22   421 35 30   443 37 32
         4141  +  504 16 14   504 17 15   607 42 36   683 56 47   710 26 24   710 27 25
         4142  +  710 27 25   711 59 50   759 62 53   759 63 54   777 66 56   805 71 61
         4143  +  899 81 68   911 82 69   929 83 70   929 84 71   979 89 75   1334 51 43
         4144  +  1416 57 48   1416 58 49   1584 29 26   1584 29 26   1584 31 27   1584 32 28
         4145  +  1584 32 28   1891 49 41   1922 87 73   1922 88 74   2005 52 44   2005 52 44
         4146  +  2005 54 45   2005 55 46   2518 45 38   2518 46 39   2518 46 39   2518 48 40
         4147  +  2523 73 63   2523 73 63   2523 75 64   2523 76 65   2523 77 66}
         4148  +
         4149  +do_execsql_test 5.1.13.1 {
         4150  +  SELECT max(c) OVER win,
         4151  +             min(c) OVER win,
         4152  +             count(a) OVER win
         4153  +      FROM t3
         4154  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE NO OTHERS  )
         4155  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4156  +} {102 102 1   113 113 2   113 113 2   133 133 1   148 148 1   158 158 1
         4157  +  158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
         4158  +  238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
         4159  +  257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
         4160  +  346 346 1   354 354 1   355 355 1   355 355 1   393 393 2   393 393 2
         4161  +  398 398 1   399 399 1   399 399 1   412 412 1   421 421 1   430 430 1
         4162  +  443 443 1   480 480 2   480 480 2   572 572 1   574 574 1   607 607 1
         4163  +  618 618 2   618 618 2   627 627 1   629 629 1   629 629 1   633 633 1
         4164  +  634 634 1   652 652 1   660 660 1   667 667 1   667 667 1   670 670 1
         4165  +  671 671 1   683 683 1   705 705 1   711 711 1   716 716 1   726 726 1
         4166  +  730 730 1   759 759 1   762 762 1   768 768 2   768 768 2   777 777 1
         4167  +  786 786 1   790 790 1   792 792 1   794 794 1   805 805 1   822 822 1
         4168  +  839 839 2   839 839 2   840 840 1   844 844 1   845 845 1   870 870 2
         4169  +  870 870 2   870 870 2   899 899 1   911 911 1   929 929 1   934 934 1
         4170  +  938 938 2   938 938 2   959 959 1   963 963 1   979 979 1}
         4171  +
         4172  +do_execsql_test 5.1.13.2 {
         4173  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4174  +             rank() OVER win,
         4175  +             dense_rank() OVER win
         4176  +      FROM t3
         4177  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE NO OTHERS  )
         4178  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4179  +} {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 11 9   {} 12 10
         4180  +  {} 13 11   {} 16 14   {} 17 15   {} 18 16   {} 22 20   {} 24 22   {} 25 23
         4181  +  {} 26 24   {} 31 27   {} 34 29   {} 36 31   {} 38 33   {} 38 33   {} 40 34
         4182  +  {} 41 35   {} 43 37   {} 43 37   {} 49 41   {} 50 42   {} 51 43   {} 54 45
         4183  +  {} 59 50   {} 60 51   {} 61 52   {} 63 54   {} 64 55   {} 64 55   {} 67 57
         4184  +  {} 68 58   {} 69 59   {} 70 60   {} 72 62   {} 75 64   {} 76 65   {} 78 67
         4185  +  {} 78 67   {} 78 67   {} 84 71   {} 85 72   {} 85 72   133 4 3   223 10 8
         4186  +  226 2 2   226 2 2   239 14 12   247 15 13   257 19 17   295 20 18
         4187  +  309 21 19   335 23 21   421 35 30   443 37 32   607 42 36   627 45 38
         4188  +  633 48 40   671 55 46   683 56 47   705 57 48   710 27 25   710 27 25
         4189  +  711 58 49   759 62 53   777 66 56   786 29 26   786 29 26   798 32 28
         4190  +  798 32 28   805 71 61   845 77 66   899 81 68   911 82 69   929 83 70
         4191  +  959 87 73   963 88 74   979 89 75   1258 46 39   1258 46 39   1334 52 44
         4192  +  1334 52 44   1678 73 63   1678 73 63}
         4193  +
         4194  +do_execsql_test 5.1.14.1 {
         4195  +  SELECT max(c) OVER win,
         4196  +             min(c) OVER win,
         4197  +             count(a) OVER win
         4198  +      FROM t3
         4199  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
         4200  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
         4201  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4202  +} {979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         4203  +  979 102 83   979 113 81   979 113 82   979 133 80   979 148 79   979 158 77
         4204  +  979 158 78   979 160 77   979 208 76   979 223 75   979 224 74   979 234 73
         4205  +  979 238 72   979 239 71   979 247 70   979 250 69   979 252 68   979 256 67
         4206  +  979 257 66   979 295 65   979 309 64   979 330 63   979 335 62   979 336 61
         4207  +  979 346 60   979 354 59   979 355 57   979 355 58   979 393 56   979 393 57
         4208  +  979 398 55   979 399 53   979 399 54   979 412 53   979 421 52   979 430 51
         4209  +  979 443 50   979 480 48   979 480 49   979 572 47   979 574 46   979 607 45
         4210  +  979 618 43   979 618 44   979 627 42   979 629 40   979 629 41   979 633 40
         4211  +  979 634 39   979 652 38   979 660 37   979 667 35   979 667 36   979 670 35
         4212  +  979 671 34   979 683 33   979 705 32   979 711 31   979 716 30   979 726 29
         4213  +  979 730 28   979 759 27   979 762 26   979 768 24   979 768 25   979 777 23
         4214  +  979 786 22   979 790 21   979 792 20   979 794 19   979 805 18   979 822 17
         4215  +  979 839 15   979 839 16   979 840 14   979 844 13   979 845 12   979 870 9
         4216  +  979 870 10   979 870 11   979 899 9   979 911 8   979 929 7}
         4217  +
         4218  +do_execsql_test 5.1.14.2 {
         4219  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4220  +             rank() OVER win,
         4221  +             dense_rank() OVER win
         4222  +      FROM t3
         4223  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
  3868   4224           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE NO OTHERS  )
  3869         -      ORDER BY 1 , 2 , 3
         4225  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3870   4226   } {3830 89 89   4741 88 88   5640 84 84   5640 85 85   5640 86 86   5640 87 87
  3871   4227     6485 81 81   6485 82 82   6485 83 83   7324 80 80   8163 78 78   8163 79 79
  3872   4228     8968 73 73   8968 74 74   8968 75 75   8968 76 76   8968 77 77   9745 69 69
  3873   4229     9745 70 70   9745 71 71   9745 72 72   10504 65 65   10504 66 66
  3874   4230     10504 67 67   10504 68 68   11215 64 64   11920 63 63   12603 62 62
  3875   4231     13274 60 60   13274 61 61   13941 59 59   14608 55 55   14608 56 56
  3876   4232     14608 57 57   14608 58 58   15241 54 54   15870 53 53   16499 52 52
................................................................................
  3887   4243   
  3888   4244   do_execsql_test 5.2.1.1 {
  3889   4245     SELECT max(c) OVER win,
  3890   4246                min(c) OVER win,
  3891   4247                count(a) OVER win
  3892   4248         FROM t3
  3893   4249         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  3894         -      ORDER BY 1 , 2 , 3
         4250  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3895   4251   } {963 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  3896   4252     979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  3897   4253     979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  3898   4254     979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  3899   4255     979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  3900   4256     979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  3901   4257     979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
................................................................................
  3910   4266   
  3911   4267   do_execsql_test 5.2.1.2 {
  3912   4268     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3913   4269                rank() OVER win,
  3914   4270                dense_rank() OVER win
  3915   4271         FROM t3
  3916   4272         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  3917         -      ORDER BY 1 , 2 , 3
         4273  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3918   4274   } {22176 1 1   22192 1 1   22196 1 1   22226 1 1   22244 1 1   22256 1 1
  3919   4275     22310 1 1   22316 1 1   22316 1 1   22350 1 1   22378 1 1   22396 1 1
  3920   4276     22444 1 1   22450 1 1   22472 1 1   22484 1 1   22488 1 1   22488 1 1
  3921   4277     22522 1 1   22526 1 1   22526 1 1   22528 1 1   22548 1 1   22712 1 1
  3922   4278     22734 1 1   22756 1 1   22756 1 1   22762 1 1   22762 1 1   22800 1 1
  3923   4279     22800 1 1   22820 1 1   22846 1 1   22860 1 1   22898 1 1   22908 1 1
  3924   4280     22916 1 1   22932 1 1   23022 1 1   23042 1 1   23042 1 1   23155 1 1
................................................................................
  3932   4288     23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1}
  3933   4289   
  3934   4290   do_execsql_test 5.2.2.1 {
  3935   4291     SELECT max(c) OVER win,
  3936   4292                min(c) OVER win,
  3937   4293                count(a) OVER win
  3938   4294         FROM t3
  3939         -      WINDOW win AS (  ORDER BY a  
         4295  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  3940   4296           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  3941         -      ORDER BY 1 , 2 , 3
         4297  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3942   4298   } {839 113 8   899 113 8   899 113 8   899 113 8   899 113 8   899 113 8
  3943   4299     899 113 8   899 113 8   899 113 15   899 113 15   899 113 15   899 113 15
  3944   4300     899 113 15   899 113 15   899 113 15   899 234 8   963 113 24   979 102 43
  3945   4301     979 102 43   979 102 43   979 102 43   979 102 43   979 102 43   979 102 43
  3946   4302     979 102 43   979 102 43   979 102 43   979 102 48   979 102 48   979 102 48
  3947   4303     979 102 48   979 102 48   979 102 55   979 102 55   979 102 55   979 102 55
  3948   4304     979 102 55   979 102 55   979 102 55   979 102 61   979 102 61   979 102 61
................................................................................
  3956   4312     979 113 32   979 113 32   979 113 32   979 113 32   979 113 43}
  3957   4313   
  3958   4314   do_execsql_test 5.2.2.2 {
  3959   4315     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  3960   4316                rank() OVER win,
  3961   4317                dense_rank() OVER win
  3962   4318         FROM t3
  3963         -      WINDOW win AS (  ORDER BY a  
         4319  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  3964   4320           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  3965         -      ORDER BY 1 , 2 , 3
         4321  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3966   4322   } {2048 81 11   2108 81 11   2108 81 11   2690 81 11   2834 81 11   2947 81 11
  3967   4323     2947 81 11   2947 81 11   2947 81 11   4482 74 10   4616 74 10   4844 74 10
  3968   4324     4866 74 10   5287 74 10   5287 74 10   5287 74 10   7421 65 9   7437 65 9
  3969   4325     7717 65 9   8045 65 9   8267 65 9   8400 65 9   8400 65 9   8400 65 9
  3970   4326     8400 65 9   8735 57 8   9329 57 8   9664 57 8   9664 57 8   9664 57 8
  3971   4327     9664 57 8   9664 57 8   9664 57 8   9959 46 7   10331 46 7   10626 46 7
  3972   4328     10626 46 7   10626 46 7   10626 46 7   10626 46 7   10626 46 7   10626 46 7
................................................................................
  3982   4338   do_execsql_test 5.2.3.1 {
  3983   4339     SELECT max(c) OVER win,
  3984   4340                min(c) OVER win,
  3985   4341                count(a) OVER win
  3986   4342         FROM t3
  3987   4343         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  3988   4344           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  3989         -      ORDER BY 1 , 2 , 3
         4345  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  3990   4346   } {667 158 0   671 250 6   759 158 5   768 113 4   777 113 4   777 113 4
  3991   4347     777 113 4   777 252 4   792 247 12   805 250 6   805 250 6   805 250 6
  3992   4348     805 250 6   805 250 6   805 398 6   822 158 5   822 158 5   822 158 5
  3993   4349     822 158 5   822 346 5   839 113 8   840 247 12   840 247 12   840 247 12
  3994   4350     840 247 12   840 247 12   840 247 12   840 247 12   840 247 12   840 247 12
  3995   4351     840 247 12   840 247 12   840 393 12   845 224 6   870 102 10   870 158 0
  3996   4352     870 158 0   870 158 0   870 158 0   870 355 0   899 113 8   899 113 8
................................................................................
  4006   4362   do_execsql_test 5.2.3.2 {
  4007   4363     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4008   4364                rank() OVER win,
  4009   4365                dense_rank() OVER win
  4010   4366         FROM t3
  4011   4367         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  4012   4368           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  4013         -      ORDER BY 1 , 2 , 3
         4369  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4014   4370   } {295 1 1   335 1 1   607 1 1   667 1 1   742 1 1   759 1 1   845 1 1
  4015   4371     890 1 1   929 1 1   959 1 1   962 1 1   962 1 1   962 1 1   962 1 1
  4016   4372     962 1 1   962 1 1   962 1 1   962 1 1   962 1 1   1264 1 1   1264 1 1
  4017   4373     1264 1 1   1264 1 1   1264 1 1   1264 1 1   1366 1 1   1366 1 1   1366 1 1
  4018   4374     1366 1 1   1383 1 1   1398 1 1   1406 1 1   1421 1 1   1519 1 1   1519 1 1
  4019   4375     1535 1 1   1651 1 1   1669 1 1   1682 1 1   1695 1 1   1804 1 1   1804 1 1
  4020   4376     1804 1 1   1804 1 1   1804 1 1   1897 1 1   1919 1 1   2000 1 1   2048 1 1
................................................................................
  4026   4382     3481 1 1   3481 1 1   3481 1 1   3481 1 1   3481 1 1}
  4027   4383   
  4028   4384   do_execsql_test 5.2.4.1 {
  4029   4385     SELECT max(c) OVER win,
  4030   4386                min(c) OVER win,
  4031   4387                count(a) OVER win
  4032   4388         FROM t3
  4033         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE CURRENT ROW  )
  4034         -      ORDER BY 1 , 2 , 3
         4389  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE CURRENT ROW  )
         4390  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4035   4391   } {667 158 0   870 158 0   870 158 0   870 158 0   870 158 0   870 355 0
  4036   4392     911 158 7   934 158 7   934 158 7   934 158 7   934 158 7   934 158 7
  4037   4393     934 158 7   934 158 7   934 158 20   934 158 20   934 158 20   934 158 20
  4038   4394     934 158 20   934 158 20   934 158 20   934 158 20   934 158 20   934 158 20
  4039   4395     934 158 20   934 158 20   934 158 20   934 158 26   934 158 26   934 158 26
  4040   4396     934 158 26   934 158 26   934 158 26   934 158 33   959 102 49   959 102 49
  4041   4397     959 102 49   959 102 49   959 102 49   959 102 49   959 102 49   959 102 49
................................................................................
  4049   4405     979 102 58   979 102 58   979 102 58   979 102 58   979 102 58}
  4050   4406   
  4051   4407   do_execsql_test 5.2.4.2 {
  4052   4408     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4053   4409                rank() OVER win,
  4054   4410                dense_rank() OVER win
  4055   4411         FROM t3
  4056         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE CURRENT ROW  )
  4057         -      ORDER BY 1 , 2 , 3
         4412  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE CURRENT ROW  )
         4413  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4058   4414   } {1383 1 1   1421 1 1   1651 1 1   1695 1 1   2050 1 1   2050 1 1   3448 7 2
  4059   4415     3732 7 2   4050 7 2   4120 7 2   4136 7 2   4359 7 2   4359 7 2   4359 7 2
  4060   4416     7129 15 3   7135 15 3   7207 15 3   7441 15 3   7447 15 3   7447 15 3
  4061   4417     7593 15 3   7840 15 3   7840 15 3   7840 15 3   7840 15 3   7840 15 3
  4062   4418     7840 15 3   8447 28 4   8599 28 4   9206 28 4   9206 28 4   9206 28 4
  4063   4419     9206 28 4   10051 34 5   10165 34 5   11010 34 5   11010 34 5   11010 34 5
  4064   4420     11010 34 5   11010 34 5   11563 74 10   11697 74 10   11752 41 6
................................................................................
  4073   4429     13949 81 11   13949 81 11   13949 81 11}
  4074   4430   
  4075   4431   do_execsql_test 5.2.5.1 {
  4076   4432     SELECT max(c) OVER win,
  4077   4433                min(c) OVER win,
  4078   4434                count(a) OVER win
  4079   4435         FROM t3
  4080         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE CURRENT ROW  )
  4081         -      ORDER BY 1 , 2 , 3
         4436  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE CURRENT ROW  )
         4437  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4082   4438   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4083   4439     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4084   4440     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   113 113 1
  4085   4441     113 113 1   158 158 1   160 158 1   160 158 2   223 223 1   224 224 1
  4086   4442     238 234 2   239 234 2   239 238 2   252 250 2   256 252 2   257 247 4
  4087   4443     257 247 4   257 250 3   335 330 2   336 330 2   336 335 2   355 354 1
  4088   4444     355 354 2   355 355 1   399 393 3   399 393 3   399 393 3   399 393 3
................................................................................
  4096   4452     959 959 1   963 963 1}
  4097   4453   
  4098   4454   do_execsql_test 5.2.5.2 {
  4099   4455     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4100   4456                rank() OVER win,
  4101   4457                dense_rank() OVER win
  4102   4458         FROM t3
  4103         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE CURRENT ROW  )
  4104         -      ORDER BY 1 , 2 , 3
         4459  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE CURRENT ROW  )
         4460  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4105   4461   } {{} 1 1   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 10 8
  4106   4462     {} 14 12   {} 15 13   {} 19 17   {} 20 18   {} 21 19   {} 23 21   {} 25 23
  4107   4463     {} 34 29   {} 35 30   {} 36 31   {} 37 32   {} 38 33   {} 38 33   {} 40 34
  4108   4464     {} 41 35   {} 42 36   {} 43 37   {} 43 37   {} 50 42   {} 56 47   {} 60 51
  4109   4465     {} 61 52   {} 62 53   {} 64 55   {} 64 55   {} 66 56   {} 67 57   {} 68 58
  4110   4466     {} 69 59   {} 70 60   {} 71 61   {} 72 62   {} 78 67   {} 78 67   {} 78 67
  4111   4467     {} 81 68   {} 82 69   {} 83 70   {} 85 72   {} 85 72   {} 89 75   113 2 2
................................................................................
  4118   4474     2005 54 45   2523 75 64   2523 76 65}
  4119   4475   
  4120   4476   do_execsql_test 5.2.6.1 {
  4121   4477     SELECT max(c) OVER win,
  4122   4478                min(c) OVER win,
  4123   4479                count(a) OVER win
  4124   4480         FROM t3
  4125         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE CURRENT ROW  )
  4126         -      ORDER BY 1 , 2 , 3
         4481  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE CURRENT ROW  )
         4482  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4127   4483   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4128   4484     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4129   4485     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4130   4486     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4131   4487     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4132   4488     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4133   4489     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
................................................................................
  4140   4496     938 938 1   938 938 1}
  4141   4497   
  4142   4498   do_execsql_test 5.2.6.2 {
  4143   4499     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4144   4500                rank() OVER win,
  4145   4501                dense_rank() OVER win
  4146   4502         FROM t3
  4147         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE CURRENT ROW  )
  4148         -      ORDER BY 1 , 2 , 3
         4503  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE CURRENT ROW  )
         4504  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4149   4505   } {{} 1 1   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 10 8
  4150   4506     {} 11 9   {} 12 10   {} 13 11   {} 14 12   {} 15 13   {} 16 14   {} 17 15
  4151   4507     {} 18 16   {} 19 17   {} 20 18   {} 21 19   {} 22 20   {} 23 21   {} 24 22
  4152   4508     {} 25 23   {} 26 24   {} 31 27   {} 34 29   {} 35 30   {} 36 31   {} 37 32
  4153   4509     {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 42 36   {} 43 37   {} 43 37
  4154   4510     {} 45 38   {} 48 40   {} 49 41   {} 50 42   {} 51 43   {} 54 45   {} 55 46
  4155   4511     {} 56 47   {} 57 48   {} 58 49   {} 59 50   {} 60 51   {} 61 52   {} 62 53
................................................................................
  4161   4517     629 46 39   667 52 44   667 52 44   839 73 63   839 73 63}
  4162   4518   
  4163   4519   do_execsql_test 5.2.7.1 {
  4164   4520     SELECT max(c) OVER win,
  4165   4521                min(c) OVER win,
  4166   4522                count(a) OVER win
  4167   4523         FROM t3
  4168         -      WINDOW win AS (  ORDER BY c , b , a 
         4524  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
  4169   4525           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  4170         -      ORDER BY 1 , 2 , 3
         4526  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4171   4527   } {963 929 6   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  4172   4528     979 102 83   979 113 80   979 113 81   979 113 82   979 133 79   979 148 78
  4173   4529     979 158 76   979 158 77   979 160 76   979 208 75   979 223 74   979 224 73
  4174   4530     979 234 72   979 238 71   979 239 70   979 247 69   979 250 68   979 252 67
  4175   4531     979 256 66   979 257 65   979 295 64   979 309 64   979 330 62   979 335 61
  4176   4532     979 336 60   979 346 59   979 354 59   979 355 57   979 355 57   979 393 55
  4177   4533     979 393 56   979 398 54   979 399 53   979 399 53   979 412 52   979 421 51
................................................................................
  4185   4541     979 870 9   979 870 10   979 870 10   979 899 8   979 911 7}
  4186   4542   
  4187   4543   do_execsql_test 5.2.7.2 {
  4188   4544     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4189   4545                rank() OVER win,
  4190   4546                dense_rank() OVER win
  4191   4547         FROM t3
  4192         -      WINDOW win AS (  ORDER BY c , b , a 
         4548  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
         4549  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4550  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4551  +} {2851 89 89   3778 88 88   4681 87 87   5556 83 83   5574 82 82   5586 81 81
         4552  +  5640 84 84   5640 85 85   5640 86 86   7324 80 80   8123 77 77   8129 73 73
         4553  +  8129 74 74   8163 78 78   8163 79 79   8940 71 71   8968 75 75   8968 76 76
         4554  +  9727 66 66   9745 69 69   9745 70 70   9745 72 72   10504 65 65
         4555  +  10504 67 67   10504 68 68   11215 64 64   11844 62 62   11920 63 63
         4556  +  13274 60 60   13274 61 61   13897 58 58   13903 57 57   13925 56 56
         4557  +  13937 55 55   13941 59 59   15203 53 53   15241 54 54   15832 52 52
         4558  +  17100 48 48   17104 46 46   17104 47 47   17106 45 45   17126 49 49
         4559  +  17126 50 50   17126 51 51   17569 42 42   17733 44 44   18176 43 43
         4560  +  18597 40 40   18597 41 41   18952 37 37   18996 39 39   19395 38 38
         4561  +  19760 35 35   19788 36 36   20492 32 32   20492 33 33   20498 30 30
         4562  +  20536 34 34   20833 29 29   20871 28 28   20891 31 31   21180 27 27
         4563  +  21752 23 23   21830 26 26   22025 21 21   22087 22 22   22087 24 24
         4564  +  22087 25 25   22278 20 20   22316 19 19   22549 15 15   22557 14 14
         4565  +  22573 17 17   22573 18 18   22706 10 10   22796 11 11   22796 12 12
         4566  +  22796 13 13   22796 16 16   23022 4 4   23042 2 2   23042 3 3   23042 9 9
         4567  +  23155 1 1   23155 5 5   23155 6 6   23155 7 7   23155 8 8}
         4568  +
         4569  +do_execsql_test 5.2.8.1 {
         4570  +  SELECT max(c) OVER win,
         4571  +             min(c) OVER win,
         4572  +             count(a) OVER win
         4573  +      FROM t3
         4574  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4575  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4576  +} {963 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4577  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4578  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4579  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4580  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4581  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4582  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4583  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4584  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4585  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4586  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4587  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4588  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4589  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 83   979 102 83
         4590  +  979 102 83   979 102 83   979 102 83   979 102 83   979 113 82}
         4591  +
         4592  +do_execsql_test 5.2.8.2 {
         4593  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4594  +             rank() OVER win,
         4595  +             dense_rank() OVER win
         4596  +      FROM t3
         4597  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4598  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4599  +} {22176 1 1   22192 1 1   22196 1 1   22226 1 1   22244 1 1   22256 1 1
         4600  +  22310 1 1   22316 1 1   22316 1 1   22350 1 1   22378 1 1   22396 1 1
         4601  +  22444 1 1   22450 1 1   22472 1 1   22484 1 1   22488 1 1   22488 1 1
         4602  +  22522 1 1   22526 1 1   22526 1 1   22528 1 1   22548 1 1   22712 1 1
         4603  +  22734 1 1   22756 1 1   22756 1 1   22762 1 1   22762 1 1   22800 1 1
         4604  +  22800 1 1   22820 1 1   22846 1 1   22860 1 1   22898 1 1   22908 1 1
         4605  +  22916 1 1   22932 1 1   23022 1 1   23042 1 1   23042 1 1   23155 1 1
         4606  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         4607  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         4608  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         4609  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         4610  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         4611  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         4612  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1
         4613  +  23155 1 1   23155 1 1   23155 1 1   23155 1 1   23155 1 1}
         4614  +
         4615  +do_execsql_test 5.2.9.1 {
         4616  +  SELECT max(c) OVER win,
         4617  +             min(c) OVER win,
         4618  +             count(a) OVER win
         4619  +      FROM t3
         4620  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         4621  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4622  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4623  +} {667 158 0   870 113 8   870 158 0   870 158 0   870 158 0   870 158 0
         4624  +  870 355 0   899 113 8   899 113 8   899 113 8   899 113 8   899 113 8
         4625  +  899 113 8   899 113 8   899 113 15   899 113 15   899 113 15   899 113 15
         4626  +  899 113 15   899 113 15   899 113 15   899 158 8   963 113 24   979 102 43
         4627  +  979 102 43   979 102 43   979 102 43   979 102 43   979 102 43   979 102 43
         4628  +  979 102 43   979 102 43   979 102 43   979 102 48   979 102 48   979 102 48
         4629  +  979 102 48   979 102 48   979 102 55   979 102 55   979 102 55   979 102 55
         4630  +  979 102 55   979 102 55   979 102 55   979 102 61   979 102 61   979 102 61
         4631  +  979 102 61   979 102 61   979 102 61   979 102 74   979 102 74   979 102 74
         4632  +  979 102 74   979 102 74   979 102 74   979 102 74   979 102 74   979 102 74
         4633  +  979 102 74   979 102 74   979 102 74   979 102 74   979 102 82   979 102 82
         4634  +  979 102 82   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4635  +  979 113 24   979 113 24   979 113 24   979 113 24   979 113 24   979 113 24
         4636  +  979 113 24   979 113 24   979 113 32   979 113 32   979 113 32   979 113 32
         4637  +  979 113 32   979 113 32   979 113 32   979 113 32   979 113 43}
         4638  +
         4639  +do_execsql_test 5.2.9.2 {
         4640  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4641  +             rank() OVER win,
         4642  +             dense_rank() OVER win
         4643  +      FROM t3
         4644  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         4645  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4646  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4647  +} {1383 84 11   1421 84 11   1651 84 11   1695 84 11   2050 84 11   2050 84 11
         4648  +  4098 75 10   4158 75 10   4158 75 10   4740 75 10   4884 75 10   4997 75 10
         4649  +  4997 75 10   4997 75 10   4997 75 10   6532 68 9   6666 68 9   6894 68 9
         4650  +  6916 68 9   7337 68 9   7337 68 9   7337 68 9   9471 59 8   9487 59 8
         4651  +  9767 59 8   10095 59 8   10317 59 8   10450 59 8   10450 59 8   10450 59 8
         4652  +  10450 59 8   10785 51 7   11379 51 7   11714 51 7   11714 51 7   11714 51 7
         4653  +  11714 51 7   11714 51 7   11714 51 7   12009 40 6   12381 40 6   12676 40 6
         4654  +  12676 40 6   12676 40 6   12676 40 6   12676 40 6   12676 40 6   12676 40 6
         4655  +  12676 40 6   12676 40 6   13418 35 5   13566 35 5   14082 35 5   14195 35 5
         4656  +  14195 35 5   15040 28 4   15154 28 4   15999 28 4   15999 28 4   15999 28 4
         4657  +  15999 28 4   15999 28 4   16606 22 3   16758 22 3   17365 22 3   17365 22 3
         4658  +  17365 22 3   17365 22 3   20135 9 2   20141 9 2   20213 9 2   20447 9 2
         4659  +  20453 9 2   20453 9 2   20599 9 2   20846 9 2   20846 9 2   20846 9 2
         4660  +  20846 9 2   20846 9 2   20846 9 2   22244 1 1   22528 1 1   22846 1 1
         4661  +  22916 1 1   22932 1 1   23155 1 1   23155 1 1   23155 1 1}
         4662  +
         4663  +do_execsql_test 5.2.10.1 {
         4664  +  SELECT max(c) OVER win,
         4665  +             min(c) OVER win,
         4666  +             count(a) OVER win
         4667  +      FROM t3
         4668  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         4669  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4670  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4671  +} {667 158 0   671 250 6   759 158 5   768 113 4   777 113 4   777 113 4
         4672  +  777 113 4   777 252 4   792 247 12   805 250 6   805 250 6   805 250 6
         4673  +  805 250 6   805 250 6   805 398 6   822 158 5   822 158 5   822 158 5
         4674  +  822 158 5   822 346 5   839 113 8   840 247 12   840 247 12   840 247 12
         4675  +  840 247 12   840 247 12   840 247 12   840 247 12   840 247 12   840 247 12
         4676  +  840 247 12   840 247 12   840 393 12   845 224 6   870 102 10   870 158 0
         4677  +  870 158 0   870 158 0   870 158 0   870 355 0   899 113 8   899 113 8
         4678  +  899 113 8   899 113 8   899 113 8   899 113 8   899 113 8   899 234 8
         4679  +  911 223 7   929 148 7   934 223 7   934 223 7   934 223 7   934 223 7
         4680  +  934 223 7   934 223 7   934 239 7   938 102 10   938 102 10   938 102 10
         4681  +  938 102 10   938 102 10   938 102 10   938 102 10   938 102 10   938 102 10
         4682  +  938 148 7   938 148 7   938 148 7   938 148 7   938 148 7   938 148 7
         4683  +  938 160 7   938 208 10   959 224 6   959 224 6   959 224 6   959 224 6
         4684  +  959 224 6   959 238 6   963 133 8   979 133 8   979 133 8   979 133 8
         4685  +  979 133 8   979 133 8   979 133 8   979 133 8   979 330 8}
         4686  +
         4687  +do_execsql_test 5.2.10.2 {
         4688  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4689  +             rank() OVER win,
         4690  +             dense_rank() OVER win
         4691  +      FROM t3
         4692  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         4693  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4694  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4695  +} {295 1 1   335 1 1   607 1 1   667 1 1   742 1 1   759 1 1   845 1 1
         4696  +  890 1 1   929 1 1   959 1 1   962 1 1   962 1 1   962 1 1   962 1 1
         4697  +  962 1 1   962 1 1   962 1 1   962 1 1   962 1 1   1264 1 1   1264 1 1
         4698  +  1264 1 1   1264 1 1   1264 1 1   1264 1 1   1366 1 1   1366 1 1   1366 1 1
         4699  +  1366 1 1   1383 1 1   1398 1 1   1406 1 1   1421 1 1   1519 1 1   1519 1 1
         4700  +  1535 1 1   1651 1 1   1669 1 1   1682 1 1   1695 1 1   1804 1 1   1804 1 1
         4701  +  1804 1 1   1804 1 1   1804 1 1   1897 1 1   1919 1 1   2000 1 1   2048 1 1
         4702  +  2050 1 1   2050 1 1   2070 1 1   2086 1 1   2108 1 1   2108 1 1   2134 1 1
         4703  +  2150 1 1   2309 1 1   2309 1 1   2309 1 1   2340 1 1   2340 1 1   2340 1 1
         4704  +  2430 1 1   2690 1 1   2758 1 1   2770 1 1   2776 1 1   2834 1 1   2848 1 1
         4705  +  2947 1 1   2947 1 1   2947 1 1   2947 1 1   2980 1 1   3082 1 1   3088 1 1
         4706  +  3088 1 1   3113 1 1   3113 1 1   3113 1 1   3113 1 1   3234 1 1   3481 1 1
         4707  +  3481 1 1   3481 1 1   3481 1 1   3481 1 1   3481 1 1}
         4708  +
         4709  +do_execsql_test 5.2.11.1 {
         4710  +  SELECT max(c) OVER win,
         4711  +             min(c) OVER win,
         4712  +             count(a) OVER win
         4713  +      FROM t3
         4714  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE CURRENT ROW  )
         4715  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4716  +} {911 223 7   934 158 26   934 158 26   934 158 26   934 158 26   934 158 26
         4717  +  934 158 33   934 223 7   934 223 7   934 223 7   934 223 7   934 223 7
         4718  +  934 223 7   934 223 20   934 223 20   934 223 20   934 223 20   934 223 20
         4719  +  934 223 20   934 223 20   934 223 20   934 223 20   934 223 20   934 223 20
         4720  +  934 223 20   934 223 20   934 223 26   934 239 7   959 102 49   959 102 49
         4721  +  959 102 49   959 102 49   959 102 49   959 102 49   959 102 49   959 102 49
         4722  +  959 102 49   959 102 49   959 102 57   959 102 57   959 102 57   959 102 57
         4723  +  959 102 57   959 102 57   959 102 57   959 102 57   959 113 38   959 113 38
         4724  +  959 113 38   959 113 38   959 113 49   959 158 33   959 158 33   959 158 33
         4725  +  959 158 33   959 158 33   959 158 33   959 158 38   963 102 58   979 102 49
         4726  +  979 102 49   979 102 49   979 102 49   979 102 49   979 102 49   979 102 52
         4727  +  979 102 52   979 102 52   979 102 52   979 102 52   979 102 52   979 102 52
         4728  +  979 102 55   979 102 55   979 102 55   979 102 55   979 102 55   979 102 55
         4729  +  979 102 55   979 102 55   979 102 55   979 102 58   979 102 58   979 102 58
         4730  +  979 102 58   979 102 58   979 102 58   979 102 58   979 102 58}
         4731  +
         4732  +do_execsql_test 5.2.11.2 {
         4733  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4734  +             rank() OVER win,
         4735  +             dense_rank() OVER win
         4736  +      FROM t3
         4737  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE CURRENT ROW  )
         4738  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4739  +} {1398 1 1   1682 1 1   2000 1 1   2070 1 1   2086 1 1   2309 1 1   2309 1 1
         4740  +  2309 1 1   5079 9 2   5085 9 2   5157 9 2   5391 9 2   5397 9 2   5397 9 2
         4741  +  5543 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2   5790 9 2
         4742  +  6397 22 3   6549 22 3   7156 22 3   7156 22 3   7156 22 3   7156 22 3
         4743  +  8001 28 4   8115 28 4   8960 28 4   8960 28 4   8960 28 4   8960 28 4
         4744  +  8960 28 4   9702 35 5   9850 35 5   10366 35 5   10479 35 5   10479 35 5
         4745  +  10774 40 6   11146 40 6   11441 40 6   11441 40 6   11441 40 6   11441 40 6
         4746  +  11441 40 6   11441 40 6   11441 40 6   11441 40 6   11441 40 6   11563 68 9
         4747  +  11697 68 9   11776 51 7   11925 68 9   11947 68 9   12368 68 9   12368 68 9
         4748  +  12368 68 9   12370 51 7   12530 59 8   12546 59 8   12705 51 7   12705 51 7
         4749  +  12705 51 7   12705 51 7   12705 51 7   12705 51 7   12826 59 8
         4750  +  13050 75 10   13110 75 10   13110 75 10   13154 59 8   13376 59 8
         4751  +  13509 59 8   13509 59 8   13509 59 8   13509 59 8   13528 84 11
         4752  +  13566 84 11   13692 75 10   13796 84 11   13836 75 10   13840 84 11
         4753  +  13949 75 10   13949 75 10   13949 75 10   13949 75 10   14195 84 11
         4754  +  14195 84 11}
         4755  +
         4756  +do_execsql_test 5.2.12.1 {
         4757  +  SELECT max(c) OVER win,
         4758  +             min(c) OVER win,
         4759  +             count(a) OVER win
         4760  +      FROM t3
         4761  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE CURRENT ROW  )
         4762  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4763  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4764  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4765  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   113 113 1
         4766  +  113 113 1   158 158 1   160 158 1   160 158 2   223 223 1   224 224 1
         4767  +  238 234 2   239 234 2   239 238 2   252 250 2   256 252 2   257 247 4
         4768  +  257 247 4   257 250 3   335 330 2   336 330 2   336 335 2   355 354 1
         4769  +  355 354 2   355 355 1   399 393 3   399 393 3   399 393 3   399 393 3
         4770  +  399 393 4   480 480 1   480 480 1   572 572 1   574 574 1   618 618 1
         4771  +  618 618 1   633 629 2   634 627 3   634 627 3   634 627 4   634 629 3
         4772  +  667 667 1   670 667 2   671 667 2   671 667 2   671 667 3   711 711 1
         4773  +  711 711 1   716 705 2   726 726 1   730 730 1   762 762 1   768 759 3
         4774  +  768 762 2   768 762 2   792 790 2   792 790 2   794 786 3   794 786 3
         4775  +  844 839 4   845 839 4   845 839 4   845 839 4   845 839 4   870 870 1
         4776  +  870 870 1   870 870 2   934 934 1   938 929 3   938 934 2   938 934 2
         4777  +  959 959 1   963 963 1}
         4778  +
         4779  +do_execsql_test 5.2.12.2 {
         4780  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4781  +             rank() OVER win,
         4782  +             dense_rank() OVER win
         4783  +      FROM t3
         4784  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE CURRENT ROW  )
         4785  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4786  +} {{} 1 1   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 10 8
         4787  +  {} 14 12   {} 15 13   {} 19 17   {} 20 18   {} 21 19   {} 23 21   {} 25 23
         4788  +  {} 34 29   {} 35 30   {} 36 31   {} 37 32   {} 38 33   {} 38 33   {} 40 34
         4789  +  {} 41 35   {} 42 36   {} 43 37   {} 43 37   {} 50 42   {} 56 47   {} 60 51
         4790  +  {} 61 52   {} 62 53   {} 64 55   {} 64 55   {} 66 56   {} 67 57   {} 68 58
         4791  +  {} 69 59   {} 70 60   {} 71 61   {} 72 62   {} 78 67   {} 78 67   {} 78 67
         4792  +  {} 81 68   {} 82 69   {} 83 70   {} 85 72   {} 85 72   {} 89 75   113 2 2
         4793  +  113 2 2   223 11 9   239 12 10   239 13 11   257 18 16   335 22 20
         4794  +  335 24 22   355 27 25   355 27 25   504 16 14   504 17 15   705 58 49
         4795  +  710 26 24   711 57 48   711 59 50   759 63 54   929 84 71   959 88 74
         4796  +  963 87 73   1185 32 28   1185 32 28   1191 29 26   1191 29 26   1334 51 43
         4797  +  1334 55 46   1338 52 44   1338 52 44   1584 31 27   1678 77 66   1684 73 63
         4798  +  1684 73 63   1885 48 40   1889 46 39   1889 46 39   1891 45 38   1891 49 41
         4799  +  2005 54 45   2523 75 64   2523 76 65}
         4800  +
         4801  +do_execsql_test 5.2.13.1 {
         4802  +  SELECT max(c) OVER win,
         4803  +             min(c) OVER win,
         4804  +             count(a) OVER win
         4805  +      FROM t3
         4806  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE CURRENT ROW  )
         4807  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4808  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4809  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4810  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4811  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4812  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4813  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4814  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4815  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         4816  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   113 113 1
         4817  +  113 113 1   158 158 0   158 158 1   355 355 0   355 355 1   393 393 1
         4818  +  393 393 1   399 399 0   399 399 1   480 480 1   480 480 1   618 618 1
         4819  +  618 618 1   629 629 0   629 629 1   667 667 0   667 667 1   768 768 1
         4820  +  768 768 1   839 839 1   839 839 1   870 870 1   870 870 1   870 870 2
         4821  +  938 938 1   938 938 1}
         4822  +
         4823  +do_execsql_test 5.2.13.2 {
         4824  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4825  +             rank() OVER win,
         4826  +             dense_rank() OVER win
         4827  +      FROM t3
         4828  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE CURRENT ROW  )
         4829  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4830  +} {{} 1 1   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 10 8
         4831  +  {} 11 9   {} 12 10   {} 13 11   {} 14 12   {} 15 13   {} 16 14   {} 17 15
         4832  +  {} 18 16   {} 19 17   {} 20 18   {} 21 19   {} 22 20   {} 23 21   {} 24 22
         4833  +  {} 25 23   {} 26 24   {} 31 27   {} 34 29   {} 35 30   {} 36 31   {} 37 32
         4834  +  {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 42 36   {} 43 37   {} 43 37
         4835  +  {} 45 38   {} 48 40   {} 49 41   {} 50 42   {} 51 43   {} 54 45   {} 55 46
         4836  +  {} 56 47   {} 57 48   {} 58 49   {} 59 50   {} 60 51   {} 61 52   {} 62 53
         4837  +  {} 63 54   {} 64 55   {} 64 55   {} 66 56   {} 67 57   {} 68 58   {} 69 59
         4838  +  {} 70 60   {} 71 61   {} 72 62   {} 75 64   {} 76 65   {} 77 66   {} 78 67
         4839  +  {} 78 67   {} 78 67   {} 81 68   {} 82 69   {} 83 70   {} 84 71   {} 85 72
         4840  +  {} 85 72   {} 87 73   {} 88 74   {} 89 75   113 2 2   113 2 2   355 27 25
         4841  +  355 27 25   393 29 26   393 29 26   399 32 28   399 32 28   629 46 39
         4842  +  629 46 39   667 52 44   667 52 44   839 73 63   839 73 63}
         4843  +
         4844  +do_execsql_test 5.2.14.1 {
         4845  +  SELECT max(c) OVER win,
         4846  +             min(c) OVER win,
         4847  +             count(a) OVER win
         4848  +      FROM t3
         4849  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
         4850  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
         4851  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         4852  +} {963 929 6   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         4853  +  979 102 83   979 113 80   979 113 81   979 113 82   979 133 79   979 148 78
         4854  +  979 158 76   979 158 77   979 160 76   979 208 75   979 223 74   979 224 73
         4855  +  979 234 72   979 238 71   979 239 70   979 247 69   979 250 68   979 252 67
         4856  +  979 256 66   979 257 65   979 295 64   979 309 63   979 330 63   979 335 61
         4857  +  979 336 60   979 346 59   979 354 58   979 355 56   979 355 58   979 393 55
         4858  +  979 393 56   979 398 54   979 399 52   979 399 53   979 412 52   979 421 51
         4859  +  979 430 50   979 443 49   979 480 47   979 480 48   979 572 46   979 574 46
         4860  +  979 607 44   979 618 42   979 618 43   979 627 41   979 629 40   979 629 40
         4861  +  979 633 39   979 634 38   979 652 37   979 660 36   979 667 34   979 667 35
         4862  +  979 670 34   979 671 33   979 683 32   979 705 31   979 711 30   979 716 29
         4863  +  979 726 28   979 730 27   979 759 26   979 762 25   979 768 23   979 768 24
         4864  +  979 777 22   979 786 21   979 790 20   979 792 19   979 794 18   979 805 17
         4865  +  979 822 16   979 839 15   979 839 15   979 840 13   979 844 12   979 845 11
         4866  +  979 870 8   979 870 9   979 870 10   979 899 8   979 911 7}
         4867  +
         4868  +do_execsql_test 5.2.14.2 {
         4869  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         4870  +             rank() OVER win,
         4871  +             dense_rank() OVER win
         4872  +      FROM t3
         4873  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
  4193   4874           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE CURRENT ROW  )
  4194         -      ORDER BY 1 , 2 , 3
         4875  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4195   4876   } {2851 89 89   3778 88 88   4681 87 87   5556 83 83   5574 82 82   5586 81 81
  4196   4877     5640 84 84   5640 85 85   5640 86 86   7324 80 80   8123 77 77   8129 73 73
  4197   4878     8129 74 74   8163 78 78   8163 79 79   8940 71 71   8968 75 75   8968 76 76
  4198   4879     9727 66 66   9745 69 69   9745 70 70   9745 72 72   10504 65 65
  4199   4880     10504 67 67   10504 68 68   11215 64 64   11844 62 62   11920 63 63
  4200   4881     13274 60 60   13274 61 61   13897 58 58   13903 57 57   13925 56 56
  4201   4882     13937 55 55   13941 59 59   15203 53 53   15241 54 54   15832 52 52
................................................................................
  4212   4893   
  4213   4894   do_execsql_test 5.3.1.1 {
  4214   4895     SELECT max(c) OVER win,
  4215   4896                min(c) OVER win,
  4216   4897                count(a) OVER win
  4217   4898         FROM t3
  4218   4899         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4219         -      ORDER BY 1 , 2 , 3
         4900  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4220   4901   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4221   4902     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4222   4903     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4223   4904     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4224   4905     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4225   4906     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4226   4907     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
................................................................................
  4233   4914   
  4234   4915   do_execsql_test 5.3.1.2 {
  4235   4916     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4236   4917                rank() OVER win,
  4237   4918                dense_rank() OVER win
  4238   4919         FROM t3
  4239   4920         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4240         -      ORDER BY 1 , 2 , 3
         4921  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4241   4922   } {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4242   4923     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4243   4924     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4244   4925     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4245   4926     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4246   4927     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4247   4928     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
................................................................................
  4252   4933     {} 1 1}
  4253   4934   
  4254   4935   do_execsql_test 5.3.2.1 {
  4255   4936     SELECT max(c) OVER win,
  4256   4937                min(c) OVER win,
  4257   4938                count(a) OVER win
  4258   4939         FROM t3
  4259         -      WINDOW win AS (  ORDER BY a  
         4940  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  4260   4941           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4261         -      ORDER BY 1 , 2 , 3
         4942  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4262   4943   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4263   4944     {} {} 0   {} {} 0   899 113 9   899 113 9   899 113 9   899 113 9
  4264   4945     899 113 9   899 113 9   899 113 9   899 113 16   899 113 16   899 113 16
  4265   4946     899 113 16   899 113 16   899 113 16   899 113 16   899 113 16   899 113 16
  4266   4947     979 102 44   979 102 44   979 102 44   979 102 44   979 102 44   979 102 49
  4267   4948     979 102 49   979 102 49   979 102 49   979 102 49   979 102 49   979 102 49
  4268   4949     979 102 56   979 102 56   979 102 56   979 102 56   979 102 56   979 102 56
................................................................................
  4276   4957     979 113 33   979 113 33   979 113 33   979 113 33}
  4277   4958   
  4278   4959   do_execsql_test 5.3.2.2 {
  4279   4960     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4280   4961                rank() OVER win,
  4281   4962                dense_rank() OVER win
  4282   4963         FROM t3
  4283         -      WINDOW win AS (  ORDER BY a  
         4964  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  4284   4965           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4285         -      ORDER BY 1 , 2 , 3
         4966  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4286   4967   } {{} 81 11   {} 81 11   {} 81 11   {} 81 11   {} 81 11   {} 81 11   {} 81 11
  4287   4968     {} 81 11   {} 81 11   2947 74 10   2947 74 10   2947 74 10   2947 74 10
  4288   4969     2947 74 10   2947 74 10   2947 74 10   5287 65 9   5287 65 9   5287 65 9
  4289   4970     5287 65 9   5287 65 9   5287 65 9   5287 65 9   5287 65 9   5287 65 9
  4290   4971     8400 57 8   8400 57 8   8400 57 8   8400 57 8   8400 57 8   8400 57 8
  4291   4972     8400 57 8   8400 57 8   9664 46 7   9664 46 7   9664 46 7   9664 46 7
  4292   4973     9664 46 7   9664 46 7   9664 46 7   9664 46 7   9664 46 7   9664 46 7
................................................................................
  4302   4983   do_execsql_test 5.3.3.1 {
  4303   4984     SELECT max(c) OVER win,
  4304   4985                min(c) OVER win,
  4305   4986                count(a) OVER win
  4306   4987         FROM t3
  4307   4988         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  4308   4989           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4309         -      ORDER BY 1 , 2 , 3
         4990  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4310   4991   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4311   4992     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4312   4993     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4313   4994     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4314   4995     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4315   4996     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4316   4997     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
................................................................................
  4324   5005   do_execsql_test 5.3.3.2 {
  4325   5006     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4326   5007                rank() OVER win,
  4327   5008                dense_rank() OVER win
  4328   5009         FROM t3
  4329   5010         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  4330   5011           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4331         -      ORDER BY 1 , 2 , 3
         5012  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4332   5013   } {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4333   5014     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4334   5015     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4335   5016     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4336   5017     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4337   5018     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4338   5019     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
................................................................................
  4343   5024     {} 1 1}
  4344   5025   
  4345   5026   do_execsql_test 5.3.4.1 {
  4346   5027     SELECT max(c) OVER win,
  4347   5028                min(c) OVER win,
  4348   5029                count(a) OVER win
  4349   5030         FROM t3
  4350         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE GROUP  )
  4351         -      ORDER BY 1 , 2 , 3
         5031  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE GROUP  )
         5032  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4352   5033   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   870 158 0
  4353   5034     870 158 0   870 158 0   870 158 0   870 158 0   870 158 0   870 158 0
  4354   5035     870 158 0   934 158 8   934 158 8   934 158 8   934 158 8   934 158 8
  4355   5036     934 158 8   934 158 8   934 158 8   934 158 8   934 158 8   934 158 8
  4356   5037     934 158 8   934 158 8   934 158 21   934 158 21   934 158 21   934 158 21
  4357   5038     934 158 21   934 158 21   934 158 27   934 158 27   934 158 27   934 158 27
  4358   5039     934 158 27   934 158 27   934 158 27   959 102 50   959 102 50   959 102 50
................................................................................
  4366   5047     979 102 47   979 102 47   979 102 47   979 102 47}
  4367   5048   
  4368   5049   do_execsql_test 5.3.4.2 {
  4369   5050     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4370   5051                rank() OVER win,
  4371   5052                dense_rank() OVER win
  4372   5053         FROM t3
  4373         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE GROUP  )
  4374         -      ORDER BY 1 , 2 , 3
         5054  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE GROUP  )
         5055  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4375   5056   } {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   2050 7 2   2050 7 2
  4376   5057     2050 7 2   2050 7 2   2050 7 2   2050 7 2   2050 7 2   2050 7 2   4359 15 3
  4377   5058     4359 15 3   4359 15 3   4359 15 3   4359 15 3   4359 15 3   4359 15 3
  4378   5059     4359 15 3   4359 15 3   4359 15 3   4359 15 3   4359 15 3   4359 15 3
  4379   5060     7840 28 4   7840 28 4   7840 28 4   7840 28 4   7840 28 4   7840 28 4
  4380   5061     9206 34 5   9206 34 5   9206 34 5   9206 34 5   9206 34 5   9206 34 5
  4381   5062     9206 34 5   10028 74 10   10028 74 10   10028 74 10   10028 74 10
................................................................................
  4389   5070     12529 46 7   12529 46 7   12529 46 7   12529 46 7   12529 46 7   12529 46 7}
  4390   5071   
  4391   5072   do_execsql_test 5.3.5.1 {
  4392   5073     SELECT max(c) OVER win,
  4393   5074                min(c) OVER win,
  4394   5075                count(a) OVER win
  4395   5076         FROM t3
  4396         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE GROUP  )
  4397         -      ORDER BY 1 , 2 , 3
         5077  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE GROUP  )
         5078  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4398   5079   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4399   5080     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4400   5081     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4401   5082     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4402   5083     {} {} 0   158 158 1   160 160 1   160 160 1   223 223 1   224 224 1
  4403   5084     238 234 2   239 234 2   239 238 2   252 250 2   256 252 2   257 247 4
  4404   5085     257 247 4   257 250 3   335 330 2   336 330 2   336 335 2   354 354 1
................................................................................
  4412   5093     963 963 1}
  4413   5094   
  4414   5095   do_execsql_test 5.3.5.2 {
  4415   5096     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4416   5097                rank() OVER win,
  4417   5098                dense_rank() OVER win
  4418   5099         FROM t3
  4419         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE GROUP  )
  4420         -      ORDER BY 1 , 2 , 3
         5100  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE GROUP  )
         5101  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4421   5102   } {{} 1 1   {} 2 2   {} 2 2   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6
  4422   5103     {} 9 7   {} 10 8   {} 14 12   {} 15 13   {} 19 17   {} 20 18   {} 21 19
  4423   5104     {} 23 21   {} 25 23   {} 27 25   {} 27 25   {} 34 29   {} 35 30   {} 36 31
  4424   5105     {} 37 32   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 42 36   {} 43 37
  4425   5106     {} 43 37   {} 50 42   {} 56 47   {} 60 51   {} 61 52   {} 62 53   {} 64 55
  4426   5107     {} 64 55   {} 66 56   {} 67 57   {} 68 58   {} 69 59   {} 70 60   {} 71 61
  4427   5108     {} 72 62   {} 78 67   {} 78 67   {} 78 67   {} 81 68   {} 82 69   {} 83 70
................................................................................
  4434   5115     2005 54 45   2523 75 64   2523 76 65}
  4435   5116   
  4436   5117   do_execsql_test 5.3.6.1 {
  4437   5118     SELECT max(c) OVER win,
  4438   5119                min(c) OVER win,
  4439   5120                count(a) OVER win
  4440   5121         FROM t3
  4441         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE GROUP  )
  4442         -      ORDER BY 1 , 2 , 3
         5122  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE GROUP  )
         5123  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4443   5124   } {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4444   5125     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4445   5126     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4446   5127     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4447   5128     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4448   5129     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
  4449   5130     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
................................................................................
  4455   5136     {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0}
  4456   5137   
  4457   5138   do_execsql_test 5.3.6.2 {
  4458   5139     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4459   5140                rank() OVER win,
  4460   5141                dense_rank() OVER win
  4461   5142         FROM t3
  4462         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE GROUP  )
  4463         -      ORDER BY 1 , 2 , 3
         5143  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE GROUP  )
         5144  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4464   5145   } {{} 1 1   {} 2 2   {} 2 2   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6
  4465   5146     {} 9 7   {} 10 8   {} 11 9   {} 12 10   {} 13 11   {} 14 12   {} 15 13
  4466   5147     {} 16 14   {} 17 15   {} 18 16   {} 19 17   {} 20 18   {} 21 19   {} 22 20
  4467   5148     {} 23 21   {} 24 22   {} 25 23   {} 26 24   {} 27 25   {} 27 25   {} 29 26
  4468   5149     {} 29 26   {} 31 27   {} 32 28   {} 32 28   {} 34 29   {} 35 30   {} 36 31
  4469   5150     {} 37 32   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 42 36   {} 43 37
  4470   5151     {} 43 37   {} 45 38   {} 46 39   {} 46 39   {} 48 40   {} 49 41   {} 50 42
................................................................................
  4476   5157     {} 85 72   {} 87 73   {} 88 74   {} 89 75}
  4477   5158   
  4478   5159   do_execsql_test 5.3.7.1 {
  4479   5160     SELECT max(c) OVER win,
  4480   5161                min(c) OVER win,
  4481   5162                count(a) OVER win
  4482   5163         FROM t3
  4483         -      WINDOW win AS (  ORDER BY c , b , a 
         5164  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
  4484   5165           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4485         -      ORDER BY 1 , 2 , 3
         5166  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4486   5167   } {963 929 6   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
  4487   5168     979 102 83   979 113 80   979 113 81   979 113 82   979 133 79   979 148 78
  4488   5169     979 158 76   979 158 77   979 160 76   979 208 75   979 223 74   979 224 73
  4489   5170     979 234 72   979 238 71   979 239 70   979 247 69   979 250 68   979 252 67
  4490   5171     979 256 66   979 257 65   979 295 64   979 309 64   979 330 62   979 335 61
  4491   5172     979 336 60   979 346 59   979 354 59   979 355 57   979 355 57   979 393 55
  4492   5173     979 393 56   979 398 54   979 399 53   979 399 53   979 412 52   979 421 51
................................................................................
  4500   5181     979 870 9   979 870 10   979 870 10   979 899 8   979 911 7}
  4501   5182   
  4502   5183   do_execsql_test 5.3.7.2 {
  4503   5184     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4504   5185                rank() OVER win,
  4505   5186                dense_rank() OVER win
  4506   5187         FROM t3
  4507         -      WINDOW win AS (  ORDER BY c , b , a 
         5188  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
         5189  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5190  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5191  +} {2851 89 89   3778 88 88   4681 87 87   5556 83 83   5574 82 82   5586 81 81
         5192  +  5640 84 84   5640 85 85   5640 86 86   7324 80 80   8123 77 77   8129 73 73
         5193  +  8129 74 74   8163 78 78   8163 79 79   8940 71 71   8968 75 75   8968 76 76
         5194  +  9727 66 66   9745 69 69   9745 70 70   9745 72 72   10504 65 65
         5195  +  10504 67 67   10504 68 68   11215 64 64   11844 62 62   11920 63 63
         5196  +  13274 60 60   13274 61 61   13897 58 58   13903 57 57   13925 56 56
         5197  +  13937 55 55   13941 59 59   15203 53 53   15241 54 54   15832 52 52
         5198  +  17100 48 48   17104 46 46   17104 47 47   17106 45 45   17126 49 49
         5199  +  17126 50 50   17126 51 51   17569 42 42   17733 44 44   18176 43 43
         5200  +  18597 40 40   18597 41 41   18952 37 37   18996 39 39   19395 38 38
         5201  +  19760 35 35   19788 36 36   20492 32 32   20492 33 33   20498 30 30
         5202  +  20536 34 34   20833 29 29   20871 28 28   20891 31 31   21180 27 27
         5203  +  21752 23 23   21830 26 26   22025 21 21   22087 22 22   22087 24 24
         5204  +  22087 25 25   22278 20 20   22316 19 19   22549 15 15   22557 14 14
         5205  +  22573 17 17   22573 18 18   22706 10 10   22796 11 11   22796 12 12
         5206  +  22796 13 13   22796 16 16   23022 4 4   23042 2 2   23042 3 3   23042 9 9
         5207  +  23155 1 1   23155 5 5   23155 6 6   23155 7 7   23155 8 8}
         5208  +
         5209  +do_execsql_test 5.3.8.1 {
         5210  +  SELECT max(c) OVER win,
         5211  +             min(c) OVER win,
         5212  +             count(a) OVER win
         5213  +      FROM t3
         5214  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5215  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5216  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5217  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5218  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5219  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5220  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5221  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5222  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5223  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5224  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5225  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5226  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5227  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5228  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0}
         5229  +
         5230  +do_execsql_test 5.3.8.2 {
         5231  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5232  +             rank() OVER win,
         5233  +             dense_rank() OVER win
         5234  +      FROM t3
         5235  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5236  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5237  +} {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5238  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5239  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5240  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5241  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5242  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5243  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5244  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5245  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5246  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5247  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5248  +  {} 1 1}
         5249  +
         5250  +do_execsql_test 5.3.9.1 {
         5251  +  SELECT max(c) OVER win,
         5252  +             min(c) OVER win,
         5253  +             count(a) OVER win
         5254  +      FROM t3
         5255  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         5256  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5257  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5258  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   870 158 0
         5259  +  870 158 0   870 158 0   870 158 0   870 158 0   870 158 0   870 158 0
         5260  +  870 158 0   870 158 0   899 113 9   899 113 9   899 113 9   899 113 9
         5261  +  899 113 9   899 113 9   899 113 9   899 113 16   899 113 16   899 113 16
         5262  +  899 113 16   899 113 16   899 113 16   899 113 16   899 113 16   899 113 16
         5263  +  979 102 44   979 102 44   979 102 44   979 102 44   979 102 44   979 102 49
         5264  +  979 102 49   979 102 49   979 102 49   979 102 49   979 102 49   979 102 49
         5265  +  979 102 56   979 102 56   979 102 56   979 102 56   979 102 56   979 102 56
         5266  +  979 102 62   979 102 62   979 102 62   979 102 62   979 102 62   979 102 62
         5267  +  979 102 62   979 102 62   979 102 62   979 102 62   979 102 62   979 102 62
         5268  +  979 102 62   979 102 75   979 102 75   979 102 75   979 102 75   979 102 75
         5269  +  979 102 75   979 102 75   979 102 75   979 113 25   979 113 25   979 113 25
         5270  +  979 113 25   979 113 25   979 113 25   979 113 25   979 113 25   979 113 33
         5271  +  979 113 33   979 113 33   979 113 33   979 113 33   979 113 33   979 113 33
         5272  +  979 113 33   979 113 33   979 113 33   979 113 33}
         5273  +
         5274  +do_execsql_test 5.3.9.2 {
         5275  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5276  +             rank() OVER win,
         5277  +             dense_rank() OVER win
         5278  +      FROM t3
         5279  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         5280  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5281  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5282  +} {{} 84 11   {} 84 11   {} 84 11   {} 84 11   {} 84 11   {} 84 11
         5283  +  2050 75 10   2050 75 10   2050 75 10   2050 75 10   2050 75 10   2050 75 10
         5284  +  2050 75 10   2050 75 10   2050 75 10   4997 68 9   4997 68 9   4997 68 9
         5285  +  4997 68 9   4997 68 9   4997 68 9   4997 68 9   7337 59 8   7337 59 8
         5286  +  7337 59 8   7337 59 8   7337 59 8   7337 59 8   7337 59 8   7337 59 8
         5287  +  7337 59 8   10450 51 7   10450 51 7   10450 51 7   10450 51 7   10450 51 7
         5288  +  10450 51 7   10450 51 7   10450 51 7   11714 40 6   11714 40 6   11714 40 6
         5289  +  11714 40 6   11714 40 6   11714 40 6   11714 40 6   11714 40 6   11714 40 6
         5290  +  11714 40 6   11714 40 6   12676 35 5   12676 35 5   12676 35 5   12676 35 5
         5291  +  12676 35 5   14195 28 4   14195 28 4   14195 28 4   14195 28 4   14195 28 4
         5292  +  14195 28 4   14195 28 4   15999 22 3   15999 22 3   15999 22 3   15999 22 3
         5293  +  15999 22 3   15999 22 3   17365 9 2   17365 9 2   17365 9 2   17365 9 2
         5294  +  17365 9 2   17365 9 2   17365 9 2   17365 9 2   17365 9 2   17365 9 2
         5295  +  17365 9 2   17365 9 2   17365 9 2   20846 1 1   20846 1 1   20846 1 1
         5296  +  20846 1 1   20846 1 1   20846 1 1   20846 1 1   20846 1 1}
         5297  +
         5298  +do_execsql_test 5.3.10.1 {
         5299  +  SELECT max(c) OVER win,
         5300  +             min(c) OVER win,
         5301  +             count(a) OVER win
         5302  +      FROM t3
         5303  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         5304  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5305  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5306  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5307  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5308  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5309  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5310  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5311  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5312  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5313  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5314  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5315  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5316  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5317  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5318  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0}
         5319  +
         5320  +do_execsql_test 5.3.10.2 {
         5321  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5322  +             rank() OVER win,
         5323  +             dense_rank() OVER win
         5324  +      FROM t3
         5325  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         5326  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5327  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5328  +} {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5329  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5330  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5331  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5332  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5333  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5334  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5335  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5336  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5337  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5338  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5339  +  {} 1 1}
         5340  +
         5341  +do_execsql_test 5.3.11.1 {
         5342  +  SELECT max(c) OVER win,
         5343  +             min(c) OVER win,
         5344  +             count(a) OVER win
         5345  +      FROM t3
         5346  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE GROUP  )
         5347  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5348  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5349  +  {} {} 0   934 158 27   934 158 27   934 158 27   934 158 27   934 158 27
         5350  +  934 158 27   934 158 27   934 223 8   934 223 8   934 223 8   934 223 8
         5351  +  934 223 8   934 223 8   934 223 8   934 223 8   934 223 8   934 223 8
         5352  +  934 223 8   934 223 8   934 223 8   934 223 21   934 223 21   934 223 21
         5353  +  934 223 21   934 223 21   934 223 21   959 102 50   959 102 50   959 102 50
         5354  +  959 102 50   959 102 50   959 102 50   959 102 50   959 102 50   959 102 50
         5355  +  959 102 50   959 102 50   959 102 50   959 102 50   959 102 50   959 102 50
         5356  +  959 102 50   959 102 50   959 113 39   959 113 39   959 113 39   959 113 39
         5357  +  959 113 39   959 113 39   959 113 39   959 113 39   959 113 39   959 113 39
         5358  +  959 113 39   959 158 34   959 158 34   959 158 34   959 158 34   959 158 34
         5359  +  979 102 46   979 102 46   979 102 46   979 102 46   979 102 46   979 102 46
         5360  +  979 102 46   979 102 47   979 102 47   979 102 47   979 102 47   979 102 47
         5361  +  979 102 47   979 102 47   979 102 47   979 102 47   979 102 49   979 102 49
         5362  +  979 102 49   979 102 49   979 102 49   979 102 49}
         5363  +
         5364  +do_execsql_test 5.3.11.2 {
         5365  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5366  +             rank() OVER win,
         5367  +             dense_rank() OVER win
         5368  +      FROM t3
         5369  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE GROUP  )
         5370  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5371  +} {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5372  +  2309 9 2   2309 9 2   2309 9 2   2309 9 2   2309 9 2   2309 9 2   2309 9 2
         5373  +  2309 9 2   2309 9 2   2309 9 2   2309 9 2   2309 9 2   2309 9 2   5790 22 3
         5374  +  5790 22 3   5790 22 3   5790 22 3   5790 22 3   5790 22 3   7156 28 4
         5375  +  7156 28 4   7156 28 4   7156 28 4   7156 28 4   7156 28 4   7156 28 4
         5376  +  8960 35 5   8960 35 5   8960 35 5   8960 35 5   8960 35 5   10028 68 9
         5377  +  10028 68 9   10028 68 9   10028 68 9   10028 68 9   10028 68 9   10028 68 9
         5378  +  10396 59 8   10396 59 8   10396 59 8   10396 59 8   10396 59 8   10396 59 8
         5379  +  10396 59 8   10396 59 8   10396 59 8   10479 40 6   10479 40 6   10479 40 6
         5380  +  10479 40 6   10479 40 6   10479 40 6   10479 40 6   10479 40 6   10479 40 6
         5381  +  10479 40 6   10479 40 6   11002 75 10   11002 75 10   11002 75 10
         5382  +  11002 75 10   11002 75 10   11002 75 10   11002 75 10   11002 75 10
         5383  +  11002 75 10   11441 51 7   11441 51 7   11441 51 7   11441 51 7
         5384  +  11441 51 7   11441 51 7   11441 51 7   11441 51 7   12145 84 11
         5385  +  12145 84 11   12145 84 11   12145 84 11   12145 84 11   12145 84 11}
         5386  +
         5387  +do_execsql_test 5.3.12.1 {
         5388  +  SELECT max(c) OVER win,
         5389  +             min(c) OVER win,
         5390  +             count(a) OVER win
         5391  +      FROM t3
         5392  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE GROUP  )
         5393  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5394  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5395  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5396  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5397  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5398  +  {} {} 0   158 158 1   160 160 1   160 160 1   223 223 1   224 224 1
         5399  +  238 234 2   239 234 2   239 238 2   252 250 2   256 252 2   257 247 4
         5400  +  257 247 4   257 250 3   335 330 2   336 330 2   336 335 2   354 354 1
         5401  +  354 354 1   355 355 1   398 393 3   398 393 3   399 393 3   399 398 2
         5402  +  399 398 2   572 572 1   574 574 1   633 629 2   634 627 3   634 627 3
         5403  +  634 627 3   634 629 3   667 667 1   670 667 2   671 667 2   671 670 2
         5404  +  671 670 2   711 711 1   711 711 1   716 705 2   726 726 1   730 730 1
         5405  +  762 762 1   762 762 1   762 762 1   768 759 3   792 790 2   792 790 2
         5406  +  794 786 3   794 786 3   844 839 4   845 839 4   845 839 4   845 840 3
         5407  +  845 840 3   934 934 1   934 934 1   934 934 1   938 929 3   959 959 1
         5408  +  963 963 1}
         5409  +
         5410  +do_execsql_test 5.3.12.2 {
         5411  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5412  +             rank() OVER win,
         5413  +             dense_rank() OVER win
         5414  +      FROM t3
         5415  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE GROUP  )
         5416  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5417  +} {{} 1 1   {} 2 2   {} 2 2   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6
         5418  +  {} 9 7   {} 10 8   {} 14 12   {} 15 13   {} 19 17   {} 20 18   {} 21 19
         5419  +  {} 23 21   {} 25 23   {} 27 25   {} 27 25   {} 34 29   {} 35 30   {} 36 31
         5420  +  {} 37 32   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 42 36   {} 43 37
         5421  +  {} 43 37   {} 50 42   {} 56 47   {} 60 51   {} 61 52   {} 62 53   {} 64 55
         5422  +  {} 64 55   {} 66 56   {} 67 57   {} 68 58   {} 69 59   {} 70 60   {} 71 61
         5423  +  {} 72 62   {} 78 67   {} 78 67   {} 78 67   {} 81 68   {} 82 69   {} 83 70
         5424  +  {} 85 72   {} 85 72   {} 89 75   223 11 9   239 12 10   239 13 11
         5425  +  257 18 16   335 22 20   335 24 22   504 16 14   504 17 15   671 52 44
         5426  +  671 52 44   705 58 49   710 26 24   711 57 48   711 59 50   759 63 54
         5427  +  786 32 28   786 32 28   798 29 26   798 29 26   845 73 63   845 73 63
         5428  +  929 84 71   959 88 74   963 87 73   1260 46 39   1260 46 39   1334 51 43
         5429  +  1334 55 46   1584 31 27   1678 77 66   1885 48 40   1891 45 38   1891 49 41
         5430  +  2005 54 45   2523 75 64   2523 76 65}
         5431  +
         5432  +do_execsql_test 5.3.13.1 {
         5433  +  SELECT max(c) OVER win,
         5434  +             min(c) OVER win,
         5435  +             count(a) OVER win
         5436  +      FROM t3
         5437  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE GROUP  )
         5438  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5439  +} {{} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5440  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5441  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5442  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5443  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5444  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5445  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5446  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5447  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5448  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5449  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5450  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0
         5451  +  {} {} 0   {} {} 0   {} {} 0   {} {} 0   {} {} 0}
         5452  +
         5453  +do_execsql_test 5.3.13.2 {
         5454  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5455  +             rank() OVER win,
         5456  +             dense_rank() OVER win
         5457  +      FROM t3
         5458  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE GROUP  )
         5459  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5460  +} {{} 1 1   {} 2 2   {} 2 2   {} 4 3   {} 5 4   {} 6 5   {} 6 5   {} 8 6
         5461  +  {} 9 7   {} 10 8   {} 11 9   {} 12 10   {} 13 11   {} 14 12   {} 15 13
         5462  +  {} 16 14   {} 17 15   {} 18 16   {} 19 17   {} 20 18   {} 21 19   {} 22 20
         5463  +  {} 23 21   {} 24 22   {} 25 23   {} 26 24   {} 27 25   {} 27 25   {} 29 26
         5464  +  {} 29 26   {} 31 27   {} 32 28   {} 32 28   {} 34 29   {} 35 30   {} 36 31
         5465  +  {} 37 32   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 42 36   {} 43 37
         5466  +  {} 43 37   {} 45 38   {} 46 39   {} 46 39   {} 48 40   {} 49 41   {} 50 42
         5467  +  {} 51 43   {} 52 44   {} 52 44   {} 54 45   {} 55 46   {} 56 47   {} 57 48
         5468  +  {} 58 49   {} 59 50   {} 60 51   {} 61 52   {} 62 53   {} 63 54   {} 64 55
         5469  +  {} 64 55   {} 66 56   {} 67 57   {} 68 58   {} 69 59   {} 70 60   {} 71 61
         5470  +  {} 72 62   {} 73 63   {} 73 63   {} 75 64   {} 76 65   {} 77 66   {} 78 67
         5471  +  {} 78 67   {} 78 67   {} 81 68   {} 82 69   {} 83 70   {} 84 71   {} 85 72
         5472  +  {} 85 72   {} 87 73   {} 88 74   {} 89 75}
         5473  +
         5474  +do_execsql_test 5.3.14.1 {
         5475  +  SELECT max(c) OVER win,
         5476  +             min(c) OVER win,
         5477  +             count(a) OVER win
         5478  +      FROM t3
         5479  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
         5480  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
         5481  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5482  +} {963 929 6   979 102 82   979 102 82   979 102 82   979 102 82   979 102 82
         5483  +  979 102 83   979 113 80   979 113 81   979 113 82   979 133 79   979 148 78
         5484  +  979 158 76   979 158 77   979 160 76   979 208 75   979 223 74   979 224 73
         5485  +  979 234 72   979 238 71   979 239 70   979 247 69   979 250 68   979 252 67
         5486  +  979 256 66   979 257 65   979 295 64   979 309 63   979 330 63   979 335 61
         5487  +  979 336 60   979 346 59   979 354 58   979 355 56   979 355 58   979 393 55
         5488  +  979 393 56   979 398 54   979 399 52   979 399 53   979 412 52   979 421 51
         5489  +  979 430 50   979 443 49   979 480 47   979 480 48   979 572 46   979 574 46
         5490  +  979 607 44   979 618 42   979 618 43   979 627 41   979 629 40   979 629 40
         5491  +  979 633 39   979 634 38   979 652 37   979 660 36   979 667 34   979 667 35
         5492  +  979 670 34   979 671 33   979 683 32   979 705 31   979 711 30   979 716 29
         5493  +  979 726 28   979 730 27   979 759 26   979 762 25   979 768 23   979 768 24
         5494  +  979 777 22   979 786 21   979 790 20   979 792 19   979 794 18   979 805 17
         5495  +  979 822 16   979 839 15   979 839 15   979 840 13   979 844 12   979 845 11
         5496  +  979 870 8   979 870 9   979 870 10   979 899 8   979 911 7}
         5497  +
         5498  +do_execsql_test 5.3.14.2 {
         5499  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5500  +             rank() OVER win,
         5501  +             dense_rank() OVER win
         5502  +      FROM t3
         5503  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
  4508   5504           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE GROUP  )
  4509         -      ORDER BY 1 , 2 , 3
         5505  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4510   5506   } {2851 89 89   3778 88 88   4681 87 87   5556 83 83   5574 82 82   5586 81 81
  4511   5507     5640 84 84   5640 85 85   5640 86 86   7324 80 80   8123 77 77   8129 73 73
  4512   5508     8129 74 74   8163 78 78   8163 79 79   8940 71 71   8968 75 75   8968 76 76
  4513   5509     9727 66 66   9745 69 69   9745 70 70   9745 72 72   10504 65 65
  4514   5510     10504 67 67   10504 68 68   11215 64 64   11844 62 62   11920 63 63
  4515   5511     13274 60 60   13274 61 61   13897 58 58   13903 57 57   13925 56 56
  4516   5512     13937 55 55   13941 59 59   15203 53 53   15241 54 54   15832 52 52
................................................................................
  4527   5523   
  4528   5524   do_execsql_test 5.4.1.1 {
  4529   5525     SELECT max(c) OVER win,
  4530   5526                min(c) OVER win,
  4531   5527                count(a) OVER win
  4532   5528         FROM t3
  4533   5529         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4534         -      ORDER BY 1 , 2 , 3
         5530  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4535   5531   } {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   158 158 0
  4536   5532     158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
  4537   5533     238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
  4538   5534     257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
  4539   5535     346 346 1   354 354 1   355 355 0   355 355 1   393 393 1   393 393 1
  4540   5536     398 398 1   399 399 0   399 399 1   412 412 1   421 421 1   430 430 1
  4541   5537     443 443 1   480 480 1   480 480 1   572 572 1   574 574 1   607 607 1
................................................................................
  4550   5546   
  4551   5547   do_execsql_test 5.4.1.2 {
  4552   5548     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4553   5549                rank() OVER win,
  4554   5550                dense_rank() OVER win
  4555   5551         FROM t3
  4556   5552         WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4557         -      ORDER BY 1 , 2 , 3
         5553  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4558   5554   } {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4559   5555     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4560   5556     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4561   5557     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4562   5558     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4563   5559     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4564   5560     113 1 1   113 1 1   133 1 1   223 1 1   239 1 1   247 1 1   257 1 1
................................................................................
  4569   5565     899 1 1   911 1 1   929 1 1   959 1 1   963 1 1   979 1 1}
  4570   5566   
  4571   5567   do_execsql_test 5.4.2.1 {
  4572   5568     SELECT max(c) OVER win,
  4573   5569                min(c) OVER win,
  4574   5570                count(a) OVER win
  4575   5571         FROM t3
  4576         -      WINDOW win AS (  ORDER BY a  
         5572  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  4577   5573           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4578         -      ORDER BY 1 , 2 , 3
         5574  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4579   5575   } {113 113 1   234 234 1   257 257 1   336 336 1   354 354 1   768 768 1
  4580   5576     839 839 1   839 839 1   899 113 10   899 113 10   899 113 10   899 113 10
  4581   5577     899 113 10   899 113 10   899 113 10   899 113 17   899 113 17   899 113 17
  4582   5578     899 113 17   899 113 17   899 113 17   899 113 17   899 899 1   963 113 17
  4583   5579     979 102 34   979 102 45   979 102 45   979 102 45   979 102 45   979 102 45
  4584   5580     979 102 50   979 102 50   979 102 50   979 102 50   979 102 50   979 102 50
  4585   5581     979 102 50   979 102 57   979 102 57   979 102 57   979 102 57   979 102 57
................................................................................
  4593   5589     979 113 34   979 113 34   979 113 34   979 113 34   979 113 34}
  4594   5590   
  4595   5591   do_execsql_test 5.4.2.2 {
  4596   5592     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4597   5593                rank() OVER win,
  4598   5594                dense_rank() OVER win
  4599   5595         FROM t3
  4600         -      WINDOW win AS (  ORDER BY a  
         5596  +      WINDOW win AS (  ORDER BY a NULLS FIRST 
  4601   5597           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4602         -      ORDER BY 1 , 2 , 3
         5598  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4603   5599   } {{} 81 11   {} 81 11   {} 81 11   {} 81 11   113 81 11   257 81 11
  4604   5600     839 81 11   839 81 11   899 81 11   2947 74 10   2947 74 10   2947 74 10
  4605   5601     3368 74 10   3390 74 10   3618 74 10   3752 74 10   5287 65 9   5287 65 9
  4606   5602     5287 65 9   5287 65 9   5420 65 9   5642 65 9   5970 65 9   6250 65 9
  4607   5603     6266 65 9   8400 57 8   8400 57 8   8400 57 8   8400 57 8   8400 57 8
  4608   5604     8400 57 8   8735 57 8   9329 57 8   9664 46 7   9664 46 7   9664 46 7
  4609   5605     9664 46 7   9664 46 7   9664 46 7   9664 46 7   9664 46 7   9664 46 7
................................................................................
  4619   5615   do_execsql_test 5.4.3.1 {
  4620   5616     SELECT max(c) OVER win,
  4621   5617                min(c) OVER win,
  4622   5618                count(a) OVER win
  4623   5619         FROM t3
  4624   5620         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  4625   5621           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4626         -      ORDER BY 1 , 2 , 3
         5622  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4627   5623   } {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   158 158 0
  4628   5624     158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
  4629   5625     238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
  4630   5626     257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
  4631   5627     346 346 1   354 354 1   355 355 0   355 355 1   393 393 1   393 393 1
  4632   5628     398 398 1   399 399 0   399 399 1   412 412 1   421 421 1   430 430 1
  4633   5629     443 443 1   480 480 1   480 480 1   572 572 1   574 574 1   607 607 1
................................................................................
  4643   5639   do_execsql_test 5.4.3.2 {
  4644   5640     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4645   5641                rank() OVER win,
  4646   5642                dense_rank() OVER win
  4647   5643         FROM t3
  4648   5644         WINDOW win AS (  PARTITION BY coalesce(a, '') 
  4649   5645           RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4650         -      ORDER BY 1 , 2 , 3
         5646  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4651   5647   } {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4652   5648     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4653   5649     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4654   5650     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4655   5651     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4656   5652     {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
  4657   5653     113 1 1   113 1 1   133 1 1   223 1 1   239 1 1   247 1 1   257 1 1
................................................................................
  4662   5658     899 1 1   911 1 1   929 1 1   959 1 1   963 1 1   979 1 1}
  4663   5659   
  4664   5660   do_execsql_test 5.4.4.1 {
  4665   5661     SELECT max(c) OVER win,
  4666   5662                min(c) OVER win,
  4667   5663                count(a) OVER win
  4668   5664         FROM t3
  4669         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE TIES  )
  4670         -      ORDER BY 1 , 2 , 3
         5665  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE TIES  )
         5666  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4671   5667   } {158 158 0   355 355 0   399 399 0   629 629 0   667 667 0   870 158 1
  4672   5668     870 158 1   870 158 1   870 158 1   870 158 1   870 158 1   870 870 0
  4673   5669     911 158 1   934 158 1   934 158 9   934 158 9   934 158 9   934 158 9
  4674   5670     934 158 9   934 158 9   934 158 9   934 158 9   934 158 9   934 158 9
  4675   5671     934 158 9   934 158 9   934 158 9   934 158 22   934 158 22   934 158 22
  4676   5672     934 158 22   934 158 22   934 158 22   934 158 28   934 158 28   934 158 28
  4677   5673     934 158 28   934 158 28   934 158 28   959 102 40   959 102 51   959 102 51
................................................................................
  4685   5681     979 102 48   979 102 48   979 102 48   979 102 48   979 102 51}
  4686   5682   
  4687   5683   do_execsql_test 5.4.4.2 {
  4688   5684     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4689   5685                rank() OVER win,
  4690   5686                dense_rank() OVER win
  4691   5687         FROM t3
  4692         -      WINDOW win AS (  ORDER BY a  GROUPS 6 PRECEDING   EXCLUDE TIES  )
  4693         -      ORDER BY 1 , 2 , 3
         5688  +      WINDOW win AS (  ORDER BY a NULLS FIRST GROUPS 6 PRECEDING   EXCLUDE TIES  )
         5689  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4694   5690   } {{} 1 1   {} 1 1   355 1 1   399 1 1   629 1 1   667 1 1   2050 7 2
  4695   5691     2050 7 2   2050 7 2   2273 7 2   2289 7 2   2359 7 2   2677 7 2   2961 7 2
  4696   5692     4359 15 3   4359 15 3   4359 15 3   4359 15 3   4359 15 3   4359 15 3
  4697   5693     4606 15 3   4752 15 3   4752 15 3   4758 15 3   4992 15 3   5064 15 3
  4698   5694     5070 15 3   7840 28 4   7840 28 4   7840 28 4   7840 28 4   8447 28 4
  4699   5695     8599 28 4   9206 34 5   9206 34 5   9206 34 5   9206 34 5   9206 34 5
  4700   5696     10028 74 10   10028 74 10   10028 74 10   10051 34 5   10165 34 5
................................................................................
  4709   5705     12529 46 7   12529 46 7   12824 46 7   13196 46 7}
  4710   5706   
  4711   5707   do_execsql_test 5.4.5.1 {
  4712   5708     SELECT max(c) OVER win,
  4713   5709                min(c) OVER win,
  4714   5710                count(a) OVER win
  4715   5711         FROM t3
  4716         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE TIES  )
  4717         -      ORDER BY 1 , 2 , 3
         5712  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE TIES  )
         5713  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4718   5714   } {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   160 158 1
  4719   5715     160 158 2   160 158 2   208 208 1   224 223 2   224 223 2   239 234 3
  4720   5716     239 234 3   239 234 3   252 247 3   257 247 5   257 247 5   257 250 4
  4721   5717     257 252 3   295 295 1   309 309 1   336 330 3   336 330 3   336 330 3
  4722   5718     346 346 1   355 354 1   355 354 2   355 354 2   399 393 3   399 393 3
  4723   5719     399 393 3   399 393 4   399 393 4   412 412 1   421 421 1   430 430 1
  4724   5720     443 443 1   480 480 1   480 480 1   574 572 2   574 572 2   607 607 1
................................................................................
  4732   5728     938 934 2   938 934 2   963 959 2   963 959 2   979 979 1}
  4733   5729   
  4734   5730   do_execsql_test 5.4.5.2 {
  4735   5731     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4736   5732                rank() OVER win,
  4737   5733                dense_rank() OVER win
  4738   5734         FROM t3
  4739         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE TIES  )
  4740         -      ORDER BY 1 , 2 , 3
         5735  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE TIES  )
         5736  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4741   5737   } {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 25 23   {} 34 29
  4742   5738     {} 36 31   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 43 37   {} 43 37
  4743   5739     {} 50 42   {} 60 51   {} 61 52   {} 64 55   {} 64 55   {} 67 57   {} 68 58
  4744   5740     {} 69 59   {} 70 60   {} 72 62   {} 78 67   {} 78 67   {} 78 67   {} 85 72
  4745   5741     {} 85 72   113 2 2   113 2 2   133 4 3   223 10 8   223 11 9   239 12 10
  4746   5742     239 13 11   239 14 12   247 15 13   257 18 16   257 19 17   295 20 18
  4747   5743     309 21 19   335 22 20   335 23 21   335 24 22   355 27 25   355 27 25
................................................................................
  4754   5750     2518 45 38   2518 48 40   2523 75 64   2523 76 65   2523 77 66}
  4755   5751   
  4756   5752   do_execsql_test 5.4.6.1 {
  4757   5753     SELECT max(c) OVER win,
  4758   5754                min(c) OVER win,
  4759   5755                count(a) OVER win
  4760   5756         FROM t3
  4761         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE TIES  )
  4762         -      ORDER BY 1 , 2 , 3
         5757  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE TIES  )
         5758  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4763   5759   } {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   158 158 0
  4764   5760     158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
  4765   5761     238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
  4766   5762     257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
  4767   5763     346 346 1   354 354 1   355 355 0   355 355 1   393 393 1   393 393 1
  4768   5764     398 398 1   399 399 0   399 399 1   412 412 1   421 421 1   430 430 1
  4769   5765     443 443 1   480 480 1   480 480 1   572 572 1   574 574 1   607 607 1
................................................................................
  4777   5773     938 938 1   938 938 1   959 959 1   963 963 1   979 979 1}
  4778   5774   
  4779   5775   do_execsql_test 5.4.6.2 {
  4780   5776     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4781   5777                rank() OVER win,
  4782   5778                dense_rank() OVER win
  4783   5779         FROM t3
  4784         -      WINDOW win AS (  ORDER BY c  RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE TIES  )
  4785         -      ORDER BY 1 , 2 , 3
         5780  +      WINDOW win AS (  ORDER BY c NULLS FIRST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE TIES  )
         5781  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4786   5782   } {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 11 9   {} 12 10
  4787   5783     {} 13 11   {} 16 14   {} 17 15   {} 18 16   {} 22 20   {} 24 22   {} 25 23
  4788   5784     {} 26 24   {} 31 27   {} 34 29   {} 36 31   {} 38 33   {} 38 33   {} 40 34
  4789   5785     {} 41 35   {} 43 37   {} 43 37   {} 49 41   {} 50 42   {} 51 43   {} 54 45
  4790   5786     {} 59 50   {} 60 51   {} 61 52   {} 63 54   {} 64 55   {} 64 55   {} 67 57
  4791   5787     {} 68 58   {} 69 59   {} 70 60   {} 72 62   {} 75 64   {} 76 65   {} 78 67
  4792   5788     {} 78 67   {} 78 67   {} 84 71   {} 85 72   {} 85 72   113 2 2   113 2 2
................................................................................
  4799   5795     959 87 73   963 88 74   979 89 75}
  4800   5796   
  4801   5797   do_execsql_test 5.4.7.1 {
  4802   5798     SELECT max(c) OVER win,
  4803   5799                min(c) OVER win,
  4804   5800                count(a) OVER win
  4805   5801         FROM t3
  4806         -      WINDOW win AS (  ORDER BY c , b , a 
         5802  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
  4807   5803           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4808         -      ORDER BY 1 , 2 , 3
         5804  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4809   5805   } {979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
  4810   5806     979 102 83   979 113 81   979 113 82   979 133 80   979 148 79   979 158 77
  4811   5807     979 158 78   979 160 77   979 208 76   979 223 75   979 224 74   979 234 73
  4812   5808     979 238 72   979 239 71   979 247 70   979 250 69   979 252 68   979 256 67
  4813   5809     979 257 66   979 295 65   979 309 64   979 330 63   979 335 62   979 336 61
  4814   5810     979 346 60   979 354 59   979 355 58   979 355 58   979 393 56   979 393 57
  4815   5811     979 398 55   979 399 54   979 399 54   979 412 53   979 421 52   979 430 51
................................................................................
  4823   5819     979 870 11   979 870 11   979 899 9   979 911 8   979 929 7}
  4824   5820   
  4825   5821   do_execsql_test 5.4.7.2 {
  4826   5822     SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
  4827   5823                rank() OVER win,
  4828   5824                dense_rank() OVER win
  4829   5825         FROM t3
  4830         -      WINDOW win AS (  ORDER BY c , b , a 
         5826  +      WINDOW win AS (  ORDER BY c NULLS FIRST, b NULLS FIRST, a NULLS FIRST
         5827  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         5828  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5829  +} {3830 89 89   4741 88 88   5640 84 84   5640 85 85   5640 86 86   5640 87 87
         5830  +  6485 81 81   6485 82 82   6485 83 83   7324 80 80   8163 78 78   8163 79 79
         5831  +  8968 73 73   8968 74 74   8968 75 75   8968 76 76   8968 77 77   9745 69 69
         5832  +  9745 70 70   9745 71 71   9745 72 72   10504 65 65   10504 66 66
         5833  +  10504 67 67   10504 68 68   11215 64 64   11920 63 63   12603 62 62
         5834  +  13274 60 60   13274 61 61   13941 59 59   14608 55 55   14608 56 56
         5835  +  14608 57 57   14608 58 58   15241 54 54   15870 53 53   16499 52 52
         5836  +  17126 49 49   17126 50 50   17126 51 51   17733 44 44   17733 45 45
         5837  +  17733 46 46   17733 47 47   17733 48 48   18176 42 42   18176 43 43
         5838  +  18597 40 40   18597 41 41   18996 39 39   19395 37 37   19395 38 38
         5839  +  19788 36 36   20181 35 35   20536 34 34   20891 30 30   20891 31 31
         5840  +  20891 32 32   20891 33 33   21226 28 28   21226 29 29   21535 27 27
         5841  +  21830 26 26   22087 22 22   22087 23 23   22087 24 24   22087 25 25
         5842  +  22334 21 21   22573 17 17   22573 18 18   22573 19 19   22573 20 20
         5843  +  22796 11 11   22796 12 12   22796 13 13   22796 14 14   22796 15 15
         5844  +  22796 16 16   22929 10 10   23042 9 9   23155 1 1   23155 2 2   23155 3 3
         5845  +  23155 4 4   23155 5 5   23155 6 6   23155 7 7   23155 8 8}
         5846  +
         5847  +do_execsql_test 5.4.8.1 {
         5848  +  SELECT max(c) OVER win,
         5849  +             min(c) OVER win,
         5850  +             count(a) OVER win
         5851  +      FROM t3
         5852  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         5853  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5854  +} {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   158 158 0
         5855  +  158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
         5856  +  238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
         5857  +  257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
         5858  +  346 346 1   354 354 1   355 355 0   355 355 1   393 393 1   393 393 1
         5859  +  398 398 1   399 399 0   399 399 1   412 412 1   421 421 1   430 430 1
         5860  +  443 443 1   480 480 1   480 480 1   572 572 1   574 574 1   607 607 1
         5861  +  618 618 1   618 618 1   627 627 1   629 629 0   629 629 1   633 633 1
         5862  +  634 634 1   652 652 1   660 660 1   667 667 0   667 667 1   670 670 1
         5863  +  671 671 1   683 683 1   705 705 1   711 711 1   716 716 1   726 726 1
         5864  +  730 730 1   759 759 1   762 762 1   768 768 1   768 768 1   777 777 1
         5865  +  786 786 1   790 790 1   792 792 1   794 794 1   805 805 1   822 822 1
         5866  +  839 839 1   839 839 1   840 840 1   844 844 1   845 845 1   870 870 0
         5867  +  870 870 1   870 870 1   899 899 1   911 911 1   929 929 1   934 934 1
         5868  +  938 938 1   938 938 1   959 959 1   963 963 1   979 979 1}
         5869  +
         5870  +do_execsql_test 5.4.8.2 {
         5871  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5872  +             rank() OVER win,
         5873  +             dense_rank() OVER win
         5874  +      FROM t3
         5875  +      WINDOW win AS (  RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         5876  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5877  +} {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5878  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5879  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5880  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5881  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5882  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5883  +  113 1 1   113 1 1   133 1 1   223 1 1   239 1 1   247 1 1   257 1 1
         5884  +  295 1 1   309 1 1   335 1 1   355 1 1   355 1 1   393 1 1   393 1 1
         5885  +  399 1 1   399 1 1   421 1 1   443 1 1   607 1 1   627 1 1   629 1 1
         5886  +  629 1 1   633 1 1   667 1 1   667 1 1   671 1 1   683 1 1   705 1 1
         5887  +  711 1 1   759 1 1   777 1 1   805 1 1   839 1 1   839 1 1   845 1 1
         5888  +  899 1 1   911 1 1   929 1 1   959 1 1   963 1 1   979 1 1}
         5889  +
         5890  +do_execsql_test 5.4.9.1 {
         5891  +  SELECT max(c) OVER win,
         5892  +             min(c) OVER win,
         5893  +             count(a) OVER win
         5894  +      FROM t3
         5895  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         5896  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         5897  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5898  +} {158 158 0   355 355 0   399 399 0   629 629 0   667 667 0   870 113 1
         5899  +  870 158 1   870 158 1   870 158 1   870 158 1   870 158 1   870 158 1
         5900  +  870 158 1   870 870 0   899 113 10   899 113 10   899 113 10   899 113 10
         5901  +  899 113 10   899 113 10   899 113 10   899 113 17   899 113 17   899 113 17
         5902  +  899 113 17   899 113 17   899 113 17   899 113 17   899 158 1   963 113 17
         5903  +  979 102 34   979 102 45   979 102 45   979 102 45   979 102 45   979 102 45
         5904  +  979 102 50   979 102 50   979 102 50   979 102 50   979 102 50   979 102 50
         5905  +  979 102 50   979 102 57   979 102 57   979 102 57   979 102 57   979 102 57
         5906  +  979 102 57   979 102 63   979 102 63   979 102 63   979 102 63   979 102 63
         5907  +  979 102 63   979 102 63   979 102 63   979 102 63   979 102 63   979 102 63
         5908  +  979 102 63   979 102 63   979 102 76   979 102 76   979 102 76   979 102 76
         5909  +  979 102 76   979 102 76   979 102 76   979 102 76   979 113 17   979 113 26
         5910  +  979 113 26   979 113 26   979 113 26   979 113 26   979 113 26   979 113 26
         5911  +  979 113 26   979 113 34   979 113 34   979 113 34   979 113 34   979 113 34
         5912  +  979 113 34   979 113 34   979 113 34   979 113 34   979 113 34}
         5913  +
         5914  +do_execsql_test 5.4.9.2 {
         5915  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5916  +             rank() OVER win,
         5917  +             dense_rank() OVER win
         5918  +      FROM t3
         5919  +      WINDOW win AS (  ORDER BY a NULLS LAST 
         5920  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         5921  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5922  +} {{} 84 11   {} 84 11   355 84 11   399 84 11   629 84 11   667 84 11
         5923  +  2050 75 10   2050 75 10   2050 75 10   2050 75 10   2163 75 10   2307 75 10
         5924  +  2889 75 10   2889 75 10   2949 75 10   4997 68 9   4997 68 9   4997 68 9
         5925  +  5418 68 9   5440 68 9   5668 68 9   5802 68 9   7337 59 8   7337 59 8
         5926  +  7337 59 8   7337 59 8   7470 59 8   7692 59 8   8020 59 8   8300 59 8
         5927  +  8316 59 8   10450 51 7   10450 51 7   10450 51 7   10450 51 7   10450 51 7
         5928  +  10450 51 7   10785 51 7   11379 51 7   11714 40 6   11714 40 6   11714 40 6
         5929  +  11714 40 6   11714 40 6   11714 40 6   11714 40 6   11714 40 6   11714 40 6
         5930  +  12009 40 6   12381 40 6   12676 35 5   12676 35 5   12789 35 5   13305 35 5
         5931  +  13453 35 5   14195 28 4   14195 28 4   14195 28 4   14195 28 4   14195 28 4
         5932  +  15040 28 4   15154 28 4   15999 22 3   15999 22 3   15999 22 3   15999 22 3
         5933  +  16606 22 3   16758 22 3   17365 9 2   17365 9 2   17365 9 2   17365 9 2
         5934  +  17365 9 2   17365 9 2   17612 9 2   17758 9 2   17758 9 2   17764 9 2
         5935  +  17998 9 2   18070 9 2   18076 9 2   20846 1 1   20846 1 1   20846 1 1
         5936  +  21069 1 1   21085 1 1   21155 1 1   21473 1 1   21757 1 1}
         5937  +
         5938  +do_execsql_test 5.4.10.1 {
         5939  +  SELECT max(c) OVER win,
         5940  +             min(c) OVER win,
         5941  +             count(a) OVER win
         5942  +      FROM t3
         5943  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         5944  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         5945  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5946  +} {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   158 158 0
         5947  +  158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
         5948  +  238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
         5949  +  257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
         5950  +  346 346 1   354 354 1   355 355 0   355 355 1   393 393 1   393 393 1
         5951  +  398 398 1   399 399 0   399 399 1   412 412 1   421 421 1   430 430 1
         5952  +  443 443 1   480 480 1   480 480 1   572 572 1   574 574 1   607 607 1
         5953  +  618 618 1   618 618 1   627 627 1   629 629 0   629 629 1   633 633 1
         5954  +  634 634 1   652 652 1   660 660 1   667 667 0   667 667 1   670 670 1
         5955  +  671 671 1   683 683 1   705 705 1   711 711 1   716 716 1   726 726 1
         5956  +  730 730 1   759 759 1   762 762 1   768 768 1   768 768 1   777 777 1
         5957  +  786 786 1   790 790 1   792 792 1   794 794 1   805 805 1   822 822 1
         5958  +  839 839 1   839 839 1   840 840 1   844 844 1   845 845 1   870 870 0
         5959  +  870 870 1   870 870 1   899 899 1   911 911 1   929 929 1   934 934 1
         5960  +  938 938 1   938 938 1   959 959 1   963 963 1   979 979 1}
         5961  +
         5962  +do_execsql_test 5.4.10.2 {
         5963  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         5964  +             rank() OVER win,
         5965  +             dense_rank() OVER win
         5966  +      FROM t3
         5967  +      WINDOW win AS (  PARTITION BY coalesce(a, '') 
         5968  +        RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         5969  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5970  +} {{} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5971  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5972  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5973  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5974  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5975  +  {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1   {} 1 1
         5976  +  113 1 1   113 1 1   133 1 1   223 1 1   239 1 1   247 1 1   257 1 1
         5977  +  295 1 1   309 1 1   335 1 1   355 1 1   355 1 1   393 1 1   393 1 1
         5978  +  399 1 1   399 1 1   421 1 1   443 1 1   607 1 1   627 1 1   629 1 1
         5979  +  629 1 1   633 1 1   667 1 1   667 1 1   671 1 1   683 1 1   705 1 1
         5980  +  711 1 1   759 1 1   777 1 1   805 1 1   839 1 1   839 1 1   845 1 1
         5981  +  899 1 1   911 1 1   929 1 1   959 1 1   963 1 1   979 1 1}
         5982  +
         5983  +do_execsql_test 5.4.11.1 {
         5984  +  SELECT max(c) OVER win,
         5985  +             min(c) OVER win,
         5986  +             count(a) OVER win
         5987  +      FROM t3
         5988  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE TIES  )
         5989  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         5990  +} {223 223 1   239 239 1   309 309 1   572 572 1   627 627 1   870 870 1
         5991  +  911 911 1   934 158 22   934 158 28   934 158 28   934 158 28   934 158 28
         5992  +  934 158 28   934 158 28   934 223 9   934 223 9   934 223 9   934 223 9
         5993  +  934 223 9   934 223 9   934 223 9   934 223 9   934 223 9   934 223 9
         5994  +  934 223 9   934 223 9   934 223 9   934 223 22   934 223 22   934 223 22
         5995  +  934 223 22   934 223 22   934 934 1   959 102 40   959 102 51   959 102 51
         5996  +  959 102 51   959 102 51   959 102 51   959 102 51   959 102 51   959 102 51
         5997  +  959 102 51   959 102 51   959 102 51   959 102 51   959 102 51   959 102 51
         5998  +  959 102 51   959 113 35   959 113 40   959 113 40   959 113 40   959 113 40
         5999  +  959 113 40   959 113 40   959 113 40   959 113 40   959 113 40   959 113 40
         6000  +  959 158 28   959 158 35   959 158 35   959 158 35   959 158 35   963 102 51
         6001  +  979 102 47   979 102 47   979 102 47   979 102 47   979 102 47   979 102 47
         6002  +  979 102 47   979 102 48   979 102 48   979 102 48   979 102 48   979 102 48
         6003  +  979 102 48   979 102 48   979 102 48   979 102 48   979 102 49   979 102 49
         6004  +  979 102 49   979 102 49   979 102 49   979 102 49   979 102 51}
         6005  +
         6006  +do_execsql_test 5.4.11.2 {
         6007  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         6008  +             rank() OVER win,
         6009  +             dense_rank() OVER win
         6010  +      FROM t3
         6011  +      WINDOW win AS (  ORDER BY a NULLS LAST GROUPS 6 PRECEDING   EXCLUDE TIES  )
         6012  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         6013  +} {{} 1 1   {} 1 1   {} 1 1   223 1 1   239 1 1   309 1 1   627 1 1   911 1 1
         6014  +  2309 9 2   2309 9 2   2309 9 2   2309 9 2   2309 9 2   2309 9 2   2556 9 2
         6015  +  2702 9 2   2702 9 2   2708 9 2   2942 9 2   3014 9 2   3020 9 2   5790 22 3
         6016  +  5790 22 3   5790 22 3   5790 22 3   6397 22 3   6549 22 3   7156 28 4
         6017  +  7156 28 4   7156 28 4   7156 28 4   7156 28 4   8001 28 4   8115 28 4
         6018  +  8960 35 5   8960 35 5   9073 35 5   9589 35 5   9737 35 5   10028 68 9
         6019  +  10028 68 9   10028 68 9   10396 59 8   10396 59 8   10396 59 8   10396 59 8
         6020  +  10449 68 9   10471 68 9   10479 40 6   10479 40 6   10479 40 6   10479 40 6
         6021  +  10479 40 6   10479 40 6   10479 40 6   10479 40 6   10479 40 6   10529 59 8
         6022  +  10699 68 9   10751 59 8   10774 40 6   10833 68 9   11002 75 10
         6023  +  11002 75 10   11002 75 10   11002 75 10   11079 59 8   11115 75 10
         6024  +  11146 40 6   11259 75 10   11359 59 8   11375 59 8   11441 51 7
         6025  +  11441 51 7   11441 51 7   11441 51 7   11441 51 7   11441 51 7   11776 51 7
         6026  +  11841 75 10   11841 75 10   11901 75 10   12145 84 11   12145 84 11
         6027  +  12370 51 7   12500 84 11   12544 84 11   12774 84 11   12812 84 11}
         6028  +
         6029  +do_execsql_test 5.4.12.1 {
         6030  +  SELECT max(c) OVER win,
         6031  +             min(c) OVER win,
         6032  +             count(a) OVER win
         6033  +      FROM t3
         6034  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE TIES  )
         6035  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         6036  +} {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   160 158 1
         6037  +  160 158 2   160 158 2   208 208 1   224 223 2   224 223 2   239 234 3
         6038  +  239 234 3   239 234 3   252 247 3   257 247 5   257 247 5   257 250 4
         6039  +  257 252 3   295 295 1   309 309 1   336 330 3   336 330 3   336 330 3
         6040  +  346 346 1   355 354 1   355 354 2   355 354 2   399 393 3   399 393 3
         6041  +  399 393 3   399 393 4   399 393 4   412 412 1   421 421 1   430 430 1
         6042  +  443 443 1   480 480 1   480 480 1   574 572 2   574 572 2   607 607 1
         6043  +  618 618 1   618 618 1   634 627 3   634 627 4   634 627 4   634 627 4
         6044  +  634 629 3   652 652 1   667 660 2   671 667 2   671 667 3   671 667 3
         6045  +  671 667 3   683 683 1   711 705 2   716 705 3   716 711 2   730 726 2
         6046  +  730 726 2   762 759 2   768 759 4   768 762 2   768 762 2   777 777 1
         6047  +  792 786 3   794 786 4   794 786 4   794 790 3   805 805 1   822 822 1
         6048  +  845 839 4   845 839 4   845 839 5   845 839 5   845 839 5   870 870 0
         6049  +  870 870 1   870 870 1   899 899 1   911 911 1   934 929 2   938 929 4
         6050  +  938 934 2   938 934 2   963 959 2   963 959 2   979 979 1}
         6051  +
         6052  +do_execsql_test 5.4.12.2 {
         6053  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         6054  +             rank() OVER win,
         6055  +             dense_rank() OVER win
         6056  +      FROM t3
         6057  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 6 PRECEDING AND 7 FOLLOWING   EXCLUDE TIES  )
         6058  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         6059  +} {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 25 23   {} 34 29
         6060  +  {} 36 31   {} 38 33   {} 38 33   {} 40 34   {} 41 35   {} 43 37   {} 43 37
         6061  +  {} 50 42   {} 60 51   {} 61 52   {} 64 55   {} 64 55   {} 67 57   {} 68 58
         6062  +  {} 69 59   {} 70 60   {} 72 62   {} 78 67   {} 78 67   {} 78 67   {} 85 72
         6063  +  {} 85 72   113 2 2   113 2 2   133 4 3   223 10 8   223 11 9   239 12 10
         6064  +  239 13 11   239 14 12   247 15 13   257 18 16   257 19 17   295 20 18
         6065  +  309 21 19   335 22 20   335 23 21   335 24 22   355 27 25   355 27 25
         6066  +  421 35 30   443 37 32   504 16 14   504 17 15   607 42 36   683 56 47
         6067  +  710 26 24   711 59 50   759 62 53   759 63 54   777 66 56   805 71 61
         6068  +  899 81 68   911 82 69   929 83 70   929 84 71   979 89 75   1185 32 28
         6069  +  1185 32 28   1191 29 26   1191 29 26   1334 51 43   1338 52 44   1338 52 44
         6070  +  1416 57 48   1416 58 49   1584 31 27   1684 73 63   1684 73 63   1889 46 39
         6071  +  1889 46 39   1891 49 41   1922 87 73   1922 88 74   2005 54 45   2005 55 46
         6072  +  2518 45 38   2518 48 40   2523 75 64   2523 76 65   2523 77 66}
         6073  +
         6074  +do_execsql_test 5.4.13.1 {
         6075  +  SELECT max(c) OVER win,
         6076  +             min(c) OVER win,
         6077  +             count(a) OVER win
         6078  +      FROM t3
         6079  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE TIES  )
         6080  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         6081  +} {102 102 1   113 113 1   113 113 1   133 133 1   148 148 1   158 158 0
         6082  +  158 158 1   160 160 1   208 208 1   223 223 1   224 224 1   234 234 1
         6083  +  238 238 1   239 239 1   247 247 1   250 250 1   252 252 1   256 256 1
         6084  +  257 257 1   295 295 1   309 309 1   330 330 1   335 335 1   336 336 1
         6085  +  346 346 1   354 354 1   355 355 0   355 355 1   393 393 1   393 393 1
         6086  +  398 398 1   399 399 0   399 399 1   412 412 1   421 421 1   430 430 1
         6087  +  443 443 1   480 480 1   480 480 1   572 572 1   574 574 1   607 607 1
         6088  +  618 618 1   618 618 1   627 627 1   629 629 0   629 629 1   633 633 1
         6089  +  634 634 1   652 652 1   660 660 1   667 667 0   667 667 1   670 670 1
         6090  +  671 671 1   683 683 1   705 705 1   711 711 1   716 716 1   726 726 1
         6091  +  730 730 1   759 759 1   762 762 1   768 768 1   768 768 1   777 777 1
         6092  +  786 786 1   790 790 1   792 792 1   794 794 1   805 805 1   822 822 1
         6093  +  839 839 1   839 839 1   840 840 1   844 844 1   845 845 1   870 870 0
         6094  +  870 870 1   870 870 1   899 899 1   911 911 1   929 929 1   934 934 1
         6095  +  938 938 1   938 938 1   959 959 1   963 963 1   979 979 1}
         6096  +
         6097  +do_execsql_test 5.4.13.2 {
         6098  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         6099  +             rank() OVER win,
         6100  +             dense_rank() OVER win
         6101  +      FROM t3
         6102  +      WINDOW win AS (  ORDER BY c NULLS LAST RANGE BETWEEN 0 PRECEDING AND 0 FOLLOWING   EXCLUDE TIES  )
         6103  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         6104  +} {{} 1 1   {} 5 4   {} 6 5   {} 6 5   {} 8 6   {} 9 7   {} 11 9   {} 12 10
         6105  +  {} 13 11   {} 16 14   {} 17 15   {} 18 16   {} 22 20   {} 24 22   {} 25 23
         6106  +  {} 26 24   {} 31 27   {} 34 29   {} 36 31   {} 38 33   {} 38 33   {} 40 34
         6107  +  {} 41 35   {} 43 37   {} 43 37   {} 49 41   {} 50 42   {} 51 43   {} 54 45
         6108  +  {} 59 50   {} 60 51   {} 61 52   {} 63 54   {} 64 55   {} 64 55   {} 67 57
         6109  +  {} 68 58   {} 69 59   {} 70 60   {} 72 62   {} 75 64   {} 76 65   {} 78 67
         6110  +  {} 78 67   {} 78 67   {} 84 71   {} 85 72   {} 85 72   113 2 2   113 2 2
         6111  +  133 4 3   223 10 8   239 14 12   247 15 13   257 19 17   295 20 18
         6112  +  309 21 19   335 23 21   355 27 25   355 27 25   393 29 26   393 29 26
         6113  +  399 32 28   399 32 28   421 35 30   443 37 32   607 42 36   627 45 38
         6114  +  629 46 39   629 46 39   633 48 40   667 52 44   667 52 44   671 55 46
         6115  +  683 56 47   705 57 48   711 58 49   759 62 53   777 66 56   805 71 61
         6116  +  839 73 63   839 73 63   845 77 66   899 81 68   911 82 69   929 83 70
         6117  +  959 87 73   963 88 74   979 89 75}
         6118  +
         6119  +do_execsql_test 5.4.14.1 {
         6120  +  SELECT max(c) OVER win,
         6121  +             min(c) OVER win,
         6122  +             count(a) OVER win
         6123  +      FROM t3
         6124  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
         6125  +        ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
         6126  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
         6127  +} {979 102 83   979 102 83   979 102 83   979 102 83   979 102 83   979 102 83
         6128  +  979 102 83   979 113 81   979 113 82   979 133 80   979 148 79   979 158 77
         6129  +  979 158 78   979 160 77   979 208 76   979 223 75   979 224 74   979 234 73
         6130  +  979 238 72   979 239 71   979 247 70   979 250 69   979 252 68   979 256 67
         6131  +  979 257 66   979 295 65   979 309 64   979 330 63   979 335 62   979 336 61
         6132  +  979 346 60   979 354 59   979 355 57   979 355 58   979 393 56   979 393 57
         6133  +  979 398 55   979 399 53   979 399 54   979 412 53   979 421 52   979 430 51
         6134  +  979 443 50   979 480 48   979 480 49   979 572 47   979 574 46   979 607 45
         6135  +  979 618 43   979 618 44   979 627 42   979 629 40   979 629 41   979 633 40
         6136  +  979 634 39   979 652 38   979 660 37   979 667 35   979 667 36   979 670 35
         6137  +  979 671 34   979 683 33   979 705 32   979 711 31   979 716 30   979 726 29
         6138  +  979 730 28   979 759 27   979 762 26   979 768 24   979 768 25   979 777 23
         6139  +  979 786 22   979 790 21   979 792 20   979 794 19   979 805 18   979 822 17
         6140  +  979 839 15   979 839 16   979 840 14   979 844 13   979 845 12   979 870 9
         6141  +  979 870 10   979 870 11   979 899 9   979 911 8   979 929 7}
         6142  +
         6143  +do_execsql_test 5.4.14.2 {
         6144  +  SELECT sum(c) FILTER (WHERE (c%2)!=0) OVER win,
         6145  +             rank() OVER win,
         6146  +             dense_rank() OVER win
         6147  +      FROM t3
         6148  +      WINDOW win AS (  ORDER BY c NULLS LAST, b NULLS LAST, a NULLS LAST
  4831   6149           ROWS BETWEEN 6 PRECEDING AND UNBOUNDED FOLLOWING   EXCLUDE TIES  )
  4832         -      ORDER BY 1 , 2 , 3
         6150  +      ORDER BY 1 NULLS FIRST, 2 NULLS FIRST, 3 NULLS FIRST
  4833   6151   } {3830 89 89   4741 88 88   5640 84 84   5640 85 85   5640 86 86   5640 87 87
  4834   6152     6485 81 81   6485 82 82   6485 83 83   7324 80 80   8163 78 78   8163 79 79
  4835   6153     8968 73 73   8968 74 74   8968 75 75   8968 76 76   8968 77 77   9745 69 69
  4836   6154     9745 70 70   9745 71 71   9745 72 72   10504 65 65   10504 66 66
  4837   6155     10504 67 67   10504 68 68   11215 64 64   11920 63 63   12603 62 62
  4838   6156     13274 60 60   13274 61 61   13941 59 59   14608 55 55   14608 56 56
  4839   6157     14608 57 57   14608 58 58   15241 54 54   15870 53 53   16499 52 52
................................................................................
  4856   6174     INSERT INTO t2 VALUES('A', NULL);
  4857   6175     INSERT INTO t2 VALUES('B', NULL);
  4858   6176     INSERT INTO t2 VALUES('C', 1);
  4859   6177   } {}
  4860   6178   
  4861   6179   do_execsql_test 6.1 {
  4862   6180     SELECT group_concat(a, '.') OVER (
  4863         -    ORDER BY b  RANGE BETWEEN 7 PRECEDING AND 2 PRECEDING
         6181  +    ORDER BY b NULLS FIRST RANGE BETWEEN 7 PRECEDING AND 2 PRECEDING
  4864   6182     )
  4865   6183     FROM t2
  4866   6184   } {A.B   A.B   {}}
  4867   6185   
  4868   6186   do_execsql_test 6.2 {
  4869   6187     SELECT group_concat(a, '.') OVER (
  4870         -    ORDER BY b DESC  RANGE BETWEEN 7 PRECEDING AND 2 PRECEDING
         6188  +    ORDER BY b DESC NULLS LAST RANGE BETWEEN 7 PRECEDING AND 2 PRECEDING
  4871   6189     )
  4872   6190     FROM t2
  4873   6191   } {{}   A.B   A.B}
  4874   6192   
  4875   6193   finish_test