Commit Graph

569 Commits

Author SHA1 Message Date
drh
e3863b5176 Ensure that the "PRAGMA schema_version" command causes the schema to be
reparsed and reloaded.

FossilOrigin-Name: 27d4a9a7b530c77a5b2593d1a5232b10746da9906f8d12890de7a8fbd7270256
2020-07-01 16:19:14 +00:00
drh
e937df81f0 Fix the handling of reserve-bytes so that the maximum value of 255 can be used.
FossilOrigin-Name: 99749d4fd4930ccf15227f67c732266af9e09dd3cabdc0834fb450ef98196441
2020-05-07 01:56:57 +00:00
drh
49a76a8fe5 Add "PRAGMA analysis_limit=N;" to limit the number of rows visited by
ANALYZE when N is positive.  Positive N also disables collecting stat4.

FossilOrigin-Name: a279b151c1623807774daf4975175c62ea252eefb71f9820ced6773769b392c5
2020-03-31 20:57:06 +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
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
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
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
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
2eeca2046e Performance improvements and test cases added. Allow "PRAGMA trusted_schema=ON"
FossilOrigin-Name: 30882ca80f6c51f6bb7b2692c1ac3f19a7c61a23aa8730be79aec0ae3ef08d54
2020-01-08 20:37:45 +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
337ca519e1 Enhance PRAGMA function_list to show internal functions if the direct use
of internal functions is enabled via the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS
test control.

FossilOrigin-Name: 7a8d7ca726666f4384925f959df0d58f7622229e06f1b5e643a3caccd539bb6e
2020-01-04 19:58:28 +00:00
drh
79d5bc80c7 Enhance PRAGMA function_list so that it shows all instances of each FuncDef,
the number of arguments, the encoding, the type, and the flags.  Use this
capability to locate and fix incorrect function flags in the standard build.

FossilOrigin-Name: 9ca906d24a2e88eddb2fd067783512b66cfc49dce1596d816a1c38a09d128218
2020-01-04 01:43:02 +00:00
drh
ebd70eedd5 Fix the NOT NULL verification logic in PRAGMA integrity_check so that it
works for generated columns whose value is the result of a comparison operator.
Ticket [bd8c280671ba44a7]

FossilOrigin-Name: f3b39c71b88cb6721f443de56cdce4c08252453a5e340b00a2bd88dc10c42400
2019-12-09 15:52:07 +00:00
drh
31999c5cac Fix a bug in the hard_heap_limit pragma so that it returns the new value of
the hard_heap_limit, not the soft_heap_limit.  Change SQLITE_MAX_MEMORY so
that it works by setting the default hard_heap_limit value.

FossilOrigin-Name: 33fd0c3abcad5555a150990a22d9c1bab99e79be01143fccb9fafc9b52cf92c8
2019-11-14 17:46:32 +00:00
drh
803f06bf62 Merge recent enhancements from trunk.
FossilOrigin-Name: b8a631fd30d0732505679230684b3362c965438197a2b11518f01a77599c9202
2019-11-14 15:21:15 +00:00
drh
6df9c4b990 Claw back some performance from the sqlite3ExprGetColumnOfTable() routine.
FossilOrigin-Name: e8426acb94179ff49549aced6ea3c26c49ba4761c2f414fa1772d6a031edc79d
2019-10-18 12:52:08 +00:00
drh
0b0b3a95d0 In the Table object, change the nVCol field to nNVCol - the number of
non-virtual columns, as that is the quantity that we need most.

FossilOrigin-Name: 4ad66af04a654d92711d2d056ce8f35cd21eac4b99fb8d78be1a314620b6d29e
2019-10-17 18:35:57 +00:00
drh
c143114460 Some (but not all) INSERT and UPDATE statements now work for STORED columns.
FossilOrigin-Name: fe7517bf4d360597576ab9aba29627d7926d23f2bbbfb3e7bf4d32761617574c
2019-10-17 17:54:05 +00:00
drh
676fa25a0f Bug fixes so that "make test" once against runs with no errors.
FossilOrigin-Name: 7bfe0f679d8951b3e925bdf549efa0f8d6b514eddeaca69cbfddbd9476cfff5f
2019-10-17 14:21:07 +00:00
drh
ab3c5f26ab Fix the table_info and table_xinfo pragmas so that they work with virtual
columns.  Table_info omits virtual columns.  Table_xinfo gives them a
"hidden" flag of 2, and 3 for STORED columns.

