mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Remove an optimization that can no longer occur, being superceded by the
subquery-reuse optimization. Put an assert in place of the optimization to detect if the need for this optimization ever returns. FossilOrigin-Name: 4fcdc7a2939457e51aab37cab168677cd7f464a9a0aff4f8981e864a30828b3b
This commit is contained in:
22
src/select.c
22
src/select.c
@@ -5835,22 +5835,12 @@ int sqlite3Select(
|
||||
pSub = pItem->pSelect;
|
||||
if( pSub==0 ) continue;
|
||||
|
||||
/* Sometimes the code for a subquery will be generated more than
|
||||
** once, if the subquery is part of the WHERE clause in a LEFT JOIN,
|
||||
** for example. In that case, do not regenerate the code to manifest
|
||||
** a view or the co-routine to implement a view. The first instance
|
||||
** is sufficient, though the subroutine to manifest the view does need
|
||||
** to be invoked again. */
|
||||
if( pItem->addrFillSub ){
|
||||
if( pItem->fg.viaCoroutine==0 ){
|
||||
/* The subroutine that manifests the view might be a one-time routine,
|
||||
** or it might need to be rerun on each iteration because it
|
||||
** encodes a correlated subquery. */
|
||||
testcase( sqlite3VdbeGetOp(v, pItem->addrFillSub)->opcode==OP_Once );
|
||||
sqlite3VdbeAddOp2(v, OP_Gosub, pItem->regReturn, pItem->addrFillSub);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
/* The code for a subquery should only be generated once, though it is
|
||||
** technically harmless for it to be generated multiple times. The
|
||||
** following assert() will detect if something changes to cause
|
||||
** the same subquery to be coded multiple times, as a signal to the
|
||||
** developers to try to optimize the situation. */
|
||||
assert( pItem->addrFillSub==0 );
|
||||
|
||||
/* Increment Parse.nHeight by the height of the largest expression
|
||||
** tree referred to by this, the parent select. The child select
|
||||
|
||||
Reference in New Issue
Block a user