Commit Graph

2790 Commits

Author SHA1 Message Date
dan
57a852cd11 Fix some mappings from e_fkey.test.
FossilOrigin-Name: 171c67138527750ec4af403f05389fae5f7da7b5
2009-10-12 16:02:10 +00:00
dan
1760024b62 Update e_fkey.test to match the latest version of foreignkeys.html.
FossilOrigin-Name: a2ca9f1a7a158e7b83a642a8d17549d81caea557
2009-10-12 15:25:28 +00:00
dan
3bc485e647 Extra test cases mapped to statements in foreignkeys.html.
FossilOrigin-Name: ffa6207dd72024f01ab6f2715fe628943f178ca5
2009-10-12 11:27:00 +00:00
dan
e506deb255 Add further test cases to e_fkey.test.
FossilOrigin-Name: d61cc0e1a1e8b4bf49016d3d14554f9c20f86f6b
2009-10-12 08:41:49 +00:00
dan
2f01f465f3 Add tests to e_fkey.test.
FossilOrigin-Name: 5ec07feea47e727824b8b48236b5cce80539a455
2009-10-10 15:49:49 +00:00
drh
c4ad1e946b Update requirement text for sqlite3_open_blob(). Update evidence comment
in e_fkey.test to conform to the latest requirement phrasing.

