Commit Graph

7039 Commits

Author SHA1 Message Date
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
e1e2ae2d3f Fix a bug in the code for REPLACE conflict handling on IPK columns when there are no indexes on the table. Triggers and foreign key processing were being bypassed.
FossilOrigin-Name: beb2094f94849c66d98bab5999ff474cd91eea11
2009-09-24 16:52:28 +00:00
dan
8c430041f5 Fix a problem in fkey.c when a child key is the IPK of its table.
FossilOrigin-Name: 8a000a8aae4d356e68acf2bc1788d2c40279522c
2009-09-24 15:16:33 +00:00
drh
46803c3e0b Remove the ALWAYS() added by the previous check-in. It is not needed.
FossilOrigin-Name: 36568963356e3919e8b862e7e40ded2eae7ce187
2009-09-24 14:27:33 +00:00
drh
1f638ceb34 Comment enhancements. Add an ALWAYS macro in fkey.c to indicate a branch
that is always taken.

FossilOrigin-Name: d5b714cffffe588dd4dd10e0b82df8d99657be88
2009-09-24 13:48:10 +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
dan
4bb3b679b0 Use sqlite3FkOldmask() in delete.c instead of assuming that foreign key constraints always require all columns of the deleted row to be stored in registers.
FossilOrigin-Name: ce554a393401fc2fb9b5be049ddd383070102934
2009-09-24 10:42:09 +00:00
dan
94d7f50a0f Remove unused parameter from sqlite3CodeRowTrigger(). Fix header comments for this function and CodeRowTriggerDirect().
FossilOrigin-Name: 0443f7c9112ca91aa45c78a3d6287e5fcf5c3b73
2009-09-24 09:05:49 +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
8a2fff7a78 Fix a problem with FK constraints that implicitly map to a composite primary key.
FossilOrigin-Name: e0a48d53110130de75602603f524539e421a9dba
2009-09-23 18:07:22 +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
drh
f1dfc4fbb3 Modify the ".dump" command on the CLI so that it always issues a
PRAGMA foreign_keys=OFF at the top of the output.

FossilOrigin-Name: 0755b9b697d32292f378a4b934ca1cf9f56225cd
2009-09-23 15:51:35 +00:00
drh
6d4486ae9f Change the version number to 3.6.19. Fix a couple of incorrect testcase()
macros associated with the new IS and IS NOT operators in expr.c.

FossilOrigin-Name: e3b73394bf9c0391e997079b160eace3589415ab
2009-09-23 14:45:05 +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
8099ce6f4a Add missing comments to fkey.c. Also, change the terminology used for comments and names in fkey.c from "referenced/referencing" to "parent/child". This is arguably less correct, but is easier to follow.
FossilOrigin-Name: 540c2d18e14c277b55f95729fbafc04ca66466b2
2009-09-23 08:43:35 +00:00
drh
788536b165 Do not run ON UPDATE actions of a foreign key constraint unless at least one
column value really does change.

FossilOrigin-Name: 71ac8e28e55ff0250ebe2fe239159ce2458d9165
2009-09-23 03:01:58 +00:00
drh
6a2fe09387 Generalize the IS and IS NOT operators so that their right-hand side can be
an arbitrary expression and not simple the constant NULL.  They work like
= and <> except that NULL values compare equal to one another an unequal to
everything else.

FossilOrigin-Name: 98853f6104076c50ea92175e17a3254bfbbd4619
2009-09-23 02:29:36 +00:00
drh
7ba5bc5bf2 Factor the UMINUS and UPLUS tokens out of the parser so that the parser
tables can go back to using 8-bit values instead of 16-bit values.

FossilOrigin-Name: 3fc938c961fd7810594224b91a2d6e1ac9e48084
2009-09-22 20:08:34 +00:00
drh
9c8abf2b14 The NO ACTION action really should be no-action and not RESTRICT.
FossilOrigin-Name: 55b263fa2b2fed8c721154e3c48f4226be95065c
2009-09-22 19:53:41 +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
ba9108b84a Fix compilation errors when OMIT_FOREIGN_KEY is defined.
FossilOrigin-Name: c447cb37d6439090eb08028d54a91d7d06043744
2009-09-22 07:13:42 +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
3be7d6eb75 Add fkey.c to the autoconf and amalgamation build systems.
FossilOrigin-Name: aab7a4b3c91e0a149f6499660892d09c17b010e3
2009-09-19 17:59:59 +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
drh
323eb20464 Set the execute permission bit on "configure".
FossilOrigin-Name: f8c02b2b720e26a9ca7e35cb8015888fae538351
2009-09-11 18:28:53 +00:00
drh
4d11afe3bb Make sure the (unsupported) configure script in the source tree has
execute permission prior to constructing a tarball.
Ticket [65bbb65a47ce].

FossilOrigin-Name: 5e0e941f3adf09c5f315e27cefdc968c59aa574e
2009-09-11 17:59:55 +00:00
drh
92aa5eacd8 Add an #ifndef so that the build works with SQLITE_OMIT_ANALYZE again.
FossilOrigin-Name: b084828a771ec40be85f07c590ca99de4f6c24ee
2009-09-11 14:05:06 +00:00
drh
d0bc5d2aa6 Omit the mutexIsInit test variable when mutexes are disabled.
FossilOrigin-Name: 3ea10434434d27a1300ba2b58e2c47c54909f4ff
2009-09-10 22:30:53 +00:00
shane
11bb41f878 Fixed some warnings and an assert in the WINCE code when compiling under MSVC.
FossilOrigin-Name: f42ec993ac9d42ca31305f26b09924108c36d9f4
2009-09-10 20:23:30 +00:00
drh
08da4bb16e Make sure the threadsOverrideEachOthersLocks variable is only referenced by
linux systems on a threadsafe compile.

FossilOrigin-Name: e9d064bd9318c2bc9248df948f71fd30f24525eb
2009-09-10 19:20:03 +00:00
shane
abc6b89085 Cleanup of warnings on MSVC build.
FossilOrigin-Name: 5588cc96bbe0b9df5f8d31f8f2d2b48b3f54ff09
2009-09-10 19:09:03 +00:00