Commit Graph

23934 Commits

Author SHA1 Message Date
dan
1942d1f236 Avoid an assert() failure in allocateSpace() triggered by a corrupt database. dbsqlfuzz f022eb0ce64d27808574d1dcde5cf7d002dabde8.
FossilOrigin-Name: 2de7f8cc7fe18f0828bb53f1fd11f5eb828faf4d6dfaf39693dff4f8926c1c7a
2022-04-18 15:56:58 +00:00
drh
e98b71e65d Improved comment field in the bytecode generated for OP_Column and OP_Rowid.
FossilOrigin-Name: 1b2c5cef9560123344db391cd065090d1914724715ec6643d2d9b5fac2051a21
2022-04-18 14:15:07 +00:00
larrybr
2d27d36cba Make shell auto-column work with lots of columns when log() is missing.
FossilOrigin-Name: 82366436ef74838dae1f379f3e5b8ad187225a30ec58fb49f047ab7c08a263cf
2022-04-16 17:53:25 +00:00
dan
b192970809 Fix a problem with "ON DELETE RESTRICT" and "ON UPDATE RESTRICT" foreign keys in attached databases scanning child tables in the wrong schema.
FossilOrigin-Name: 04d5b637f087520cd58211505f9b5c086ff96d864a1908f60464b6fe22c62b7d
2022-04-16 15:46:23 +00:00
drh
b3ebf3043f Cherry pick subroutine indentation improvements and the hardening of
OP_Gosub from the right-join branch back into trunk.

FossilOrigin-Name: 12645f100d902690630a2925674aedbb01d41a53426a26a2f56de5b8fdec955f
2022-04-14 19:48:32 +00:00
drh
3b79f7580a Fix an assert() in btree.c that might not be true for a corrupt database file.
FossilOrigin-Name: dbd8e2e46cfb2de0ebdbb62cda2fe669df3eda98f5d6112d541f581995b1361d
2022-04-13 10:49:50 +00:00
dan
6625d6d873 Earlier detection of corruption in balance_nonroot(). dbsqlfuzz 9191ade77ebd3b7a3356e074957aa85b0c669d14.
FossilOrigin-Name: bff4f083eb1c35544988493a5d73a42e646c4250b841f5aae38c2183f0867a0e
2022-04-12 17:02:27 +00:00
dan
f7413d9acf Modify utility function sqlite3SetString() so that it may be used safely on Parse.zErrMsg. Fuzzer test case "crash-1604e5d76c92574e21e437049dab9b672e06b767.txt".
FossilOrigin-Name: 09c5a4ec13b02efd6207e26dab7beaf184f0d8ccea0bd0dfe94fc803fe5636ce
2022-04-12 11:02:06 +00:00
drh
d198526289 Rename the Expr.w.iRightJoinTable to just Expr.w.iJoin, so that the words
"RightJoin" in the former name do not lead readers to believe that this has
something to do with RIGHT JOINs in particular.

FossilOrigin-Name: e8c00442d2daedec079748d13147bf73b0ec3c3cf432bce2cdccb706bdff2853
2022-04-11 11:25:28 +00:00
larrybr
039132be20 Fix .import bug reported at https://sqlite.org/forum/forumpost/14db09d7e765b819 . zAutoColumn made to deliver characters, not bytes.
FossilOrigin-Name: 21e96600d90c1cda84777abe22a11058eba46c9faefeb05f8c31bc0e7fa84b19
2022-04-09 18:51:49 +00:00
drh
f8bdcfa3f1 The sqlite3WhereMalloc() routine allocates memory that is automatically
deleted when the corresponding WhereInfo object is destroyed.

FossilOrigin-Name: f237e1d8cc41b937f34288daebfacf5f7b0990a807a805e0cb6b45bc730192d6
2022-04-09 03:06:01 +00:00
drh
7d0ae00361 Enhance the sqlite_dbpage fix at [/info/642a0b4752743216|check-in 642a0b4752743]
from about a month ago such that it still takes a transaction on all attached
databases, but it only starts a read transaction for read-only operations,
rather than starting a write transaction for everything.