FossilOrigin-Name: 069351b85f9a706f60d3e98fbc8aaf40c374356b967c0464aede30ead3d9d18b
2019-10-17 13:15:40 +00:00
drh
7e508f1ee2 Simple INSERT and SELECT operations working with VIRTUAL columns.
FossilOrigin-Name: 7f9f90b1b885fa9905b296f2e0fcc9b2341019b42fc839722a93cf60e49a9252
2019-10-16 19:31:46 +00:00
drh
81f7b37270 Initial experimental code for generated column support. Non-functional.
FossilOrigin-Name: 11d472c1df707b8d03ec57d8fc582a34f5eb89a9d02a154a9871650c65065b45
2019-10-16 12:18:59 +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
cc3f3d1f05 Activate introspection pragmas by default. The new option
SQLITE_OMIT_INTROSPECTION_PRAGMAS must be provided to keep them out.

FossilOrigin-Name: 9c4bca64fb5f635296a8d7d7c1bf2808e02ca734a9983e5cee9132f5352a9a6d
2019-08-17 15:27:58 +00:00
drh
7b1904e35d Enhance the "PRAGMA index_info()" and "PRAGMA index_xinfo()" statements so that
they allow a WITHOUT ROWID table as their argument, and in that case show
the structure of the underlying index used to implement the WITHOUT ROWID
table.

FossilOrigin-Name: 62274ff683ba077d8b0fa34ad653ce235a8c5cbfdb7ab8558469af7333d03698
2019-07-17 11:01:11 +00:00
drh
51e441da2b Combine the implementations of the key and hexkey pragmas into a single
case.  Have both pragmas return "ok" if they are implemented.

FossilOrigin-Name: b3692c406f7ba62587c9d3256f888748393519680e9e2db53f59557f1a300e05
2019-05-21 17:04:27 +00:00
drh
6c35b3065c Disable PRAGMA journal_mode=OFF when SQLITE_DBCONFIG_DEFENSIVE is turned on.
Ticket [f4ec250930342e0c].

FossilOrigin-Name: a0f5eb5c79cc33b7224f3421d2baa02a2a19eb9d6eaa8117dda4a1878b229cb5
2019-05-17 20:37:17 +00:00
drh
08652b5ea0 Provide the SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA compile-time option to
omit the case_sensitive_like pragma.  This change, in combination with
documentation changes, is the current solution to ticket
[a340eef47b0cad5].

FossilOrigin-Name: eabe7f2d4ff0e0dd868dcab7ec1d4a9168a25f80d3a52f0eeea2f90bd33782f2
2019-05-08 17:27:18 +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
9b747068ba Improvements to "PRAGMA parser_trace=ON": Make it a flag pragma, and then
use the flag to show the complete SQL text at the beginning of the parse.

FossilOrigin-Name: 507c43537f00d089efb3c3020fb6e826e8f89f3efa2caaa12c5309d35dd0c22e
2019-01-31 01:39:01 +00:00
drh
ec4ccdbcb1 A new implementation of sqlite3VdbeMakeLabel() is faster and makes fewer
memory allocations by deferring memory allocation until 
sqlite3VdbeResolveLabel() is called, at which point the code generator has
a better idea of how big the relocation table needs to be.
The sqlite3VdbeMakeLabel() routine now takes a Parse* parameter instead of
Vdbe*.

FossilOrigin-Name: 4a0929ac76d8aa5dd65eac3b83d6bbf41e505e01d175ca0fb2b19ba02d439415
2018-12-29 02:26:59 +00:00
drh
d5b44d60c7 When masking bits off of sqlite3.flags, make sure the mask is 64 bits
in size so as not to accidentally mask of high-order bits.

FossilOrigin-Name: 53d3b169d8e1892163526caff2c843302c92e280fdeff6831e23a9bb15b82be3
2018-12-06 17:06:02 +00:00
drh
eea8eb6d04 Do not allow direct access to internal-use SQL functions such as
sqlite_rename_column() and sqlite3_rename_table() except when the
new SQLITE_TESTCTRL_INTERNAL_FUNCTIONS flag is set.

