Commit Graph

21841 Commits

Author SHA1 Message Date
drh
cb49f5468e Further simplification and modularization of the EXPLAIN logic.
FossilOrigin-Name: aee1c12f4227cea9e8c6295cee3ec11797422c31b48c9468f176eb52f8261fe8
2020-03-23 19:14:11 +00:00
drh
356cd76aa8 Begin breaking appear the sqlite3VdbeList() routine into subroutines that
can be reused by the bytecode() table.

FossilOrigin-Name: 2c4dd79fbd4b9f72634a732abb9ed833cd8c9b05fe1e10af8f23e6d6ec023c7c
2020-03-23 17:24:46 +00:00
drh
691b5c54b8 Infrastructure for the bytecode() table-valued function. The function itself
is not yet implemented.

FossilOrigin-Name: 2795f0d633577e0de66b389d9e8e44c55e85975bdc62f1a0b8f93959d19b22bf
2020-03-23 15:49:22 +00:00
drh
74a07986ce Fix to the recomputation of the colUsed field added by check-in
[a9bb71ba708ba722].  This fixes ticket [5829597ac43811e3].

FossilOrigin-Name: 5d14a1c4f2fc17de98ad685ad1422cdfda89dfccb00afcaf32ee416b6f84f525
2020-03-21 23:10:38 +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
dan
7d76fad8eb Simplify some of the code modified by the previous commit.
FossilOrigin-Name: 04abadb545d1b34bdd74d62becb3bfd83aceee373fd6b4b708d5ad53f41d9464
2020-03-21 20:58:05 +00:00
dan
31f170f396 Ensure that "main" can always be used to refer to the main database, even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME.
FossilOrigin-Name: 682b426f5658254e63dff02c960b557fb33cb3e944fdd14faa0aa9988af7269a
2020-03-21 15:41:55 +00:00
dan
465c2b8964 Consolidate some code on this branch.
FossilOrigin-Name: a85c63daa640e02fdfd891a05a1a09e848c9621a5dd6e112338451008623ecbb
2020-03-21 15:10:40 +00:00
drh
2c3629e1c9 Change a bitfield in sqlite3_stmt into an unsigned character, for slightly
smaller code and better performance.

FossilOrigin-Name: 0d4d3c642494ad494b4ec937215eaf833158e62e5ae59ed981d6b546220c13b8
2020-03-21 15:07:27 +00:00
drh
62b6e1d042 Performance optimization in sqlite3VdbeMakeReady().
FossilOrigin-Name: aa92f9b95f95d40cc58910da87168a5bd440f71deb072dc651bb15936315786c
2020-03-21 14:22:27 +00:00
drh
2aee514b4c Recompute the set of columns used for each table when the table is
involved in query flattening.

FossilOrigin-Name: a9bb71ba708ba72255ba8d18c9856e38ddf53eae2d61c8435149354fb2b2459e
2020-03-21 00:05:53 +00:00
dan
00bd55e1ae Allow "main" to be used to refer to the main database even after SQLITE_DBCONFIG_MAINDBNAME has been used to assign another alias.
FossilOrigin-Name: 75c85ca32f9ae4a28fd8f8ff2f7639599413d22af706e9799a0e76cc560d14eb
2020-03-20 20:54:28 +00:00
dan
ec8e689a20 Avoid an undefined integer overflow in fts3 by detecting data structure corruption earlier.
FossilOrigin-Name: 86e98ddc19470410ccc6d2cf4ad56ef0bc5a23b7fbe6331b8cae374689f54529
2020-03-20 20:18:49 +00:00
drh
589c787620 Chagnes the ESCAPE clause on the LIKE operator to overwrite wildcard
characters, in order ot match the behavior of PosgreSQL.

FossilOrigin-Name: 11e0844f71e8f2d27ce9363fb505e02fd7795c61dae0b3886cf0d8df4484dd97
2020-03-19 18:13:28 +00:00
drh
f0a2172d1d Fix an integer overflow problem with the dbstat virtual table that comes up
when trying to analyze a corrupt database.

FossilOrigin-Name: 1d64f4a8af81fe1235fffa54884d8f842a48ff6a33d6172f0cd65bf42fe8b2a1
2020-03-19 17:27:52 +00:00
drh
91a23dc299 Fix a typo in a comment. No changes to code.
FossilOrigin-Name: 3a51919ac23ae7312d78905334dc97742b517a7476052a85aa07945d9c77697b
2020-03-19 15:57:03 +00:00
drh
78a50d7280 Fix the build for when SQLITE_ENABLE_STAT4 is defined.
FossilOrigin-Name: 8f0a8c2aa45f7cf7339094d83893aeb046b010b5b97bb4dae99ac07a8ebf2fa6
2020-03-18 15:58:13 +00:00
drh
59a8cb7931 Add the SQLITE_ANALYZE_LIMIT compile-time option (expected to be temporary)
that sets a threshold at which ANALYZE starts to use approximations during
the analysis process.

FossilOrigin-Name: a773fd4698d474fda5e57bc77ed66a79cf74efee2706f43f6def6f450bfd1fc0
2020-03-18 14:43:05 +00:00
drh
9f27463684 Provide an estimated row count to stat_init() for STAT1 analysis.
FossilOrigin-Name: 714419fe85cfdad22979183a94e4569c87740652758ab76b646753cf2b013b54
2020-03-17 17:11:23 +00:00
drh
e50478d727 Remove the SQLITE_OMIT_BTREECOUNT option. Btree count is required.
FossilOrigin-Name: a9bfa47aeea27e91611ba913d33e6635d2016e2c2ab78f9b0657f1bd8933e1a8
2020-03-17 13:41:51 +00:00
drh
dc4a1687b8 Improved bytecode comments for the ANALYZE command.
FossilOrigin-Name: c38ea4139d87535b789f43eb1e38b2dc4b8312352a721035283e67cf0f3d5067
2020-03-17 13:07:04 +00:00
drh
9d8c287309 Merge changes from trunk.
FossilOrigin-Name: 93d710262eb046e2370660b1096ac634373755f92a2e9b1220df3b2bda5f9eeb
2020-03-17 12:37:27 +00:00
dan
553948e514 Fix handling of window functions in aggregate queries that have no GROUP BY clause. Also remove a faulty assert causing the error reported in [618156e3].
FossilOrigin-Name: 38e3dd389d142e520c71139ec84aa3c7722992af28a5f93a7f16e0ea176b74bb
2020-03-16 18:52:53 +00:00
drh
14c98a4f40 At the end of the right-hand table loop of a LEFT JOIN that uses an IN
operator in the ON clause, put the OP_IfNoHope operator after the
OP_IfNotOpen operator, not before, to avoid a (harmless) uninitialized
register reference.  Ticket [82b588d342d515d1]

FossilOrigin-Name: 8b437b47266ec2d80d85eafcfdd6949556d6c28d9d67d5f43d89799f0f5b7bd0
2020-03-16 03:07:53 +00:00
drh
ba25c7e29f Remove stray comment characters at the end of an #ifdef that were
accidently left in the previous check-in.

FossilOrigin-Name: ea914bec81c49625072fc9d23faa048300f3a0421e069d303b7203edcdfb3743
2020-03-12 17:54:39 +00:00
drh
576d0a9fd9 Fix comments and strengthen assert() statements associated with the
OPFLAG_SEEKEQ and BTREE_SEEK_EQ flags.

