Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | An experimental minor tweak to the way affinities are computed for compound subqueries, when the actual affinity is ambiguous. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | compound-subquery-affinity |
Files: | files | file ages | folders |
SHA3-256: |
779723ad792ca24dd07b7a1425303c76 |
User & Date: | drh 2024-04-24 19:49:52 |
Context
2024-04-25
| ||
16:55 | Back out the previous change on this branch. In its place: Determine the affinity of a subquery by the left-most arm of the subquery that has an affinity other than NONE. In other words, scan from left to right looking for an arm of the compound subquery with an affinity of BLOB, TEXT, INTEGER, or REAL and pick the first one found. Or stay with NONE if no arm has a defined affinity. Test cases added. (check-in: b8ec8511 user: drh tags: compound-subquery-affinity) | |
2024-04-24
| ||
19:49 | An experimental minor tweak to the way affinities are computed for compound subqueries, when the actual affinity is ambiguous. (check-in: 779723ad user: drh tags: compound-subquery-affinity) | |
16:36 | If a RETURNING clause contains a subquery that references the table that is being updated in the statement that includes the RETURNING clause, then mark the subquery as correlated so that it is recomputed for each result and not just computed once and reused. See forum post 2c83569ce8945d39. (check-in: 9ea6bcc8 user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
6413 6414 6415 6416 6417 6418 6419 | for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){ Table *pTab = pFrom->pTab; assert( pTab!=0 ); if( (pTab->tabFlags & TF_Ephemeral)!=0 ){ /* A sub-query in the FROM clause of a SELECT */ Select *pSel = pFrom->pSelect; if( pSel ){ | | | 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 | for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){ Table *pTab = pFrom->pTab; assert( pTab!=0 ); if( (pTab->tabFlags & TF_Ephemeral)!=0 ){ /* A sub-query in the FROM clause of a SELECT */ Select *pSel = pFrom->pSelect; if( pSel ){ sqlite3SubqueryColumnTypes(pParse, pTab, pSel, SQLITE_AFF_BLOB); } } } } #endif |
︙ | ︙ |
Changes to test/view.test.
︙ | ︙ | |||
733 734 735 736 737 738 739 | } {} do_execsql_test view-27.5 { SELECT 1 FROM v0 WHERE c0<c1 } {1} do_execsql_test view-27.6 { SELECT c0<c1 FROM (SELECT t0.c0 AS c0, AVG(t0.c1) AS c1 FROM t0) | | | | | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | } {} do_execsql_test view-27.5 { SELECT 1 FROM v0 WHERE c0<c1 } {1} do_execsql_test view-27.6 { SELECT c0<c1 FROM (SELECT t0.c0 AS c0, AVG(t0.c1) AS c1 FROM t0) } 0 do_execsql_test view-27.7 { SELECT c1<c0 FROM (SELECT t0.c0 AS c0, AVG(t0.c1) AS c1 FROM t0) } 1 do_execsql_test view-27.8 { SELECT 1 FROM (SELECT t0.c0 AS c0, AVG(t0.c1) AS c1 FROM t0) WHERE c1<c0 } {} do_execsql_test view-27.9 { SELECT 1 FROM (SELECT t0.c0 AS c0, AVG(t0.c1) AS c1 FROM t0) WHERE c0<c1 } {} #------------------------------------------------------------------------- reset_db do_execsql_test view-28.0 { CREATE TABLE t0(c0 TEXT); CREATE VIEW v0(c0) AS SELECT t0.c0 FROM t0; INSERT INTO t0(c0) VALUES ('0'); |
︙ | ︙ |