FossilOrigin-Name: 6e1330545e7b74fe5f1f20751a3425e2788441485fc07fcb7626e448c72027ce
2018-11-26 18:09:15 +00:00
dan
3c425484a7 Fix problems in pragma.c causing some PRAGMA statements to test the wrong
schema-cookie before proceeding, or to try to open cursors on the wrong
database ("PRAGMA foreign_key_check" only).

FossilOrigin-Name: 6982f52f579d20b8a2965373731d41622bda7f09fbf82cc005bb378321829f4c
2018-11-20 18:09:59 +00:00
drh
84c501bac1 Initial code to make shadow tables read-only to ordinary SQL. The now
xShadowName method is added to the sqlite3_module object and is used
to identify potential shadow tables.  The SQLITE_PREPARE_SHADOW argument
to sqlite3_prepare_v3() is defined.  It is designed to permit writing to
shadow tables, but is currently an unused placeholder.

FossilOrigin-Name: 31942b3dd3f66eb0d9977bf1cadc2f2d7be7967cce2b55784be0b939dfef1985
2018-11-05 23:01:45 +00:00
drh
fd748c6460 Split the SQLITE_WriteSchema flag in two flags, WriteSchema and
SQLITE_NoSchemaError.  Set only WriteSchema on a VACUUM to avoid problems
when trying to vacuum a corrupt database.  With this change, the size
of the flags field on sqlite3 must grow from 32 to 64 bytes.

FossilOrigin-Name: 4f9878107a54356b7105fa1db7655ee239685d570436f6ad4d4221c9bd829b3d
2018-10-30 16:25:35 +00:00
drh
fa5c62ef2e Add the textkey and textrekey pragmas.
FossilOrigin-Name: f03164d45450cd7ff2162999aa9e51eec7fb5e7cab1fa83d876b544f8f841097
2018-10-11 18:41:50 +00:00
drh
d7dc0a36cc Add the extra "hidden" column to the end of the PRAGMA table_vinfo output.
FossilOrigin-Name: cf1b76135f511530dcc7b82f78c952bf97ebcddb40be06f713f9f2326915fabe
2018-10-01 18:28:42 +00:00
drh
5612ef1057 Bring the PRAGMA table_vinfo statement up to date with trunk.
FossilOrigin-Name: 6f606f99231f88ae5ff719d0ce21afc4b844490102c27ac20aa606baaf78d8d6
2018-10-01 17:15:17 +00:00
drh
15fc988ce0 Add the PRAGMA table_vinfo command (with an extra "v" before "info") that
works like PRAGMA table_info (without the "v") except that it also shows
hidden columns on virtual tables.

FossilOrigin-Name: 8bcd1a59560aa7ea73e6529e5c14ece8ac09bf7e99efdcfd388fead39846b6bf
2018-09-29 19:38:42 +00:00
drh
c4ceea72b7 Fix various harmless warnings generated by static analysis tools.
FossilOrigin-Name: a04a0ea9e30e0ef12bafa0b90b7d1b7764865768bb4a738b0c73a7a3ef9416db
2018-08-21 12:16:33 +00:00
drh
02ceed058a Completely remove the column cache logic, which has been a persistent source
of bugs for many years.  We recent enhancements to the performance of the
OP_Column opcode, the removing the column cache actually makes speed-check.sh
run faster.  It also saves about 1,800 bytes of code space.

FossilOrigin-Name: 3f5f60cd7529330209027fdae8129cca420cec1050eae50a7750d0b715b56972
2018-08-03 23:04:16 +00:00
drh
4011c44322 Rearrange the order of some checks in the integrity_check pragma for a very
slight performance gain.

FossilOrigin-Name: 4b853f020570bf4af1b14e03f35764c7d7a03a40af58efc783e06f2b883cef78
2018-06-06 19:48:19 +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
dan
518e3f0673 Merge latest trunk changes with this branch.
FossilOrigin-Name: 2719cf5c5bbe8e31d18368d54d968af3878ad2e15f0666e18d7b567d7439c451
2017-10-11 20:26:07 +00:00
drh
b5c1063ab7 Fix the rendering of the P4_INTARRAY argument to the OP_IntegrityCk opcode
in the output of EXPLAIN.