FossilOrigin-Name: 231749213854756b599b33413b17b35186f17889b0c73f109fa9db726b415558
2020-03-12 17:28:27 +00:00
drh
e31f00bbef Merge enhancements from trunk.
FossilOrigin-Name: 4945a66237fa3861bc691d5fbef0d40286b596a0902b4f4c032d1d6528bb1a1b
2020-03-11 20:03:22 +00:00
drh
2267a7fa87 Do not factor out constant functions into the initialization section of a
prepared statement, because even though they are constant, they can still
throw exceptions.  Instead, put such functions in an OP_Once block.  This
fixes ticket [3c9eadd2a6ba0aa5] and causes COALESCE() and CASE...END to
be short-circuit.

FossilOrigin-Name: c5f96a085db9688a09793f52ce1ecf033c2e6e2e5873a19fe0fb374b242b317f
2020-03-11 19:56:26 +00:00
drh
9b258c54e4 Rename sqlite3ExprCodeAtInit() to sqlite3ExprCodeRunJustOnce().
Other changes to make the new code cleaner.  Test cases added.

FossilOrigin-Name: d7f18489978fdbbe3ab317485518cac91a75416ccef55898301afdd76d3b415b
2020-03-11 19:41:49 +00:00
drh
38dfbdae8a Do not factor out constant functions into the initialization section at the
end of the prepared statement, be cause if they throw an exception, it will
abort the statement even if the function is never called.  Better to put
constant functions in an OP_Once block.

FossilOrigin-Name: 97a18a5cd701848a9660385e31bffe2c397e3cfe57ccdb876f44d08c00d1d39a
2020-03-11 17:58:27 +00:00
drh
8d5cea6b61 This variant to the fix for ticket [e0c2ad1aa8a9c691] uses fewer CPU cycles.
FossilOrigin-Name: fb5a8a9edd0a4f979d6c30278d4ddc73c651f56ae989b4e5983fca36887c5ceb
2020-03-11 02:04:15 +00:00
drh
2e51dc6c9b Merge updates from trunk.
FossilOrigin-Name: e05f743f619a6b60d0782ee85c73f6866696962954d7cb3eceb03af79c6a6189
2020-03-10 22:55:51 +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
5cf1b611a2 Further changes to ensure that expressions held in table and index definitions
do not get passed down into code generator logic where they might be modified.

FossilOrigin-Name: f45f5de000834da5b23cdcf12c3f0e3073287756afe06bdb77b95fb65b250258
2020-03-10 18:55:41 +00:00
drh
24e399038b Make a copy of the expression that defines a value of a generated column
before sending it to the code generator routines.

FossilOrigin-Name: 03d201c041c17579e791c73fe6babd60b9f892a84ffd1470851f8eb2857d3990
2020-03-10 13:35:04 +00:00
drh
0c76e892d9 Apply the correct affinity transformations when pulling values off of the
sorter index used for GROUP BY.  Ticket [e0c2ad1aa8a9c691]

FossilOrigin-Name: 101f7dea75a203f1f3aa422a607ef701eb0901ba4d5e8d1075cd350454a61956
2020-03-10 11:50:43 +00:00
drh
088489e8d9 The sqlite3ExprCodeFactorable() routine should make a copy of non-factorable
expressions, as they might be coming from a DEFAULT or generated column
in a table constraint.

FossilOrigin-Name: a2d6f108c5d07559b125823a04c9cb072c80be80d7913097891a6192c7e1e225
2020-03-10 02:57:37 +00:00
drh
9d33d9e7ac Background work for experiments trying to enhance ANALYZE so that it runs
off of samples of the entire index and does not need to read the entire
index.

FossilOrigin-Name: 29d1cc5c3619a88229f18c3c8131228f8a2d151ac3d9203f0c7fc538a996ecec
2020-03-10 01:24:13 +00:00
drh
afa1ecac9b Cleaner separation of the STAT4-specific logic in the implementation of
ANALYZE.

FossilOrigin-Name: 3df07e5a9a3781a4cf866fc6ee0e5c6f9cd7ca35ce0a6eb3aa7f5f3502e0ffae
2020-03-09 18:26:11 +00:00
drh
ccb3781673 Enhancements to the ".import" command of the CLI.
FossilOrigin-Name: cab1834cfc71f71bfed3c5170a0ba40a39385c3b2c50b7c6b6f09cc830dd1b1e
2020-03-09 15:39:39 +00:00
pdr
45dc9ca46b Fix typos in RowSet.
FossilOrigin-Name: 86465c08f4d629a296332a7985937326ac43ea2822c5651bf03862cd79d370fc
2020-03-09 03:21:33 +00:00
drh
ed5e66881e Fix typos in the Lemon documentation.
FossilOrigin-Name: 35f1f151ac478d6b46f3685d2565c35108ef74bd33ce96fb65300d3c303b289b
2020-03-09 01:02:45 +00:00
pdr
db9cb17dc7 Avoid a redundant NULL check
FossilOrigin-Name: 25dc53f6608dd9b8b4e8d8ee22e194a6d41d15811781752797cb42fc22ee1317
2020-03-08 13:33:58 +00:00
dan
0ea2d42ac3 Report an error if the main, or any other, database encoding is modified by an external process (perhaps using the backup API) after the db has been opened.
FossilOrigin-Name: 895bd20b29e223496e1585483c6ce3335ae9050f2e5de4d6b69d0e40df396862
2020-03-05 18:04:09 +00:00
drh
42a630b1da Change the sqlite3.pDfltColl (the default collating sequence for the
database connection) so that it is the collating sequence appropriate for
the database encoding, not the UTF8 collating sequence.  This helps to
ensure that the database encoding collation is always used, even for
expressions that do not have an defined collating sequence.
Ticket [1b8d7264567eb6fc].

FossilOrigin-Name: 4a5851893c3d71cc823b6ab5df5e58a852cd322fff26290f1ea05b63d67f564a
2020-03-05 16:13:24 +00:00
drh
4cf2121e1c When printing the OP_CollSeq opcode for EXPLAIN listings, include the
text encoding with the name of the collating sequence.

FossilOrigin-Name: eb5c1b77d1c55fc286ff8fccfd61e21cb67aec92d6f93b093b9af5c32165d82b
2020-03-05 14:19:49 +00:00
drh
f5cfe6f2c4 Fix a false-positive in the debugging logic that attempts to detect the
use of uninitialized registers inside triggers.
Ticket [c4c56482ced89d90]

FossilOrigin-Name: 0463576b5de0a1ee71530f0e4988fc9cceda79148520bea2c67f1fbc4a99cea9
2020-03-03 20:48:12 +00:00
drh
d346fe0ab5 Remove an invalid assert() on the debugging logic that checks to ensure that
register values are not used after they go stale.  Ticket [d165ad781b39d574].

FossilOrigin-Name: bd94d7d052734460904c687756231f8aa243a2252f07f742dd1e437aa940f536
2020-03-03 20:04:29 +00:00
drh
b3f0d92b91 Improved detection of corruption in the interior nodes of a segment btree
in FTS3/4.

FossilOrigin-Name: cc99447ac923166104e8a7c75088ed95279f4491b30cfa37dc3ee5e005dd9fac
2020-03-03 01:16:04 +00:00
drh
39b3bcf8ef Enhance the fuzzcheck test program so that it is able to simulate OOM errors
in the same way that dbsqlfuzz does.

FossilOrigin-Name: a65c8d4e26b2428ecb8232a4a6a44443aa1701319223397e61a823a5aa1827de
2020-03-02 16:31:21 +00:00
drh
a2ec2e4843 Fix a faulty assert() statement in the stale-register detection logic.
Ticket [da5a09be6dabbf42].

FossilOrigin-Name: 219c296cc8cab13fa12b64c297bc4a98d8e21491309d97a031edf89ae77fce75
2020-03-02 01:50:48 +00:00
drh
7f05d52c4c Ensure that the NULL-scan pass counter is initialized when a ORDER BY NULLS LAST
is used on the right table of a LEFT JOIN.  Ticket [e12a0ae526bb51c7].

