diff options
author | drh <drh@noemail.net> | 2017-05-29 13:09:24 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-05-29 13:09:24 +0000 |
commit | d8a295669c4308647717c54f58697746e99e37ce (patch) | |
tree | fe2c1d378ab6821b4ddd45080ed8237cdb7014d3 /src | |
parent | e16a350f1734df8584fcb025ef638e4199b3a9c3 (diff) | |
download | sqlite-d8a295669c4308647717c54f58697746e99e37ce.tar.gz sqlite-d8a295669c4308647717c54f58697746e99e37ce.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/select.c b/src/select.c index ff7d6c6e4..a8547f811 100644 --- a/src/select.c +++ b/src/select.c @@ -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); |