Commit Graph

23111 Commits

Author SHA1 Message Date
drh
7061aa8977 Fix the build for SQLITE_ENABLE_UPDATE_DELETE_LIMIT.
FossilOrigin-Name: 5150d2da06ab3c7e3bea1865413cd21c64d5cefb91d3d874e9dd0bf51aea754b
2021-08-03 23:23:23 +00:00
drh
76f2477531 Improved harmony with the reuse-schema branch.
FossilOrigin-Name: cbc703f70d16de0e93b276528fc761290f30af770ceb4b4d11d6a6e6506ac67c
2021-08-03 18:45:41 +00:00
drh
cf9d36d1b3 Refactor field names in the Column object, zCnName and zCnColl, to make them
unique and thus easier to find amid all the other code.

FossilOrigin-Name: 8b781dcaf68e0cf12a844708c82eee00193e340195cbca915d077e4846983bf3
2021-08-02 18:03:43 +00:00
drh
f38524d20d Refactor the Table object to reduce its memory footprint.
FossilOrigin-Name: bbb6759bcf6e01d36dfc787a82a610d359f50aaeac8104b73883a84906d54e1f
2021-08-02 16:41:57 +00:00
drh
79cf2b7120 Refactor the way that DEFAULT expressions are stored on columns, in order
to save memory in the common case where the column has no DEFAULT clause.

FossilOrigin-Name: 8646547e54211d44c415663c33775c4268550f8332949c4731a4bb6ec9cc663a
2021-07-31 20:30:41 +00:00
drh
c2df4d6adb Recognize certain standard datatypes ("INT", "INTEGER", "REAL", "TEXT", and
"BLOB") and if a column has one of those datatypes, store the type part of
the bit-field information in the Column structure to save space.

FossilOrigin-Name: d2da62a9df63036b02dadca3798de9e623c2680b3ef0c37d2b18bb88693afd7f
2021-07-30 23:30:30 +00:00
drh
e48f261ebf If a generated column uses the optional keywords GENERATE ALWAYS, try to avoid
putting those keywords in the typename of the column.
[forum:/forumpost/ff3ffe09251c105b|Forum post ff3ffe09251c105b]

FossilOrigin-Name: 3c954863f45271a3518acf51fd685a641878811fb5cfcbdbad85154aeccdc902
2021-07-30 20:09:08 +00:00
drh
77441faff5 Avoid clownfeet in the names columns when the column names are quoted
in the original CREATE TABLE statement.

FossilOrigin-Name: 980f7292afd45a8e73272e2139b55b99ab86167febec9fd0bf0356e8167b2ee9
2021-07-30 18:39:59 +00:00
drh
7b3c514b53 Reduce clownfooting in the allocation of the Table.aCol array. This reduces
the amount of heap space required to hold large schemas by about 11%.

FossilOrigin-Name: 2941ded0acbdcf914567bf7451cfd9b770269545c20d3fa7107c40492689afad
2021-07-30 12:47:35 +00:00
drh
f873392dde Enhance the wal.c source file with an ASCII-art schematic of the -shm file
header.

FossilOrigin-Name: a6c160e08a61d105f8aab959440ac5ec4f1aaca8f0d393e08e7c2c67815b5bb2
2021-07-29 18:34:35 +00:00
drh
b71959cb4e Improvements to asserts to enforce magic numbers in the wal-index format.
Also improve automatic configure and make builds on legacy PPC iBooks.

FossilOrigin-Name: 87b8d47889f1990442aa90398614656658207085d064381074f72bda9bdcbfa5
2021-07-29 17:31:40 +00:00
drh
5025cb581f Complete warning-free build on old PPC iBook.
FossilOrigin-Name: ef2a0850394b1c6c1fc84b26694a3712ae1e50d52bb78fea2ec40148a7d833de
2021-07-29 17:23:23 +00:00
drh
944d85dfe2 Fix an error in one of the assert() statements added by [23b08fe9db24a953].
FossilOrigin-Name: ad24334bc06dc9ae52825a1873a1eab6c258d77fcc00dec55884ddddecd9932e
2021-07-29 17:01:44 +00:00
drh
20de9f6cb1 Minor tweaks to various TCL build scripts so that they work even for TCL 8.4,
which is obsolete, but is also all that is available for some legacy platforms.

