SQLite

Check-in [e313edca04]
Login

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

Overview
Comment:Do not report missing collating functions while parsing the schema. Also remove a stray comment.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ticket-71e333e7
Files: files | file ages | folders
SHA1: e313edca0472f07e9b872b92120d80b4bc177328
User & Date: drh 2012-12-07 22:54:41.904
Context
2012-12-07
23:10
For an ORDER BY on a compound SELECT, take the collating sequence from the left-most term of the compound. (check-in: 8e724b383d user: drh tags: ticket-71e333e7)
22:54
Do not report missing collating functions while parsing the schema. Also remove a stray comment. (check-in: e313edca04 user: drh tags: ticket-71e333e7)
22:18
Fix a long-standing issue with the distinct-as-aggregate optimization that only expressed when the new collating-sequence logic is turned on. (check-in: 0aaf52a339 user: drh tags: ticket-71e333e7)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
108
109
110
111
112
113
114




115

116
117
118
119
120
121
122
  while( p && pColl==0 ){
    int op = p->op;
    if( op==TK_CAST || op==TK_UPLUS ){
      p = p->pLeft;
      continue;
    }
    if( op==TK_COLLATE ){




      pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);

      break;
    }
    if( p->pTab!=0
     && (op==TK_AGG_COLUMN || op==TK_COLUMN
          || op==TK_REGISTER || op==TK_TRIGGER)
    ){
      /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally







>
>
>
>
|
>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
  while( p && pColl==0 ){
    int op = p->op;
    if( op==TK_CAST || op==TK_UPLUS ){
      p = p->pLeft;
      continue;
    }
    if( op==TK_COLLATE ){
      if( db->init.busy ){
        /* Do not report errors when parsing while the schema */
        pColl = sqlite3FindCollSeq(db, ENC(db), p->u.zToken, 0);
      }else{
        pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
      }
      break;
    }
    if( p->pTab!=0
     && (op==TK_AGG_COLUMN || op==TK_COLUMN
          || op==TK_REGISTER || op==TK_TRIGGER)
    ){
      /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally
Changes to src/select.c.
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
      for(i=0; i<nOrderBy; i++){
        CollSeq *pColl;
        Expr *pTerm = pOrderBy->a[i].pExpr;
        if( pTerm->flags & EP_Collate ){
          pColl = sqlite3ExprCollSeq(pParse, pTerm);
        }else{
          pColl = multiSelectCollSeq(pParse, p, aPermute[i]);
//          pTerm->flags |= EP_Collate;
        }
        pKeyMerge->aColl[i] = pColl;
        pKeyMerge->aSortOrder[i] = pOrderBy->a[i].sortOrder;
      }
    }
  }else{
    pKeyMerge = 0;







<







2333
2334
2335
2336
2337
2338
2339

2340
2341
2342
2343
2344
2345
2346
      for(i=0; i<nOrderBy; i++){
        CollSeq *pColl;
        Expr *pTerm = pOrderBy->a[i].pExpr;
        if( pTerm->flags & EP_Collate ){
          pColl = sqlite3ExprCollSeq(pParse, pTerm);
        }else{
          pColl = multiSelectCollSeq(pParse, p, aPermute[i]);

        }
        pKeyMerge->aColl[i] = pColl;
        pKeyMerge->aSortOrder[i] = pOrderBy->a[i].sortOrder;
      }
    }
  }else{
    pKeyMerge = 0;