FossilOrigin-Name: 704bb9a39acbee420c1d6ac9eb1466a02dd77d3334b938bfddf235973129b5fe
2020-03-02 01:16:33 +00:00
dan
0a21ea997d Fix a problem with window functions occuring within sub-selects that are part of an OR term in a WHERE clause of the outer SELECT.
FossilOrigin-Name: 1e174ed0d29366eb56ad1a0cc8defcb440b426bfd9525aed2f93468248606efc
2020-02-29 17:19:42 +00:00
drh
4a3a3eb3d7 In the CLI, add the ".oom" command for debugging builds.
FossilOrigin-Name: 9c3136a722715952d155aae55cbc6d1fb921c6940d8e7d3e32fcba000f6ac1ed
2020-02-29 15:53:48 +00:00
drh
2826918d10 The RTREE extension behaves has if data columns have type REAL, so we
should actually declare them as REAL so that automatic indexes handle
them correctly.  Ticket [e63b4d1a65546532]

FossilOrigin-Name: 85a9b6a92fd5805d5936f02d555af395441607b9eb5f4dae63560b5e65663b00
2020-02-28 16:04:28 +00:00
dan
9e5ecdc172 In sqlite3changeset_apply(), ensure that DELETE and UPDATE changes are always executed on main database tables, not similarly named temp tables, as documented. INSERT statements are already being handled correctly.
FossilOrigin-Name: f71a13d072398c9fc3556f42d75159cc2d0edc2c42f6c47f64503a7fbbca6e37
2020-02-27 17:16:45 +00:00
drh
be284e4ece Fix harmless compiler warnings from MSVC.
FossilOrigin-Name: 951b39ca74c9bd933139e099d5555283278db475f410f202c162e5d1e6aef933
2020-02-27 16:21:39 +00:00
dan
67e2bb92df Optimization for "SELECT min(x) FROM tbl" where "x" is indexed and NOT NULL. This also allows similar queries on NOT NULL virtual table columns to be optimized.
FossilOrigin-Name: 59726777934e201d94e99ca693f0fda4ebfb1c7883d0258ce542f63f9924c28c
2020-02-27 15:07:16 +00:00
drh
47a60d4518 Extra zero terminators on the end of the blank filename returned by
sqlite3PagerFilename() for an in-memory database.  This helps the result
work better with sqlite3_filename_journal() and similar functions.

FossilOrigin-Name: 63e533d28e87bbb10e0c611de4b79d22aae291b163fe59d1f95dcad9ab3939e4
2020-02-27 13:54:18 +00:00
drh
df97d43930 Ensure that the filename passed into the xFullPathname method of the VFS is
acceptable as an argument to sqlite3_uri_parameter().  The interface spec does
not guarantee this, but it has been so historically and some applications
have come to depends on it.

FossilOrigin-Name: bfb09371d452d5d4dacab2ec476880bc729952f44ac0e5de90ea7ba203243c8c
2020-02-27 11:32:14 +00:00
drh
a8781d9d93 Update the fuzzcheck test module so that it avoids inserting text values
that contain embedded NULs in the XSQL table.  Fix some legacy entries in
the test/fuzzdata8.db that had embedded NULs.  Add in new dbsqlfuzz cases
that have accumulated over on the dbsqlfuzz project for a while.

FossilOrigin-Name: 47d4240c4a837e829f593bb2aad7563010838f55345e7a0d8e2ea79462aeeb3c
2020-02-25 20:05:58 +00:00
drh
f575c1cf06 If STAT4 determines that a WHERE clause term that is not used by an index
has very high probability of being true, then do not use that term to reduce
the estimated output row count.

FossilOrigin-Name: 40739c793b0e98a3bae296d3a1f74944edcdd4cc33c26b417fde4eaf6f14d062
2020-02-24 17:05:09 +00:00
drh
f06cdde2cf Rework this changes so that instead of setting the WhereTerm.truthProb when
a term is seen to be of low selectivity, it merely sets a new flag
(the TERM_HIGHTRUTH flag) which causes whereLoopOutputAdjust() to ignore
that term.

FossilOrigin-Name: 4558163b6a525990f0f1b6629dbb76daf49bcaf1ddbaf0c50fe05ce9ee480ff8
2020-02-24 16:46:08 +00:00
drh
35d3cb80c4 Disable the new analyzeG.test module if not building with STAT4.
FossilOrigin-Name: 4a9d3005769e0398183b03a3e132e3946b9d1c48073af2e0559d7beeac3245c0
2020-02-24 13:35:34 +00:00
drh
2ed1b0e753 Merge bugfix from trunk.
FossilOrigin-Name: b542dee9de843c19664c19df7435c6034d23d0d213804d588ec0ff599082d576
2020-02-24 13:26:29 +00:00
drh
0990c415f6 Fix a problem with ALTER TABLE for views that have a nested FROM clause.
Ticket [f50af3e8a565776b].

FossilOrigin-Name: c431b3fd8fd0f6a6974bba3e9366b0430ec003d570e7ce70ceefbcff5fe4b6fa
2020-02-23 17:34:45 +00:00
drh
cea1951e80 Do not activate the truthProb adjustment mechanism if the truth probability
is less than the heuristic value, as there could be correlations unknown to
stat4.  Also add additional tracing output to make truthProb adjustments more
visible.

FossilOrigin-Name: c535fea147ce5c6e4aab25d3c85a3f53a7364c5b5ee10fb6d393c5911a02be7e
2020-02-22 18:27:48 +00:00
dan
5c19346451 Add new test file analyzeG.test, containing a test for the change on this branch.
FossilOrigin-Name: 243ab1852a2291595527ea1f26e78ad83eda285ae28f876bc1c703677f495cfa
2020-02-22 17:32:00 +00:00
drh
89efac94fd When stat4 information is available, try to use it to improve the truth
probability of WHERE clause terms that do not participate in the index.

FossilOrigin-Name: 1babd6ec5d60e2c34aa1c0285ead768a88004218468e97262411973fe3487022
2020-02-22 16:58:49 +00:00
drh
e8c4f03266 In the OP_Column opcode, if the cursor is marked NullRow (due to being the
right table of a LEFT JOIN that does not match) and the cursor is the table
cursor for an OR-optimization with a covering index, then do not substitute
the covering index cursor, since the covering index cursor does not have
the NullRow flag set.  Ticket [aa4378693018aa99]

FossilOrigin-Name: f02030b3403d67734bba471a91ad5bfdb03ddf6fdc3ef14808a04495e43b0470
2020-02-22 13:01:19 +00:00
dan
8a64d62d31 Add test case for previous commit.
FossilOrigin-Name: 14d14eb537075c6ac77513b1e7305bed8bc01a9034dfb763fd96f76400f2b705
2020-02-20 14:11:08 +00:00
drh
5f69512404 Early-out on the INTERSECT query processing following an error.
FossilOrigin-Name: a67cf5b7d37d5b1484be32092635faafd8f76e5881898cd9435517c4b287d663
2020-02-20 14:08:51 +00:00
drh
1cfee74a28 Fix a potential NULL pointer dereference following OOM. Problem discovered
by dbsqlfuzz.  Test case in TH3.

FossilOrigin-Name: 5aeb5a2d295e10d5fc1d456b3acaf8ac13c04cb5bb71a8c4571541d366e95887
2020-02-19 15:39:46 +00:00
drh
4b9e736898 Remove a NEVER() macro and add a test case to cause its argument to be true.
FossilOrigin-Name: ee034fe916448e953ee7824e5c0db99a36a0ad138ebfb25f751bf84cb80a8fa7
2020-02-18 23:58:58 +00:00
drh
4defdddc31 Add the new sqlite3_create_filename() and sqlite3_free_filename() interfaces
for use by Shims.  Use these interfaces inside the multiplexor.