FossilOrigin-Name: 8efd61e8518594e3e9c84681fc35796a78fe8885a97ad4dd19f1573ee8065b18
2022-04-08 17:01:29 +00:00
drh
81a23623d8 Improved explanation and commentary on the sqlite3JoinType() routine. One
of the error messages changes slightly, but besides that everything works
the same.

FossilOrigin-Name: 48f2e5a1fbaa8ceb32e08066766be74233b0c67ab430bbf7adfdff42cdb7b8ec
2022-04-08 15:11:10 +00:00
drh
ce5dd9e8d6 Fix two unreachable branches introduced by the recent
sqlite3TriggersExist() optimization.

FossilOrigin-Name: 1b5475d212cf9de0bff69eee8c607b4fcd8e04bf4df72171429e7609c4153951
2022-04-07 20:45:38 +00:00
drh
e603ab00ee Enhance the EXPLAIN output formatting in the CLI so that the subroutine that
implements the loop body for the multi-index OR optimization is indented.

FossilOrigin-Name: c2965fea9df7076b235d3eadaf84f0a36242476d0329030b0e57557b66e2540c
2022-04-07 19:06:31 +00:00
drh
da4c7ccc07 The ".testctrl optimizations 0x400000" command disables the generation of
OP_ReleaseReg opcodes.  OP_ReleaseReg opcodes are usually only generated for
SQLITE_DEBUG builds and are used to verify that registers are descoped
propertly.  But they can get in the way of code understanding when studying
bytecode dumps.  So this new optimization setting is provided to
temporarily turn OP_ReleaseReg opcodes off.

FossilOrigin-Name: fa5276725f246cef9d58b27c1e617ee3f873f7a9b88284a4e8fc453ebda338bc
2022-04-07 18:17:56 +00:00
drh
db08a6d13c Fix the parsing of C-style comments in Lemon, as reported by
[forum:/forumpost/b6edc69548|forum post b6edc69548].  This has no affect
on SQLite itself.

FossilOrigin-Name: 201569e09b000919ccb463bd581fb2ecd5320e7f584fdb1bc2aaba111061d5c3
2022-04-07 14:13:32 +00:00
drh
a744167956 Optimization to sqlite3TriggersExist() saves over 700K CPU cycles.
FossilOrigin-Name: 5043a3507e0781878e0e1bea5095a33273958820baead4af8fc2929e9d7c07ee
2022-04-07 14:03:07 +00:00
drh
4cd8296f39 Avoid compiler warnings about the new sqlite3Show() debugging routines
begin "defined but not used".

FossilOrigin-Name: 47ddc26974fbad8233c953d435e79d4f5dd5e09fbd684ea5f4ad32f4cae6cae6
2022-04-07 13:48:34 +00:00
drh
9c949b1c46 Omit an unnecessary initialization in tokenExpr().
FossilOrigin-Name: 8f6ae686019c61a03fe70eb78d2b529b1cf126215b45513a97cfdf7086f82f54
2022-04-07 12:10:00 +00:00
drh
c381056e6d Fix harmless compiler warnings.
FossilOrigin-Name: 61095b5bcb5c30d29f03efa5b4809e3a0b780ed57e35227c292aab9dd1cfe3f6
2022-04-07 10:11:35 +00:00
drh
d44f8b2385 Improved technique for parsing the ON and USING clauses of a join is faster
and uses less memory.

FossilOrigin-Name: 158156a3e3d50042cafc75dea3aaaa68b1f2efb9c3d178518ea6e68e32e0d21c
2022-04-07 01:11:13 +00:00
drh
200adc9e75 Faster parsing of the FROM clause in joins for the common case where there
is no INDEXED BY clause.

FossilOrigin-Name: 848b7a0ea99ddc52091b78313f018c07d00a0e28aa6da8c1cae709c1d03468fe
2022-04-06 19:46:20 +00:00
drh
c2d0df95ba Improvements to the display of AST for DML statements.
FossilOrigin-Name: 84c239a071cfaf8af107646f01ef269e2915fd2384e95927d484f2e408ba6bbf
2022-04-06 18:30:17 +00:00
drh
2a7dcbfbb0 Attempt to show triggers in the TreeView output from DELETE, INSERT, and
UPDATE statements.