FossilOrigin-Name: 89c548acf4691bad3d90400026267d4c6a55cde1
2009-10-10 14:29:30 +00:00
dan
2140429ccd Add test cases to e_fkey.test.
FossilOrigin-Name: e391dfe79d52e1de48688715d4a6707ffca214fd
2009-10-09 18:16:55 +00:00
dan
4e7deacf48 Test a couple of the examples in foreignkeys.html.
FossilOrigin-Name: a2fb7902c01f8b095b25d338fc2f23cb26c941d9
2009-10-08 19:02:50 +00:00
dan
598d2028e2 Add test cases to test file "e_fkey.test".
FossilOrigin-Name: 23e0f61a4f24315bf31f632f43b60ec232f348fb
2009-10-08 17:42:28 +00:00
dan
ce3745329c Add tests to test/e_fkey.test.
FossilOrigin-Name: 533703d78ab4330b2dc8e08aaba89b4667e46331
2009-10-08 11:57:24 +00:00
dan
07fcc26824 Update triggerC.test to match the change to the way the trigger-recursion limit is handled.
FossilOrigin-Name: 5806925283b889867567c4ad92518bad000e9d9d
2009-10-08 06:24:41 +00:00
dan
f589450dc9 Add some tests of statements in foreignkeys.html.
FossilOrigin-Name: 8382867956caf20f62c46c15b456c1c16d0824fd
2009-10-07 18:41:19 +00:00
dan
02470b20f3 Handle an SQLITE_IGNORE returned when requesting authorization to read parent key columns by pretending the parent key columns contain NULL values.
FossilOrigin-Name: 3c24df38e6ae5dfe999bbf3133b65df0074c6a50
2009-10-03 07:04:11 +00:00
dan
251ad6e1c5 Add one more authentication test to fkey2.test to cover an untested branch.
FossilOrigin-Name: e4fa8be770eb79806d489be46f68f969de17378b
2009-10-02 15:29:10 +00:00
dan
47a06346ff When inserting a row into a child table, invoke the authorization callback to request permission to read the parent key columns.
FossilOrigin-Name: 9842f2d5f606eb8f641ecae9fbc5368b8d7e4286
2009-10-02 14:23:41 +00:00
dan
1316700e54 Add a test to check that the incrblob API cannot be used to write to an IPK column. Also a comment to explain why the incrblob code does not need to check if a column is part of a parent key before writing to it.
FossilOrigin-Name: dca2a7f608d9237039541707846c76cd460f5805
2009-10-02 06:35:06 +00:00
dan
3d7b046996 Add test cases to cover the branches added by the previous commit.
FossilOrigin-Name: aaa005b6da222f711f201c453d28f5be40e9c601
2009-10-01 17:13:31 +00:00
dan
e7a94d8128 If an update does not modify any child or parent key columns, omit foreign key processing for the statement.
FossilOrigin-Name: edff3500058eb8ad2381f855ef7a09ecb680f7b8
2009-10-01 16:09:04 +00:00
dan
d583502e7d Add tests to check that FK support interacts with count-changes correctly.
FossilOrigin-Name: 5b8366154b2a91c1be3e7e52ec270ecdfe7d2bb1
2009-10-01 04:35:05 +00:00
dan
f7a94543b8 Remove unreachable branches from fkey.c. Add a few tests to cover the remaining branches.
FossilOrigin-Name: 0a0a17d87c990a811a2755b9d9d4141b611b49db
2009-09-30 08:11:07 +00:00
dan
652ac1d0a7 Use the affinity and collation sequence associated with the parent key when finding child table rows to apply a foreign key action to.
FossilOrigin-Name: 9a4b7ec2928307e88783223903c842accaff7ccf
2009-09-29 16:38:59 +00:00
dan
9707c7b104 Check that a unique index uses the default collation sequences for each column before using it as part of a foreign key constraint operation.
FossilOrigin-Name: 64154174cf8a53bd9be818db53cb0e586c5d24cb
2009-09-29 15:41:57 +00:00
dan
792e92012f Remove an unused variable from fkey.c.
FossilOrigin-Name: 582bd7682831362cd0e2f91ac0dba5ab2b7e2983
2009-09-29 11:28:51 +00:00
dan
856ef1a5f9 Various fixes so that "make test" works with OMIT_FOREIGN_KEY, OMIT_TRIGGER and OMIT_ALTER_TABLE.
FossilOrigin-Name: e4eb227b14e4bfcb9f7f284692a391b7355f0204
2009-09-29 06:33:23 +00:00
dan
f0662567fa Ignore foreign key mismatch errors while compiling DROP TABLE commands.
FossilOrigin-Name: 5b4d46374a8e808246a1813c12c36c4a75371898
2009-09-28 18:52:11 +00:00
dan
d66c83095e Fix the DROP TABLE command so that it cannot be used to bypass foreign key constraints (if foreign key support is enabled).
FossilOrigin-Name: 8353808c9e70412fdee31bfda7810e948f1c7485
2009-09-28 14:49:01 +00:00
dan
9277efa3d5 Fix some foreign key constraint related problems that occur when a row refers to itself.
FossilOrigin-Name: 9e503e2d0428c9e8df878c7c6594790232cca4e0
2009-09-28 11:54:21 +00:00
dan
432cc5b9f3 When ALTER TABLE RENAME TO is used to change the name of a table that is the parent table of a foreign key constraint, modify that foreign key constraint to use the new table name.
FossilOrigin-Name: b4a10c39e726dc190e9597e382baddc034294114
2009-09-26 17:51:48 +00:00
dan
0ff297eaa7 Avoid checking if an insert or delete has "fixed" an outstanding FK constraint violation if the constraint counter indicates that the database contains no such violations.
FossilOrigin-Name: 519144ac437b5842e4213f0e81e05c709939c2ab
2009-09-25 17:03:14 +00:00
dan
bd74783270 Fix comments in fkey2.c to reflect the immediate-constraint-counter approach.
FossilOrigin-Name: 9fd54b0aa73ed74c65f7db53cb666752f13263f9
2009-09-25 12:00:01 +00:00
dan
53c3fa8dbe Prevent ALTER TABLE from being used to add a column with a REFERENCES clause and a non-NULL default value while foreign key support is enabled.
FossilOrigin-Name: 353b1b18253ab71ba38a887e555994f5469b87bd
2009-09-25 11:26:54 +00:00
dan
140026bdb5 Fixes and test cases to make sure the affinity and collation sequence associated with the parent key is used when comparing it with a child key value.
FossilOrigin-Name: 76e8e74b49be4c80b9fb20d52e9b39db8001362e
2009-09-24 18:19:41 +00:00
dan
1bea559a94 Ensure foreign key related processing takes place when rows are deleted from the database by REPLACE conflict handling.
FossilOrigin-Name: 3f40c142c8526c1572020bd4d945c03a72019135
2009-09-24 11:31:21 +00:00
drh
ff738bce0d Make sure a transaction is available for rollback whenever a REDUCE conflict
resolution occurs and there is the possibility to ABORT.
Ticket [4a03edc4c8c]

