Commit Graph

80 Commits

Author SHA1 Message Date
drh
105dcaa503 Refactor Window.pFunc into Window.pWFunc to disambiguate from other uses of
the variable or field named "pFunc".

FossilOrigin-Name: d9475ebcde169272ad7b1d3a82b2326df55dafc68217bfecd9fcd1f2b89efbd9
2022-03-10 16:01:14 +00:00
drh
e684ac6f12 Fix compiler warnings.
FossilOrigin-Name: 5e30c6ea707f9d381127e8b2bb59e0b39bc00997da2c14d32a0e302d0121203b
2022-03-08 13:59:46 +00:00
drh
796588ae07 Record the position of many identifiers in the parse using the new
Expr.w.iOfst field.  This is done with the idea of providing offset
results for sqlite3_error_offset() for a more kinds of errors, though that
part is not yet implemented.

FossilOrigin-Name: 32a3a53b62ab09ac2212905e7f42fe6f1b09d891e015203e5caf4cb16262f18e
2022-02-05 21:49:47 +00:00
drh
477572b9f1 Protect access to the Expr.y union using nearby assert()s and branches.
FossilOrigin-Name: 87e2f5eb436fc448427b0e24fb70f29688796b513b8c7b12f1a21540dae1e56d
2021-10-07 20:46:29 +00:00
drh
a4eeccdfdf Protect all accesses to the Expr.x union using nearby assert()s and branches.
FossilOrigin-Name: 8eaa1d4a98b24adf245bbd2fe9212aa6a924a0f09c445906d7f87574f36a7423
2021-10-07 17:43:30 +00:00
drh
f975107437 Protect all accesses to the FuncDef.u and Expr.u unions using nearby
assert()s or branches.

FossilOrigin-Name: 9af863f065e0bef491c2ab7525194505f9516f4e6dfc789d2e3a9d2c2438533a
2021-10-07 13:40:29 +00:00
drh
348e002ec9 One of the optimizations of check-in [de9c86c9e4cdb34f] does not work for
terms originating in the ON/USING clause, as demonstrated by
[forum:/forumpost/6cf3bb457c3f4685|forum post 6cf3bb457c3f4685].  This
check-in disables that optimization for ON/USING terms.  Also improve the
TreeView display for the resulting "true"/"false" nodes to show that they
originate from the ON/USING clause.  Add a testcase() to the other optimization
to show that it can still be used for ON/USING terms.

FossilOrigin-Name: 1f6796044008e6f3a61bcf390c0c7eb31947e971f0edada74e7a3a211f8ae76a
2021-07-22 16:07:01 +00:00
drh
e46292a920 Improved rebustness in sqlite3ExprListDup() when it contains a vector assignment
from an UPDATE where the initial term is omitted.  This can happen during a
UNION ALL query flattening while processing a virtual table update in which
the first term of the vector is repeated.
[forum:/forumpost/16ca0e9f32|Forum post 16ca0e9f32].

FossilOrigin-Name: 2547cfe38f8fb35109b3fc5bdfada387fe4b2b8a304156b704ab7f03f1f71198
2021-07-05 02:40:29 +00:00
drh
10f08270e1 Ensure that TK_SELECT_COLUMN Expr nodes always have their iTable field set to
to the number of columns in the vector. This is not strictly necessary. It
just simplifies the state description and make the code easier to reason about.

FossilOrigin-Name: 026f08d4cff19a95e0f38f2ef431cacd65c7c77ed92e30d7f2ded84651f47150
2021-07-05 01:11:26 +00:00
drh
4a4e02bc52 Enhance the treeview debugging mechanism so that it correctly deals with
TK_ROW expression nodes.

FossilOrigin-Name: e87fdb6514b6f6775a5a36ca0ec5c920eeaba9e3b842dffa327e970b27cd036d
2021-07-04 22:33:08 +00:00
drh
9b9f235165 Show CROSS JOINs in the TreeView debuggingn output.
FossilOrigin-Name: 72e09b6c9b74c8226b231fec021228af6bc191fc1b5798d0ff2e893f4ba203bf
2021-06-23 11:39:00 +00:00
drh
bf7f3a005e Fix the TreeView module so that it works with the TK_ERROR exprssion.
Also fix an assert() that was failing due to the recent TK_ERROR addition.

