Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Revised fix for the DESC ORDER BY and IN constraint bug, ticket [4dd95f6943fbd18]. The previous check-in was incorrect. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | desc-orderby-fix-1 |
Files: | files | file ages | folders |
SHA1: |
8b2eb7a43b4580f04c14ea8600cf080e |
User & Date: | drh 2013-03-12 18:40:20.150 |
Context
2013-03-12
| ||
18:44 | Add test cases for [4dd95f6943]. (check-in: 723c144c76 user: dan tags: desc-orderby-fix-1) | |
18:40 | Revised fix for the DESC ORDER BY and IN constraint bug, ticket [4dd95f6943fbd18]. The previous check-in was incorrect. (check-in: 8b2eb7a43b user: drh tags: desc-orderby-fix-1) | |
18:34 | A proposed fix for the DESC ORDER BY bug of ticket [4dd95f6943fbd18]. Seems to work, but lots more testing is needed prior to moving to trunk. (check-in: 614a038ad2 user: drh tags: desc-orderby-fix-1) | |
Changes
Changes to src/sqliteInt.h.
︙ | ︙ | |||
1927 1928 1929 1930 1931 1932 1933 | ** is only used when wsFlags&WHERE_VIRTUALTABLE is true. It is never the ** case that more than one of these conditions is true. */ struct WherePlan { u32 wsFlags; /* WHERE_* flags that describe the strategy */ u16 nEq; /* Number of == constraints */ u16 nOBSat; /* Number of ORDER BY terms satisfied */ | < | 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 | ** is only used when wsFlags&WHERE_VIRTUALTABLE is true. It is never the ** case that more than one of these conditions is true. */ struct WherePlan { u32 wsFlags; /* WHERE_* flags that describe the strategy */ u16 nEq; /* Number of == constraints */ u16 nOBSat; /* Number of ORDER BY terms satisfied */ double nRow; /* Estimated number of rows (for EQP) */ union { Index *pIdx; /* Index when WHERE_INDEXED is true */ struct WhereTerm *pTerm; /* WHERE clause term for OR-search */ sqlite3_index_info *pVtabIdx; /* Virtual table index to use */ } u; }; |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
1830 1831 1832 1833 1834 1835 1836 | ** of pCost. */ WHERETRACE(("... multi-index OR cost=%.9g nrow=%.9g\n", rTotal, nRow)); if( rTotal<p->cost.rCost ){ p->cost.rCost = rTotal; p->cost.used = used; p->cost.plan.nRow = nRow; p->cost.plan.nOBSat = p->i ? p->aLevel[p->i-1].plan.nOBSat : 0; | < | 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 | ** of pCost. */ WHERETRACE(("... multi-index OR cost=%.9g nrow=%.9g\n", rTotal, nRow)); if( rTotal<p->cost.rCost ){ p->cost.rCost = rTotal; p->cost.used = used; p->cost.plan.nRow = nRow; p->cost.plan.nOBSat = p->i ? p->aLevel[p->i-1].plan.nOBSat : 0; p->cost.plan.wsFlags = flags; p->cost.plan.u.pTerm = pTerm; } } } #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ } |
︙ | ︙ | |||
3794 3795 3796 3797 3798 3799 3800 | }else{ int eType; int iTab; struct InLoop *pIn; u8 bRev; if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){ | | < | 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 | }else{ int eType; int iTab; struct InLoop *pIn; u8 bRev; if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){ bRev = pLevel->plan.u.pIdx->aSortOrder[iEq]; }else{ bRev = 0; } if( pLevel->plan.wsFlags & WHERE_REVERSE ) bRev = 1 - bRev; assert( pX->op==TK_IN ); iReg = iTarget; eType = sqlite3FindInIndex(pParse, pX, 0); |
︙ | ︙ |