FossilOrigin-Name: 9469f36ac89e4b75d0ab25fefbeff25201992c53141da915dcaa017083cab6db
2020-02-18 19:49:48 +00:00
drh
0184a256e3 Convert invalid surrogates to 0xfffd when translating UTF.
FossilOrigin-Name: 7fab1393c2b22b1f3b159b631e06e7e0d3900850ee249c38e4d3cdd0aacf637e
2020-02-17 23:08:16 +00:00
drh
78d1d225d8 A better (smaller and faster) solution to ticket [4374860b29383380].
FossilOrigin-Name: abc473fb8fb999005dc79a360e34f97b3b25429decf1820dd2afa5c19577753d
2020-02-17 19:25:07 +00:00
drh
bf48ce49f7 Take care when checking the table of a TK_COLUMN expression node to see if the
table is a virtual table to first ensure that the Expr.y.pTab pointer is not
null due to generated column optimizations.  Ticket [4374860b29383380].

FossilOrigin-Name: 9d0d4ab95dc0c56e053c2924ed322a9ea7b25439e6f74599f706905a1994e454
2020-02-17 00:12:04 +00:00
drh
ac9e184e1f Avoid an infinite recursion on an illegal recursive definition of an
fts5vocab table.

FossilOrigin-Name: 109ee07433b274a39954cef62bf67d47bcda960df9bef56127210ebf1c3c104c
2020-02-16 17:40:35 +00:00
drh
fdfd45aef3 Fix problems in the constant propagation optimization that were introduced
by check-in [1c3e5c20a9e6f501].  Fix for ticket [1dcb4d44964846ad]

FossilOrigin-Name: c9a8defcef35a1fee6bcbb88252a2d0076dabe8381b0128b2257b5b5cc494e0f
2020-02-13 22:12:35 +00:00
drh
ab7fdca2ee Disallow the skip-scan optimization in the absence of sqlite_stat1 data.
FossilOrigin-Name: e0c6b8bdb76fcd4f08c89ff20dce6a33ef3c11752e1e919fec5c4e7d423c4b93
2020-02-13 14:51:54 +00:00
drh
0ba3621592 Omit O_NOFOLLOW from the open() call when opening /dev/null, since /dev/null
is a symlink on Solaris, we are told.

FossilOrigin-Name: 0c683c43a62fe25c6cb765e4a31556ec91a7c21af79349b3d7eeb13f73dd1cdc
2020-02-13 13:45:04 +00:00
drh
77c9b3ccb3 Fix an incorrect assert() statement that was added yesterday.
Tickets [41c1456a6e61c0e7] and [fb8c538a8f57ae2a].

FossilOrigin-Name: abfb043ebb0c55fdc2be58255bc852b13865d81fa4c2e0dbe8c375810557aafe
2020-02-13 11:46:47 +00:00
drh
efdba1a8b3 Increase the default upper bound on the number of parameters in a single
SQL statement to 32766 (from 999).

FossilOrigin-Name: 2def75693a8ae002375aff80db0e6c970c75f75e8b6ba64f2c518712badb0ae8
2020-02-12 20:50:20 +00:00
dan
41aa442cf4 When determining whether an == or IS constraint in a WHERE clause makes an ORDER BY term redundant, consider the collation sequence used by the == or IS comparison, not the collation sequence of the comparison expression itself. Possible fix for [fb8c538a8f].
FossilOrigin-Name: 16aed5d0c63dcdc2054dbb8a4b6b992476640433bf81e19301e6db5a3fc82633
2020-02-12 11:57:35 +00:00
drh
df9b5cab93 Mark the sha1() extension function as SQLITE_DETERMINISTIC.
FossilOrigin-Name: 7d8dcfb95cea732e7588e7505bf80a171dd2e371b164c9435c6ac286060df6df
2020-02-10 19:24:49 +00:00
drh
b6664744c0 Fix the build for when SQLITE_VDBE_COVERAGE is used.
FossilOrigin-Name: 084381649edf374ccc5664f136055109a31d4c3a19c4ae2ee5275f630507a2a3
2020-02-10 13:29:10 +00:00
drh
dc4f6fc099 During byte-code generation, strive to avoid jumps that merely jump to the
following instruction.

FossilOrigin-Name: bcf876e67e75f6709f2b25683a3952bbbb87c672bb9d7af456feebc0ab9f6c31
2020-02-07 19:44:13 +00:00
drh
b48c0d59fa Simplify the code by removing the unsupported and undocumented
SQLITE_HAS_CODEC compile-time option

FossilOrigin-Name: 5a877221ce90e7523059353a68650c5fdd28ed032807afc2f10afbfbf864bdfe
2020-02-07 01:12:53 +00:00
drh
c84ad31851 There is no need to keep track of the number of changed rows or of the
last-insert-rowid while running VACUUM.

FossilOrigin-Name: a8a7c05b16f6c73ac55c359fbf62cae4a76eb0d105a3c53e9f47cede9fd85916
2020-02-06 20:46:08 +00:00
drh
0de19cac43 Unroll the comparison loop inside keywordCode() for to avoid unnecessary
comparisions and thus help that routine run faster.

FossilOrigin-Name: cec5f920f5c2a963f88329a08a443fc04be2dd6f7f2d840be63c0ab1de898f0a
2020-02-06 15:38:43 +00:00
drh
c879c4eac0 Separate OP_IdxInsert and OP_SorterInsert into completely separate opcodes,
helping each one to run a little faster.

FossilOrigin-Name: 447d71f0867a11f789eba164ea77470b3ae4953927556304b0861cf690250776
2020-02-06 13:57:08 +00:00
drh
5bdad79f01 Remove dead code from the sqlite3_filename_database() function.
FossilOrigin-Name: 1b6185550f2bcfa11513898984f1fc2029e0356e9acdc786c5c4a8006b1da2ba
2020-02-06 13:09:56 +00:00
dan
fcbc673752 Fix some fts3 problems found by usan.
FossilOrigin-Name: fb7ccf61bed8d862986eda7096bec3df5947f1d1c88f27e7d9c8acf420f40c50
2020-02-06 10:55:10 +00:00
drh
2a74006087 Small size reduction and performance improvement in the
sqlite3VdbeMemFromBtree() interface used to pull content out of the b-tree
and into an sqlite3_value object.

FossilOrigin-Name: ae6dd8d3e921670ee6450453b54245dd71bcfff3fd1bc7fdb7cf4cf9585c3375
2020-02-05 18:28:17 +00:00
dan
3cdc820544 Enable more detailed log messages in SQLITE_ENABLE_CORRUPT_PGNO builds if database corruption is encountered.
FossilOrigin-Name: 57c36a293e16bb4d9652874124ee1447bef278e08664bc8dd0070a0ee2ef1173
2020-02-04 20:01:44 +00:00
drh
92a27f7bf2 Extend the OP_Copy-coalesce optimization fix of check-in [b36126c1889e323c]
so that it is also correctly disabled by the CASE operator.
Ticket [9d3666754ac37d5a].

FossilOrigin-Name: 29a969d6b1709b80d9cb88b60971e4eb021f7f5f8ee9a619be74b833a78a35ef
2020-02-04 01:41:44 +00:00
drh
40d1db8d20 Fix a problem with the byte-code decompiler that was inserted by the
enhancements at [4248980a356f659b]

