1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Correctly initialize the iSelectId of FROM clause terms that are a self

join of a reused materialized subquery.  Without this, the EXPLAIN QUERY PLAN
output for the query will identify the subquery using the uninitialized
(and arbitrary) iSelectId.

FossilOrigin-Name: 43c9ae371f6250fee98a7c4011726eff8ad37f5a97add4f490ac3a2dd501a0d2
This commit is contained in:
drh
2017-05-29 13:09:24 +00:00
parent e16a350f17
commit d8a295669c
4 changed files with 24 additions and 9 deletions

View File

@@ -5270,6 +5270,7 @@ int sqlite3Select(
pPrior = isSelfJoinView(pTabList, pItem);
if( pPrior ){
sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
explainSetInteger(pItem->iSelectId, pPrior->iSelectId);
}else{
sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);