FossilOrigin-Name: adc12c83dda8ba93ca220bbff649f763058b9440968ae463621f0cb7de8889cf
2017-09-21 00:49:15 +00:00
drh
74588ceb31 PRAGMA integrity_check returns SQLITE_OK even if it encounters corruption
while scanning indexes.

FossilOrigin-Name: 81f62e99f27dedf3dc10fa1593c4cd9fc158680867206aee853e503a0cc8df71
2017-09-13 00:13:05 +00:00
drh
9ecd7086c1 Simplifications to the PRAGMA integrity_check code generator.
FossilOrigin-Name: 99b9140c795c0c17c4e9d2547477c9dac056edfd443f2b2bd70edecd43c49ab7
2017-09-10 01:06:05 +00:00
drh
226cef4ef1 Improved detection of malformed records by PRAGMA integrity_check.
FossilOrigin-Name: 8fa923caa1535fc9ebed0214d211fc3d09a015d78afd01f288c215a7980d25f2
2017-09-09 20:38:49 +00:00
dan
3841372350 Update "PRAGMA integrity_check" to detect inconsistencies between a single
record's header and body.

FossilOrigin-Name: 9e393a0edf1a578ddecc16a72fe3c54b75c2a650d507bcbc37c9724fbede1494
2017-09-05 20:16:19 +00:00
dan
1c305122a2 Avoid returning duplicate rows in experimental pragmas "pragma_list",
"module_list" and "function_list".

FossilOrigin-Name: b79cc8dc88c8ae03daff1290fd650b2b0e6f673ec9d83be6a533a57172930190
2017-08-25 09:17:14 +00:00
drh
6e97f8ec84 Combine the Parse.ckBase and Parse.iSelfTab fields into just Parse.iSelfTab.
This fixes a problem with date/time functions in check-constraints.  Add
some test cases for date/time functions in index expressions and check
constraints.

FossilOrigin-Name: 22eda0985ecd1f456c073e6ad735a8417f3ff1fb6aaad1640e1cec01e50c51d8
2017-07-20 13:17:08 +00:00
drh
3e34eabcdf Allow indexes to be created on date/time functions as long as the 'now'
date and the 'localtime' and 'utc' modifiers are not used.

FossilOrigin-Name: 0a5e1c04d9d07bb7fd6546a9ddac1bf42b19ea19c2b79570aea6cd4226887a27
2017-07-19 19:48:40 +00:00
dan
d8ecefa5ab Add the "unionvtab" virtual table extension in ext/misc/unionvtab.c.
FossilOrigin-Name: 62a86aa6c0519cf1fa232169122d3d6ae8d2f66b20530fb934a82a15712bd2f0
2017-07-15 20:48:30 +00:00
drh
3963e584b4 Fix a register allocation problem in PRAGMA integrity_check that caused
the same register to be used for two different purposes on the first
ATTACHed database if the schema for the ATTACHed database was noticable
more complex than the schema for the first database.
Fix for ticket [a4e06e75a9ab61a1].

FossilOrigin-Name: 253945d480b052bfe311888022b5eb0be91c8c80cda05036e58207d57520262c
2017-07-15 20:33:19 +00:00
drh
e7c6f97b1d Fix a missing \n at the end of a comment causing a line to be too long.
No code changes.

FossilOrigin-Name: 687bd478710eb827e041533eea67115464f5a0de767bb6cfdbe36a0d3c597fa1
2017-07-15 20:25:22 +00:00
drh
08f1efeb16 Add the "PRAGMA secure_delete=FAST" option, which overwrites most deleted
content without increasing the amount of I/O.  Deleted content might persist
on the free page list, however.  And extra CPU cycles are used for zeroing,
of course.

FossilOrigin-Name: 38978ce65b280bb7cba3fc08ba91485fb1b84cd9fbba2e950ecf41c021ff452a
2017-07-07 20:06:28 +00:00
drh
d5eae667f4 Add new PRAGMAs: "function_list", "module_list", and "pragma_list". All are
enclosed within #ifdef SQLITE_INTROSPECTION_PRAGMAS.  The compile-time option
is not on ctime.c yet, since these are still experimental and one can always
test "PRAGMA pragma_list" and see whether or not it returns an empty set.

