SQLite

Check-in [41c27bc0ff]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improved optimizations of views as the right operand of a LEFT JOIN.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 41c27bc0ff1d3135cdb6273ede4595f5bb0c0e1e1d470ea1633cb525674cf431
User & Date: drh 2017-04-18 11:20:19.836
References
2023-03-02
13:49
When flattening the right operand of a LEFT JOIN (check-in [41c27bc0ff1d3135]), ensure that the OP_IfNullRow opcode does not NULL-out a subquery result that was computed within OP_Once. This fixes the problem problem reported by forum post 402f05296d. (check-in: 8fe13f7a5e user: drh tags: trunk)
2023-03-01
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: 198b3e33dc user: drh tags: trunk)
2020-02-22
13:07 Fixed ticket [aa43786930]: sqlite3.c:87338: int sqlite3VdbeExec(Vdbe *): Assertion `sqlite3BtreeCursorIsValid(pCrsr)' failed. plus 6 other changes (artifact: 9fee20675e user: drh)
2019-12-18
20:51
Continue to back away from the LEFT JOIN optimization of check-in [41c27bc0ff1d3135] by disallowing query flattening if the outer query is DISTINCT. Without this fix, if an index scan is run on the table within the view on the right-hand side of the LEFT JOIN, stale result registers might be accessed yielding incorrect results, and/or an OP_IfNullRow opcode might be invoked on the un-opened table, resulting in a NULL-pointer dereference. This problem was found by the Yongheng and Rui fuzzer. (check-in: 862974312e user: drh tags: trunk)
2017-07-29
03:26 New ticket [de3403bf5a] Column name shift due to LEFT JOIN query flattening. (artifact: e6b7df6949 user: drh)
2017-06-20
16:15 New ticket [892fc34f17] Incorrect query result when a LEFT JOIN subquery is flattened. (artifact: d28d654485 user: drh)
Context
2017-04-18
13:50
Use sqlite3_table_column_metadata() instead of a SELECT statement to check for the existence of a %_stat table in fts3. This leads to smaller and easier to test code. (check-in: dc2a48020a user: dan tags: trunk)
11:20
Improved optimizations of views as the right operand of a LEFT JOIN. (check-in: 41c27bc0ff user: drh tags: trunk)
05:49
Refactor the fts3ColumnMethod() function so that all branches can be covered. (check-in: e47fdb493b user: dan tags: trunk)
2017-04-14
19:03
Add the TK_IF_NULL_ROW opcode to deal with non-NULL result columns in the result set of a view or subquery on the RHS of a LEFT JOIN that gets flattened. (Closed-Leaf check-in: 3a5860d86f user: drh tags: left-join-view)
Changes
Unified Diff Side-by-Side Diff Patch
Changes to src/expr.c.
Changes to src/parse.y.
Changes to src/select.c.
Changes to src/treeview.c.
Changes to src/vdbe.c.
Changes to src/where.c.
Changes to tool/addopcodes.tcl.