FossilOrigin-Name: f0c56fa90dc95aff6fe6764b5ab75a90199247b0
2009-09-24 00:09:58 +00:00
shane
86d682950b More fkey tests.
FossilOrigin-Name: 2d544bd53d0fb9633aca40841529aec8e7df61f8
2009-09-23 18:49:41 +00:00
dan
475f571994 Fix a problem in the fkey_malloc.test script.
FossilOrigin-Name: 0ce1efa46080f379089b03706daeac96c4add0f9
2009-09-23 17:31:19 +00:00
dan
32b09f29c9 Do not check immediate foreign key constraints until the end of the statement. This matches the postgres behaviour.
FossilOrigin-Name: 1a32149cc3c722058f4ed4c81edadeb6ce5bc9e4
2009-09-23 17:29:59 +00:00
dan
d981d44781 Disallow using the implicit rowid column as the parent key of an FK constraint.
FossilOrigin-Name: a5f7e71f424900071a3925e53e9128c9148ea2e8
2009-09-23 13:59:17 +00:00
drh
6f94702f20 Add test cases for the IS and IS NOT operator.
FossilOrigin-Name: 101ed58cf4a1dfe53031b98cfc7ed01e86b4c7b6
2009-09-23 13:39:56 +00:00
dan
a8f0bf643e Add extra tests for foreign key support.
FossilOrigin-Name: 7d086afe69da4d03bd1de5408626858273f91e8f
2009-09-23 12:06:52 +00:00
dan
f59c5cacb8 Fix another OOM related problem in fkey.c.
FossilOrigin-Name: e2bc51bc61d54d103ccffd12106c27a574e4e997
2009-09-22 16:55:38 +00:00
dan
934ce300a0 Fix a problem with ON DELETE SET DEFAULT actions.
FossilOrigin-Name: 9406995055f53639b0af46985c7b0a24a80308ae
2009-09-22 16:08:58 +00:00
dan
29c7f9caac Fix an OOM related crash in fkey.c.
FossilOrigin-Name: 635d6a775a3f192d4292738905f5e01bc956a712
2009-09-22 15:53:47 +00:00
shane
3e82c1d99b Allow specific exclusion of localtime_s() usage on Windows.
FossilOrigin-Name: 216bcda7d2818efda55849d5cb84aa483bc6429b
2009-09-22 13:25:00 +00:00
dan
3606264bc9 Fix a problem with foreign key constraints that map from and IPK column.
FossilOrigin-Name: 84129052623dc6a175c76db602ab07fa3e57f1eb
2009-09-21 18:56:23 +00:00
dan
e83c4f3a9e Fix compilation with both OMIT_UTF16 and ENABLE_STAT2 defined. Ticket [56928bd084ea530eb8a0b3ebe5d2d9033fb1de7f|56928bd084].
FossilOrigin-Name: cd850d49a12a2852258cbd7d5db56715132dff17
2009-09-21 16:34:24 +00:00
dan
75cbd984f7 Fix compilation with OMIT_TRIGGER defined. Ticket [1ff6d29030e9757d052af0f394e56bea96b8b59b|1ff6d29030].
FossilOrigin-Name: fb6ceed388f6d75bdc2ac2f43e5c98da74e2a448
2009-09-21 16:06:03 +00:00
dan
1da40a381f Check in implementation of foreign key constraints.
FossilOrigin-Name: d5d399811876391642937edeb9e8434dd9e356f5
2009-09-19 17:00:31 +00:00
drh
3991bb0dee When coding a trigger, assume that the "oldmask" requires all columns until
we know otherwise.  That pessimistic assumption assures that all necessary
parameters are available on a cascading delete trigger.
Ticket [e25d9ea771f]

FossilOrigin-Name: 03e464be51a1c36fc02cf31178ae91f736dfddd6
2009-09-17 00:41:19 +00:00
drh
3492dd71dd Make sure sufficient space is allocated for at least one VDBE cursor when
autoincrement is used.  Ticket [a696379c1f088].