FossilOrigin-Name: dd56fbe0cfb0f7848190ce097b378321dd25ae509c7edf93682b091014824fc6
2021-05-24 11:35:16 +00:00
drh
ff37491874 Fix the display of SrcList in the sqlite3TreeView debugging routines.
FossilOrigin-Name: 28ecb3810b40ca58c2e04a752bbc2234c64c27185aef2cb3fe7c933082dc2578
2021-04-12 12:58:55 +00:00
drh
6610e6a54f Further simplification of the EQP output. Only show "SUBQUERY n" if the
subquery is anonymous.

FossilOrigin-Name: 1fadd30525dbf22678ba014b78af3a0fb33047692f073b7c62a90a028081ac48
2021-03-19 19:44:56 +00:00
drh
a79e2a2d28 Materialize any CTE that is used more than once.
FossilOrigin-Name: ba59159fbe6b83fb6d79fbfee22d983768b0ebbaac7e99d2ac66c810e5e04100
2021-02-21 23:44:14 +00:00
drh
7601294ad3 Rename the "struct SrcList_item" object to the more succinct "SrcItem".
This is a symbolic change only.  The logic is unmodified.

FossilOrigin-Name: bfd5bf2c73110fcb36db9ba2a949ff516131fbd3e89325f88fe9f5c2b4ed87b2
2021-02-21 21:04:54 +00:00
drh
e26d428a59 Improved tree-view debugging output for aggregate functions.
FossilOrigin-Name: b5711b4eead10ef4b0b61f2e2c54768d215a4105f6d47d2ea78991b6e53a6831
2020-06-09 11:59:15 +00:00
drh
a0365c487c In the debugging treeview output, change the name of "SELECT-expr" expression
nodes to be "subquery-expr", so as to not confuse them with actual SELECT
nodes.

FossilOrigin-Name: c1c8937a30feff6aa4385b0c264fd8e70d54422a0629c2ce38082d85d3334a57
2020-06-05 04:01:50 +00:00
drh
ca74fbf6f1 Improvements to parse-tree tracing logic. No changes in deliverable code.
FossilOrigin-Name: f7e5a68a7ebbb97a5beb050a75b3b4cf2fd6adc54653da993a8950fb3a5799f7
2020-05-24 02:05:04 +00:00
drh
f7f6dbf501 Enhance the treeview system to show the SrcList_item.colUsed field for
FROM clause elements.

FossilOrigin-Name: 8a5c539b77aa174c048a504d211c56902075f9b42b654e1f8cc5767739e5fcc9
2020-03-21 22:03:32 +00:00
drh
e7375bfa72 Enhanced detection logic for preventing the use of static schema expressions
by code generating routines.

FossilOrigin-Name: 5f60b527b938c0778e8f725c635ce0dc5ed7a4e01fd6252aa2cdb64da2f625bc
2020-03-10 19:24:38 +00:00
drh
014fff20ad Block edgy functions used in DEFAULT constraints.
FossilOrigin-Name: da434dc149786e4b1cd80b3b2b25f8b614d0dec62d5439f839a66b536999e398
2020-01-08 22:22:36 +00:00
drh
b7e519956a In the TreeView debugging output, show a "DDL" mark on SrcList and Expr nodes
that derive from a non-TEMP schema.

FossilOrigin-Name: fe7472fd2a70b4df6cb62041b72ed1638ba27ed1e6ceb8aaf56d1c8a82d91889
2020-01-08 14:39:57 +00:00
drh
e1f49b8850 Fix a problem in sqlite3TreeViewBareExprList() in which the routine was
not interpreting the new ExprList format correctly.

FossilOrigin-Name: cd56872afbb4edeff2e8c1cb1c8d47c7a9b333b3fc416c20183250807291fae8
2020-01-03 00:28:14 +00:00
drh
5f6a2ed7f2 Merge recent enhancements from trunk.
FossilOrigin-Name: 39d55579376906f212271ce9b2d367e3ad029fb173f22c7253312b467970208a
2019-12-31 14:49:10 +00:00
drh
a513e591ae Debugging enhancment: Show the Expr.y.pTab pointer on TK_COLUMN nodes of
an expression tree in the treeview.