FossilOrigin-Name: b0939d6f4d94b45dce53ace6295508a67d574cc72bd6977623bf77065b3c4e64
2022-04-06 15:41:53 +00:00
drh
c16a5686fe Corrections and updates to the header comment describing the
TriggerStep object.  No changes to code.

FossilOrigin-Name: abb34c0830a49d4f4e277ddd17e710529e87cba7061f3546079dbba2f82b020e
2022-04-06 12:54:41 +00:00
drh
8f1eb6f5e4 Add the sqlite3Show() family of debugging interfaces under SQLITE_DEBUG.
No changes to deliverable builds.  Rename SQLITE_ENABLE_SELECTTRACE to
SQLITE_ENABLE_TREETRACE in ctime.c.

FossilOrigin-Name: bc33168cf1f48caf848c2dc5c3ae15e4efff8c0378f944eb5398a245139a2b35
2022-04-06 12:25:04 +00:00
drh
5e431bead8 Rename debugging defines and variables from SELECTTRACE to TREETRACE (and
similar) since the functionality has how expanded to include data structures
beyond SELECT statements.  Should not affect deliverable builds.

FossilOrigin-Name: 393fa32e188a017f431372b54037cb31e885030542f00d0bfd59da9d9db5c014
2022-04-06 11:08:38 +00:00
drh
f8ef2dbd7b Add additional tree display routines for DELETE and UPDATE. No changes
to deliverable code.

FossilOrigin-Name: fbd288ff3d4ea47cd324b5952e7754a465901844f2d950f0860d4488d5b6eb9f
2022-04-06 10:37:44 +00:00
drh
7d2c1d24b0 Add new diagnostic "sqlite3TreeView" routines for IdList, Upsert, and for
INSERT statements.  This is all debugging code.  There are no changes to
release builds.

FossilOrigin-Name: f3084122039bcb30c8617f5f432009a49be8b488235850a1f10ef862c91560b2
2022-04-06 00:29:21 +00:00
drh
ec534e6a23 Small performance and size improvement to OP_Found.
FossilOrigin-Name: 81587a18b7c0516628453000172a0c58e74ee173c15f655d035799d84d4e2d81
2022-04-04 20:20:22 +00:00
drh
50f22d17a8 Tag an always-taken branch using ALWAYS().
FossilOrigin-Name: ad8bc3d7443ff57ce5a8756428e717ac42ec0295191a9b4d7ae44846d8fa03a2
2022-04-04 19:58:55 +00:00
drh
b834e0de59 Optimizations to the OP_Found opcode save about 600K cycles in speedtest1.
FossilOrigin-Name: 5c3357ad62843fe982b9c2d31dbf02018f2948ceab2c85dac917cd9ce1e97dd6
2022-04-04 19:43:57 +00:00
drh
36d2d09023 Use unpacked keys for OP_Found in foreign key processing.
FossilOrigin-Name: 328dc76657eb5317f0201859d2b3abe6918103b894f7beaed0aca3058a9f2b64
2022-04-04 18:17:59 +00:00
drh
0de10ac11c When constructing the JSON Path for the "fullpath" column of the
json_tree() and json_each() table-valued functions, be sure to quote
object labels where necessary.

FossilOrigin-Name: 0fbbe7881cadf0b3c211653c7a0797e0a90c7c24da78ecc8a27140c05f89f2ed
2022-04-04 15:15:45 +00:00
drh
b07fb4f1c2 Fix the JSON Path parser so that it will accept zero-length object labels.
[forum/forumpost/c082aeab43|Forum thread c082aeab43].

FossilOrigin-Name: 84fe95d2a5b4d232d657e3b8110027a698a9bcd597f205cc535cfa97bc299f21
2022-04-04 14:24:14 +00:00
drh
a81a9f78fd Performance optimization and stronger assert()s in the comparison opcodes.
FossilOrigin-Name: e0305e640b9078c7eed9ab0bcc14f4515b54e7cd9ade3306bc2d1660f05b2725
2022-04-04 11:38:49 +00:00
drh
1c8486301f Only invoke sqlite3VdbeClearObject() from a single location, so that the
compiler is more likely to in-line the code.  Performance increase and
size reduction.

