1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Fix an obscure problem allowing the propagate-constants optimization to improperly substitute a column of a sub-query with NONE affinity.

FossilOrigin-Name: d82725dcaec7437f37fc15dfb492b51a4f9dbbbcaea04e387d9471b7d291cde2
This commit is contained in:
dan
2025-04-10 14:53:32 +00:00
parent 8a6f89c845
commit 2d1c71abeb
4 changed files with 56 additions and 11 deletions

View File

@@ -4858,7 +4858,8 @@ static void constInsert(
return; /* Already present. Return without doing anything. */
}
}
if( sqlite3ExprAffinity(pColumn)==SQLITE_AFF_BLOB ){
assert( SQLITE_AFF_NONE<SQLITE_AFF_BLOB );
if( sqlite3ExprAffinity(pColumn)<=SQLITE_AFF_BLOB ){
pConst->bHasAffBlob = 1;
}
@@ -4933,7 +4934,8 @@ static int propagateConstantExprRewriteOne(
if( pColumn==pExpr ) continue;
if( pColumn->iTable!=pExpr->iTable ) continue;
if( pColumn->iColumn!=pExpr->iColumn ) continue;
if( bIgnoreAffBlob && sqlite3ExprAffinity(pColumn)==SQLITE_AFF_BLOB ){
assert( SQLITE_AFF_NONE<SQLITE_AFF_BLOB );
if( bIgnoreAffBlob && sqlite3ExprAffinity(pColumn)<=SQLITE_AFF_BLOB ){
break;
}
/* A match is found. Add the EP_FixedCol property */