Proposed fix for ticket [a7b7803e8d1e8699cd8a].

FossilOrigin-Name: 3d0e00c731c39af91bad74c6d74853375bac356e
This commit is contained in:
drh 2012-12-19 15:53:51 +00:00
parent 832ee3d4cc
commit 7ee751d241
4 changed files with 43 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Optimize\sthe\sdegenerate\scase\sof\sa\sFROM\sclause\stable\sname\senclosed\sall\sby\nitself\sinside\sparentheses.\s\sGenerate\scode\sas\sif\sthe\sparentheses\sdid\snot\nexist,\srather\sthan\sthe\sold\sbehavior\sof\smanifesting\sthe\sparenthesized\stable\ninto\sa\stransient\stable.\s\sAlso,\stag\severy\sFROM-clause\sSELECT\ssubquery\sthat\sis\ngenerated\sby\sa\sparenthesized\sFROM-clause\sexpression\susing\sthe\sSF_NestedFrom\nflag.\s\sThe\snew\sSF_NestedFrom\sflag\sis\snot\syet\sused\sfor\sanything.
D 2012-12-18T19:36:11.944
C Proposed\sfix\sfor\sticket\s[a7b7803e8d1e8699cd8a].
D 2012-12-19T15:53:51.227
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 690d441a758cbffd13e814dc2724a721a6ebd400
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -250,7 +250,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
F src/wal.c f5c7b5027d0ed0e9bc9afeb4a3a8dfea762ec7d2
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
F src/where.c 7bdfde434b14ff88cc52ae41ac235ee1acb6b1e1
F src/where.c b971ee2d1a4f5db1b4cfd5cb85e69f34e61781d0
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@ -784,6 +784,7 @@ F test/tkt-8454a207b9.test c583a9f814a82a2b5ba95207f55001c9f0cd816c
F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5
F test/tkt-94c04eaadb.test fa9c71192f7e2ea2d51bf078bc34e8da6088bf71
F test/tkt-9d68c883.test 458f7d82a523d7644b54b497c986378a7d8c8b67
F test/tkt-a7b7803e.test 0baef2d1e7566e20a35bf6821d76a307ed78e3aa
F test/tkt-b1d3a2e531.test 610ef582413171b379652663111b1f996d9f8f78
F test/tkt-b351d95f9.test d14a503c414c5c58fdde3e80f9a3cfef986498c0
F test/tkt-b72787b1.test a95e8cdad0b98af1853ac7f0afd4ab27b77bf5f3
@ -1026,7 +1027,10 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 9b67c633d932f3e566f521ee6a9cf3be193436fa
R d9a19320be87db9daf2926b8e71a7df8
P 7fecced466d86a66b0b751c5b5608141e134fe2d
R 8b56234d9cc98530620effaeba3830d6
T *branch * tkt-a7b7803e
T *sym-tkt-a7b7803e *
T -sym-trunk *
U drh
Z bc761a01222fad0c80ad013442fb2ec8
Z 4056ade20a6836865fb5397034c830dc

View File

@ -1 +1 @@
7fecced466d86a66b0b751c5b5608141e134fe2d
3d0e00c731c39af91bad74c6d74853375bac356e

View File

@ -403,7 +403,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
}
pTerm = &pWC->a[idx = pWC->nTerm++];
pTerm->pExpr = p;
pTerm->pExpr = sqlite3ExprSkipCollate(p);
pTerm->wtFlags = wtFlags;
pTerm->pWC = pWC;
pTerm->iParent = -1;
@ -1188,7 +1188,8 @@ static void exprAnalyze(
}
pTerm = &pWC->a[idxTerm];
pMaskSet = pWC->pMaskSet;
pExpr = sqlite3ExprSkipCollate(pTerm->pExpr);
pExpr = pTerm->pExpr;
assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE );
prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft);
op = pExpr->op;
if( op==TK_IN ){

29
test/tkt-a7b7803e.test Normal file
View File

@ -0,0 +1,29 @@
# 2012 December 19
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. Specifically,
# it tests that ticket [a7b7803e8d1e8699cd8a460a38133b98892d2e17] has
# been fixed.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
do_test tkt-a7b7803e.1 {
db eval {
CREATE TABLE t1(a);
SELECT (t1.a==0) AS x
FROM t1
WHERE a=0 OR x;
}
} {}
finish_test