Merge the latest fixes from trunk.
FossilOrigin-Name: 1ba3b3ccf145d84fa75afabe2fa925f65e43f815b25b15bd60073a41aa97bf57
This commit is contained in:
commit
41db500274
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Improved\scomment\sfield\sin\sthe\sbytecode\sgenerated\sfor\sOP_Column\sand\sOP_Rowid.
|
||||
D 2022-04-18T13:57:57.631
|
||||
C Merge\sthe\slatest\sfixes\sfrom\strunk.
|
||||
D 2022-04-18T14:41:24.045
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -505,7 +505,7 @@ F src/dbstat.c 861e08690fcb0f2ee1165eff0060ea8d4f3e2ea10f80dab7d32ad70443a6ff2d
|
||||
F src/delete.c a8e844af211a48b13b5b358be77a12c860c6a557c21990ad51a548e2536500ce
|
||||
F src/expr.c 0714987d576d13acb64630274677ff0df336013bf83dfc1ff24a339b8ae2ae81
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c 94927f9b46d72a9cb858c208febf04ceb0a3270c5fa5fd0b7f436cf16e09f72a
|
||||
F src/fkey.c d965ede15d8360c09ed59348940649ee647b192e784466837d7aefa836d1d91e
|
||||
F src/func.c a3407a6fbb0d4088d8d502e46f0ace63e0aeae7467ae23a9ca9815bbf9239761
|
||||
F src/global.c e83ee571b79ee3adc32e380cf554cf1254bc43763d23786c71721fbcdfbbb965
|
||||
F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
|
||||
@ -553,7 +553,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
|
||||
F src/resolve.c ce4cb0889f1bf5990b698740b88026385cf6f30222fde1f02a3168bb780eb579
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 6544e02167adbb89a7152acf6ff2f0218a6de94146377b83e79bc8b09bf6f16e
|
||||
F src/shell.c.in eb7f10d5e2c47bd014d92ec5db1def21fcc1ed56ffaaa4ee715b6c37c370b47f
|
||||
F src/shell.c.in ecff6f4ab0e8e25acd578b3eb27ac0bad4d48643c160259a277151d6e9d412e1
|
||||
F src/sqlite.h.in 2a35f62185eb5e7ecc64a2f68442b538ce9be74f80f28a00abc24837edcf1c17
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h f49e28c25bd941e79794db5415fdf7b202deb3bc072ed6f1ed273d578703684e
|
||||
@ -920,7 +920,7 @@ F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
|
||||
F test/fkey5.test 6727452e163a427147e84e739da18713da553d79f9783559b04fdcd36d5c7421
|
||||
F test/fkey6.test d078a1e323a740062bed38df32b8a736fd320dc0
|
||||
F test/fkey7.test 64fb28da03da5dfe3cdef5967aa7e832c2507bf7fb8f0780cacbca1f2338d031
|
||||
F test/fkey8.test 48ef829d63f5f7b37aabd4df9363ac05f65539d1da8c4a44251631769d920579
|
||||
F test/fkey8.test 51deda7f1a1448bca95875e4a6e1a3a75b4bd7215e924e845bd60de60e4d84bf
|
||||
F test/fkey_malloc.test 594a7ea1fbab553c036c70813cd8bd9407d63749
|
||||
F test/fordelete.test ba98f14446b310f9c9d935b97ec748753d0144a28b356ba30d1f4f6958fdde5c
|
||||
F test/format4.test eeae341953db8b6bda7f549044797c3278a6cc345d11ada81471671b654f8ef4
|
||||
@ -1948,8 +1948,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 9168cbbedd1c9d735279295a78212d830e24269f6d7e445e71faa2c06973223d
|
||||
R a4c354da2123e1486588766b1d4b51f3
|
||||
P 009bbf8026106c5a74cced06cced48badb870a4b6e6a2f8104a544d2a8d79e45 1b2c5cef9560123344db391cd065090d1914724715ec6643d2d9b5fac2051a21
|
||||
R 7231a9090bdeb7be15e705cd24ff1359
|
||||
U drh
|
||||
Z 78587092c64ce3133bf29634c7d55b8b
|
||||
Z 90235891d6fa6cd74fed426055fa90a6
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
009bbf8026106c5a74cced06cced48badb870a4b6e6a2f8104a544d2a8d79e45
|
||||
1ba3b3ccf145d84fa75afabe2fa925f65e43f815b25b15bd60073a41aa97bf57
|
17
src/fkey.c
17
src/fkey.c
@ -534,14 +534,10 @@ static Expr *exprTableColumn(
|
||||
** Operation | FK type | Action taken
|
||||
** --------------------------------------------------------------------------
|
||||
** DELETE immediate Increment the "immediate constraint counter".
|
||||
** Or, if the ON (UPDATE|DELETE) action is RESTRICT,
|
||||
** throw a "FOREIGN KEY constraint failed" exception.
|
||||
**
|
||||
** INSERT immediate Decrement the "immediate constraint counter".
|
||||
**
|
||||
** DELETE deferred Increment the "deferred constraint counter".
|
||||
** Or, if the ON (UPDATE|DELETE) action is RESTRICT,
|
||||
** throw a "FOREIGN KEY constraint failed" exception.
|
||||
**
|
||||
** INSERT deferred Decrement the "deferred constraint counter".
|
||||
**
|
||||
@ -1189,9 +1185,9 @@ int sqlite3FkRequired(
|
||||
**
|
||||
** It returns a pointer to a Trigger structure containing a trigger
|
||||
** equivalent to the ON UPDATE or ON DELETE action specified by pFKey.
|
||||
** If the action is "NO ACTION" or "RESTRICT", then a NULL pointer is
|
||||
** returned (these actions require no special handling by the triggers
|
||||
** sub-system, code for them is created by fkScanChildren()).
|
||||
** If the action is "NO ACTION" then a NULL pointer is returned (these actions
|
||||
** require no special handling by the triggers sub-system, code for them is
|
||||
** created by fkScanChildren()).
|
||||
**
|
||||
** For example, if pFKey is the foreign key and pTab is table "p" in
|
||||
** the following schema:
|
||||
@ -1320,18 +1316,23 @@ static Trigger *fkActionTrigger(
|
||||
nFrom = sqlite3Strlen30(zFrom);
|
||||
|
||||
if( action==OE_Restrict ){
|
||||
int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
|
||||
Token tFrom;
|
||||
Token tDb;
|
||||
Expr *pRaise;
|
||||
|
||||
tFrom.z = zFrom;
|
||||
tFrom.n = nFrom;
|
||||
tDb.z = db->aDb[iDb].zDbSName;
|
||||
tDb.n = sqlite3Strlen30(tDb.z);
|
||||
|
||||
pRaise = sqlite3Expr(db, TK_RAISE, "FOREIGN KEY constraint failed");
|
||||
if( pRaise ){
|
||||
pRaise->affExpr = OE_Abort;
|
||||
}
|
||||
pSelect = sqlite3SelectNew(pParse,
|
||||
sqlite3ExprListAppend(pParse, 0, pRaise),
|
||||
sqlite3SrcListAppend(pParse, 0, &tFrom, 0),
|
||||
sqlite3SrcListAppend(pParse, 0, &tDb, &tFrom),
|
||||
pWhere,
|
||||
0, 0, 0, 0, 0
|
||||
);
|
||||
|
@ -7833,7 +7833,7 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){
|
||||
#endif /* !(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) */
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* zAutoColumn(zCol, &db, ?) => Maybe init db, add column zCol to it.
|
||||
* zAutoColumn(0, &db, ?) => (db!=0) Form columns spec for CREATE TABLE,
|
||||
* close db and set it to 0, and return the columns spec, to later
|
||||
@ -7916,6 +7916,13 @@ UPDATE ColNames AS t SET reps=\
|
||||
static const char * const zColDigits = "\
|
||||
SELECT CAST(ceil(log(count(*)+0.5)) AS INT) FROM ColNames \
|
||||
";
|
||||
#else
|
||||
/* Counting on SQLITE_MAX_COLUMN < 100,000 here. (32767 is the hard limit.) */
|
||||
static const char * const zColDigits = "\
|
||||
SELECT CASE WHEN (nc < 10) THEN 1 WHEN (nc < 100) THEN 2 \
|
||||
WHEN (nc < 1000) THEN 3 WHEN (nc < 10000) THEN 4 \
|
||||
ELSE 5 FROM (SELECT count(*) AS nc FROM ColNames) \
|
||||
";
|
||||
#endif
|
||||
static const char * const zRenameRank =
|
||||
#ifdef SHELL_COLUMN_RENAME_CLEAN
|
||||
@ -8001,11 +8008,7 @@ FROM (\
|
||||
/* Formulate the columns spec, close the DB, zero *pDb. */
|
||||
char *zColsSpec = 0;
|
||||
int hasDupes = db_int(*pDb, zHasDupes);
|
||||
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
|
||||
int nDigits = (hasDupes)? db_int(*pDb, zColDigits) : 0;
|
||||
#else
|
||||
# define nDigits 2
|
||||
#endif
|
||||
if( hasDupes ){
|
||||
#ifdef SHELL_COLUMN_RENAME_CLEAN
|
||||
rc = sqlite3_exec(*pDb, zDedoctor, 0, 0, 0);
|
||||
|
@ -228,4 +228,26 @@ do_execsql_test 5.3 {
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
forcedelete test.db2
|
||||
do_execsql_test 6.1 {
|
||||
PRAGMA foreign_keys = on;
|
||||
CREATE TABLE c1(b);
|
||||
INSERT INTO c1 VALUES(123);
|
||||
}
|
||||
|
||||
do_execsql_test 6.2 {
|
||||
ATTACH 'test.db2' AS aux;
|
||||
CREATE TABLE aux.p1(a INTEGER PRIMARY KEY);
|
||||
CREATE TABLE aux.c1(b REFERENCES p1(a) ON DELETE RESTRICT);
|
||||
|
||||
INSERT INTO aux.p1 VALUES(123);
|
||||
}
|
||||
|
||||
do_execsql_test 6.3 {
|
||||
DELETE FROM aux.p1 WHERE a=123;
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user