aboutsummaryrefslogtreecommitdiff
path: root/src/window.c
Commit message (Collapse)AuthorAge
* Detect when a UNIQUE or PRIMARY KEY on a WITHOUT ROWID table would needdrh2025-02-21
| | | | | | to use more than SQLITE_LIMIT_COLUMN columns and raise an error. Also include some unrelated compiler warning fixes. FossilOrigin-Name: d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3
* Increase the maximum number of arguments on an SQL function to 1000 with thedrh2024-12-12
| | | | | capability to increase it further up to 32767 using a compile-time option. FossilOrigin-Name: e8d7d68ba0bb0bc2f948db5d9966990a5d23597fc3658b7cd0bc99d53c7353a9
* Fix a problem with window functions min() and max() when used with a FILTER ↵dan2024-11-14
| | | | | clause. Forum post [forum:/forumpost/e9126d554a | e9126d554a]. FossilOrigin-Name: d15fb0f75e64bbfdb8df0c0d0358aafbbd7d5e2048df676dafe1abd5e9917f2a
* Refactor the SrcItem object so that information about subqueries is storeddrh2024-08-19
| | | | | | | | | in a separately allocated Subquery object. This reduces the memory requirements for SrcItem and makes the code run faster. It also provides an expansion path for subquery processing that does not burden simple queries. The current checking mostly works, but there are still issues that need to be tracked down and fixed. FossilOrigin-Name: 8ff5dda8448d7e1a533d7f27db2573ce68fa9956b9d9847ced45e83c1f06bab0
* Give unique names to fields in the SrcItem object, to facilitate analysis ofdrh2024-08-17
| | | | | how those fields are used using "grep". FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2
* Better optimize queries that use parameters in the LIMIT clause.drh2024-06-06
| | | FossilOrigin-Name: e58cb304d1e0ec6e30260a165aaccc2cf096ce6c999efb06683c4ef600ee12ef
* Enhance the sqlite3ExprIsConstant() function so that it recognizesdrh2024-03-16
| | | | | | constant functions. So far the enhancement only applies to the multi-row VALUES clause, but it could possibly be applied in many other places. FossilOrigin-Name: c9e0488c6c0135932b6e76b0f3f3acd69ef65327e0a54daa59777f35da1aef26
* Omit the new SQLITE_VALUE_SUBTYPE name. Stay with legacy SQLTIE_SUBTYPE.drh2023-11-09
| | | | | | | Add extra documentation to sqlite3_value_subtype() and sqlite3_result_subtype() indicating that the SQLITE_SUBTYPE and SQLITE_RESULT_SUBTYPE properties are required on functions that use those interfaces. FossilOrigin-Name: 563ad3be60d22c45f1c5b9a3e67738593f8b38f137147c56514166fbabf95365
* Make a distinction between functions that consume subtypes and functionsdrh2023-11-08
| | | | | that generate subtypes. FossilOrigin-Name: 48a92e3ad855227188a4c5afe4abbb7171761cf6fc930660084d9abeecfd91d9
* Simplify the Expr compression logic slightly by adding the new EP_FullSizedrh2023-10-19
| | | | | | property to expressions that are exceptions to the rule and should not be compressed. FossilOrigin-Name: d5ae82ec52eafed5e3dc8c9d99685f6523fce7d973ef7e8d9d75ed9b8912426a
* Fix straggler misspellings and tidy the custom dictionary. Also include ↵larrybr2023-06-07
|\ | | | | | | | | pickups from [forum:/info/c61fb09afd|forum post c61fb09afd]. FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
* | Add a C-source spell-checking facility. make misspell (on Nix)larrybr2023-06-07
|/ | | FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
* Fix a code-generator issue associated with very unusual use of windowdrh2023-04-13
| | | | | | | functions. Both the expr.c or the window.c changes will each independently fix the problem. They are both included in this patch for defense in depth. [forum:/forumpost/0d48347967|Forum post 0d48347967]. FossilOrigin-Name: 1ba22631a7831e3562eda0eb6a5edf7f009c85c7ab4451d9eacd13ef0fb6036a
* Do not assume that sub-queries that contain window functions are uncorrelated.dan2023-01-28
| | | FossilOrigin-Name: f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac
* If OP_Rewind has P2 of zero, that is an assertion that the table is neverdrh2023-01-11
| | | | | | | empty. This fixes a false-positive in the out-of-subroutine jump detection logic added in version 3.39.0, and which was causing the assertion on the previous check-in. FossilOrigin-Name: 33fd9997ebb88f0d78522c036e75aef08015d31d28b1cbee08ae7c4cd5ecc6aa
* Rename the SELECTTRACE macro to TREETRACE, so that is corresponds to the newdrh2022-11-22
| | | | | | | CLI command. Renumber all of the bits in the bitmask used to enable various kinds of tracing, and add a trace bitmap decoder in sqliteInt.h. Changes to debugging logic only. No (intentional) changes to production code. FossilOrigin-Name: 8036445a36d9d982c1305935e7e37367bdf9e466b923eb6286b52524802e3ccd
* Restore a VDBE coverage macro that is mistakenly deleted fordrh2022-07-26
| | | | | check-in [92ac01d41d46ab73]. FossilOrigin-Name: 01de7ec44fb1e8e6f847eaef433216b3163a44a8789451718e1c419ef840ddfb
* Small performance increase and size reduction by splitting out thedrh2022-07-25
| | | | | sqlite3VdbeGetLastOp() from sqlite3VdbeGetOp(). FossilOrigin-Name: 92ac01d41d46ab73e189b1e5596ea63e5edb5b15639c5d7bdb981b95366c069b
* Omit the EP_MemToken flag that was made obsolete by [e1f1cfe7f4387b60], fordrh2022-07-22
| | | | | a size reduction and performance increase. FossilOrigin-Name: 28934a9d92d5e5ac862a0dc7169f071f39047f98dc79441db697cf353a4b9433
* Organize the various flag bits of the ExprList_item object into a substructuredrh2022-05-02
| | | | | so that the whole lot can be copied all at once. Faster and smaller code. FossilOrigin-Name: 5341d4bbe9a943f9cdbbdea829e18f108e98972ebb706396c50fc62fcc6a6328
* Fix a problem with using multiple SQLITE_SUBTYPE function as window ↵dan2022-04-20
| | | | | functions in a single query. FossilOrigin-Name: 9430ead7ba433cbfce99f4f364a0c08499230e3a04f167326b0f131f098ffa09
* Stronger defenses against corrupt schemas in the ALTER TABLE logic.drh2022-03-10
| | | FossilOrigin-Name: 13fbde28173332522a7ad307c1aad2b83c9aa1fe737583afa2b29f6da4de6370
* Prevent a NULL-pointer dereference when trying to parse a illegaldrh2022-03-10
| | | | | | schema entry that contains a window function while doing a RENAME COLUMN. [forum:/forumpost/ec2a2e0deb|Forum post ec2a2e0deb]. FossilOrigin-Name: 58de3c2b1a773a71b2d6a5d9a4dc0f839185d78d64519e7d267ad133b9830120
* Refactor Window.pFunc into Window.pWFunc to disambiguate from other uses ofdrh2022-03-10
| | | | | the variable or field named "pFunc". FossilOrigin-Name: d9475ebcde169272ad7b1d3a82b2326df55dafc68217bfecd9fcd1f2b89efbd9
* Add ALWAYS() macros. Change some existing ALWAYS() into assert(). Otherdrh2022-01-24
| | | | | code simplifications. FossilOrigin-Name: 4aa27b4fcd1ffd06c38357a87ba3f5776367570439c49652f0903873def0bb23
* Ensure that the window function rewrite does not leave the parse treedrh2021-11-07
| | | | | | | | | in an invalid state that might cause problems downstream before the error is recognized and unwinds the stack. Also take steps such that an invalid parse tree does not cause problems even if it goes unrecognized. [forum:/forumpost/398e9d5aa9|Forum post 398e9d5aa9]. FossilOrigin-Name: 0f9fc6b6073365d5159cd71e7fe08f8dadbc7b42abd324361e809502f4359155
* Protect all accesses to the Expr.x union using nearby assert()s and branches.drh2021-10-07
| | | FossilOrigin-Name: 8eaa1d4a98b24adf245bbd2fe9212aa6a924a0f09c445906d7f87574f36a7423
* Protect all accesses to the FuncDef.u and Expr.u unions using nearbydrh2021-10-07
| | | | | assert()s or branches. FossilOrigin-Name: 9af863f065e0bef491c2ab7525194505f9516f4e6dfc789d2e3a9d2c2438533a
* Add const to parameters on various internal interfaces.drh2021-09-25
| | | FossilOrigin-Name: 70c221c5cf7b4d9ed34f16d045f262f99d16aa3db84f80cf0b03ee82ba28d075
* Add assert() statements to refute drh2021-09-13
| | | | | [forum:/forumpost/9f4e7f58fbb66ddd|forum post 9f4e7f58fbb66ddd]. FossilOrigin-Name: 83a83475c5064ea62016a03e9173ecd2a1fec7f6296f1ee99896fa0a38b4196a
* Attempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BYdrh2021-07-15
| | | | | | | | | clauses do not affect the output. See [forum:/forumpost/2d76f2bcf65d256a|forum thread 2d76f2bcf65d256a] for discussion. This can help the query flattener in some cases, resulting in faster query plans. The current implemention does not always work. FossilOrigin-Name: ef97c3e7c3ea2cf1a4db6591328fe7ce3f1d189afc2d578159135824ec89e620
* Fix a problem handling ORDER BY terms of the form "ORDER BY ↵dan2021-06-23
| | | | | likely(<integer>)" within window frames. FossilOrigin-Name: 710f75b98bb4ac5bfdfa745c1de832dd1e4d9fb387da52b2f0d1353613f5cdc3
* Take care that the code is not generated for the same Select object moredrh2021-05-26
| | | | | | | than once, as transformations that apply during the first pass might cause problems for the second pass. dbsqlfuzz 836b625cd8a41809ef80fc7ebaa6554357bcb463. FossilOrigin-Name: f30fb19ff763a7cbe768ea49954704e14d6400f69bb4257c9c890e1564e14835
* Allow aggregate sub-selects within ORDER BY and PARTITION BY clauses of ↵dan2021-05-19
| | | | | window frame definitions. FossilOrigin-Name: 3daab94977af5e8a95690acc555540311403d890a3261a9757c633fcaaf428a9
* Detect misuse of aggregate functions in the ORDER BY clause of a querydrh2021-05-07
| | | | | even if the query also contains window functions. FossilOrigin-Name: 0d11d777c8d368f0b6e9faf3afccf7da1b041d303a68782e43aebd713aaecf51
* Adjust a VDBE coverage macros due to the enhancement at [506333742103c1f4].drh2021-04-28
| | | FossilOrigin-Name: daed59b4f96a6899d2404274ad985be3f22f407c1502b3f8ffd7977441a9fe9a
* Make window range queries more robust against corrupt database files.drh2021-04-24
| | | | | dbsqlfuzz f22df3a7b2aab0937a415484514fc2f68a293c99. FossilOrigin-Name: 506333742103c1f440db5da819a36f3b518f7b49e94a7b74419b02bbcadc5a78
* Restructure a loop in window.c to avoid hitting an assert() following an ↵dan2021-04-06
| | | | | OOM. dbsqlfuzz test case 6ef74a9659de87e9be3d8694ad062c448aa7ef1d. FossilOrigin-Name: 887c19a15ba60a5dc375dda7e289d476ba24d4adb38086a013df9709b88f32a7
* Earlier detection of OOM errors during window function processing.drh2021-04-06
| | | | | dbsqlfuzz b08676f5a0437552c95d2a5d7ef285f8c451ea35. FossilOrigin-Name: 8e04f52e32c9655b703ab0a6dc6d57e6bd134db9e7168807b7b2ce81974f9274
* Earlier detection and handling of OOM problems.drh2021-04-06
| | | | | dbsqlfuzz 39f2963ea5559aa3a16e24e0e3cb42aac85a7371. FossilOrigin-Name: 8d46df73132e46abb32b9dc129b6beb978d34dac3d372fb004ca283b0832d04c
* Do not allow floating point rounding errors to cause a window function ↵dan2021-04-05
| | | | | xInverse() function to be invoked before the corresponding xStep() call. FossilOrigin-Name: 7a19fed4f222bc6c20e13a1367c8235916d21ba5e6f5a31cd26842efe748e744
* Improved robustness to OOM conditions in the window function logic.drh2021-04-03
| | | | | dbsqlfuzz 0c123f7d80b29beaafc8411c12129e46f7ffdac3. FossilOrigin-Name: 35ff7cbf547d41109b7cd4217a5439b3b4a1a4c310309c572c88f596fbc1b099
* Ensure that negative numbers may not be used in frame offset clauses even if ↵dan2021-03-31
| | | | | they are initially text value. e.g. (RANGE BETWEEN '-1' PRECEDING ...). FossilOrigin-Name: 8b681b274dd01c3e0f76d5bbddcbb2450c6d9475b9cfa0db961a3ab5edf51db1
* Ensure the correct collation sequence is used for comparisons when ↵dan2021-03-06
| | | | | delimiting a RANGE window. FossilOrigin-Name: 01eae68e85b31b7a9f08733459765bbd9bf9dad592bf64f10fc2fa32e02a89c2
* Allow WHERE terms to be pushed down into sub-queries that contain window ↵dan2021-02-22
| | | | | functions, provided that the WHERE term is made up of entirely of constants and copies of expressions found in the PARTITION BY clauses of all window functions in the sub-query. FossilOrigin-Name: dac51f303bba1a0aac7768c688b0c134deb7641062cce2071d546f2d8f241dec
* Fix harmless compiler warnings that surface in newer versions of GCC.drh2020-08-10
| | | FossilOrigin-Name: 9d670a318381f219b467653f5f9539097808b887ae37291ce13be462dedfb18d
* Fix a problem causing queries containing window functions to ignore ↵dan2020-07-13
| | | | | collation sequences under some circumstances. FossilOrigin-Name: e6c2192ef88e9990c8b91755c8e779f09e23f936a17123d8e42059257b756ed7
* Remove unnecessary code from the window functions implementation.drh2020-07-10
| | | FossilOrigin-Name: 1e87da9c93309d1d69b1e0ab65c615b9ff9c1c6813ad0c7b90d2495be4ba0adc
* Extend the refactoring into extensions. Clean up stray newlines.drh2020-06-19
| | | FossilOrigin-Name: 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b
* Provide the ability to use the SELECTTRACE() debugging macro outside of thedrh2020-06-11
| | | | | | select.c source file. Use this to add a new SELECTTRACE() entry in window.c for improved tracing of window-function parse-tree rewriting. FossilOrigin-Name: 30c6d895b573d5f2a53487b3b7a0d20be7e382c7a0bc87336bd43fbd2fa89bf4