]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Any function call can abort. Take this into account when deciding if a DML
authordrh <>
Tue, 30 Aug 2022 00:11:51 +0000 (00:11 +0000)
committerdrh <>
Tue, 30 Aug 2022 00:11:51 +0000 (00:11 +0000)
statement needs a statement journal.  See
[forum:/forumpost/9b9e4716c0d7bbd1|forum thread 9b9e4716c0d7bbd1] for more
information.

FossilOrigin-Name: 5c95ae6c9b93b9bcf698bb1cad93b2da2e28121b35e7c539b1ddc0ef2de33cfe

manifest
manifest.uuid
src/vdbeaux.c
test/json101.test

index 30df2a135211367664c860304136ffd0b3267559..3c24e60572f59679e77cd7d3afd79cdc6fc8d915 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C More\sassert()\sstatements\sin\sthe\spage\scache.
-D 2022-08-27T16:11:00.802
+C Any\sfunction\scall\scan\sabort.\s\sTake\sthis\sinto\saccount\swhen\sdeciding\sif\sa\sDML\nstatement\sneeds\sa\sstatement\sjournal.\s\sSee\n[forum:/forumpost/9b9e4716c0d7bbd1|forum\sthread\s9b9e4716c0d7bbd1]\sfor\smore\ninformation.
+D 2022-08-30T00:11:51.654
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -664,7 +664,7 @@ F src/vdbe.c d27ec9a57f752fc2acf6a64d43bbf6072d2415efc976184f6d8a146e65819d3b
 F src/vdbe.h 64619af62603dc3c4f5ff6ff6d2c8f389abd667a29ce6007ed44bd22b3211cd0
 F src/vdbeInt.h 17b7461ffcf9ee760d1341731715a419f6b8c763089a7ece25c2e8098d702b3f
 F src/vdbeapi.c fc3183daf72808b4311b228989120fdbc2dc44972fb0d77d5c453460cc0e5b2c
-F src/vdbeaux.c 1f33d20fc19f13ad781ee083276ffad2204a182617859895db9daa3412456457
+F src/vdbeaux.c c719cebaffa75e166f16a405b3dee96e7150d60fc563ab2dea716b60c6a51312
 F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd
 F src/vdbemem.c c3ce80af15e2ff5c2824a8db881681cbf511376f13613da020bac6d320c535b1
 F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35
@@ -1202,7 +1202,7 @@ F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ff
 F test/jrnlmode.test 9b5bc01dac22223cb60ec2d5f97acf568d73820794386de5634dcadbea9e1946
 F test/jrnlmode2.test 8759a1d4657c064637f8b079592651530db738419e1d649c6df7048cd724363d
 F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
-F test/json101.test 9d46b8e254c4e23306da175dd226d5c4f164db6b294bcea98e5dcd891ba48c91
+F test/json101.test 9f6337e7423d2c1774d1d485c919fc4e11c8f7e423a2f8831f73471983432108
 F test/json102.test 327e77275f338c028faefa2da5164daf6b142a165e3015ff2a6e4251ddc6a0ac
 F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe
 F test/json104.test a502dc01853aada95d721b3b275afbe2dc18fffdac1fea6e96fb20c13586bbb5
@@ -1999,8 +1999,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 e67f03c166277951725c194674c84da61c152a5820aa6df55a726f7dda838e92
-R c207204f107e850d8e2aa83942d0fc9c
+P 7c96a56c0d1de966844da6c5a84c0cd6066130a10724797ce6f228a9182d9b85
+R d226864f8cee6eb0d81fc9d58efcbd85
 U drh
-Z 3df13e569c05286e45e508a55914ef8f
+Z 9f6d1bb5822b24330e59c622b60a8f90
 # Remove this line to create a well-formed Fossil manifest.
index a04ed0e9efd0e77c8d85adc4f81e0b9f277457c3..7a3219289b426d0458e3ffe63b6525c9f61e3835 100644 (file)
@@ -1 +1 @@
-7c96a56c0d1de966844da6c5a84c0cd6066130a10724797ce6f228a9182d9b85
\ No newline at end of file
+5c95ae6c9b93b9bcf698bb1cad93b2da2e28121b35e7c539b1ddc0ef2de33cfe
\ No newline at end of file
index a4b4516c04987c67cb7bd030e46d989865a67c0d..8785e3b568f4d02a513ea02083e735deb01b8045 100644 (file)
@@ -388,6 +388,7 @@ int sqlite3VdbeAddFunctionCall(
   addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function,
                            p1, p2, p3, (char*)pCtx, P4_FUNCCTX);
   sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef);
+  sqlite3MayAbort(pParse);
   return addr;
 }
 
@@ -723,6 +724,7 @@ int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
      || opcode==OP_VDestroy
      || opcode==OP_VCreate
      || opcode==OP_ParseSchema
+     || opcode==OP_Function || opcode==OP_PureFunc
      || ((opcode==OP_Halt || opcode==OP_HaltIfNull) 
       && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
     ){
index b84846d8889c99ed2c286113f0788e14c29d4482..135c988e97b5bd06bfaf5ec1068023fa69bdaa43 100644 (file)
@@ -867,4 +867,22 @@ do_catchsql_test json-18.5 {
   SELECT json_extract('{"":8}', '$.');
 } {1 {JSON path error near ''}}
 
+# 2022-08-29 https://sqlite.org/forum/forumpost/9b9e4716c0d7bbd1
+# This is not a problem specifically with JSON functions.  It is
+# a problem with transaction control.  But the json() function makes
+# the problem more easily accessible, so it is tested here.
+#
+do_execsql_test json-19.1 {
+  DROP TABLE IF EXISTS t1;
+  CREATE TABLE t1(x);
+} {}
+do_catchsql_test json-19.2 {
+  BEGIN;
+  INSERT INTO t1 VALUES(0), (json('not-valid-json'));
+} {1 {malformed JSON}}
+do_execsql_test json-19.3 {
+  COMMIT;
+  SELECT * FROM t1;
+} {}
+
 finish_test