SQLite

Check-in [0a7649afeb]
Login

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

Overview
Comment:Enhance the sqlite3ExprCompare() routine so that it knows to compare the OVER clause of window functions.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0a7649afebc9349bf44a0e3588e81ab595ea85be1c70de08859ea76a7b271f62
User & Date: drh 2018-07-10 06:47:07.491
Context
2018-07-10
07:25
Assert that if two functions compare equal in every other way, then they must both have OVER clauses, or neither has an OVER clause. Use this fact to simplify expression comparison. (check-in: 52559ad58c user: drh tags: trunk)
06:47
Enhance the sqlite3ExprCompare() routine so that it knows to compare the OVER clause of window functions. (check-in: 0a7649afeb user: drh tags: trunk)
06:32
Enhance the TreeView mechanism so that it shows the window function data structures as part of the abstract syntax tree. (check-in: a2c0e1bec0 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
4947
4948
4949
4950
4951
4952
4953








4954
4955
4956
4957
4958
4959
4960
    if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
    assert( (combinedFlags & EP_Reduced)==0 );
    if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
      if( pA->iColumn!=pB->iColumn ) return 2;
      if( pA->iTable!=pB->iTable 
       && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
    }








  }
  return 0;
}

/*
** Compare two ExprList objects.  Return 0 if they are identical and 
** non-zero if they differ in any way.







>
>
>
>
>
>
>
>







4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
    if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
    assert( (combinedFlags & EP_Reduced)==0 );
    if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
      if( pA->iColumn!=pB->iColumn ) return 2;
      if( pA->iTable!=pB->iTable 
       && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
    }
#ifndef SQLITE_OMIT_WINDOWFUNC
    if( pA->pWin!=0 ){
      if( pB->pWin==0 ) return 2;
      if( sqlite3WindowCompare(pParse,pA->pWin,pB->pWin)!=0 ) return 2;
    }else if( pB->pWin!=0 ){
      return 2;
    }
#endif
  }
  return 0;
}

/*
** Compare two ExprList objects.  Return 0 if they are identical and 
** non-zero if they differ in any way.