Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix the OP_Affinity operator so that when applying REAL affinity, it only sets MEM_IntReal if the integer value will fit in 6 bytes or less. Fix for ticket [ba2f4585cf495231] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2b221bb15fd2b9f6a426e5eb439f7dba |
User & Date: | drh 2019-07-29 06:06:53 |
Context
2019-07-29
| ||
15:32 | When using an index for both DISTINCT and ORDER BY, do not confuse the number of columns required for distinctness with the number required to get the correct sort order. Fix for [6749cb3c]. (check-in: 6ac0f822 user: dan tags: trunk) | |
06:06 | Fix the OP_Affinity operator so that when applying REAL affinity, it only sets MEM_IntReal if the integer value will fit in 6 bytes or less. Fix for ticket [ba2f4585cf495231] (check-in: 2b221bb1 user: drh tags: trunk) | |
05:23 | Fix a minor typo in a comment. (check-in: cea8a892 user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
2813 2814 2815 2816 2817 2818 2819 | assert( zAffinity[pOp->p2]==0 ); pIn1 = &aMem[pOp->p1]; while( 1 /*exit-by-break*/ ){ assert( pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)] ); assert( memIsValid(pIn1) ); applyAffinity(pIn1, zAffinity[0], encoding); if( zAffinity[0]==SQLITE_AFF_REAL && (pIn1->flags & MEM_Int)!=0 ){ | | > > | > > > > > | | > > > > > | 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 | assert( zAffinity[pOp->p2]==0 ); pIn1 = &aMem[pOp->p1]; while( 1 /*exit-by-break*/ ){ assert( pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)] ); assert( memIsValid(pIn1) ); applyAffinity(pIn1, zAffinity[0], encoding); if( zAffinity[0]==SQLITE_AFF_REAL && (pIn1->flags & MEM_Int)!=0 ){ /* When applying REAL affinity, if the result is still an MEM_Int ** that will fit in 6 bytes, then change the type to MEM_IntReal ** so that we keep the high-resolution integer value but know that ** the type really wants to be REAL. */ testcase( pIn1->u.i==140737488355328LL ); testcase( pIn1->u.i==140737488355327LL ); testcase( pIn1->u.i==-140737488355328LL ); testcase( pIn1->u.i==-140737488355329LL ); if( pIn1->u.i<=140737488355327LL && pIn1->u.i>=-140737488355328LL ){ pIn1->flags |= MEM_IntReal; pIn1->flags &= ~MEM_Int; }else{ pIn1->u.r = (double)pIn1->u.i; pIn1->flags |= MEM_Real; pIn1->flags &= ~MEM_Int; } } REGISTER_TRACE((int)(pIn1-aMem), pIn1); zAffinity++; if( zAffinity[0]==0 ) break; pIn1++; } break; |
︙ | ︙ |
Changes to test/intreal.test.
︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 | SELECT * FROM t0, t1 WHERE ( t1.c1 >= CAST(8366271098608253588 AS REAL) AND t1.c1 <= CAST(8366271098608253588 AS REAL) ); } [list a $D] finish_test | > > > > > > > > > > > > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | SELECT * FROM t0, t1 WHERE ( t1.c1 >= CAST(8366271098608253588 AS REAL) AND t1.c1 <= CAST(8366271098608253588 AS REAL) ); } [list a $D] # 2019-07-29 ticket ba2f4585cf495231 # db close sqlite3 db :memory: do_execsql_test 3.0 { CREATE TABLE t0 (c0 REAL, c1); CREATE UNIQUE INDEX i0 ON t0(c1, 0 | c0); INSERT INTO t0(c0) VALUES (4750228396194493326), (0); UPDATE OR REPLACE t0 SET c0 = 'a', c1 = ''; SELECT * FROM t0 ORDER BY t0.c1; PRAGMA integrity_check; } {a {} ok} finish_test |