FossilOrigin-Name: af63e95dcdd6e9741cdddc3698e857e3b8be40048d3036f939f3583e517c4eff
2020-02-04 00:55:27 +00:00
drh
51f37b2bb8 Cosmetic change to the xfer-optimization to put the OP_RowData opcode closer
to the corresponding OP_Insert opcode.  This makes it slightly easier to read
and understand the code.

FossilOrigin-Name: 0ea2dbfc9088561d62c3456803cb08d357e4e60f1d21f6ed37315564be4957d3
2020-02-03 19:56:51 +00:00
drh
081ce2042c Increase the version number to 3.32.0.
FossilOrigin-Name: 8130bbb4217bd4a4db1f6bf97115a60bee8b29943bed0c7bdf54bba5edbed8fc
2020-02-03 12:25:18 +00:00
drh
9dce0ef4ca On an INSERT or UPDATE, perform affinity conversions on new data prior to
running CHECK constraints.  Ticket [86ba67afafded936].

FossilOrigin-Name: 1d4f86201dab9a22df9ef8175a7ebf3640e97cdb23a06fb454b4c69bfda3a9af
2020-02-01 21:03:27 +00:00
drh
d7b10d74e1 Fix the comment display for the OP_Function opcode. And at the same time,
improve the comment generating logic to make use of the newer
sqlite3_str_appendf() interface.

FossilOrigin-Name: 4248980a356f659b10b12c778592996d53c91fae4ea50c8566678da176bdd152
2020-02-01 17:38:24 +00:00
drh
745befd13f Merge the sqlite3CodecQueryParameters() fix into trunk.
FossilOrigin-Name: a812f533693a3605f297199ae0320d663e872208675e86860c5c1803943943aa
2020-02-01 14:20:35 +00:00
drh
1eac966076 Fix a problem in sqlite3CodecQueryParameters() that was introduced by the
query parameter encoding changes for the 3.31.1 release.

FossilOrigin-Name: cc65ca541265bd7061ed8f5ec9a54f3c384c41019c5ea1c68dcaabeff3495839
2020-02-01 13:30:39 +00:00
drh
7aedd5d70b Fix a minor typo in a comment in the btreeinfo extension.
FossilOrigin-Name: b5a66d10f4bbaf10def7b50b9ed98b05b41bb2c2af5ab9a90f6cda61169ab123
2020-01-31 14:52:19 +00:00
dan
d03f77ae46 Fix a problem with the processing of IN(...) constraints handled by virtual table implementations that do not set the "omit" flag when the virtual table column contains at least one NULL value.
FossilOrigin-Name: dcb4838757ca49cf149a6e883b3eb0ac8a075147387a078280dfabe39b1a3e8d
2020-01-29 15:03:01 +00:00
dan
759e9cc064 Add a test case for commit [ffd8bb93].
FossilOrigin-Name: bcd5b37b8ebd67537f60c0061fcbc70b2aebebb88d6fb842ccf321a3e20c122c
2020-01-29 13:56:35 +00:00
drh
48118e4060 Remove a NEVER() that is in fact reachable. Test cases in dbsqlfuzz and TH3.
FossilOrigin-Name: ffd8bb9351fbd8c1285491d4e10734f6816689de6042d640c178a5ecda75a5ef
2020-01-29 13:50:11 +00:00
drh
ffd3fd0c30 Add new memory barriers during initialization.
FossilOrigin-Name: a9b2adc5d61790abd86839d12e7ecb98a85d7e4cde5f94558530e32449d9e483
2020-01-29 13:10:50 +00:00
drh
9ca9a53a42 Modify a couple of FTS test cases so that they work on big-endian platforms.
FossilOrigin-Name: b20503aaf5b6595afafee6aa2bc6276354a62b0f583f6d94e31fedfdfc130347
2020-01-29 12:37:59 +00:00
drh
02a95eb9bb Faster decoding of 32-bit variable-length integers in cases were we do not
need to know the number of bytes in the encoding.

FossilOrigin-Name: 59a31b16b54a0068c81ee65bc2fa905c2c826e98da3a7ffd8c3ea860a2827b4a
2020-01-28 20:27:42 +00:00
drh
925ab5c17e Small performance improvement to the key-comparision routine for strings.
FossilOrigin-Name: 41454499a2b63c5fe6fae2d2085773a5f7d869250dcbe669929d20c961211f70
2020-01-28 20:09:39 +00:00
drh
fbfd113365 Reinstate the optimization of converting "a IN (C)" into "a=C" but only
if C is a constant.  If the RHS is a table column, the complications of
managing affinity and collations become too involved to mess with.

FossilOrigin-Name: 8ac26a23d7f0ef29c5eb007c7467181f8b96102c8600ea8a5b15cc7584af27bd
2020-01-28 18:09:53 +00:00
dan
4b2f45be34 Fix a 4 byte OOB read in test_multiplex.c.
FossilOrigin-Name: 912148913c11d98e48119a2c1fa7a0e52f318af36e7e2491d968ffde286c949f
2020-01-28 16:55:32 +00:00
drh
b9f2e5f777 Minor change for compatibility with the s390 architecture.
FossilOrigin-Name: 04885763c4cd00cbca26d048f2b19316bfc93e8edebeceaa171ebfc6c563d53e
2020-01-28 15:02:23 +00:00
drh
562fd18b9d Version 3.31.1
FossilOrigin-Name: 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6
2020-01-27 19:55:54 +00:00
drh
f54f105446 Update the version number to 3.31.1.
FossilOrigin-Name: 6fb9a8fb85486a8fccc462856316ef523450c23a7a7a81c8dfb323fbe809f8f5
2020-01-27 17:09:02 +00:00
drh
532b0d23fd Revise the layout of filenames in the Pager object so that it is unchanged
from prior versions.  It turns out that some important 3rd-party software
does questionable pointer manipulations on those filenames that depend on
that legacy layout.  Technical this is a misuse of SQLite by the 3rd-party
software, but we want to avoid unnecessary breakage.

FossilOrigin-Name: 34ab760689fd493eda482e856047708d74e769a01cc90b69da456d79ffe39aea
2020-01-27 14:40:44 +00:00
drh
9a3bdeba3e Fix typos in the sqlite3ext.h header file that prevent some newer APIs from
being accessed from loadable extensions.

FossilOrigin-Name: 14331989fcaf6591336290ed1548e9c90f0f153e27f456f4c30c966f9c23aa6e
2020-01-23 15:00:18 +00:00
mistachkin
8122c6e9be Fix variable declaration issue seen with MSVC.
FossilOrigin-Name: 8a6fe3066cf0599fcf2960e8fb3ae39e4e7a61ec81e8ec71d0b5910aee2c16f6
2020-01-23 00:08:25 +00:00
drh
78b5220328 Fix a NEVER() macro that can be true if compiled with
SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION.
Ticket [b985f0bd1636d9bc]

