From: drh <> Date: Sun, 17 Mar 2024 16:01:23 +0000 (+0000) Subject: Omit the "noop(X)" test SQL function. Accomplish the same thing using X-Git-Tag: version-3.46.0~123^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54bf109e807cc2c12cd81883affd008d718d0748;p=thirdparty%2Fsqlite.git Omit the "noop(X)" test SQL function. Accomplish the same thing using the idiom: "coalesce(X,random())". FossilOrigin-Name: 0eb2fbb8910e7a372c50db3ae44238d7b161f0e45858b74061b5228aec5fcc7e --- diff --git a/manifest b/manifest index d667045fa5..7f30177097 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sALWAYS\son\san\sunreachable\sbranch. -D 2024-03-17T00:13:12.278 +C Omit\sthe\s"noop(X)"\stest\sSQL\sfunction.\s\sAccomplish\sthe\ssame\sthing\susing\nthe\sidiom:\s\s"coalesce(X,random())". +D 2024-03-17T16:01:23.923 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -760,7 +760,7 @@ F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 F src/tclsqlite.c ecbc3c99c0d0c3ed122a913f143026c26d38d57f33e06bb71185dd5c1efe37cd -F src/test1.c 5a67577fa7d93a19a72aa165b7013606a35e53f62d0de11587940aed5797d92d +F src/test1.c 310f43eb17a9252a7790726ca652e4ea3197da17c19eec93b8578863a49dc7b4 F src/test2.c 54520d0565ef2b9bf0f8f1dcac43dc4d06baf4ffe13d10905f8d8c3ad3e4b9ab F src/test3.c e5178558c41ff53236ae0271e9acb3d6885a94981d2eb939536ee6474598840e F src/test4.c 4533b76419e7feb41b40582554663ed3cd77aaa54e135cf76b3205098cd6e664 @@ -1271,7 +1271,7 @@ F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8 F test/in.test d1cad4ededd425568b2e39fb0c31fa9a3772311dd595801ff13ba3912b69bba6 F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75 F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0 -F test/in4.test 176719161ba96c9386027891602700738aadac3419964f72b628f59d2071d53d +F test/in4.test bb767ec1cfd1730256f0a83219f0acda36bc251b63f8b8bb7d8c7cff17875a4f F test/in5.test b32ce7f4a93f44c5dee94af16886d922cc16ebe33c8e1765c73d4049d0f4b40f F test/in6.test f5f40d6816a8bb7c784424b58a10ac38efb76ab29127a2c17399e0cbeeda0e4b F test/incrblob.test c9b96afc292aeff43d6687bcb09b0280aa599822 @@ -2011,7 +2011,7 @@ F test/whereH.test e4b07f7a3c2f5d31195cd33710054c78667573b2 F test/whereI.test c4bb7e2ca56d49bd8ab5c7bd085b8b83e353922b46904d68aefb3c7468643581 F test/whereJ.test fc05e374cc9f2dc204148d6c06822c380ad388895fe97a6d335b94a26a08aecf F test/whereK.test 0270ab7f04ba5436fb9156d31d642a1c82727f4c4bfe5ba90d435c78cf44684a -F test/whereL.test bf41203fda5e19e4c554a296b4ad2ff3eb27207549b94a819a2bc37275b4529d +F test/whereL.test 438a397fa883b77bb6361c08a8befa41b52e9cfbe15a2a43715d122f8cfa8649 F test/whereM.test 0dbc9998783458ddcf3cc078ca7c2951d8b2677d472ecf0028f449ed327c0250 F test/wherefault.test 6cf2a9c5712952d463d3f45ebee7f6caf400984df51a195d884cfb7eb0e837a7 F test/wherelfault.test 9012e4ef5259058b771606616bd007af5d154e64cc25fa9fd4170f6411db44e3 @@ -2179,8 +2179,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 c0e5ceb87d3cf28f22d381f863b8f91043804fd7901f23f3afb02fe698e6a12a -R c0fd5d4c2ab2c847266cf4b9416ae243 +P 0dce6211690210e802545cbca9b3375e07075e117fad3f8c921879da7671d981 +R 04c934383a09ffd06af013a1dd47675b U drh -Z 061bbac91348ec107ed9e1ccfd2e024e +Z ca3e70db7b33adfad0eeda8b7a11174b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9a374d564f..186e057cef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0dce6211690210e802545cbca9b3375e07075e117fad3f8c921879da7671d981 \ No newline at end of file +0eb2fbb8910e7a372c50db3ae44238d7b161f0e45858b74061b5228aec5fcc7e \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index a552c3f509..8faf5a397b 100644 --- a/src/test1.c +++ b/src/test1.c @@ -1024,23 +1024,6 @@ static void addRealTypeFunction( sqlite3_result_value(context, argv[0]); } -/* -** Implementation of the noop(X) SQL function. -** -** The result is just a copy of its argument. However, this function -** does not have the SQLITE_FUNC_CONSTANT flag, so it is consider -** non-constant by sqlite3ExprIsConstant(). -*/ -static void noopFunction( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - (void)argc; - sqlite3_result_value(context, argv[0]); -} - - /* ** SQL function: strtod(X) ** @@ -1168,10 +1151,6 @@ static int SQLITE_TCLAPI test_create_function( rc = sqlite3_create_function(db, "add_real_type", 1, SQLITE_UTF8, 0, addRealTypeFunction, 0, 0); } - if( rc==SQLITE_OK ){ - rc = sqlite3_create_function(db, "noop", 1, SQLITE_UTF8, - 0, noopFunction, 0, 0); - } /* Functions strtod() and dtostr() work as in the shell. These routines ** use the standard C library to convert between floating point and diff --git a/test/in4.test b/test/in4.test index 81f2b2840d..71993e7003 100644 --- a/test/in4.test +++ b/test/in4.test @@ -455,18 +455,17 @@ do_execsql_test 11.0 { INSERT INTO sqlite_stat1 VALUES('t1','t1abc','10000 5 00 2003 10'); ANALYZE sqlite_schema; } {} -sqlite3_create_function db do_execsql_test 11.1 { SELECT * FROM t1 WHERE b IN (345, (SELECT 1 FROM t1 - WHERE b IN (noop(1)) + WHERE b IN (coalesce(1,random())) AND c GLOB 'abc*xyz')) AND c BETWEEN 'abc' AND 'xyz'; } {xyz 1 abcdefxyz 99} do_execsql_test 11.2 { EXPLAIN SELECT * FROM t1 WHERE b IN (345, (SELECT 1 FROM t1 - WHERE b IN (noop(1)) + WHERE b IN (coalesce(1,random())) AND c GLOB 'abc*xyz')) AND c BETWEEN 'abc' AND 'xyz'; } {/ SeekScan /} diff --git a/test/whereL.test b/test/whereL.test index 9d1054964c..2e9ae219e1 100644 --- a/test/whereL.test +++ b/test/whereL.test @@ -60,13 +60,14 @@ do_eqp_test 121 { `--SCAN t3 } -# The sqlite3ExprIsConstant() routine does not believe that noop(3) -# is constant. So the optimization does not apply in this case. +# The sqlite3ExprIsConstant() routine does not believe that +# the expression "coalesce(5,random())" is constant. So the +# optimization does not apply in this case. # sqlite3_create_function db do_eqp_test 122 { SELECT * FROM t1, t2, t3 - WHERE t1.a=t2.a AND t2.a=t3.j AND t3.j=noop(5) + WHERE t1.a=t2.a AND t2.a=t3.j AND t3.j=coalesce(5,random()) ORDER BY t1.a; } { QUERY PLAN