Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When changing a COLLATE expression node into TK_AGG_COLUMN because the nodes value is contained in an indexed expression, be sure to clear the EP_Collate property from the expression node. Fix for the assertion faults reported by forum post e45108732c and forum post 44270909bb. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
cf6454ce26983b9c3ae924c44a802f3f |
User & Date: | drh 2023-04-03 17:46:14 |
Context
2023-04-03
| ||
20:11 | Improved diagnostic output from PRAGMA vdbe_addoptrace. (check-in: 050958c1 user: drh tags: trunk) | |
18:00 | When changing a COLLATE expression node into TK_AGG_COLUMN because the nodes value is contained in an indexed expression, be sure to clear the EP_Collate property from the expression node. (check-in: af0f55cf user: drh tags: branch-3.41) | |
17:46 | When changing a COLLATE expression node into TK_AGG_COLUMN because the nodes value is contained in an indexed expression, be sure to clear the EP_Collate property from the expression node. Fix for the assertion faults reported by forum post e45108732c and forum post 44270909bb. (check-in: cf6454ce user: drh tags: trunk) | |
15:01 | Add the SQLITE_VTAB_USES_ALL_SCHEMAS option to sqlite3_vtab_config(). Update the sqlite_dbpage, sqlite_dbdata, and sqlite_dbptr virtual tables to make use of that interface. This was formerly handled by the internal sqlite3VtabUsesAllSchemas() routine that was called directly from sqlite_dbpage. But since sqlite_dbdata and sqlite_dbptr are an extension, an external interface to that functionality had to be provided. dbsqlfuzz 1a29c245175a63393b6a78c5b8cab5199939d6a8 (check-in: bcd51abe user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 | pAggInfo = pExpr->pAggInfo; if( pExpr->iAgg>=pAggInfo->nColumn ) return WRC_Continue; assert( pExpr->iAgg>=0 ); pCol = &pAggInfo->aCol[pExpr->iAgg]; pExpr->op = TK_AGG_COLUMN; pExpr->iTable = pCol->iTable; pExpr->iColumn = pCol->iColumn; return WRC_Prune; } /* ** Convert every pAggInfo->aFunc[].pExpr such that any node within ** those expressions that has pAppInfo set is changed into a TK_AGG_COLUMN ** opcode. | > | 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 | pAggInfo = pExpr->pAggInfo; if( pExpr->iAgg>=pAggInfo->nColumn ) return WRC_Continue; assert( pExpr->iAgg>=0 ); pCol = &pAggInfo->aCol[pExpr->iAgg]; pExpr->op = TK_AGG_COLUMN; pExpr->iTable = pCol->iTable; pExpr->iColumn = pCol->iColumn; ExprClearProperty(pExpr, EP_Skip|EP_Collate); return WRC_Prune; } /* ** Convert every pAggInfo->aFunc[].pExpr such that any node within ** those expressions that has pAppInfo set is changed into a TK_AGG_COLUMN ** opcode. |
︙ | ︙ |
Changes to test/indexexpr2.test.
︙ | ︙ | |||
381 382 383 384 385 386 387 388 389 | CREATE TABLE t2(c INT, d INT); INSERT INTO t1(a,b) VALUES(4,4),(5,-5),(5,20),(6,6); INSERT INTO t2(c,d) VALUES(100,1),(200,1),(300,2); SELECT *, (SELECT max(c+abs(b)) FROM t2 GROUP BY d ORDER BY d LIMIT 1) AS subq FROM t1 WHERE a=5; } {5 -5 205 5 20 220} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | CREATE TABLE t2(c INT, d INT); INSERT INTO t1(a,b) VALUES(4,4),(5,-5),(5,20),(6,6); INSERT INTO t2(c,d) VALUES(100,1),(200,1),(300,2); SELECT *, (SELECT max(c+abs(b)) FROM t2 GROUP BY d ORDER BY d LIMIT 1) AS subq FROM t1 WHERE a=5; } {5 -5 205 5 20 220} # 2023-04-03 https://sqlite.org/forum/forumpost/44270909bb # and https://sqlite.org/forum/forumpost/e45108732c which are the # same problem, namely the failure to omit the EP_Collate property # from an expression node when changing it from TK_COLLATE into # TK_AGG_COLUMN because it resolves to an indexed expression. # reset_db do_execsql_test 10.0 { CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT); CREATE INDEX t1x ON t1 (b, +b COLLATE NOCASE); INSERT INTO t1(a,b) VALUES(1,'abcde'); SELECT * FROM t1 AS a0 WHERE (SELECT count(a0.b=+a0.b COLLATE NOCASE IN (b)) FROM t1 GROUP BY 2.5) ORDER BY a0.b; } {1 abcde} do_execsql_test 10.1 { CREATE TABLE t2(a TEXT); INSERT INTO t2 VALUES('alice'),('bob'),('cindy'),('david'); CREATE INDEX t2x ON t2 (+a COLLATE NOCASE); SELECT count(+a COLLATE NOCASE IN (SELECT 1)) AS x FROM t2 GROUP BY SUBSTR(0,0); } 4 finish_test |