FossilOrigin-Name: e0b6ae92adfae46f64fc2e2719e22e5467c34d49c1aeaec5cc5faf04258de0f7
2017-07-07 17:43:30 +00:00
drh
8ae11aac93 Add the "Pragma_list" pragma. Put all three pragmas created on this branch
inside of #ifdef SQLITE_INTROSPECTION_PRAGMAS.

FossilOrigin-Name: 2f3c3781ef3d66ecafef083d7144287ff23eea5a6d93b014dfeb2a8ac71f757e
2017-07-07 17:33:07 +00:00
drh
40cf27cb63 Enhance the sqlite3VdbeMultiLoad() interface to automatically generate the
OP_ResultRow opcode on PRAGMA implementations, for a small reduction in the
library footprint.

FossilOrigin-Name: c46f0f076c674891e20240bad56693d891aedc43004bcf980a5d199515f23413
2017-07-07 16:00:53 +00:00
drh
ab53bb635c Add new pragmas: "function_list" and "module_list"
FossilOrigin-Name: e5f01d7fde05fdb547f35816ff15c31a92c170b31877f4c640b7bc2be3f580b3
2017-07-07 15:43:22 +00:00
drh
a5907a86b8 Experimental "PRAGMA secure_delete=FAST" pragma. The intent is to overwrite
deleted content with zeros without increasing the amount of disk I/O.

FossilOrigin-Name: f1682f0faf1a93ded066464b1ddd5f987e21ee0f6bb5e828ed31c3ad903cf2c3
2017-06-19 11:44:22 +00:00
dan
c42a0056d7 Merge latest trunk changes into this branch.
FossilOrigin-Name: b1533bc455f52f570c0f4b8aaa0da802757dc89b0e45b9a9b31aa591a44bf7bd
2017-04-20 17:35:46 +00:00
dan
4bee5599c0 Consolidate two branches of code in the "PRAGMA foreign_key_check"
implementation.

FossilOrigin-Name: 69f51f838abcf57b35e41f7a10fbb45f56536f93825aac865debc3c8315930be
2017-04-17 18:42:33 +00:00
dan
940464b1dc Fix a problem in "PRAGMA foreign_key_check" in handling a WITHOUT ROWID child
table with an INTEGER PRIMARY KEY parent key. Also, if an FK violation is
detected in a WITHOUT ROWID child table, do not try to read and return the
rowid. The third column returned by "PRAGMA foreign_key_check" in this case
(WITHOUT ROWID child table) is now always set to NULL.

FossilOrigin-Name: 690870bd7b2e607b7992c4496c9f08c29eb72a36af002c606fd7aa3dcf94a2a4
2017-04-17 18:02:41 +00:00
dan
2b78dd2359 Merge latest trunk with this branch.
FossilOrigin-Name: e051e8f21b909c5e89a7203eef6501fecd64f82a634c4e10398b5ef7d716eb37
2017-04-08 19:00:37 +00:00
dan
75f9558808 Fix a problem causing "PRAGMA integrity_check" to disable the xfer
optimization for subsequent VACUUM operations on tables with one or more CHECK
constraints. This could result in VACUUM producing slightly larger database
files.

FossilOrigin-Name: e5bb7db51cdfd8124c60329782798cea398733545594dab55cb892b2a08c4d29
2017-04-04 19:58:54 +00:00
dan
fbf3bdcdbc Merge latest trunk into this branch.
FossilOrigin-Name: cb721d0b36268a7b0ef493fa4d7f6bcbaa9ead8b1990e3c3fae015fa1d545226
2017-03-31 11:20:20 +00:00
drh
a3b2da9889 Fix a problem in the enhanced PRAGMA integrity_check where it verifies
CHECK constraints: Do not be confused by the reuse of the Table.pCheck field
by VIEWs with named columns.  Problem discovered by OSS-Fuzz.

