aboutsummaryrefslogtreecommitdiff
path: root/src/vdbe.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2012-12-07 22:18:54 +0000
committerdrh <drh@noemail.net>2012-12-07 22:18:54 +0000
commit953f7611da21d43454ae5173f5fb1b69465a2d45 (patch)
tree5b68b836a82c4ba563f31d536f51b2b8d53154ee /src/vdbe.c
parentbd13d34b08ddc66a079f671bcbe96127b41da957 (diff)
downloadsqlite-953f7611da21d43454ae5173f5fb1b69465a2d45.tar.gz
sqlite-953f7611da21d43454ae5173f5fb1b69465a2d45.zip
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
Diffstat (limited to 'src/vdbe.c')
-rw-r--r--src/vdbe.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/vdbe.c b/src/vdbe.c
index bbccac8a9..6b78d27fd 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -422,7 +422,9 @@ void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
** Print the value of a register for tracing purposes:
*/
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");
}else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
fprintf(out, " si:%lld", p->u.i);
@@ -1077,6 +1079,9 @@ case OP_Copy: {
while( 1 ){
sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
Deephemeralize(pOut);
+#ifdef SQLITE_DEBUG
+ pOut->pScopyFrom = 0;
+#endif
REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
if( (n--)==0 ) break;
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
** of integers in P4.
**
-** The permutation is only valid until the next OP_Permutation, OP_Compare,
-** OP_Halt, or OP_ResultRow. Typically the OP_Permutation should occur
-** immediately prior to the OP_Compare.
+** The permutation is only valid until the next OP_Compare that has
+** the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should
+** occur immediately prior to the OP_Compare.
*/
case OP_Permutation: {
assert( pOp->p4type==P4_INTARRAY );
@@ -1898,7 +1903,7 @@ case OP_Permutation: {
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
** 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 */
int bRev; /* True for DESCENDING sort order */
+ if( (pOp->p5 & OPFLAG_PERMUTE)==0 ) aPermute = 0;
n = pOp->p3;
pKeyInfo = pOp->p4.pKeyInfo;
assert( n>0 );