From e26021ed6052f74355ba4aca5a1e70381c2549cd Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 12 Oct 2026 17:52:40 +0000 Subject: [PATCH] Temporarily back out the penultimate check-in on this branch in order to prevent an assertion fault. Need to reconsider this approach in light of [bug:/info/2026-05-18T14:04:01Z|Bug 2026-05-18T14:04:01Z]. That other bug might be fixed incorrectly, and might also need to be backed out. Both bugs reopened until we can complete the analysis. FossilOrigin-Name: 163413d8e19b97e36b2a1f6734c271b3944195a213973e2975e43f45a1e80735 --- manifest | 16 ++-- manifest.uuid | 2 +- src/expr.c | 10 +-- test/subtype2.test | 204 --------------------------------------------- 4 files changed, 11 insertions(+), 221 deletions(-) delete mode 100644 test/subtype2.test diff --git a/manifest b/manifest index 939c1f1363..7018a754f4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\scausing\s"aggregate(\st1.col1\sORDER\sBY\st2.col2\s)"\swhere\scol1\sand\scol2\sare\sin\sthe\ssame\spositions\sin\stheir\stables\sto\sbe\streated\sas\s"aggregate(\st2.col2\sORDER\sBY\st2.col2\s)".\sReport\s[bugs:info/2026-10-12T13:31:40Z\s|\s2026-10-12T13:31:40Z]. -D 2026-10-12T16:29:30.806 +C Temporarily\sback\sout\sthe\spenultimate\scheck-in\son\sthis\sbranch\sin\sorder\sto\nprevent\san\sassertion\sfault.\s\sNeed\sto\sreconsider\sthis\sapproach\sin\slight\sof\n[bug:/info/2026-05-18T14:04:01Z|Bug\s2026-05-18T14:04:01Z].\s\sThat\sother\nbug\smight\sbe\sfixed\sincorrectly,\sand\smight\salso\sneed\sto\sbe\sbacked\sout.\nBoth\sbugs\sreopened\suntil\swe\scan\scomplete\sthe\sanalysis. +D 2026-10-12T17:52:40.694 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -752,7 +752,7 @@ F src/date.c 080641f59097d14fc7341f8bc0458d273b3a62d8381916db8ccbc89c2aae07b3 F src/dbpage.c ec8590c5e7a564cef28ca3c6156521316a4d26cb572a34841b0bcb26b67b3f97 F src/dbstat.c 34d4e825fbf763640ce3dbc56910ab080495ef4a6efb48b2b1852a43d43763fc F src/delete.c 59eeca3fb88c29329afc41bb803ee568b120d9dd7470b5f38ab55cc38390b451 -F src/expr.c 9535e8bb442ee113073127b78921b354938980b30755f6db55857c8afaa4ff70 +F src/expr.c b80229730263f70ef39a7ca46f847df6c124ec3bd7de43ba570b994757d51d9f F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 26788ae6c785d70f9829c4176e9764447014fc73e6ba31e9f1881720a64ae7f1 F src/func.c 54d96eeafcb6ec4cff92028ea0f7bb09e27b375b248d969aeb80a61e560ef302 @@ -1772,7 +1772,6 @@ F test/subquery2.test ab96ff3fa9c4e3dce0d699f74e61c50250ed4335bc8f400e127707d552 F test/subselect.test 0966aa8e720224dbd6a5e769a3ec2a723e332303 F test/substr.test 6a3d2c32b4d58ab063041ce67ecb16427ca5d3cd06d8d17c7b4775cbaa86fc88 F test/subtype1.test 6e385ea8c0cab8d51f8193a8b107669224486fba0601ee256ad66a57cb4b77bc -F test/subtype2.test a2da5636a66b752f3fa0346ce43c06098952853c5bdd050b37adf9dc44afc7c9 F test/superlock.test 85256830339a6871ce36a2ef591c3f67716a701b5497788fb2068b90159c2442 F test/swarmvtab.test 250231404fcac88f61a6c147bb0e3a118ed879278cd3ccb0ae2d3a729e1e8e26 F test/swarmvtab2.test c948cb2fdfc5b01d85e8f6d6504854202dc1a0782ab2a0ed61538f27cbd0aa5c @@ -2285,8 +2284,9 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P af3c900e2b5251bcbc0611dbe2f86b13fd2daa07bcf42563a9d6db46dfdd6b3d -R 318f91e7552443466e3da867167fa0f3 -U dan -Z d4a88c098862838c6f2fe56a59c4eb6f +P ffe3f056f1789f188a0afece0363dc2ea74912510bbbd4edcb656ad8a1acc704 +Q -af3c900e2b5251bcbc0611dbe2f86b13fd2daa07bcf42563a9d6db46dfdd6b3d +R 1ee008533bacf16d5a11ec948df6271a +U drh +Z 03283ce8edef75ca3cf9cd863ba9d8c3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8534c2d7b3..46bd72b642 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ffe3f056f1789f188a0afece0363dc2ea74912510bbbd4edcb656ad8a1acc704 +163413d8e19b97e36b2a1f6734c271b3944195a213973e2975e43f45a1e80735 diff --git a/src/expr.c b/src/expr.c index f89f2a12b9..9ec6be07ec 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4038,12 +4038,6 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ } sqlite3VdbeScanStatusRange(v, addrExplain, addrExplain, -1); - if( dest.eDest==SRT_Mem - && sqlite3ExprCanReturnSubtype(pParse, pSel->pEList->a[0].pExpr) - ){ - sqlite3VdbeAddOp1(v, OP_ClrSubtype, rReg); - } - /* Subroutine return */ assert( ExprUseYSub(pExpr) ); assert( sqlite3VdbeGetOp(v,pExpr->y.sub.iAddr-1)->opcode==OP_BeginSubrtn @@ -4799,7 +4793,7 @@ static int exprCodeInlineFunction( ** ** The only expressions that can return a subtype are: ** -** 1. A function, including an aggregate function +** 1. A function ** 2. The no-op "+" operator ** 3. A CASE...END expression ** 4. A CAST() expression @@ -4824,7 +4818,7 @@ static int exprNodeCanReturnSubtype(Walker *pWalker, Expr *pExpr){ ){ return WRC_Continue; } - if( pExpr->op!=TK_FUNCTION && pExpr->op!=TK_AGG_FUNCTION ){ + if( pExpr->op!=TK_FUNCTION ){ return WRC_Prune; } assert( ExprUseXList(pExpr) ); diff --git a/test/subtype2.test b/test/subtype2.test deleted file mode 100644 index 97252658cc..0000000000 --- a/test/subtype2.test +++ /dev/null @@ -1,204 +0,0 @@ -# 2026 October 12 -# -# The author disclaims copyright to this source code. In place of -# a legal notice, here is a blessing: -# -# May you do good and not evil. -# May you find forgiveness for yourself and forgive others. -# May you share freely, never taking more than you give. -# -#*********************************************************************** -# This file implements regression tests for SQLite library. Specifically, -# it tests that scalar sub-queries never return values with subtypes. -# - - -set testdir [file dirname $argv0] -source $testdir/tester.tcl -set testprefix subtype2 - -do_execsql_test 1.0.1 { - SELECT - json_group_object( - 'key', - (SELECT CAST(json(0) AS TEXT) - FROM (SELECT 1 AS k) - WHERE k = 1 - ORDER BY k) - ) AS q1, - json_group_object( - 'key', - (SELECT CAST(json(0) AS TEXT) - FROM (SELECT 1 AS k) - WHERE NOT (NOT (k = 1)) - ORDER BY k) - ) AS q2; -} { - {{"key":"0"}} {{"key":"0"}} -} - -do_execsql_test 1.0.2 { - SELECT - json_group_object( - 'key', - (SELECT json(0) - FROM (SELECT 1 AS k) - WHERE k = 1 - ORDER BY k) - ) AS q1, - json_group_object( - 'key', - (SELECT json(0) - FROM (SELECT 1 AS k) - WHERE NOT (NOT (k = 1)) - ORDER BY k) - ) AS q2; -} { - {{"key":"0"}} {{"key":"0"}} -} - -do_execsql_test 1.0.3 { - SELECT json_group_object( - 'key', - (SELECT json(0) - FROM (SELECT 1 AS k) - WHERE k = 1 - ORDER BY k) - ); -} { - {{"key":"0"}} -} - -do_execsql_test 1.0.4 { - SELECT json_group_object( - 'key', - (SELECT json(0) - FROM (SELECT 1 AS k) - WHERE (NOT (NOT (k = 1))) - ORDER BY k) - ); -} { - {{"key":"0"}} -} - -do_execsql_test 1.0.5 { - SELECT subtype ( - (SELECT json(0) - FROM (SELECT 1 AS k) - WHERE k = 1 - ORDER BY k) - ); -} {0} - -do_execsql_test 1.0.6 { - SELECT subtype ( - (SELECT json(0) - FROM (SELECT 1 AS k) - WHERE (NOT (NOT (k = 1))) - ORDER BY k) - ); -} {0} - -do_execsql_test 2.1 { - SELECT json_group_object( 'key', (SELECT CAST(json(0) AS TEXT)) ); -} {{{"key":"0"}}} - -do_execsql_test 2.2 { - SELECT 'key', typeof( (SELECT CAST(json(0) AS TEXT)) ) -} {key text} - -do_execsql_test 2.3 { - SELECT 'key', subtype( (SELECT CAST(json(0) AS TEXT)) ) -} {key 0} - -do_execsql_test 2.4.1 { - SELECT 'key', subtype( json(0) ) -} {key 74} -do_execsql_test 2.4.2 { - SELECT 'key', subtype( (SELECT json(0)) ) -} {key 0} - -do_execsql_test 2.5 { - SELECT 'key', subtype( max(0) ) -} {key 0} - -do_execsql_test 2.6 { - SELECT 'key', typeof( json(0) ) -} {key text} - -do_execsql_test 2.7 { - SELECT 'key', subtype( +json(0) ) -} {key 74} - -do_execsql_test 2.8 { - SELECT 'key', coalesce(NULL, json(0)) -} {key 0} - -do_execsql_test 2.9 { - SELECT 'key', coalesce(json(0), NULL) -} {key 0} - -#----------------------------------------------------------------------------- -reset_db - -do_execsql_test 3.0 { - CREATE TABLE t1(a, b); - INSERT INTO t1 values('a', 1); - INSERT INTO t1 values('b', 2); - INSERT INTO t1 values('c', 3); -} - -do_execsql_test 3.1 { - SELECT max( - (SELECT json( b ) FROM t1 WHERE t1.b=o.b) - ) FROM t1 AS o; -} {3} - -do_execsql_test 3.2 { - SELECT subtype (( - SELECT max( - (SELECT json( b ) FROM t1 WHERE t1.b=o.b) - ) FROM t1 AS o - )) -} {0} - -#----------------------------------------------------------------------------- -# Test that aggregate scalar sub-queries do not return subtypes as well. -# -reset_db - -do_execsql_test 4.0 { - CREATE TABLE t1(a, b); - INSERT INTO t1 VALUES(1, '[1]'); - INSERT INTO t1 VALUES(2, '[2]'); -} - -do_execsql_test 4.1.1 { - SELECT subtype( json_group_array(a) ) FROM t1; -} {74} -do_execsql_test 4.1.2 { - SELECT subtype( (SELECT json_group_array(a) FROM t1) ); -} {0} -do_execsql_test 4.1.3 { - SELECT json_array( (SELECT json_group_array(a) FROM t1) ); -} {{["[1,2]"]}} - -do_execsql_test 4.2.1 { - SELECT subtype( (SELECT json_group_object('k', a) FROM t1) ); -} {0} -do_execsql_test 4.2.2 { - SELECT json_array( (SELECT json_group_object('k', a) FROM t1) ); -} {{["{\"k\":1,\"k\":2}"]}} - -do_execsql_test 4.3.1 { - SELECT subtype( max(json(b)) ) FROM t1; -} {74} -do_execsql_test 4.3.2 { - SELECT subtype( (SELECT max(json(b)) FROM t1) ); -} {0} -do_execsql_test 4.3.3 { - SELECT json_array( (SELECT min(json(b)) FROM t1) ); -} {{["[1]"]}} - -finish_test -