FossilOrigin-Name: 2269ce64f707c4a198fcb9a72933648ea61a80b4251024b8058ff28ad81b4917
2021-07-29 16:49:28 +00:00
drh
fd4c7862ee Improve comments and add new assert() statements in WAL to help document
how everything works.

FossilOrigin-Name: 23b08fe9db24a953cc231b093cf74d140c9965d22964d0401ff8ab3d4ecba443
2021-07-29 16:48:21 +00:00
drh
02a9996e40 Remove ALWAYS() macros that can be true if the internal test function
implies_nonnull_row() is used in the result set of a query and contains
comparison operator against a computed column.
dbsqlfuzz 4c34db5bff6247f33ee49e341a1f3018e72be0a0.

FossilOrigin-Name: 4d1dbfa35c7dc0f09321b2e274a00e506f4ca65322454652d5891d815a6966d3
2021-07-29 00:33:20 +00:00
dan
779e990629 Add test case to ensure that sessions works with DELETE statements that use the truncate optimization (i.e. a DELETE without a WHERE clause).
FossilOrigin-Name: a2fc531177c3a061f2881198bb711d502db7cd831351b6a5dd415936845b6625
2021-07-28 18:13:28 +00:00
drh
c6da6dba69 Fix a harmless uninitialized variable read that occurs after an error
associated with a subquery that uses DISTINCT.  Found by a fuzzer.

FossilOrigin-Name: e9719f975f61c4c9f40ea077b049eed97d0957b925a4b6149d9ee21ce827b6a1
2021-07-28 02:04:58 +00:00
drh
9045e7d696 Reduce the scope of a variable in order to fix a harmless compiler warning
that occurs under -DSQLITE_OMIT_AUTOMATIC_INDEX.

FossilOrigin-Name: 36d5dbbe13562f4ea6435e620d102f8515bd0e6b8e66fd1841062a4e4621e330
2021-07-28 01:22:23 +00:00
larrybr
1ae057d873 Remove sqldiff --visible-controls option, make it always happen. Add test cases for controls made visible
FossilOrigin-Name: ff74c0cc4cefa5271b12ecfff3f2fd4749852d9d1d01f4ae64a07a26decc001b
2021-07-26 19:49:01 +00:00
larrybr
e40875d211 Give sqldiff --visible-controls option to deal with non-graphic text content robustly across platforms
FossilOrigin-Name: 68d2373f5d578cf3aff9d1ac4b1ab3ac00b466e94e1eb516523fc7660dfc0549
2021-07-26 18:28:24 +00:00
drh
3740712677 Enhance the CLI with the ".connection" command that can switch between
up to five different database connections.  Used for manual testing of multiple
database connections in the same process.

FossilOrigin-Name: 54eaf076c05887157179459ab39c2556953f6fef9c1b14f17a8aa74087da3023
2021-07-23 18:43:58 +00:00
drh
c0495e8c9c Set the checkSchema flag if a CREATE TABLE parse fails because the table
already exists, to ensure that the table was not previously deleted by
some other connection.

FossilOrigin-Name: 91bcb9621529b58d28e91a2763eb9eef3951400d5eaef105073258f3dd331872
2021-07-22 21:11:06 +00:00
drh
55b8b73e74 Fix ALTER TABLE DROP COLUMN so that it generates valid bytecode even when
operating on a corrupt database and using PRAGMA writable_schema=ON.
dbsqlfuzz 5f09e7bcc78b4954d06bf9f2400d7715f48d1fef

