Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When flattening a view that is the right operand of a LEFT JOIN, using the optimization of check-in [41c27bc0ff1d3135], always insert the TK_IF_NULL_ROW expression nodes, even for TK_COLUMN expressions, as the TK_COLUMN might be a column from an outer query and hence still need to be NULLed out. This fixes the problem described by forum post 26387ea7ef. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
198b3e33dcfd74c7ba6abcf789ee81df |
User & Date: | drh 2023-03-01 20:23:46 |
References
2023-03-11
| ||
23:21 | The check-in at [198b3e33dcfd74c7] caused a performance regression for some queries, which is here fixed. Problem reported by forum post b405033490fa56d9. (check-in: dc9f025d user: drh tags: trunk) | |
Context
2023-03-02
| ||
05:51 | Rename some vars in the ext/wasm makefiles for consistency's sake. (check-in: c23589d9 user: stephan tags: trunk) | |
2023-03-01
| ||
20:44 | When flattening a view that is the right operand of a LEFT JOIN always insert the TK_IF_NULL_ROW expression nodes, even for TK_COLUMN expressions, as the TK_COLUMN might be a column from an outer query and hence still need to be NULLed out. (check-in: 37183856 user: drh tags: branch-3.41) | |
20:23 | When flattening a view that is the right operand of a LEFT JOIN, using the optimization of check-in [41c27bc0ff1d3135], always insert the TK_IF_NULL_ROW expression nodes, even for TK_COLUMN expressions, as the TK_COLUMN might be a column from an outer query and hence still need to be NULLed out. This fixes the problem described by forum post 26387ea7ef. (check-in: 198b3e33 user: drh tags: trunk) | |
15:21 | Follow-up to [bbaf1f2eb1e1637b]: Make sure subtypes do not cross a subquery boundary even if the function that returned the value with a subtype is buried down inside a larger expression. This fixes a problem identified by forum post 37dd14a538. (check-in: e72661eb user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
3857 3858 3859 3860 3861 3862 3863 | Expr ifNullRow; assert( pSubst->pEList!=0 && iColumn<pSubst->pEList->nExpr ); assert( pExpr->pRight==0 ); if( sqlite3ExprIsVector(pCopy) ){ sqlite3VectorErrorMsg(pSubst->pParse, pCopy); }else{ sqlite3 *db = pSubst->pParse->db; | | | 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 | Expr ifNullRow; assert( pSubst->pEList!=0 && iColumn<pSubst->pEList->nExpr ); assert( pExpr->pRight==0 ); if( sqlite3ExprIsVector(pCopy) ){ sqlite3VectorErrorMsg(pSubst->pParse, pCopy); }else{ sqlite3 *db = pSubst->pParse->db; if( pSubst->isOuterJoin ){ memset(&ifNullRow, 0, sizeof(ifNullRow)); ifNullRow.op = TK_IF_NULL_ROW; ifNullRow.pLeft = pCopy; ifNullRow.iTable = pSubst->iNewTable; ifNullRow.iColumn = -99; ifNullRow.flags = EP_IfNullRow; pCopy = &ifNullRow; |
︙ | ︙ |
Changes to test/join2.test.
︙ | ︙ | |||
350 351 352 353 354 355 356 357 358 | SELECT ccc, ccc IS NULL AS ddd FROM t1 LEFT JOIN v2; } {{} 1} optimization_control db query-flattener 0 do_execsql_test 9.11 { SELECT ccc, ccc IS NULL AS ddd FROM t1 LEFT JOIN v2; } {{} 1} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | SELECT ccc, ccc IS NULL AS ddd FROM t1 LEFT JOIN v2; } {{} 1} optimization_control db query-flattener 0 do_execsql_test 9.11 { SELECT ccc, ccc IS NULL AS ddd FROM t1 LEFT JOIN v2; } {{} 1} # 2023-03-01 https://sqlite.org/forum/forumpost/26387ea7ef # When flattening a VIEW which is the RHS of a LEFT JOIN, always put # an TK_IF_NULL_ROW operator on all accesses, even TK_COLUMN nodes, since # the TK_COLUMN might reference an outer subquery. # reset_db db null NULL do_execsql_test 10.1 { CREATE TABLE t1 (x INTEGER); INSERT INTO t1 VALUES(1); -- Some true value CREATE TABLE t2 (z TEXT); INSERT INTO t2 VALUES('some value'); CREATE TABLE t3(w TEXT); INSERT INTO t3 VALUES('some other value'); } do_execsql_test 10.2 { SELECT ( SELECT 1 FROM t2 LEFT JOIN (SELECT x AS v FROM t3) ON 500=v WHERE (v OR FALSE) ) FROM t1; } NULL do_execsql_test 10.3 { SELECT ( SELECT 1 FROM t2 LEFT JOIN (SELECT x AS v FROM t3) ON 500=v WHERE (v) ) FROM t1; } NULL optimization_control db all 0 do_execsql_test 10.4 { SELECT ( SELECT 1 FROM t2 LEFT JOIN (SELECT x AS v FROM t3) ON 500=v WHERE (v OR FALSE) ) FROM t1; } NULL finish_test |