FossilOrigin-Name: 2b2a1ef74e24857b8d18f6370894588fc2aa5ebb
2009-09-14 23:47:24 +00:00
dan
59d60c2cac Fix a problem in test script corrupt.test.
FossilOrigin-Name: dad2b74ad0a86ff07c77f0a60b26480fc0a2e54d
2009-09-10 18:04:02 +00:00
dan
43bc88bbe8 Remove an ALWAYS macro around an expression that is sometimes false.
FossilOrigin-Name: f2a9ee722c568e73f2a08fb6a2886719850f2923
2009-09-10 10:15:59 +00:00
dan
11b3879b18 Trying to open a transaction in one thread and close it in another is a misuse with LinuxThreads. Doing so may cause memory and file-descriptors to be leaked. Update an assert() and some test cases to account for this.
FossilOrigin-Name: ef99eb57c536d82e7c19fd3d990c17793cc64a3f
2009-09-09 18:46:52 +00:00
dan
ae0931edae Add some tests that involve BEFORE UPDATE or BEFORE DELETE triggers messing with the row being updated or deleted. SQLite behaviour in this scenario is undefined, so the tests just check that the behaviour is relatively sane and there are no crashes.
FossilOrigin-Name: 9a4c59a2ddd0df2d9425097004b450a6685f2147
2009-09-09 15:06:10 +00:00
dan
0fe60783c1 Add a test case to show that [/info/29ab7be99f|29ab7be99f] is fixed.
FossilOrigin-Name: 135d656a20a2a450955ed9ec57d9637cf31493c6
2009-09-09 11:43:43 +00:00
dan
e0af83aca6 Combine the OP_Statement and OP_Transaction opcodes.
FossilOrigin-Name: aec9dbd8d21c55c3945287a3dfa55d3ed168f977
2009-09-08 19:15:01 +00:00
dan
2283d46cd6 If recursive-triggers are enabled, fire DELETE triggers if database rows are removed as a result of OR REPLACE conflict resolution.
FossilOrigin-Name: 85cb0c94a63eda5f059ebe40887c7af9b4869893
2009-09-08 15:55:15 +00:00
drh
417168ade2 Add the SQLITE_LIMIT_TRIGGER_DEPTH option to sqlite3_limit().
FossilOrigin-Name: d7dc8b433691745b3842282569f1573d1e057963
2009-09-07 18:14:02 +00:00
drh
d7d385dde0 Do not reuse function parameters in subsequent expressions since the
function call might have triggered a text encoding change.
Fix for ticket [2ea2425d34be].

FossilOrigin-Name: f22e388727f0ba0f187cdee51ff8ba17a5d50b8a
2009-09-03 01:18:00 +00:00
dan
5bde73c4eb Change "PRAGMA disable_recursive_triggers" to "PRAGMA recursive_triggers". Also a fix for compiling with OMIT_TRIGGER defined.
FossilOrigin-Name: e016cca36390451d5d1c6e0d1b3cdbd6d869be1a
2009-09-01 17:11:07 +00:00
dan
436355a091 Add new test script triggerC.test.
FossilOrigin-Name: a2a062a4b52f45af85c195582a36d1b76d2675db
2009-09-01 16:19:19 +00:00
dan
2832ad4221 More fixes for test cases.
FossilOrigin-Name: 85d9f23be1e8673dbda42e43b9b23332ada9225f
2009-08-31 15:27:27 +00:00
dan
2bd935168e Fix some authorization callback problems.
FossilOrigin-Name: 8a746fbfd51f70f56e25ade59df49d2dc03c131c
2009-08-31 08:22:46 +00:00
dan
c02008333c Merge with main branch.
FossilOrigin-Name: 6e09e28751a7071969ef9f3445f4092d2c28f358
2009-08-31 05:39:58 +00:00
dan
523a087b9e Fix another test problem and some instances where an OOM may cause a segfault.
FossilOrigin-Name: 31199db0f77cf4b32d5589a29abd9535b155164b
2009-08-31 05:23:32 +00:00
dan
76d462ee78 Fixes for new triggers scheme.
FossilOrigin-Name: 9eb91efda5241609ff18ff15ef5eaa0e86788eab
2009-08-30 11:42:51 +00:00
dan
165921a742 Changes to support recursive triggers.
FossilOrigin-Name: 9b9c19211593d5ff7b39254a29c284560a8bcedb
2009-08-28 18:53:45 +00:00
drh
fd3ca1c680 Merge together the os_unix.c fix of [aa6acfa8ca] and the trigger fix of
[dee1b8eb40].