FossilOrigin-Name: 64154ac450e4366d18e7e867841877a69c1f978d3ba9b8754cc133248966731d
2019-12-20 20:08:56 +00:00
drh
41cee66848 Change the name of the Expr.a.zName field to zEName, so that it has a name
that is distinct from other fields and variables and is hence easier to
grep for.

FossilOrigin-Name: d3783357f8fa76c42a86f12b214522f0388c37773c36ab8c5ce0623abbc4436a
2019-12-12 20:22:34 +00:00
drh
803f06bf62 Merge recent enhancements from trunk.
FossilOrigin-Name: b8a631fd30d0732505679230684b3362c965438197a2b11518f01a77599c9202
2019-11-14 15:21:15 +00:00
drh
dbf1c4ba8a Fix the sqlite3TreeView() output to consistently use a colon and not a
comma after the table number in the AST dumps.

FossilOrigin-Name: fa2416f623d83fe93253137302a74fcd6cdd041da337a0756df344d7d09a19f5
2019-11-13 16:50:06 +00:00
drh
d493353e99 Enhance the TreeView logic to show information about Expr.op2 for
FUNCTION and COLUMN nodes.

FossilOrigin-Name: aceeaf9e28767a0880a16872867a1f57bff163acd0f10d19d5688068077590fa
2019-10-31 12:30:38 +00:00
drh
269d322de2 When a vector comparison appears in the WHERE clause and the constraint side
has a COLLATE clause on the first term of the vector, be sure to honor that
COLLATE clause.  Ticket [135c9da7513e5a97].

FossilOrigin-Name: 978b2d20cf95d0b7143e3104ce1e9d5c85002867b554dc6b21deb528b730bbc7
2019-10-23 18:09:39 +00:00
drh
018dbb17a8 Improvements to a comment. No code changes.
FossilOrigin-Name: 1a3671c7003bfff817a8239424c2f945d9dfced97daadb5a5acab203b9bda69b
2019-09-28 16:14:55 +00:00
drh
c204d81a6c Enhance treeview to show SOFT-COLLATE for TK_COLLATE operators that omit
the EP_Collate flag.

FossilOrigin-Name: a97804620a27acc30bebd2aaa04e38f2f36de48b0931038ca8bdc9cb0c36b8f4
2019-09-10 17:51:27 +00:00
drh
007ba6457e Bring the hard-heap-limit branch up-to-date with trunk.
FossilOrigin-Name: 9b14eb77548d3f65f5a4c9b16cecdbce8a3fb663692aa8315fbd21aab3e89f0d
2019-08-20 17:14:21 +00:00
drh
42d2fce7f5 Provide the SQLITE_DIRECTONLY flag for app-defined functions that prohibits
the use of those functions within triggers or views.

FossilOrigin-Name: fc745845d8d76adc165575e2192f4176e3c28e614c72571d56f4011560499fe1
2019-08-15 20:04:09 +00:00
drh
1194904b81 Refactor field Expr.affinity into Expr.affExpr to avoid confusion with other
fields and variables named "affinity" and display affExpr it in
sqlite3TreeViewExpr() output.

FossilOrigin-Name: a29f2a7d07beff64e489e8f824babc6228c4a499fadc0ee701caa60a63baadcd
2019-08-05 18:01:42 +00:00
drh
55b4c827fa In the ".wheretrace 0x100" debugging mode, show the structure of the
main parameters to sqlite3WhereBegin() calls.

FossilOrigin-Name: fd598e475d353363e19adc27a671170f11ae9f6d8cad58cb2303fb2ad8ac6bec
2019-08-03 16:17:46 +00:00
dan
6ece353f2d Handle expressions like "expr IS TRUE COLLATE xyz" in the same way as "expr IS TRUE". Fix for [4d01eda8115b10d1].
FossilOrigin-Name: 5c6146b56a75a94f4baa10e95407c54dd0b9314a57a8702a4b96b15c4d7ac48c
2019-06-12 13:49:32 +00:00
drh
10c0e7115b Add the sqlite3_hard_heap_limit64() interface and the corresponding
"PRAGMA hard_heap_limit=N" command.

