mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Fix a long-standing issue with the distinct-as-aggregate optimization that
only expressed when the new collating-sequence logic is turned on. FossilOrigin-Name: 0aaf52a339808386984c30cca0c0c35ac2e70e7e
This commit is contained in:
18
manifest
18
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sthe\sprocessing\sof\sORDER\sBY\sclauses\swith\sCOLLATE\sterms\son\scompound\nqueries.\s\s52\sveryquick\stest\sfailures\sremain.
|
C Fix\sa\slong-standing\sissue\swith\sthe\sdistinct-as-aggregate\soptimization\sthat\nonly\sexpressed\swhen\sthe\snew\scollating-sequence\slogic\sis\sturned\son.
|
||||||
D 2012-12-07T21:02:47.824
|
D 2012-12-07T22:18:54.026
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 690d441a758cbffd13e814dc2724a721a6ebd400
|
F Makefile.in 690d441a758cbffd13e814dc2724a721a6ebd400
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -172,14 +172,14 @@ F src/pragma.c 015723c48072781d2740e310ab04dc92956b76d1
|
|||||||
F src/prepare.c 931ad0d852a0df48f79adcba6ce79ca5f475625c
|
F src/prepare.c 931ad0d852a0df48f79adcba6ce79ca5f475625c
|
||||||
F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
|
F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
|
||||||
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
||||||
F src/resolve.c 34168dc9c5e7b388d0ce209dac16069263ae7ed7
|
F src/resolve.c 5ed606916be6c63f0e262cc2cb817712384f18b5
|
||||||
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
||||||
F src/select.c eb3ded8d6ffcbab20dc3e65ba6a6dc13a01e7fbf
|
F src/select.c 28176222b138f30a9bf25bdcec94f58980273f84
|
||||||
F src/shell.c e392dd1ccbb77cc1d75a8367a89b473c24bea019
|
F src/shell.c e392dd1ccbb77cc1d75a8367a89b473c24bea019
|
||||||
F src/sqlite.h.in 4e71a210f383b6d060bd3fdf81d850f0f8c4eca3
|
F src/sqlite.h.in 4e71a210f383b6d060bd3fdf81d850f0f8c4eca3
|
||||||
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
|
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
|
||||||
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
|
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
|
||||||
F src/sqliteInt.h 02e8c8d6f3001243fccbffc1cc484fb24b344ecc
|
F src/sqliteInt.h d1f0866c69d94fe018a32f78c31a043e3fc0d0de
|
||||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||||
F src/status.c bedc37ec1a6bb9399944024d63f4c769971955a9
|
F src/status.c bedc37ec1a6bb9399944024d63f4c769971955a9
|
||||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||||
@@ -237,7 +237,7 @@ F src/update.c 28d2d098b43a2c70dae399896ea8a02f622410ef
|
|||||||
F src/utf.c 8d819e2e5104a430fc2005f018db14347c95a38f
|
F src/utf.c 8d819e2e5104a430fc2005f018db14347c95a38f
|
||||||
F src/util.c 0af2e515dc0dabacec931bca39525f6c3f1c5455
|
F src/util.c 0af2e515dc0dabacec931bca39525f6c3f1c5455
|
||||||
F src/vacuum.c 2727bdd08847fcb6b2d2da6d14f018910e8645d3
|
F src/vacuum.c 2727bdd08847fcb6b2d2da6d14f018910e8645d3
|
||||||
F src/vdbe.c 5b49cb1f852e4604a4fb6c47e087ddab28af193f
|
F src/vdbe.c 328cb259ca182026ff63d78a005821339a17ba09
|
||||||
F src/vdbe.h b52887278cb173e66188da84dfab216bea61119d
|
F src/vdbe.h b52887278cb173e66188da84dfab216bea61119d
|
||||||
F src/vdbeInt.h 79abf9b31be406d35ca77d6999cb2d42aaf91e78
|
F src/vdbeInt.h 79abf9b31be406d35ca77d6999cb2d42aaf91e78
|
||||||
F src/vdbeapi.c 4c2418161cf45392ba76a7ca92f9a5f06b96f89c
|
F src/vdbeapi.c 4c2418161cf45392ba76a7ca92f9a5f06b96f89c
|
||||||
@@ -1025,7 +1025,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||||
P f9fa7581c0371fe0feb4e97487741ade18595810
|
P 49654453ad157693414c1f86fa3afa0918acffd4
|
||||||
R ffd541783cdf83fbb00a5f595a07c0f7
|
R 1c9591aed33110a685184b6893dbfa0d
|
||||||
U drh
|
U drh
|
||||||
Z c3f0cf345664d8221c8b35557e376692
|
Z 2db21ba84371cf56d0d7dbac86085c64
|
||||||
|
@@ -1 +1 @@
|
|||||||
49654453ad157693414c1f86fa3afa0918acffd4
|
0aaf52a339808386984c30cca0c0c35ac2e70e7e
|
@@ -111,20 +111,9 @@ static void resolveAlias(
|
|||||||
}
|
}
|
||||||
pDup->iTable = pEList->a[iCol].iAlias;
|
pDup->iTable = pEList->a[iCol].iAlias;
|
||||||
}
|
}
|
||||||
#if 1 /* FIXME */
|
|
||||||
if( pExpr->flags & EP_Collate ){
|
|
||||||
CollSeq *pColl = sqlite3ExprCollSeq(pParse, pExpr);
|
|
||||||
if( pColl ){
|
|
||||||
pDup = sqlite3ExprAddCollateString(pParse, pDup, pColl->zName);
|
|
||||||
}
|
|
||||||
pDup->flags |= EP_Collate;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/* Should be this: */
|
|
||||||
if( pExpr->op==TK_COLLATE ){
|
if( pExpr->op==TK_COLLATE ){
|
||||||
pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
|
pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
|
/* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
|
||||||
** prevents ExprDelete() from deleting the Expr structure itself,
|
** prevents ExprDelete() from deleting the Expr structure itself,
|
||||||
|
@@ -2337,7 +2337,7 @@ static int multiSelectOrderBy(
|
|||||||
pColl = sqlite3ExprCollSeq(pParse, pTerm);
|
pColl = sqlite3ExprCollSeq(pParse, pTerm);
|
||||||
}else{
|
}else{
|
||||||
pColl = multiSelectCollSeq(pParse, p, aPermute[i]);
|
pColl = multiSelectCollSeq(pParse, p, aPermute[i]);
|
||||||
pTerm->flags |= EP_Collate;
|
// pTerm->flags |= EP_Collate;
|
||||||
}
|
}
|
||||||
pKeyMerge->aColl[i] = pColl;
|
pKeyMerge->aColl[i] = pColl;
|
||||||
pKeyMerge->aSortOrder[i] = pOrderBy->a[i].sortOrder;
|
pKeyMerge->aSortOrder[i] = pOrderBy->a[i].sortOrder;
|
||||||
@@ -2540,6 +2540,7 @@ static int multiSelectOrderBy(
|
|||||||
sqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY);
|
sqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY);
|
||||||
sqlite3VdbeAddOp4(v, OP_Compare, destA.iSdst, destB.iSdst, nOrderBy,
|
sqlite3VdbeAddOp4(v, OP_Compare, destA.iSdst, destB.iSdst, nOrderBy,
|
||||||
(char*)pKeyMerge, P4_KEYINFO_HANDOFF);
|
(char*)pKeyMerge, P4_KEYINFO_HANDOFF);
|
||||||
|
sqlite3VdbeChangeP5(v, OPFLAG_PERMUTE);
|
||||||
sqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB);
|
sqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB);
|
||||||
|
|
||||||
/* Release temporary registers
|
/* Release temporary registers
|
||||||
|
@@ -2330,6 +2330,7 @@ struct AuthContext {
|
|||||||
#define OPFLAG_TYPEOFARG 0x80 /* OP_Column only used for typeof() */
|
#define OPFLAG_TYPEOFARG 0x80 /* OP_Column only used for typeof() */
|
||||||
#define OPFLAG_BULKCSR 0x01 /* OP_Open** used to open bulk cursor */
|
#define OPFLAG_BULKCSR 0x01 /* OP_Open** used to open bulk cursor */
|
||||||
#define OPFLAG_P2ISREG 0x02 /* P2 to OP_Open** is a register number */
|
#define OPFLAG_P2ISREG 0x02 /* P2 to OP_Open** is a register number */
|
||||||
|
#define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Each trigger present in the database schema is stored as an instance of
|
* Each trigger present in the database schema is stored as an instance of
|
||||||
|
16
src/vdbe.c
16
src/vdbe.c
@@ -422,7 +422,9 @@ void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
|
|||||||
** Print the value of a register for tracing purposes:
|
** Print the value of a register for tracing purposes:
|
||||||
*/
|
*/
|
||||||
static void memTracePrint(FILE *out, Mem *p){
|
static void memTracePrint(FILE *out, Mem *p){
|
||||||
if( p->flags & MEM_Null ){
|
if( p->flags & MEM_Invalid ){
|
||||||
|
fprintf(out, " undefined");
|
||||||
|
}else if( p->flags & MEM_Null ){
|
||||||
fprintf(out, " NULL");
|
fprintf(out, " NULL");
|
||||||
}else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
|
}else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
|
||||||
fprintf(out, " si:%lld", p->u.i);
|
fprintf(out, " si:%lld", p->u.i);
|
||||||
@@ -1077,6 +1079,9 @@ case OP_Copy: {
|
|||||||
while( 1 ){
|
while( 1 ){
|
||||||
sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
|
sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
|
||||||
Deephemeralize(pOut);
|
Deephemeralize(pOut);
|
||||||
|
#ifdef SQLITE_DEBUG
|
||||||
|
pOut->pScopyFrom = 0;
|
||||||
|
#endif
|
||||||
REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
|
REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
|
||||||
if( (n--)==0 ) break;
|
if( (n--)==0 ) break;
|
||||||
pOut++;
|
pOut++;
|
||||||
@@ -1887,9 +1892,9 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
|||||||
** Set the permutation used by the OP_Compare operator to be the array
|
** Set the permutation used by the OP_Compare operator to be the array
|
||||||
** of integers in P4.
|
** of integers in P4.
|
||||||
**
|
**
|
||||||
** The permutation is only valid until the next OP_Permutation, OP_Compare,
|
** The permutation is only valid until the next OP_Compare that has
|
||||||
** OP_Halt, or OP_ResultRow. Typically the OP_Permutation should occur
|
** the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should
|
||||||
** immediately prior to the OP_Compare.
|
** occur immediately prior to the OP_Compare.
|
||||||
*/
|
*/
|
||||||
case OP_Permutation: {
|
case OP_Permutation: {
|
||||||
assert( pOp->p4type==P4_INTARRAY );
|
assert( pOp->p4type==P4_INTARRAY );
|
||||||
@@ -1898,7 +1903,7 @@ case OP_Permutation: {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Opcode: Compare P1 P2 P3 P4 *
|
/* Opcode: Compare P1 P2 P3 P4 P5
|
||||||
**
|
**
|
||||||
** Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this
|
** Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this
|
||||||
** vector "A") and in reg(P2)..reg(P2+P3-1) ("B"). Save the result of
|
** vector "A") and in reg(P2)..reg(P2+P3-1) ("B"). Save the result of
|
||||||
@@ -1922,6 +1927,7 @@ case OP_Compare: {
|
|||||||
CollSeq *pColl; /* Collating sequence to use on this term */
|
CollSeq *pColl; /* Collating sequence to use on this term */
|
||||||
int bRev; /* True for DESCENDING sort order */
|
int bRev; /* True for DESCENDING sort order */
|
||||||
|
|
||||||
|
if( (pOp->p5 & OPFLAG_PERMUTE)==0 ) aPermute = 0;
|
||||||
n = pOp->p3;
|
n = pOp->p3;
|
||||||
pKeyInfo = pOp->p4.pKeyInfo;
|
pKeyInfo = pOp->p4.pKeyInfo;
|
||||||
assert( n>0 );
|
assert( n>0 );
|
||||||
|
Reference in New Issue
Block a user