FossilOrigin-Name: 019dd3d5ba4a596c4ec3b5f0de8402c72196af0faca9138edbc0f1f4957cae60
2017-03-17 03:21:14 +00:00
drh
7553c82894 Make "PRAGMA temp.synchronous=N" a no-op to ensure that the TEMP schema
always has synchronous=OFF.  This fixes an issue discovered by OSS-Fuzz.

FossilOrigin-Name: bcf6bb08d8b07d3c4567bcd367f8d4011ce8baad28c25d4e8870bdf347dd48bd
2017-03-15 14:04:03 +00:00
drh
59dbe3a5ef Make the default MASK argument for "PRAGMA optimize" be 0xfffe, to allow for
future expansion of up to 14 new default-on optimizations.

FossilOrigin-Name: 73019a8bba29fd07f73559cd00d5346fa822b439
2017-03-06 23:51:16 +00:00
drh
e1f1c0802c Fix a typo in a comment. No changes to code.
FossilOrigin-Name: ec529bf11b16c801ea438e57d208ff7e4cedf1f9
2017-03-06 20:44:13 +00:00
drh
1cfaf8eafb Add an optional bitmask of allowed optimizations on the "PRAGMA optimize"
command.  The 0x01 bit is Debug Mode.

FossilOrigin-Name: a35388eef4096c1856b025dbd90143409d4a72d3
2017-03-02 14:17:21 +00:00
drh
bce0414844 Do a single OP_Expire at the very end of "PRAGMA optimize", and omit the
OP_Expire on ANALYZE commands invoked by the pragma.

FossilOrigin-Name: 188300a337c87b7ee0dd1f4b9a4f1bd80e70cca4
2017-02-23 00:58:36 +00:00
drh
2ead47cb49 Change the name of the analyze_as_needed pragma to "optimize". Enhance the
comment (which will become documentation, assuming these changes land on trunk)
to explain that the optimize pragma is likely to be enhanced in various ways
in future releases and that applications should not depend upon the current
behavior.

FossilOrigin-Name: 9fced545a6f80c55d6dc4a6106cb2d3569566b3e
2017-02-22 20:24:10 +00:00
drh
114ce7a4b1 Merge integrity_check and other improvements from trunk.
FossilOrigin-Name: fe073905081b421405ca425ca03c5b8b0ff5f2c8
2017-02-22 19:49:54 +00:00
drh
66accfc56b Cleanup and simplification of the output row count limit control of
PRAGMA integrity_check.

FossilOrigin-Name: 5af7d72ed9ec758283d78ceb46627d72021c1c60
2017-02-22 18:04:42 +00:00
drh
8b174f2916 Fix integrity_check so that it verifies NOT NULL constraints even for tables
that have no indexes.  Enhance quick_check so that it verifies NOT NULL and
CHECK constraints.

FossilOrigin-Name: 5264844b069cdc20f456acee9f5b2b97c986120d
2017-02-22 15:11:36 +00:00
drh
8a284dcefe Enhance "PRAGMA integrity_check" so that it verifies CHECK constraints.
FossilOrigin-Name: 549bae0856004ff65b505175460abd598b30fe57
2017-02-22 14:15:37 +00:00
drh
99d5b4cde6 Updated comments. No code changes.
FossilOrigin-Name: e842ad391e62df273a5b1ed569d42ea46d03a99b
2017-02-18 22:52:40 +00:00
drh
4a54bb5794 Add the OP_SqlExec opcode and use it to implement "PRAGMA analyze_as_needed",
invoking ANALYZE subcommands as necessary.  This simplifies the implementation.

FossilOrigin-Name: d386015f5e7ecdd951d70db56b7bbd858be7ad90
2017-02-18 15:58:52 +00:00
drh
182e84c116 In the analyze_as_needed pragma, avoid running unnecessary OP_LoadAnalysis
and OP_Expire opcodes.  Make the analyze_as_needed pragma responsive to the
schema name.

FossilOrigin-Name: 882599a4a7ea92c9e7752e0745475508e58a11c3
2017-02-18 02:19:02 +00:00
drh
72052a73a3 Add the "PRAGMA analyze_as_needed" command.
FossilOrigin-Name: e93db2373127d31d33ec46ef918fa9386bb664a6
2017-02-17 16:26:34 +00:00
drh
33bec3f5e8 Enhance the Index and Table objects so that they remember if their stats come
from the sqlite_stat1 table.  Make the "PRAGMA stats" an SQLITE_DEBUG only
pragma.  Add the flags column to "PRAGMA stats".  These are all preliminary
steps toward a "PRAGMA analyze_ifneeded;" feature.