FossilOrigin-Name: 9f0f5d593a383ec2bebb6513ad566813f5b3dc6f052c61bcd76e8ac557bbb062
2020-01-22 23:08:19 +00:00
drh
1a3220ace6 Version 3.31.0
FossilOrigin-Name: f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86d824
2020-01-22 18:38:59 +00:00
dan
d0add948ea Update test file exclusive.test so that it works with the "journaltest" permutation.
FossilOrigin-Name: 4daf94d83319231e42243625c804d5db2d14f10fa5ea1a1f358c3603c47b955b
2020-01-21 16:31:26 +00:00
dan
8c812f98a3 Fix a problem with using views in SQLITE_OMIT_VIRTUAL_TABLE builds. Also some test case fixes required for the same builds.
FossilOrigin-Name: 934ee8bdb481a5cbd3d9c5f53028073129d3bca4fee14fe4a49bbf9c0c9d74f7
2020-01-21 16:23:17 +00:00
dan
7d2a1be84b Fix a case in fts3auto.test that fails for SQLITE_DISABLE_FTS4_DEFERRED builds.
FossilOrigin-Name: d241055ead935f0e461a67f483788bcd59f7e8d65ade54b9c7c7c4fec9414102
2020-01-21 15:01:14 +00:00
dan
70a32703ac Fix an assert() that could fail in SQLITE_MUTATION_TEST builds following an error in a query that uses CTEs.
FossilOrigin-Name: c7e29458a73bbe73a1429477d0c01d5a7b870ab75d3cb08a703be21714e439b7
2020-01-21 14:42:48 +00:00
dan
39ef8b31fb Fix a problem in the userauth extension causing it to occasionally set "PRAGMA count_changes" (and some others) to true.
FossilOrigin-Name: 3a62f64222ebd176c06e89b9fe5275b7b1f09df0afbae1c5c148a4e527e9d80b
2020-01-21 13:40:35 +00:00
drh
988af251d8 Fix the series.c and spellfix.c extensions to use SQLITE_VTAB_INNOCUOUS
correctly.  Fix the documentation on sqlite3_vtab_config() to take into
account SQLITE_VTAB_INNOCUOUS and SQLITE_VTAB_DIRECTONLY.

FossilOrigin-Name: 9265cb7f026c0e959bd034d4cd94fe597744e0dd455d0a20736ee5f5bee880c8
2020-01-21 12:29:02 +00:00
mistachkin
cbf1c8c25b Improvements to the autoconf TEA Makefile for MSVC.
FossilOrigin-Name: cffcf12f03906debeac6a974534b4439a4952cc72767e3bcb8e6d91da944d69f
2020-01-21 01:45:27 +00:00
drh
be03cc9fcf In the fuzzcheck test program, reduce the default expression depth limit
from 1000 to 500 to avoid stack-overflow problems when running stress tests
using clang ASAN.

FossilOrigin-Name: 63d886f4ce3c770498b8bdad45b04143a3f63197d81793bde107450aba4a9c87
2020-01-20 14:42:09 +00:00
drh
4b86e20485 Enhancement to the CLI to allow the ".parameter init" command to work
even if defensive mode is turned on.

FossilOrigin-Name: 4d46255096671ae7be33081e81bb25561304e069f459ffa7587f1f19381a1851
2020-01-19 20:37:26 +00:00
drh
38e14fbd5f Documentation improvements.
FossilOrigin-Name: 535afe150939d06342fbbed4ca1b6a1472fde51ac9edd4b4b583b87d90f509c2
2020-01-18 23:52:45 +00:00
drh
76a1fce53b In the TCL interface, add the ability to change the
SQLITE_DBCONFIG_TRUSTED_SCHEMA setting using the "db config" method.

FossilOrigin-Name: 1accfa8cf05856b03cecab7a2cd0c0337842a0003cfbec207b6f0acdd93e8f15
2020-01-18 22:20:14 +00:00
drh
fe7046044c Allow non-deterministic function in CHECK constraints. It turns out that
PostgreSQL, MySQL, and SQLServer all allow this.  We should be the the
exception.  Ticket [830277d9db6c3ba1]

FossilOrigin-Name: 8c8ce526adb60b8061e55151599ca8b11f1ec2e968d3bacc73a2a249e9e95ee1
2020-01-18 21:34:31 +00:00
drh
f71eb2091f Do not use memcpy() of zero bytes when initializing a pager. This avoids
a warning.

FossilOrigin-Name: cca437788e092b21ed1784dd94d4b1c7204ff1717538d276a10880d1345904bd
2020-01-18 19:46:42 +00:00
drh
a01fda7113 Disable a redundant test case that uses a very large stack, and hence
is unable to run with -fsanitize=undefined,address.

FossilOrigin-Name: 3c63f68e12af36e9fd9a3dd4daec9402e75e80bcd819d39c0215a427fd0d7803
2020-01-18 19:07:00 +00:00
mistachkin
591711751e Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: cd0437ba5b13593ebe4ec30d6236623183f8cfa30ca8a0612662eccb282a863e
2020-01-18 19:02:20 +00:00
drh
cea7b5d57e Add extra front margin to the fake empty filename returned by
sqlite3PagerFilename() for an in-memory or TEMP database.

FossilOrigin-Name: fee945671a19a93287f9bfadc346f9821fb1311c7fc75b95a6a48d1419c840e7
2020-01-18 14:50:06 +00:00
drh
1ee02a1ce5 Fix the VDBE so that it correctly handles the sequence of operations
OP_OpenEphemeral, OP_OpenDup, OP_OpenEphemeral, and OP_OpenDup in that
order on the same cursor.

FossilOrigin-Name: a1be6ee0188911448c064e2c25fb0ca1daad50f3d50fb49a34430bd09736b4a9
2020-01-18 13:53:46 +00:00
drh
2d58b7f40f Fix a typo in a comment. No code changes.
FossilOrigin-Name: 4363f69c3ad5a9859471547cab713f1acabd5fce13872cc1ddaa972d6c1dfb35
2020-01-17 23:27:41 +00:00
drh
929a940678 The compress() function should not be deterministic since the same input can
have multiple possible compressed outputs.  The uncompress() function, on the
other hand, is deterministic.

FossilOrigin-Name: 84f314902c48336849081c7e9fe2a52caf171b8215a1c6e80cded0700c447eb1
2020-01-17 21:12:22 +00:00
drh
ef9f719d0b Fix #ifdefs so it compiles cleanly with all SQLITE_OMIT compile-time options.
Update compile-time option testing.

FossilOrigin-Name: 7584e4b649d57767aac3906da6b06549d5b772aaa69f469c623ae5da834d54d5
2020-01-17 19:14:08 +00:00
drh
915530dcc8 Improved rounding in the 'unixepoch' feature of the date and time functions.
FossilOrigin-Name: c9abf1bd2d2496ced9ef4619cd997933cd58452e6ab527ba70746c9975104b6a
2020-01-17 16:47:07 +00:00
dan
a369d98b9a Update test script instrfault.test to account for the fact that bound blob values cast to text values are now intepreted using the text encoding of the database, instead of always as utf-8.
FossilOrigin-Name: 4d6cb28811c01599e34c0394fe5ed17d47f14893c860590c9b4660bef68eb294
2020-01-17 15:45:59 +00:00
dan
d1eb23cd26 Fix a case in "fuzz.test" that could fail, as non-deterministic functions may no longer appear in CHECK constraints.
FossilOrigin-Name: a370871e21bd1028ac968ca4f48e6b5f75e647ac40d4342aeb0504a848452908
2020-01-17 11:18:54 +00:00
drh
be0330e853 New testcase() macros in select.c, for coverage of the change from two
check-ins ago.

FossilOrigin-Name: 52206488f315803df73f964774270ef4783923407a2567936f56b0a1a88b4400
2020-01-16 17:53:24 +00:00
dan
1d7d8c8f74 Add the SQLITE_FCNTL_CKPT_DONE file-control for the use of custom VFSs.
FossilOrigin-Name: 3cc39e5069c8a6a32ecc49c571593615c0f347cadcd3e0325b7f9a11ddc1f546
2020-01-16 16:32:57 +00:00
drh
39df24a3f0 Do not allow the constant-propagation optimization to apple to ON/USING clause
terms as it does not help and it might cause downstream problems.

FossilOrigin-Name: 1bc783da63d58b05c690468b569cb2787846357b63c1100d11777666c5787bf4
2020-01-16 16:12:07 +00:00
drh
7db212a70b Fix an SQL syntax error in the comment on the omit-left-join optimization.
No changes to code.

