Do not automatically assume that ROWID is NOT NULL when compiled with
SQLITE_ALLOW_ROWID_IN_VIEW. dbsqlfuzz 31b38eeb63a4e1562de665078f52b7b47a7543cf FossilOrigin-Name: b5d2dce18fcd00749a3efe8386df42fca103f86bd862f2610cfb05651ddb9d59
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
C Fix\sa\sassert()\sthat\sis\sincorrect,\sthough\sharmless.\s\sAlso\sadd\sa\stest\scase.
|
||||
D 2024-03-21T22:08:33.386
|
||||
C Do\snot\sautomatically\sassume\sthat\sROWID\sis\sNOT\sNULL\swhen\scompiled\swith\nSQLITE_ALLOW_ROWID_IN_VIEW.\ndbsqlfuzz\s31b38eeb63a4e1562de665078f52b7b47a7543cf
|
||||
D 2024-03-24T16:42:12.161
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -675,7 +675,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574
|
||||
F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782
|
||||
F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43
|
||||
F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500
|
||||
F src/expr.c b5f1e44be4798d291a0e45f4f1f8a09971614fc3338b61f5a4c624837a84edd1
|
||||
F src/expr.c 832f32dd73e6844199d1b41dbbb0fa08679ef07608da10910b998ab902fcb80e
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00
|
||||
F src/func.c f8acebf8d6c4f38af99f766754650b26bca1eee058739834899896ce724e43b7
|
||||
@@ -725,7 +725,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750
|
||||
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c b93de34e541ec2a8f1abd55ab7e914230aa20526e7c6e169ed05bc964ce5edd9
|
||||
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
||||
F src/select.c a65c2f5da358b6b99e5466cb7f57d129e1708a41ef1941dd000b53f8add1ab9c
|
||||
F src/select.c 8460ae29edd8f515ed9f1debc12e972825453dbb904ced7253e8ccfd1e4ed164
|
||||
F src/shell.c.in 2e15f7ab2273843f3d3cdc22f3d6a1d080dd57099450b0a3bd9256a74ce822d9
|
||||
F src/sqlite.h.in 1ecba681f97f5e0659433da9555cacc2c124d26c4d09db1edcc64ee15d614839
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
@@ -2144,9 +2144,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 633dca907488b721ec1b8e470904af73369c1b1225005038aacb3e8a78c6390c
|
||||
Q +9ba3cff9d48fe8fc8a0a51291169599209d464465e44bdfd60058fd1e314a2b1
|
||||
R 29778b055e824f04c556d7025474ee3a
|
||||
P 57b0c984605d0f437b4930f6b994e15b80340c753d46a679b07d356c645856ea
|
||||
Q +80c4223098c1827ff3a564f1f9a4203164a943e9a83eef99df68378fa3c4764b
|
||||
R c162a40e0a5d5e3ea40cbcdd07d62479
|
||||
U drh
|
||||
Z e59e4ee383d05a95bfefdbb9cd164a12
|
||||
Z 6040e1c98703147bee1426ff9174ec82
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
57b0c984605d0f437b4930f6b994e15b80340c753d46a679b07d356c645856ea
|
||||
b5d2dce18fcd00749a3efe8386df42fca103f86bd862f2610cfb05651ddb9d59
|
||||
+6
-3
@@ -2738,9 +2738,12 @@ int sqlite3ExprCanBeNull(const Expr *p){
|
||||
return 0;
|
||||
case TK_COLUMN:
|
||||
assert( ExprUseYTab(p) );
|
||||
return ExprHasProperty(p, EP_CanBeNull) ||
|
||||
p->y.pTab==0 || /* Reference to column of index on expression */
|
||||
(p->iColumn>=0
|
||||
return ExprHasProperty(p, EP_CanBeNull)
|
||||
|| p->y.pTab==0 /* Reference to column of index on expression */
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
|| (p->iColumn==XN_ROWID && IsView(p->y.pTab))
|
||||
#endif
|
||||
|| (p->iColumn>=0
|
||||
&& p->y.pTab->aCol!=0 /* Possible due to prior error */
|
||||
&& p->y.pTab->aCol[p->iColumn].notNull==0);
|
||||
default:
|
||||
|
||||
@@ -5130,6 +5130,10 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){
|
||||
**
|
||||
** (11) The subquery is not a VALUES clause
|
||||
**
|
||||
** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This
|
||||
** case only comes up if SQLite is compiled using
|
||||
** SQLITE_ALLOW_ROWID_IN_VIEW.
|
||||
**
|
||||
** Return 0 if no changes are made and non-zero if one or more WHERE clause
|
||||
** terms are duplicated into the subquery.
|
||||
*/
|
||||
@@ -5240,6 +5244,18 @@ static int pushDownWhereTerms(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
if( ViewCanHaveRowid && (pWhere->op==TK_ISNULL || pWhere->op==TK_NOTNULL) ){
|
||||
Expr *pLeft = pWhere->pLeft;
|
||||
if( ALWAYS(pLeft)
|
||||
&& pLeft->op==TK_COLUMN
|
||||
&& pLeft->iColumn < 0
|
||||
){
|
||||
return 0; /* Restriction (12) */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){
|
||||
nChng++;
|
||||
pSubq->selFlags |= SF_PushDown;
|
||||
@@ -5868,6 +5884,7 @@ int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){
|
||||
while( pSel->pPrior ){ pSel = pSel->pPrior; }
|
||||
sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
|
||||
pTab->iPKey = -1;
|
||||
pTab->eTabType = TABTYP_VIEW;
|
||||
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
|
||||
#ifndef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
/* The usual case - do not allow ROWID on a subquery */
|
||||
|
||||
Reference in New Issue
Block a user