aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
Commit message (Collapse)AuthorAge
...
* Do not use an expression index on a generated column if generated columndrh2023-03-03
| | | | | has the wrong affinity. dbsqlfuzz 65f5eb57f8859344d5f1f33e08c77ee12960ed83 FossilOrigin-Name: e95439119ac200cb47d0e277622f41ee7986b364487cd252b485ce5fa030d70f
* When flattening the right operand of a LEFT JOINdrh2023-03-02
| | | | | | | | (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:/forumpost/402f05296d|forum post 402f05296d]. FossilOrigin-Name: 8fe13f7a5e5eb798189acb25a608df7a94c2f5cc83463331a048b779c7890c82
* Follow-up to [bbaf1f2eb1e1637b]: Make sure subtypes do not cross a subquerydrh2023-03-01
| | | | | | | 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:/forumpost/37dd14a538|forum post 37dd14a538]. FossilOrigin-Name: e72661eb680ea707a839cb3d5cf6c7ef03706e7b40af1b84760147e59cd61a50
* The "flexnum" affinity that was added by [44135d6ea84f7ba6] needs to alsodrh2023-02-09
| | | | | | be added to the output of the affinity() built-in function. dbsqlfuzz d309eaa5fe492c9606a8be876c2bc7dedb29d3d8 FossilOrigin-Name: f4ec68ceefa3a607f37d6355aac89fd1ae1704da4061bad7f271db1f17c1dd3a
* Improvement to the dbsqlfuzz fix of [f113eebdbe68246f].drh2022-12-20
| | | FossilOrigin-Name: 79d62956f206cb2987891d4ba5985cece21fc8c8c1158f46c2951f65c0dcf4e8
* Do not use indexed expressions to replace the expression being indexed on adrh2022-12-20
| | | | | | RIGHT JOIN as that leads to problems, as shown by dbsqlfuzz a644e70d7683a7ca59c71861a153c1dccf8850b9. FossilOrigin-Name: f113eebdbe68246fd38d640b0cdf0fd73ab5d2abad9226274dfa2e41fe286bf0
* Fix an unnecessarily restrictive assert() in the aggregate logic.drh2022-12-17
| | | | | dbsqlfuzz 699bee2aa26c5dc84afabf6894685c316d936485 FossilOrigin-Name: 8cc0af81ad03ac65f230d78cf97e1448c2d93d556467ea3ef700d5abd4a3890c
* Create a new affinity called FLEXNUM that works like NUMERIC except that itdrh2022-12-15
| | | | | | | | | never tries to convert integer to real or real to integer. The affinity is only used internally - it is not possible to create a table column with this affinity. This affinity is used on subqueries and views that are built off of a compound SELECT and where the datatype is controlled by a CAST expression. dbsqlfuzz c9ee6f9a0a8b8fefb02cf69de2a8b67ca39525c8 FossilOrigin-Name: 44135d6ea84f7ba6b36549954b38a8bc048d5ffea5a9779e35950afa4eb2dfb2
* Fix minor problems in the new sqlite3ExprDataType() function.drh2022-12-14
| | | FossilOrigin-Name: c1d5261b222bbf94c20e558089f3d2eae6a88b6d739225ee4f7d0338e0e59994
* If the SELECT that implements a subquery or a VIEW or a CREATE TABLE AS isdrh2022-12-14
| | | | | | a compound with different result datatypes on two or more arms of the compound, then the overall column type becomes BLOB (ANY). FossilOrigin-Name: 6ebb178c6b688ebd632e91a5ec4c748567833037c679ab3d72fb770deb230fe1
* Slightly faster implementation of sqlite3ExprAffinity().drh2022-12-13
| | | FossilOrigin-Name: 01cf3278c9c00dddcac67aa4b22ca26a52c31932cba35daa634a56b4c264bdeb
* Add loops and rows counters to "USE TEMP B-TREE FOR ORDER BY" records. Also ↵dan2022-12-05
| | | | | fix the sqliteHwtime() function so that it returns a 64-bit value. FossilOrigin-Name: 41a0e05e8c0fca3b803fe4bd017a157c172b2ca518356a2a4d4ed4f12d01a1e3
* Add CYCLES scanstat measurement to "USE TEMP B-TREE FOR ORDER BY" lines.dan2022-12-03
| | | FossilOrigin-Name: 365011ae8b7e3fcaa2c4ea9601231a3ef2223e60d7a53ec33013109dca22ad58
* Enhance the sqlite3_stmt_scanstatus() API and add ↵dan2022-12-02
| | | | | sqlite3_stmt_scanstatus_v2(). For creation of easier to read query performance reports. FossilOrigin-Name: 55800833645739efeddcacef464c623931cb6aeb43f4219b4e4faf473c25c8bb
* Improved comments. Add assert()s to verify that the AggInfo structuredrh2022-11-25
| | | | | is unchanged after registers have been assigned. FossilOrigin-Name: 5200b84195ee1ccaa387f7032eae3d463724c48cb53ba0251bbc79e927dd9752
* Take care not to try to add comments to a TK_AGG_COLUMN opcode that doesdrh2022-11-24
| | | | | | not have an associated Table object because it is a reference to an indexed expression. FossilOrigin-Name: 5fc23863e4a6388884ce061cd69546757b4c39d731bbb58a8121b92fd5144f7b
* Change a NEVER() into an assert().drh2022-11-24
| | | FossilOrigin-Name: a0fd44f4e5a0ec83465203a0009f307ca50223833575895a3ebf8a289515714f
* Add NEVER() and ALWAYS() macros on branches that are believed to bedrh2022-11-24
| | | | | unreachable. FossilOrigin-Name: 3a901e88c87fc76c7fe42e47a976a5706830f0dbd6027605663e4d55f4f33590
* New test cases. Fix the logic so that it works for GROUP BY aggregatesdrh2022-11-24
| | | | | that do not require sorting. FossilOrigin-Name: ef6ebe7922f56c1584a005deedc85ca1070b4fe5082ada8bbf8d06df54f1c9ef
* Aggregates with GROUP BY now make use of expressions on indexes. This codedrh2022-11-23
| | | | | | works and gets the correct answer for the test case in the ticket. Lots more testing and documentation is needed, however. FossilOrigin-Name: 8dcf9f2031c16f296d187fe876d4204c71fc96fec120984ff11b6d8b03d58a5f
* This attempt at modifying AggInfo to make use of indexed expressions does notdrh2022-11-23
| | | | | work. It gets an incorrect answer for the test case shown in the ticket. FossilOrigin-Name: 84c06023f4a1606664fdb9811312603b31f7c94a43d0e443ba7dde7fdba029e3
* Since the memory registers used by the columns and functions of andrh2022-11-22
| | | | | | | AggInfo object are sequential, it is not neecessary to remember each register separately. We can simply remember the first one and do the math when others are needed. FossilOrigin-Name: dc5bd34963b761c819c565653156d0befbf65cc2cc5dc4113b0ce952450f0352
* Factor out the allocation of registers for aggregates into a separatedrh2022-11-22
| | | | | subroutine. FossilOrigin-Name: 4475799d5b41e93eabc32fac502ac2de240642b3b64739216e32e9af92ee191d
* Change the name of the Parse.pIdxExpr field to pIdxEpr so that the name isdrh2022-11-21
| | | | | distinct from all other identifiers in the code and thus less confusing. FossilOrigin-Name: a2962d0187534f3496282b48efbf38dabcd226bf8972be925c8433c55a8853fe
* The generalized indexed expression optimization of [2435112867fbd7b6] makesdrh2022-10-20
| | | | | | the prior [a47efb7c8520a011] enhancement from 2017 obsolete. This check-in removes the older optimization. FossilOrigin-Name: 56442c9bdd7844454c79acf83323380ea3509cb2e0b9a3d538a6b51726ae6d07
* Improved byte-code comments for the OP_Column opcodes used by thedrh2022-10-18
| | | | | indexed expression optimization. FossilOrigin-Name: bf6d837fddbf74d5b3f40ad01ea4564edfac00b651d6f3f0e996cc5dc18bb06c
* Fix the indexed expression resolver for generated columns so that it picksdrh2022-10-18
| | | | | the correct table in a self-join. FossilOrigin-Name: 54c3eb085aca92da2b819f3532ee4750b377265f7e1e914600ea3c3d535efe51
* Improved comments and function names. No logic changes.drh2022-10-17
| | | FossilOrigin-Name: 8f460b3b15bf4b88a224907d2f83e4ed6bf84d6b3f480008a1b187ea49c6ce1d
* Enable the index-on-expression optimization even when the expression isdrh2022-10-15
| | | | | used as an argument to an aggregate function. FossilOrigin-Name: 462b3c7f39724dc814f55e7a225e7d0c48f81c524cdda797a66e9e198c35ce58
* Only extract an expression from an index when the index is not a null rowdrh2022-10-15
| | | | | in an outer join. FossilOrigin-Name: 08b033c737d1a84859291f50e2985c9dad8d660a50185d55d3171165a8e08d4c
* This experimental branch attempts to use columns for an index-on-expressiondrh2022-10-13
| | | | | | in place of the expression that is being indexed. This particular check-in mostly works, but there are still issues. FossilOrigin-Name: 2e8d4fd4cfd9e82f33c707ba246fe2bb3ca01762cf5ac5905058fbc7adf0abe7
* Proposed optimization to the IS NULL and NOT NULL operators that avoidsdrh2022-10-13
| | | | | | loading the entire content of larges strings and BLOBs. Response to [forum:/info/3c08d4715dc05b00|forum post 3c08d4715dc05b00]. FossilOrigin-Name: 45f171565442f9fd6574fb93ae7abe83c168b20be68af42531bc55571450d3ab
* Modify the OP_IfNotOpen opcode so that the jump is taken if the cursor is opendrh2022-09-20
| | | | | but was previously set to a NULL row using OP_NullRow. FossilOrigin-Name: 1292d68caa7086610ddda343f3852e63de8da1eb66536ee4716b6529f5a31bc6
* Is the query flattener restriction 29 (do not allow both EP_InnerON anddrh2022-09-20
| | | | | | | | | EP_OuterON constraints on the same FROM clause term) really necessary? This branch explores what happens if we omit that restriction. This is an effort to address the performance regression reported by [forum:/forumpost/96b9e5709cf47cda|forum post 96b9e5709cf47cda] that is caused by flattener restriction 29. FossilOrigin-Name: 19270577ad1d08c9e6e5f0600396b8a1ccda9df1e67a0df845aee6b60437f379
* Add the new internal interface sqlite3DbNNFreeNN(db,ptr) where both thedrh2022-08-22
| | | | | | | db and ptr parameters are guaranteed to be non-NULL. Use this where appropriate to save more than 2 million CPU cycles on the standard performance test. FossilOrigin-Name: e5eaa80e81fdf86f2875a912b880272b8d099b82b08e945a7988c5dd0fe9d6b5
* Make sure IF_NULL_ROW expressions receive a separate slot in the sorter useddrh2022-07-26
| | | | | to implement GROUP BY. FossilOrigin-Name: 2bda4fca06ab6be5ad02377a7d1fd9fb9586e3181f1052e4b4937958bdd45efe
* Improved AggInfo.aCol debugging output, intended to debug a problem withdrh2022-07-26
| | | | | LEFT JOIN flattening into an aggregate query with GROUP BY. FossilOrigin-Name: e717e029bde4ee68b6ea77a68721c02ddb6e296f1d310a368137ea3c4164f68c
* Fix an assert() that was made out-of-date by [b52393ac28debe98].drh2022-07-25
| | | FossilOrigin-Name: db8230e80ed894fc2801cdbb53c2cd9de00192d7f4d8328c29cc214e2e0adde9
* Performance optimization in computing the Expr.nHeight field.drh2022-07-25
| | | FossilOrigin-Name: 1798ce97c8763d75315e1716d10f6c5be301042c174f41ee8c1fb8d9db99d52b
* Small performance increase and size reduction by splitting out thedrh2022-07-25
| | | | | sqlite3VdbeGetLastOp() from sqlite3VdbeGetOp(). FossilOrigin-Name: 92ac01d41d46ab73e189b1e5596ea63e5edb5b15639c5d7bdb981b95366c069b
* Allow subqueries on the right-hand side of a LEFT JOIN to be flattened evendrh2022-07-25
| | | | | if they contain a GROUP BY clause. FossilOrigin-Name: 816da9a893ae97a21463562479edb419a8b511ae731d86eccee3fa6e3e7dc96e
* TK_IF_NULL_ROW expressions must be accumulated in the same way as TK_COLUMNdrh2022-07-25
| | | | | | expressions in an aggregate query. Proposed fix for the problem identifyed by dbsqlfuzz 8e17857db2c5a9294c975123ac807156a6559f13. FossilOrigin-Name: 40d08807209638aad728be2cedbc904e342e76c8e486c364bd571b55dd2e1e87
* Use sqlite3ParserAddCleanup() rather than pParse->pConstExpr to implementdrh2022-07-23
| | | | | | sqlite3ExprDeferredDelete(). This is a better solution than check-in [c538d07535092722]. FossilOrigin-Name: 2a6f6971fa010219323b976ff53b2606e39fb43fd36c394837c3a8528bf3c425
* Omit the EP_MemToken flag that was made obsolete by [e1f1cfe7f4387b60], fordrh2022-07-22
| | | | | a size reduction and performance increase. FossilOrigin-Name: 28934a9d92d5e5ac862a0dc7169f071f39047f98dc79441db697cf353a4b9433
* In a TK_BLOB Expr node, the Expr.zToken might not be a well-formeddrh2022-07-22
| | | | | | BLOB literal if there has been a prior OOM. dbsqlfuzz 23871e5805d6c45b392f9b7aa1e8a2b98f3c27cd. FossilOrigin-Name: c538d075350927222ab0a6598b844f7b15153c5dc008d71b921a2b73c4f4a7a4
* Make use of the sqlite3ExprDeferredDelete() interface in the previousdrh2022-07-20
| | | | | check-in, and in another place where it might be helpful. FossilOrigin-Name: 22f90e9683d5cd6619ccdb06a02e9dde9f4b7457391c0dbb4c3216c22fc0db47
* The subtype of a value should not propagate across a subquery boundary.drh2022-06-09
| | | | | | | Proposed fix for the problem reported by [forum:/forumpost/3d9caa45cbe38c78|forum post 3d9caa45cbe38c78]. Additional works is needed as not all cases are covered. FossilOrigin-Name: 08af1fe27ebd0edf6e0f1ac477deea033e7f7c813f1016b75196836daf02d2e4
* Only include the code for sqlite_offset() if compiled withdrh2022-06-01
| | | | | -DSQLITE_ENABLE_OFFSET_SQL_FUNC. FossilOrigin-Name: 382cd7e10b2df4216da8f25b55546bc74a963d9834af240f75ec8b8321ba106e
* Move the sqlite_offset() function implementation to be an in-line function,drh2022-06-01
| | | | | | thereby avoiding special case code and freeing up a bit in the FuncDef.flags field. FossilOrigin-Name: 1c9812c458bd229c862efe5df1b64fae333da9871c8756b5ae4605a81bcda4b5
* Change an unreachable branch into an assert().drh2022-05-13
| | | FossilOrigin-Name: 778e57a558dc3f819ca57623bcb85f58c8fbeb28bc12a1e2edbdd1244e9107c5