/ Check-in [47cd634c98]
Login

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

Overview
Comment:Remove an unreachable branch in the NULLS LAST logic of RANGE window functions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 47cd634c98b502d40a493455ba6d73cbd0dae74944f9cf06fcbcd025f4b49d6e
User & Date: drh 2019-08-29 16:17:59
References
2019-08-30
18:02
Back out the change at [47cd634c98b502d4] which was incorrect. Add a test case so that we don't accidently back out that change again. check-in: 596ac2a4ea user: drh tags: trunk
Context
2019-08-30
18:02
Back out the change at [47cd634c98b502d4] which was incorrect. Add a test case so that we don't accidently back out that change again. check-in: 596ac2a4ea user: drh tags: trunk
2019-08-29
16:48
Add a missing VdbeCoverage() macro. check-in: 33da6092d3 user: drh tags: trunk
16:17
Remove an unreachable branch in the NULLS LAST logic of RANGE window functions. check-in: 47cd634c98 user: drh tags: trunk
15:50
Fix another case where SQLite assumes that if "~(? AND FALSE)" is true, "?" must be non-null. check-in: 616f5663b3 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/window.c.

1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
....
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913

1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
**
** A special type of arithmetic is used such that if csr.peerVal is not
** a numeric type (real or integer), then the result of the addition is
** a copy of csr1.peerVal.
*/
static void windowCodeRangeTest(
  WindowCodeArg *p, 
  int op,                          /* OP_Ge or OP_Gt */
  int csr1, 
  int regVal, 
  int csr2,
  int lbl
){
  Parse *pParse = p->pParse;
  Vdbe *v = sqlite3GetVdbe(pParse);
................................................................................
  sqlite3VdbeJumpHere(v, addrGe);
  if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_BIGNULL ){
    int addr;
    addr = sqlite3VdbeAddOp1(v, OP_NotNull, reg1); VdbeCoverage(v);
    switch( op ){
      case OP_Ge: sqlite3VdbeAddOp2(v, OP_Goto, 0, lbl); break;
      case OP_Gt: 
        sqlite3VdbeAddOp2(v, OP_NotNull, reg2, lbl); 
        VdbeCoverage(v); 
        break;

      case OP_Le: 
        sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); 
        VdbeCoverage(v); 
        break;
      default: assert( op==OP_Lt ); /* no-op */
    }
    sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
    sqlite3VdbeJumpHere(v, addr);
    sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); VdbeCoverage(v);
    if( op==OP_Gt || op==OP_Ge ){
      sqlite3VdbeChangeP2(v, -1, sqlite3VdbeCurrentAddr(v)+1);
    }







|







 







|
<

>
|
|
<

<







1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
....
1904
1905
1906
1907
1908
1909
1910
1911

1912
1913
1914
1915

1916

1917
1918
1919
1920
1921
1922
1923
**
** A special type of arithmetic is used such that if csr.peerVal is not
** a numeric type (real or integer), then the result of the addition is
** a copy of csr1.peerVal.
*/
static void windowCodeRangeTest(
  WindowCodeArg *p, 
  int op,                          /* OP_Ge, OP_Gt, or OP_Le */
  int csr1, 
  int regVal, 
  int csr2,
  int lbl
){
  Parse *pParse = p->pParse;
  Vdbe *v = sqlite3GetVdbe(pParse);
................................................................................
  sqlite3VdbeJumpHere(v, addrGe);
  if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_BIGNULL ){
    int addr;
    addr = sqlite3VdbeAddOp1(v, OP_NotNull, reg1); VdbeCoverage(v);
    switch( op ){
      case OP_Ge: sqlite3VdbeAddOp2(v, OP_Goto, 0, lbl); break;
      case OP_Gt: 
        sqlite3VdbeAddOp2(v, OP_NotNull, reg2, lbl); VdbeCoverage(v); 

        break;
      default:
        assert( op==OP_Le );
        sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); VdbeCoverage(v); 

        break;

    }
    sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
    sqlite3VdbeJumpHere(v, addr);
    sqlite3VdbeAddOp2(v, OP_IsNull, reg2, lbl); VdbeCoverage(v);
    if( op==OP_Gt || op==OP_Ge ){
      sqlite3VdbeChangeP2(v, -1, sqlite3VdbeCurrentAddr(v)+1);
    }