FossilOrigin-Name: 86b5e5a20e967af7ac444ff0a40c2e8b93b7e5c505eebf6d3753a341b05503a8
2020-01-16 12:25:14 +00:00
drh
7d07a5f4e0 Clean up the definitions of the TERM_ constants in the code generator.
Formatting only - no logic changes.

FossilOrigin-Name: af06f80a590e20f64fa2f630e85fa728c266ea4696b975cc5f2ab72a3b914379
2020-01-16 11:51:09 +00:00
drh
b5f0e40578 Do not allow the "PRAGMA encoding" statement to change the database
encoding if TEMP content exists, or content in any other attached
database.  Formerly, encoding changes were allowed if just the main
database file was empty.  Ticket [a08879a4a476eea9].

FossilOrigin-Name: 03b003c988d27f3aa1b1e44972ee5a3c7e44ad667ec7f2b8a31d0411c66583d3
2020-01-15 16:20:16 +00:00
drh
be22a85406 Fix the urifuncs.c extension (used for testing and debugging only) so that
the sqlite3_filename_database() SQL function and its siblings correctly handle
an invalid schema name passed in as the argument.

FossilOrigin-Name: 3d7434a9d85dae9135473d1c58c22ac01a282e654807aa10be9b39f127291594
2020-01-14 16:50:09 +00:00
drh
05e8c5407f Remove an ALWAYS on a branch for improved database corruption detection
in btree.c:freeSpace().  Test case found by dbsqlfuzz.

FossilOrigin-Name: 54bf04811951db6c894f272f870e3e41f8f5e05a25c1115efbbdbd0d8bba54be
2020-01-14 16:39:54 +00:00
drh
299b102b93 Add the new noop_nd() debugging function to the noop.c extension.
FossilOrigin-Name: 72911fb1b010ae093a161b9c0d21cbdedcbc1f924a55f12227fbe342bd978e08
2020-01-14 16:33:07 +00:00
drh
c1f73e29bf For the showdb utility program, more accurate detection of when the database
is in autovacuum mode for the "pgidx" subcommand.

FossilOrigin-Name: 9ce2192b81a81bb8928e3184664694ed2f863ce41c2777cdc35e6b61486aea46
2020-01-14 13:24:14 +00:00
drh
76c1206845 Fix a minor typo on a comment in the CLI implementation.
FossilOrigin-Name: db4fb3503c4e1e40d7bd140187014e8f0cc186c441a0c7462987c77e2c83136a
2020-01-14 13:13:19 +00:00
drh
a14de91367 Improvements to sqlite3_open_v2() documentation.
FossilOrigin-Name: 4c4fd62a092b8db6398c64a92c9ff35915eedcce1079a77aeda81811d94096c4
2020-01-14 00:52:56 +00:00
drh
c6b2f9e323 More documentation updates. No code changes.
FossilOrigin-Name: a684d4ef08a48962c632b598242f5e34c9b2fa3ad6339023fbce8ac91582b5e3
2020-01-13 15:25:43 +00:00
drh
3c867026c0 Documentation updates. No changes to code.
FossilOrigin-Name: cc0e0aa3a7d534b806cdf63200b32ab3b7f0e08dde717f043a36d2f91c8a046c
2020-01-13 13:33:08 +00:00
drh
3b8eb08b17 Better than removing the incorrect assert() is to change it into a
testcase() together with a comment indicating where an appropriate test case
can be found, and the ticket that provoked the change.
Ticket [614b25314c766238]

FossilOrigin-Name: 3e3c60d8124672ff72a57dfa2e51276316bcac8c8ae8a5739da358f26924b0fb
2020-01-12 22:38:17 +00:00
drh
d8df36bd4e Change the zipfile virtual table so that the xBestIndex method gives a
reasonable cost estimate even if no filename is specified.  The missing
filename error continues to be raised in the xFilter method.  Meanwhile,
the more reasonable cost estimate avoids unnecessary wierdness in the query
planner.

FossilOrigin-Name: 0e468aa6decc73be307596782a778a739ff1b5dc0eb10fc4bd6776e460f99f8b
2020-01-12 22:25:58 +00:00
drh
ca7d3e1d42 Remove an incorrect assert(). Fix for ticket [614b25314c766238]
FossilOrigin-Name: 6a999c5aa0d1d5569a5bda50d27e3a15c13e93e69d00db97c5294901522064a3
2020-01-12 22:20:07 +00:00
drh
ffe4d4a2d5 New apis: sqlite3_filename_database(), sqlite3_filename_journal(), and
sqlite3_filename_wal().  Also sqlite3_uri_key().  And the other sqlite3_uri
functions now work using the journal or wal filename in addition to the
database file.  And the sqlite3_db_filename() result is guaranteed to work 
as an argument to the sqlite3_uri functions.

FossilOrigin-Name: fd7bcc53524096f5245e5ae04c12780d2c43b9b3af17ec529447aed21b82cc2b
2020-01-11 21:08:59 +00:00
drh
cdfadc7948 Minor changes for consistency between sqlite3_filename_wal() and
sqlite3_filename_journal().

FossilOrigin-Name: 9a70ff43a7b6848a71d5049f5a4ae24e3eb8a83d5c6651f5a9937abf03b3eccf
2020-01-11 20:27:02 +00:00
drh
8080403e44 Redesign for better legacy compatibility. Add the sqlite3_uri_key() interface.
FossilOrigin-Name: bcb43d11c4d0be36888c9e968ccdf85e7d7fccd72a29866f85c014e0562d4b93
2020-01-11 16:08:31 +00:00
drh
8875b9e7b5 Rearchitect the way in which filenames are stored in the Pager object so that
the sqlite3_uri_parameter() interface will work from journal and WAL filenames
too.  This check-in implements the central idea, and compile and runs somewhat,
but crashes on an extended test.

FossilOrigin-Name: 2ae77bd2335708343bce4541b4d2cf16edfe3fd5bc2dfb93757238c926aa960b
2020-01-10 18:05:55 +00:00
drh
b2fe5a7c35 Fix to the register validity tracking logic in debug builds. No impact
on release builds.

FossilOrigin-Name: 0a500da6aa659a8e73206e6d22ddbf2da5e4f1d1d551eeb66433163a3e13109d
2020-01-10 01:05:49 +00:00
drh
e5f8801044 Documentation updates on newer APIs. No changes to code.
FossilOrigin-Name: 8845a8c22a4ceabee130ce2addbe07e13b0496eeb542c89850f8658d21a48f89
2020-01-10 00:00:18 +00:00
drh
2e22579dea Fix the fossildelta.c extension so that it will compile on mingw.
FossilOrigin-Name: 20237d5dc4451f142b511e50a4acef4574cef17b9222c87dcebfe1ed1bab0ad9
2020-01-09 23:07:21 +00:00
drh
bebce86cde Merge in the untrusted-schema enhancements.
See [/doc/87aea3ab1cdda453/doc/trusted-schema.md|doc/trusted-schema.md]
for details.