FossilOrigin-Name: 1e2c6e134e04dd22795ad4839874ec0edd9b0970
2009-08-25 12:11:00 +00:00
drh
e408edac16 Run the column cache in a new context when generating code for trigger
programs.  Fix for ticket [efc02f9779].

FossilOrigin-Name: dee1b8eb402f47c6d5ee60aac28f8e3dcf98167f
2009-08-24 01:35:25 +00:00
dan
e946c3966a Fix a problem in os_unix.c where a malloc failure could lead to a leaked file descriptor.
FossilOrigin-Name: aa6acfa8caa2ef59b4c16dfe42c4b5644da96905
2009-08-22 11:39:46 +00:00
dan
08da86a68e When a database file is opened, try to find an unused file descriptor to reuse. This change affects unix (and other systems that use os_unix.c) only. Fix for cvstrac ticket [http://www.sqlite.org/cvstrac/tktview?tn=4018|#4018].
FossilOrigin-Name: 9b4d9ab62d687289837b13b07885e72cc3abe8a9
2009-08-21 17:18:03 +00:00
shane
6085f5e0a0 Updated sqlite3AtoF() that performs slightly better with GCC, and significantly better with MSVC.
FossilOrigin-Name: f084f5a8ba850de627ca8e9de6c81ab1ad9b7a1b
2009-08-21 02:13:14 +00:00
drh
98cdf62690 Continuing refinements of the range-scan optimizations in where.c.
The range scores are changed from an integer 1..9 to 0..100.

FossilOrigin-Name: f0c24b5fb86940f1a88adfb39cc4b9cbfcc66f8a
2009-08-20 18:14:42 +00:00
dan
68c4dbbdfc Change the code that collects samples for sqlite_stat2 so that the first sample taken is the (nRow/(2*SQLITE_INDEX_SAMPLES))th entry in the index, where nRow is the total number of index entries.
FossilOrigin-Name: cbfe6e9df39684607cbc9637e3fb3c5ee6af2515
2009-08-20 09:11:06 +00:00
dan
4190326626 Merge 29cafcfdcc and a6f39181a7.
FossilOrigin-Name: 740a93e89c5f12672d72de7b3c55807deac613d4
2009-08-19 16:21:25 +00:00
dan
dec221e352 Add some tests that use the sqlite_stat2 table in shared-cache mode.
FossilOrigin-Name: 29cafcfdccf4c0a27746b9a82fa4191605a4505a
2009-08-19 15:34:59 +00:00
dan
9267f85790 Merge with 709e16145e.
FossilOrigin-Name: 6c8a0e2b37d9f4399ef90a44cbc492526201d0d5
2009-08-19 14:42:25 +00:00
dan
85c165caca Clean up sqlite_stat2 related code. Add test cases.
FossilOrigin-Name: aa728e06ce456fa42e68687bff6c7424460c31ef
2009-08-19 14:34:54 +00:00
dan
69188d9a66 Add the SQLITE_ENABLE_STAT2 macro. If this is not defined at build-time, the stat2 table is not created, populated, or used.
FossilOrigin-Name: 362665e89c21fd603d9f8ad6c0ead590e885af7c
2009-08-19 08:18:32 +00:00
shane
6c53320320 Adjust sync count for SQLITE_DISABLE_DIRSYNC compiler option.
FossilOrigin-Name: 709e16145e37940cb243eede75071fb15095d960
2009-08-19 04:24:48 +00:00
dan
e275dc3fb8 Change the sqlite_stat2 schema to be more flexible.
FossilOrigin-Name: ded9dec6459baf21e01f63250db5ace57f390e7a
2009-08-18 16:24:58 +00:00
drh
feb306f556 Unknown functions in the DEFAULT clause of a table cause an error when
the DEFAULT value is needed.  Ticket [2d401a94287b5].

FossilOrigin-Name: 093917d7fda442012dfd1a1b2f20f85d2eefa093
2009-08-18 16:05:46 +00:00
dan
02fa469619 First version of sqlite_stat2 (schema forces exactly 10 samples).
FossilOrigin-Name: dd96bda2a85c1d94fb4a0bf5f27e2977f7f7e42e
2009-08-17 17:06:58 +00:00
dan
3d6e060b48 Move error simulation code from the sqlite3_os_init() functions into a wrapper.
FossilOrigin-Name: 67ad21abf88abb7a3e2eacddcaf1ab5d54149807
2009-08-17 15:52:25 +00:00
shane
7c7c311da5 More documentation and comment updates for sqlite3_initialize/shutdown interface changes to handle failures.
FossilOrigin-Name: 32509bc7339cd6a46cea4c243e3418546860cb2d
2009-08-17 15:31:23 +00:00
dan
e1ab219309 Add tests to check that sqlite recovers from an error in sqlite3_initialize() correctly.
FossilOrigin-Name: 904a371c6c9d3f20332b37767b06161fa0a78113
2009-08-17 15:16:19 +00:00
dan
d768f944d9 Add a test to verify that 3.6.17 releases read-locks obtained to read the database schema even if the connection is not currently in auto-commit mode.
FossilOrigin-Name: 78dfe8321db9debfcd4a7f3daf4223d0cbf23ab9
2009-08-17 09:29:09 +00:00
dan
4361e79f14 Fix a case where SQLite may write past the end of a buffer as a result of a corrupted database file.
FossilOrigin-Name: 43321a556031942389ca11b033c1eae46ac6141b
2009-08-14 17:01:22 +00:00
drh
c4fa5315a5 Tweak to the new whereB.test file to make it more consistent.
FossilOrigin-Name: 06098505fca5c67b627a9e1102451f93e490e192
2009-08-13 19:54:26 +00:00
drh
320b3a7a3a Enhancements to the whereB.test to check more affinity corner cases.
FossilOrigin-Name: 1048459824746307c9e4296cbc21716bf8b5449d
2009-08-13 18:14:32 +00:00
drh
9fa7207b1b Add a test case for the affinity problem reported by ticket [93fb9f89d6].
FossilOrigin-Name: 149ec24e61437fac2b0dd6239276d3aa543c56cb
2009-08-13 17:14:59 +00:00
drh
3da9a940b7 Merge the accidental fork.
FossilOrigin-Name: 86a06dd0494c2fe83d4fde517557600956cedd9e
2009-08-13 15:42:52 +00:00
dan
5236ac1d04 Changes to the query planner that improve the order in which tables/indexes are scanned in join queries.
FossilOrigin-Name: 19f799b32f9d1be25d4185ce18b13f4dd502e199
2009-08-13 07:09:33 +00:00
shane
d87873d19b Fixed some compiler warnings in WINCE only sections when using the MSVC compiler.
FossilOrigin-Name: 1f0a93e17d6291268da909699ce1a5a7619ae637
2009-08-12 15:34:02 +00:00
danielk1977
8f00a826ca Update a couple of tests in corrupt7.test to account for a change in the error message text emitted by SQLite. (CVS 6968)
FossilOrigin-Name: 3172a296926c6b50af5b6edfe38013056e155fa0
2009-08-10 10:18:07 +00:00
danielk1977
f77a367db4 Change mallocI.test to close a database connection that was being left open. (CVS 6966)
FossilOrigin-Name: 4f0096d7ef43f4b9f32c4d78b3dfe34271f2120a
2009-08-10 04:26:39 +00:00
drh
3d5f74b275 Alternative fix for ticket #3810. This is a replacement for check-in (6956). (CVS 6960)
FossilOrigin-Name: ba1afc040171810d0c996708d7b9cb11abcd99d8
2009-08-06 17:43:31 +00:00
drh
b4bc2b7a07 Make sure all database connections are closed at the end of the test case
for ticket #3810. (CVS 6957)

FossilOrigin-Name: 9bca5a0e8f22da6be41b0eda298fd2e19f64e8b6
2009-08-01 18:22:30 +00:00
drh
35ccb3d3bc Return a better error message when problems are encountered parsing a
TEMP trigger or TEMP view that references objects in other databases that
have been modified or dropped.  Ticket #3810. (CVS 6956)

FossilOrigin-Name: 102785b9fbc5ab5dd740110243f080e3f3661e87
2009-08-01 16:27:00 +00:00
drh
a0e0d8ea98 Add a testcase for ticket #3810. (CVS 6955)
FossilOrigin-Name: 29972f7445cede64d99c2433742572120c92b393
2009-08-01 15:54:25 +00:00