aboutsummaryrefslogtreecommitdiff
path: root/src/window.c
Commit message (Collapse)AuthorAge
* 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
* Alternative fix to ticket [c8d3b9f0a750a529]: Prior to deleting or modifyingdrh2020-06-07
| | | | | | an Expr not that is referenced by an AggInfo, modify the AggInfo to get its own copy of the original Expr. FossilOrigin-Name: 7682d8a768fbccfe0cc956e9f6481637146e1ab9763b248ff11052761ce32e32
* When rewriting a query for window functions, if the rewrite changes thedrh2020-05-24
| | | | | | depth of TK_AGG_FUNCTION nodes, be sure to adjust the Expr.op2 field appropriately. Fix for ticket [7a5279a25c57adf1] FossilOrigin-Name: ad7bb70af9bb68d192137188bb2528f1e9e43ad164c925174ca1dafc9e1f5339
* Fix a problem handling constant integer expressions with collation sequences ↵dan2020-05-11
| | | | | in PARTITION BY clauses. FossilOrigin-Name: 155e6649efe8614718be7ac6c3cccf5b073ae57496dc220db5e4313621f5188e
* Fix handling of window functions in aggregate queries that have no GROUP BY ↵dan2020-03-16
| | | | | clause. Also remove a faulty assert causing the error reported in [618156e3]. FossilOrigin-Name: 38e3dd389d142e520c71139ec84aa3c7722992af28a5f93a7f16e0ea176b74bb
* Fix a problem with window functions occuring within sub-selects that are ↵dan2020-02-29
| | | | | part of an OR term in a WHERE clause of the outer SELECT. FossilOrigin-Name: 1e174ed0d29366eb56ad1a0cc8defcb440b426bfd9525aed2f93468248606efc
* Fix an assert() in window.c that could fail with some obscure SELECT ↵dan2020-01-09
| | | | | statements that use window functions. FossilOrigin-Name: 83dc55679a91bf5d1d13706088ce58eed02b9aad1ad0ae237966e78e0d769663
* Ensure that when code for a scalar SELECT featuring window functions is ↵dan2020-01-01
| | | | | generated more than once by the planner, separate ephemeral tables are opened for each instance. FossilOrigin-Name: ce1417325273aba866767349b55d9bbfb61a08e716bebda2122918a9657ee38c
* Fix a problem with window functions in aggregate queries that do not have ↵dan2019-12-27
| | | | | GROUP BY clauses. FossilOrigin-Name: 99609786f485653464d1caef1d207ae299d28c925bff3e8e94891759b4765dcc
* Do not mistake constant integers in a PARTITION BY expression for references ↵dan2019-12-27
| | | | | to ORDER BY style references to values returned by the SELECT statement. FossilOrigin-Name: 45c64d39d5afed7fdc6b1de19408559740d1fba1f5e0269ab68b132366a289e4
* When the sqlite3WindowRewrite() routine detects and error, have it convertdrh2019-12-25
| | | | | | | | the SELECT statement into just "SELECT null" so that it does not leave the parse tree in a goofy state that can cause problems with subsequent code before the stack has a chance to unwind and report the error. Ticket [d87336c81c7d0873] FossilOrigin-Name: fa58aad48a788802b13a819e49f9b8787f713bbe395c46c7295e821c52c81738