FossilOrigin-Name: 5720924cb07766cd54fb042da58f4b4acf12b60029fba86a23a606ad0d0f7c68
2020-01-09 20:44:37 +00:00
drh
32d184e049 Only register the fts3_tokenizer() function using a single text encoding.
FossilOrigin-Name: 966964af1021feebc56cfda7b08bc787be7f447d682299f7958463aca30a73af
2020-01-09 20:33:36 +00:00
drh
7be5e3dd4c Fix a harmless compiler warning.
FossilOrigin-Name: edbf911fdeda14bd63cd752f6237896400eb5a65ef486abe7b91433621d21b5c
2020-01-09 20:33:13 +00:00
dan
fbb6e9ff48 Fix an assert() in window.c that could fail with some obscure SELECT statements that use window functions.
FossilOrigin-Name: 83dc55679a91bf5d1d13706088ce58eed02b9aad1ad0ae237966e78e0d769663
2020-01-09 20:11:29 +00:00
drh
b84fda37ef Fix a problem in the encoding display in the updated PRAGMA function_list.
FossilOrigin-Name: 318ff7720bc60c30c0826becce424226e9cec25c1d59cb2cdb75793739322760
2020-01-09 16:28:50 +00:00
drh
51ebd5fa14 Fix minor typos in the trusted-schema.md document.
FossilOrigin-Name: 87aea3ab1cdda4533e6fed605d1295e83bae0bbb9e1b238d239ce158a0d42954
2020-01-09 16:00:08 +00:00
drh
3858be3e59 Minor formatting changes in the trusted-schema.md document.
FossilOrigin-Name: 55553b5e5ece8282f6a56a6f5c71024eaaef3c86ec42203af3da708b0de3643b
2020-01-09 15:18:08 +00:00
drh
b0c4ef711f Design notes for the new-security-options branch.
FossilOrigin-Name: af7c1ed4f8a7293d0ecacca3cfbe9414e0de5ec40b418ce7831b8dc724feb747
2020-01-09 14:51:47 +00:00
drh
32266a1072 Simplified error message for the unsafe use of a virtual table.
FossilOrigin-Name: d662129a601e05e8fca5717a890b5bc920b80a750d061f3c2494788d32b917a5
2020-01-09 13:08:28 +00:00
drh
05b32ee3c0 Fix a problem that restricted edgy functions in TEMP tables.
New test cases added.

FossilOrigin-Name: 8878c40753566a8c4ccd1d413019cabde7569b947f730527d13bfc3db384e97d
2020-01-09 01:20:03 +00:00
drh
014fff20ad Block edgy functions used in DEFAULT constraints.
FossilOrigin-Name: da434dc149786e4b1cd80b3b2b25f8b614d0dec62d5439f839a66b536999e398
2020-01-08 22:22:36 +00:00
drh
2eeca2046e Performance improvements and test cases added. Allow "PRAGMA trusted_schema=ON"
FossilOrigin-Name: 30882ca80f6c51f6bb7b2692c1ac3f19a7c61a23aa8730be79aec0ae3ef08d54
2020-01-08 20:37:45 +00:00
drh
0dfa5255bc Check for whether or not it is safe to use non-innocuous functions as the
function is being coded, not when its name is resolved.

FossilOrigin-Name: 1da802d54b689a462e1fe899c6ffa08ef14d34f36728b14b055b5a76b1edc274
2020-01-08 17:28:19 +00:00
drh
15f3eacfc0 Provide the -innocuous option to the "db func" method in the TCL interface.
FossilOrigin-Name: 0138652b6c2f21fd67e59a23a396a5b9d6a16ee9b44701cddfc49b23fddfce5b
2020-01-08 15:44:10 +00:00
drh
6d35956c86 Fix the rot13.c extension to be deterministic. Add the noop.c extension.
FossilOrigin-Name: a679122ca8ec95d5c8afba3a1a50170db9dd519a3810e56877b8f56e858d0175
2020-01-08 15:43:29 +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
19ca76af38 Merge recent changes from trunk.
FossilOrigin-Name: 5962921fceaf2ec645379a5f1d18e2c2c13abbf92cf64606caee69f45a21c500
2020-01-08 13:08:52 +00:00
drh
87969b2a11 When doing a test-to-double conversion on a BLOB with an odd number of bytes
and assuming a UTF16 encoding, ignore the last byte.
Ticket [9eda2697f5cc1aba].

FossilOrigin-Name: 1c76f1d8ec0937a2d2e4ce75f98494c953e9621db31945d7e44f45d90d1c3892
2020-01-08 12:17:46 +00:00
drh
ded33ccea4 Fix a minor formatting error in the display of BLOB values during VDBE
tracing.

FossilOrigin-Name: 295442887a3cd5868df26c5be244649ffb3bae8367f5cf02fe513424a1c9f6a7
2020-01-08 11:36:30 +00:00
drh
4a62581b32 Improvements to the documentation of sqlite3_create_collation().
FossilOrigin-Name: fa866aec56deca8cc1b70814215bbdc683f41bc0826da0f8804d952de429820c
2020-01-08 10:57:27 +00:00
drh
f8f76d672b Simplification of the logic in the constant-propagation optimization.
FossilOrigin-Name: 1c3e5c20a9e6f501befa2bf6241a1b5190872bd83b765dac67065d252d04ea4f
2020-01-08 04:36:01 +00:00
drh
c9301e6e7c Fix the constant propagation optimization so that it does not try to
propagate constant expressions that have affinity.  Ticket [82ac75ba0093e5dc]

FossilOrigin-Name: 6db1c3498f6bfa01bb460e62b802b63ec4bf43577a17a94e1e2fa0ecc1e64960
2020-01-08 01:43:47 +00:00
drh
97bffe674f Fix a misworded comment. No code changes.
FossilOrigin-Name: ee0bc7ede0fbf3e54bb934c0d580c62d7393c984cbc374ece6d57fe9211dac26
2020-01-08 00:39:37 +00:00
drh
2b1c2aad9f Create the "trusted_schema" pragma. Add sqlite3_vtab_config() calls to set
the risk rank for many virtual tables.

FossilOrigin-Name: 4c21373c21c9b17b222ae65297a039a035e6ec6b505c00c33704e3c03f94f834
2020-01-07 19:45:40 +00:00
drh
3f68142b82 Enforce SQLITE_VTABRISK restrictions.
FossilOrigin-Name: 3d87ff312e617a26846d482b423163cad9c222513f33e128f0fe348dda27c7c9
2020-01-07 18:10:56 +00:00
drh
406dfcb843 Fix a performance regression caused by the previous check-in.
FossilOrigin-Name: d7d98d3dff2f0e0cfa5bb8be8e5fd2af5ab470be399eafe3d77b23ee1262f70d
2020-01-07 18:10:01 +00:00
drh
b77da374ab Invert the UNTRUSTED_SCHEMA setting to be TRUSTED_SCHEMA.
FossilOrigin-Name: f5fcf1fbc6473f8e91315b14d67745f2748010641b7463d1f4ca51e6fdf97462
2020-01-07 16:09:11 +00:00
drh
46d987405c Merge recent fixes from trunk.
FossilOrigin-Name: 5dfa33a09e608d26549e46c58a5563754688af68fa99415f9a548e91f81aca7c
2020-01-07 15:44:22 +00:00
drh
42925d1f1a Add an "|| CORRUPT_DB" term to an assert() statement inside of btree.
FossilOrigin-Name: 03c1d75ddc063469fc856114595bd12d21759fe0979ce1ba1cf52e48e6b0d4a1
2020-01-07 13:32:15 +00:00
dan
262efe4a43 Fix an instance of an undefined behaviour (a left-shift of a 64-bit unsigned integer by a value greater than 64) that could occur in fts3.
FossilOrigin-Name: e1f12978b53683114ab0ef0e84a14dd4fabc72750b214aac19cd9da22a582a27
2020-01-07 09:06:43 +00:00
drh
cbae3f8c7d In the typeof() optimization in OP_Column, expand the size of the bogus buffer
provided for data so that it is big enough to cover the increased number of
bytes displayed during register tracing from check-in [54553bf16fabd72d].
This is the correct fix for ticket [bbd55a97e66ff50d], though the earlier one
does not hurt and is useful to retain.

FossilOrigin-Name: e1154c39ba0f8caec70d330e6d5bec745c93ec9a7eafedb3e3730fadc8b8277c
2020-01-06 20:48:45 +00:00