FossilOrigin-Name: b65f4f763979ee9e0b943c787609ea22d6f7e01d41dfc1e084ec50a085a3550c
2021-07-22 18:22:51 +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
c8d214711f Improved robustness of cursor renumbering in the UNION ALL flattener
when operating on vector assignments of an UPDATE FROM.
dbsqlfuzz 417d2b053b9b3c9edaf22dd515564f06999e029c

FossilOrigin-Name: 60695359dc5d3bcba68a68e1842c40f4a01650eb5af408e02fb856fd8245e16d
2021-07-21 15:42:05 +00:00
drh
74e5a5a703 Run a "PRAGMA quick_check", if necessary, on the modified table after
an ALTER TABLE ADD COLUMN to verify that added NOT NULL or CHECK constraints
are satisfied by existing rows.  Abort the ADD COLUMN if not.
[forum:/forumpost/c04814903d6ec4f7|Forum post c04814903d6ec4f7].

FossilOrigin-Name: e3794997c34f03db2a4ac0ca5b76727d0e031778d92b08eaaf9631689ec3e56d
2021-07-20 16:07:15 +00:00
dan
d59f983501 Avoid a malfunction that could occur if the same correlated column reference appears in both the GROUP BY and the HAVING clause of a sub-select. dbsqlfuzz a779227f721a834df95f4f42d0c31550a1f8b8a2.
FossilOrigin-Name: 1e35cc6d5c2f563c6bb163bb150d7bc6ede4c993efa828af1face3261bf65a2c
2021-07-20 14:57:49 +00:00
drh
0f91a5352b Fix issues in the new ADD COLUMN constraint checking. Add preliminary
test cases.

FossilOrigin-Name: 48434ad3fa9504c063d812d119bc8f622548fd02b3d478ff247b11474c4ce5db
2021-07-20 08:23:54 +00:00
drh
b4d9b2b537 Demonstration code to show how NOT NULL and CHECK constraints can be
verified after an ALTER TABLE ADD COLUMN.

FossilOrigin-Name: 039f540373b03af9e0c87499e5e0423eb093d1d343829282a5ac1de2d600b881
2021-07-20 07:35:07 +00:00
drh
53fa02507b It does not work to deserialized into TEMP, so do not allow it. The
sqlite3_deserialize() routine now returns SQLITE_ERROR if you try.

FossilOrigin-Name: 18068cc60698d4944a9d682cdf34b14b4d4b32f043f8d584dbf41c2bb5ac6220
2021-07-20 02:02:24 +00:00
mistachkin
f5b70d06ea Fix compilation of 'threadtest3' for some older versions of MSVC.
FossilOrigin-Name: b5ede6a68891820bd5b6d051b1b641bc1cd49104cad2466db184134d14f58f5b
2021-07-20 00:18:22 +00:00
drh
de3246176b More precision in comparing integers and floating point values while
processing the integer primary key for OP_SeekGE and similar.
[forum:/forumpost/2bdb86a068|Forum post 2bdb86a068].

FossilOrigin-Name: f9c6426de3b413ff8fcf04a00931ca5f123f996c572b35181af114afa8d811d7
2021-07-19 20:52:31 +00:00
dan
bb2d2a50f9 Updates so that "threadtest3[.exe]" can be built for windows with MSVC.
FossilOrigin-Name: 4ce585fb07274284e3add6adcb66ed06e4b109584704d1ec7152bf43ca8d5d85
2021-07-19 16:49:13 +00:00
dan
73983658c9 In defensive mode, allow statements that write to shadow tables to be prepared from with virtual-table xSync() calls.
FossilOrigin-Name: c8601d83fbecf84ca7991d339449b380deb5a7620dc84756a91c2880f030b423
2021-07-19 14:00:29 +00:00
mistachkin
05de5048b4 Fix minor spacing issues in the MSVC makefile.
FossilOrigin-Name: d78c272b3966cc1b12bc7e83fbe909a3c517d553a942d7f1c07bddf69f2e2164
2021-07-19 03:38:13 +00:00
drh
ef8344c6a5 Try to omit the ORDER BY clause in subqueries if doing so does not change
the result in any way. See
[forum:/forumpost/2d76f2bcf65d256a|Forum post 2d76f2bcf65d256a] for
details and history.