FossilOrigin-Name: c6947a96e61f71aa61ca3d70d9e2612d784ab04d60fa88852b03cfce86b1bf2b
2022-04-04 01:12:11 +00:00
drh
8703edd3e9 Performance optimization in the sqlite3VdbeHalt() routine.
FossilOrigin-Name: 9564d72a0820dbcb38f905fcd42ed4c858ea8fb5f648b189ceb65380a14a785b
2022-04-03 22:35:13 +00:00
drh
8bb93daca0 Performance optimization and size reduction in the OP_Halt opcode.
FossilOrigin-Name: 21948e6e1ccd2ce128742415d21759604ecb8902226ec4707dbd75585450f208
2022-04-03 20:39:48 +00:00
drh
18bcfb999a Omit the Vdbe.runOnlyOnce flag (simplifying the prepared statement
implementation) and accomplish the same result by adding an "OP_Expire 1 1"
opcode to prepared statements that would normally have runOnlyOnce set.

FossilOrigin-Name: 6e20e1c46d17ac6aba21e02b57649af51cfa415d83d0c001b30677d2fd1f1dc1
2022-04-03 19:13:40 +00:00
drh
8ee75f7c3a Performance optimization and slight size reduction in the OP_Transaction
opcode.

FossilOrigin-Name: 7bee8c195f3fc27aaab13e493ad446a4f19201de3ac064ed6d8a3cbda7c69ee1
2022-04-03 10:42:06 +00:00
drh
c2808f39d1 Expand the getVarint32() macro in a few places, as the C-compiler seems to
be able to optimize better when that macro is expanded manually.

FossilOrigin-Name: cd4fe34b98bf5ce26f3596c717edb73932f3b46ad6e9b4934d06b7b3c176a0d6
2022-04-02 22:47:47 +00:00
drh
1f416db292 Fix harmless compiler warnings.
FossilOrigin-Name: 8a3a3486358d076c34e515ac92663a04f0c7ff10f405094cb5b6ada0d5f05cdc
2022-04-02 20:08:48 +00:00
drh
d13527daed Ensure that a zero-blob does not cause in invocation of memcpy() with a
zero length and a NULL source pointer.

FossilOrigin-Name: 35441eb5e1447e01f2031837a4ede705bce34f87be27912278cc730abce6cf05
2022-04-02 19:21:58 +00:00
drh
2c144b0f63 Minor loop optimization in OP_MakeRecord.
FossilOrigin-Name: 4350983b37879d3280432d90fef04f5cc4be1b3110b5435123d897e31b34db8a
2022-04-02 15:19:02 +00:00
drh
d859dc2b25 In-line the sqlite3VdbeSerialPut() routine into the OP_MakeRecord opcode.
This allows some duplicate comparisons to be omitted, resulting in a size
reduction and performance increase.

FossilOrigin-Name: 6f4d6f212a3558c27be6e9dcf71cec43c424d445e5889c6e91dde84a19c5a2c1
2022-04-02 14:30:58 +00:00
drh
b47b1f67dc The putVarint32() macro does not optimize well. So expand it into in-line
code in places were performance is an issue.

FossilOrigin-Name: 390c239e53cf936a97b268dce8171f0b17050542ae64735ca8ef375fec2c9544
2022-04-01 21:01:37 +00:00
drh
759e507ce5 Loop optimization in the OP_MakeRecord opcode.
FossilOrigin-Name: 47a61fbd63928021098fbe492283f1afda7c293b3b2706c001192ae4ff1b2cbe
2022-04-01 20:39:40 +00:00
drh
3b8b5be3b7 It is not necessary to de-ephermeralize the output registers in the
OP_ResultRow opcode.  Omit that step for a size reduction and performance
increase.

FossilOrigin-Name: 8a07745aed1d0a4eead55d43f1923597b12371f307ecf5bc19c5a1db9a107a50
2022-04-01 20:19:36 +00:00