FossilOrigin-Name: 85026c8ee143bbd46565660fff8346ef81421546
2017-02-17 13:38:15 +00:00
mistachkin
2e52532217 Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: 997f765bc6706769ae15f3e719354473e02bd78b
2017-02-01 22:43:08 +00:00
dan
9e1ab1a8a4 Ensure that sqlite3_column_count() returns 0 for the "set" mode of "get/set"
PRAGMA statements that do not return a value in that case (e.g. page_size,
cache_size, auto_vacuum).

FossilOrigin-Name: 5c05d8ec5e895661dae2de30c73dfdeaff93511e
2017-01-05 19:32:48 +00:00
drh
344a1bf133 Fix harmless compiler warnings.
FossilOrigin-Name: fa86db2f915c0a189c3be02b1aaa7f24d339d7d6
2016-12-22 14:53:25 +00:00
drh
d8b7200b84 Fix an error in the way the "schema" argument to some pragma virtual tables
is handled.

FossilOrigin-Name: 546821e29edb0282a4b1d8f49512e36027a6bf6d
2016-12-16 04:20:27 +00:00
drh
9a63f09204 Minor bug fixes and enhancements to the pragma eponymous virtual tables.
FossilOrigin-Name: 3f8f461504139a4efea0e033e3a274cc4b2d3072
2016-12-16 02:14:15 +00:00
drh
ae7045cd53 Fix the cost estimation in the BestIndex method of the eponymous pragma
virtual table implementation.

FossilOrigin-Name: 7126807a186746a8663fbaa267d63214d06476e4
2016-12-15 21:33:55 +00:00
drh
d7175ebeaf The pragma as eponymous virtual table mechanism now appears to work.
FossilOrigin-Name: 2c274a1a7b57ef1208901fbc1d96d39c0d492652
2016-12-15 21:11:15 +00:00
drh
2fcc1590c4 Code to automatically create eponymous virtual tables for read-only pragmas.
Compiles, but does not yet work.

FossilOrigin-Name: 988a61e8b03f302c69d11898d1ea95f002cba1a5
2016-12-15 20:59:03 +00:00
drh
c232aca184 Do more pragma processing from tables rather than in-line code.
FossilOrigin-Name: a88ca3524b97f296dffc68335466b3767a681747
2016-12-15 16:01:17 +00:00
drh
69c338263a Rename the Db.zName field to Db.zDbSName to make it more descriptive and to
distinguish it from all of the other "zName" variables scattered throughout
the code.

FossilOrigin-Name: 92a22f01343a898455fd61c3b8e7d7c954f5b569
2016-08-18 14:33:11 +00:00
drh
4d249e6128 Enhance "PRAGMA table_info" to that it provides information about eponymous
virtual tables.

FossilOrigin-Name: 53a1e5d51304cb3de700c1807a2c945a40240576
2016-06-10 22:49:01 +00:00
drh
eeb9565a3e Add a new OP_SeekRowid opcode, that combines the functions of OP_MustBeInt
and OP_NotExists.  This makes the code slightly smaller and faster.

FossilOrigin-Name: ffe80a1bfa014943a614fc6993c1749b9bfec4c1
2016-05-26 20:56:38 +00:00
drh
01c736db40 Use sqlite3VdbeAddOp0() to code OP_Expire, to save a few bytes.
FossilOrigin-Name: 3d55d24dcb27f07d1e645738ee4707e4df923036
2016-05-20 15:15:07 +00:00
drh
d7564865ad The sqlite3_column_decltype() routine should return NULL, not an empty string,
if the column has no declared type.

FossilOrigin-Name: 605eba4a756e7185119088e2242f82691d078b01
2016-03-22 20:05:09 +00:00
drh
bb9b5f2608 Fix a register allocation bug in the VDBE code generator for
PRAGMA integrity_check;

FossilOrigin-Name: 88439a866b3b16ad7c308ebe59198662a05e7eeb
2016-03-19 00:35:02 +00:00