FossilOrigin-Name: b0ccef61a7f92d20228becbf4f997bf0f4e46dad2deaf0896dc63b976ad1dd11
2019-04-25 18:15:38 +00:00
drh
6f1644c0f9 Show the pointer address for Window objects in the TreeView display.
FossilOrigin-Name: 1ae70ad2ffd36c27b154940126c5e3ed00c05c0d8761d9320a65a03b1b4e4dc6
2019-03-28 13:53:12 +00:00
drh
0dc0e9c2af More improvements to TreeView output for Window objects:
(1) Show when the frame-spec is implied rather than explicit.
(2) Move the FILTER clause out from within the OVER clause, making it
a sibling of the OVER clause, to match syntax.

FossilOrigin-Name: d6a07433421ac9a475ff0014587f0beefdf88ce89aef9443f8a20cd26083731f
2019-03-28 13:35:28 +00:00
drh
fc15f4c528 Improved TreeView display of Window objects.
Change the Window.eType field to Window.eFrmType to avoid confusion with
other "eType" values.

FossilOrigin-Name: ec2f207dedb223077bbd3e4584499250eb12219712c917e930acccfa2c46e23b
2019-03-28 13:03:41 +00:00
drh
7eb2c9176a In the treeview debugging output,
provide additional details for the Table object
associated with each FROM clause term.

FossilOrigin-Name: 11d4682d2eec133ccca99ca9cf2620cd249b4afe55918f3ebf93b454431f9c55
2018-12-27 00:30:42 +00:00
drh
145d0a35d9 In the treeview.c module, break out the display of SrcList into a separate
subroutine, so that it can be invoked while debugging.

FossilOrigin-Name: 8c74065f0031274d9bc711d5d53c39aefcfb2b2679811105974a2c7c7a9e1dcb
2018-11-08 22:53:06 +00:00
drh
eda079cd2c Combine the Expr.pTab and Expr.pWin fields into a union named "y". Add a new
EP_WinFunc property that is only true if Expr.y.pWin is a valid pointer.
This reduces the size of the Expr object by 8 bytes, reduces the overall
amount of code, and shaves over 1 million cycles off of the speed test.

FossilOrigin-Name: ad130bb86e74e6ce165fdbdce3a19699510f0e62071c1c7923b5a4538d888c7c
2018-09-20 19:02:15 +00:00
drh
efad2e2366 Constant propagation is now restricted to just the WHERE clause. The
mechanism is changed to take affinity and collation into account.  This
seems to give correct answers.  But the search for constant propagation
costs 4 million cycles in the speed test.

FossilOrigin-Name: 82c67efb723dba387964f690cd459b420e59e3367d9589016597a76531596391
2018-07-27 16:57:11 +00:00
mistachkin
1489785be5 Fix typo of 'SQLITE_OMIT_WINDOWFUNC'.
FossilOrigin-Name: 8607b84a5c53d8c9218c90802160a3000f1138b1f188e411a3af46253e0a69cc
2018-07-23 18:53:49 +00:00
drh
fef37760da Identify Select objects within a single statement using small sequential
integers rather than "0x%p".  This is more readable and yields the same result
on successive runs.

FossilOrigin-Name: a7cdc5bc85e0edfcc38f920c2ce91599bcbfdb49522d88b08c64596546d13881
2018-07-10 19:48:35 +00:00
drh
a1fd4b520b Enhance the TreeView mechanism so that it shows the window function
data structures as part of the abstract syntax tree.

FossilOrigin-Name: a2c0e1bec0d8a6f982572c4c5a8166319b8db0fe586057f7900f0ab72af6554e
2018-07-10 06:32:53 +00:00
drh
0cdbe1aee0 Make the internal dynamic string interface available to extensions using
the new sqlite3_str object and its associated methods.  This is mostly just
a renaming of internal objects and methods to use external names, through
there are a few small wrapper functions.

FossilOrigin-Name: 87f261f0cb800b06ad786f6df16f2c4dddd0d93dfdcc77b4a4eaa22920b56bf1
2018-05-09 13:46:26 +00:00