FossilOrigin-Name: 85ddaf1b59a19cbd9efe7724a163b30c14bafabfaf2cfced07b463e76f73e494
2021-07-16 22:43:00 +00:00
drh
ee612e2a5d Minor comment improvements.
FossilOrigin-Name: 6854b5919beefa43da21ba739e82d583183c8cdfe5dd63e27a810ac1ffe2330b
2021-07-16 20:16:19 +00:00
larrybr
d51a2d8b8f De-typo sqlite3_expanded_sql() doc
FossilOrigin-Name: 56b0f5418dad34d1e83d53741916e2a38a5448369031d959b8a44867774be657
2021-07-16 17:11:21 +00:00
drh
e46ec734c7 Modify the generate_series() table-valued functions so that its first
argument (the START value) is required.  Throw an error if that argument
is not supplied.  In this was the series.c loadable extension can be used
as a demonstration of how to code an xBestIndex function to require certain
parameters.  Compile with -DZERO_ARGUMENT_GENERATE_SERIES to obtain the
legacy behavior.

FossilOrigin-Name: 459d85a2898d6a53f43b4ad48d2f39edd1bbe37a4f97426a5d666c39c52576a4
2021-07-16 17:04:17 +00:00
drh
111c3cc9fb Fix the "main.mk" makefile so that "series.c" is a dependency of "shell.c".
FossilOrigin-Name: ff959917918495ef352ce48c240b1de6da162f2a5e76e37dcc53fa50bce27642
2021-07-16 15:30:19 +00:00
drh
0fb78f0cca Get the "omit ORDER BY in FROM-clause subqueries" optimization working for the
core test cases.

FossilOrigin-Name: e31c5888659ffd4c6d8b68627123df3bbb84bb010b7766b0a74877bf3ba1e52b
2021-07-16 01:19:19 +00:00
mistachkin
e13dfe4b19 By default, do not emit #line directives in the amalgamation.
FossilOrigin-Name: bacfa93677fbe014737fab7dbdb4e7a168a310bc5b914b17896ae2a48435c7b1
2021-07-15 23:34:14 +00:00
drh
bb30123178 Attempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
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
2021-07-15 19:29:43 +00:00
drh
480f5e3e6e Change references to the schema table in sqlite3_analyzer to the new
SQLITE_SCHEMA name.

FossilOrigin-Name: 3beb77d6a792d07ca605ec8e5402b8a305860cba4044fcafeed00b9fa862fa16
2021-07-15 16:39:42 +00:00
dan
20235e56f7 Fix a use-after-free error in ioerr.test caused by an error in test code.
FossilOrigin-Name: 1594056aab068b9fae82f6b885828c7127d9bedcc37c4340486e32791bc87c7a
2021-07-14 21:18:31 +00:00
mistachkin
acae2b485e Enhance comments pertaining to the interface linkage / calling convention macros.
FossilOrigin-Name: c378e99250fe06fae8ca40c62185b607f004d6806e07dbb9f964dd849b4e55f8
2021-07-13 22:49:02 +00:00
mistachkin
696555d7b5 Further revisions to #line handling for amalgamation builds.
FossilOrigin-Name: 9a84321229ad499ee0f7c85732c2728afb4476c72073a510401a559dda9be38f
2021-07-13 21:59:22 +00:00
larrybr
06a0ea9a68 Get correct #line tags into amalgamation for other builds too.
FossilOrigin-Name: 999eb80018f1bb8a8ad73483610400faf5fb37b1be446ce30edbf7028340f50b
2021-07-13 20:55:26 +00:00
larrybr
09b2196d97 Get #line tags into amalgamation, subject to configure.
FossilOrigin-Name: 5d81b598a7cd2cea2553fdf6ca38d2f65f0f1b2d5a8eea8a01c1800f68aa2422
2021-07-13 11:59:17 +00:00