]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
When a subquery is an argument to an SQLITE_SUBTYPE function, then set
authordrh <>
Mon, 18 May 2026 19:44:04 +0000 (19:44 +0000)
committerdrh <>
Mon, 18 May 2026 19:44:04 +0000 (19:44 +0000)
the EP_SubtArg flag on the result-set expressions of that subquery.
[bugs:/forumpost/8de44412fd|Bug report 8de44412fd].

FossilOrigin-Name: d75c08c8416bde3f510a135ea07cc217ba6183eacda6ba895bccbf57efe9284f

manifest
manifest.uuid
src/resolve.c

index 7a6119e7f23fc1ae7bfaaf3270e212343b9fdf11..a353861aa659ce501b6f6756f408e03686a0da91 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\swindow-function\svariant\sof\sthe\sjson_group_object()\sfunction\sso\nthat\sit\scorrectly\shandles\sNULL\sentries.\n[bugs:/forumpost/0de87b23b3|Bug\sreport\s0de87b23b3].
-D 2026-05-18T17:55:40.195
+C When\sa\ssubquery\sis\san\sargument\sto\san\sSQLITE_SUBTYPE\sfunction,\sthen\sset\nthe\sEP_SubtArg\sflag\son\sthe\sresult-set\sexpressions\sof\sthat\ssubquery.\n[bugs:/forumpost/8de44412fd|Bug\sreport\s8de44412fd].
+D 2026-05-18T19:44:04.696
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -734,7 +734,7 @@ F src/pragma.c 789ef67117b74b5be0a2db6681f7f0c55e6913791b9da309aefd280de2c8a74d
 F src/prepare.c 084a037fd3810cb7ffbfc001cd58c0ffac68ba36598a5084b55ea2a090014ebd
 F src/printf.c 2bc09ee91d69c709528575bbbee2199e16d6a7e68e1508ac7cf998a7289170ca
 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
-F src/resolve.c 11134922dfc2c89d10c658a1ae9ae9e1af0df031d40b9e9171dc14d3f2e6d80f
+F src/resolve.c 7e936a09405cb59e2b3e51a3ad23753e4803afc5269c5171a54c9bdd70f4fc50
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
 F src/select.c 4c05cde130f26991b7411d8c6809e0630625e18078742c963a047b4b9cc01d49
 F src/shell.c.in 9dcc77636cdc48d67ea0cd7f4d54d791202e435e05598ec0a147cd61269e1c4d
@@ -2205,8 +2205,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 622882529558b4779dfb7246bd5a9de776555c8f940bb941397fb56fb9f97e43
-R d24f0da7d2c47dc861907e18b0a3ec5b
+P ac3a958b0ab7766544bb406aa990668d2235ab26fb68c75ded3f71273d97b18c
+R 8b7676a9b8c1591082998d4ad9fe24e1
 U drh
-Z d5e5c346537f43415ecc1cfb3b15b0e6
+Z 9295f25c50d1d41e258f97d8c0c2ca57
 # Remove this line to create a well-formed Fossil manifest.
index 9cf5dd0088a7294664cf80422d4da1173881cbd0..1712a713d05524b78fb34f62461279d14f31305a 100644 (file)
@@ -1 +1 @@
-ac3a958b0ab7766544bb406aa990668d2235ab26fb68c75ded3f71273d97b18c
+d75c08c8416bde3f510a135ea07cc217ba6183eacda6ba895bccbf57efe9284f
index 64b20f6b707428dba80e1e70d9c842638f559e9b..d01f33ba52d8bf573ed4e7dc2a59d2e2b2b6daa7 100644 (file)
@@ -941,6 +941,26 @@ static int exprProbability(Expr *p){
   return (int)(r*134217728.0);
 }
 
+/*
+** Set the EP_SubtArg property on every expression inside of
+** pList.  If any subexpression is actually a subquery, then
+** also set the EP_SubtArg property on the first result-set
+** column of that subquery.
+*/
+static SQLITE_NOINLINE void resolveSetExprSubtypeArg(ExprList *pList){
+  int nn, ii;
+  nn = pList ? pList->nExpr : 0;
+  for(ii=0; ii<nn; ii++){
+    Expr *pExpr = pList->a[ii].pExpr;
+    ExprSetProperty(pExpr, EP_SubtArg);
+    if( pExpr->op==TK_SELECT ){
+      assert( ExprUseXSelect(pExpr) );
+      assert( pExpr->x.pSelect!=0 );
+      resolveSetExprSubtypeArg(pExpr->x.pSelect->pEList);
+    }
+  }
+}
+
 /*
 ** This routine is callback for sqlite3WalkExpr().
 **
@@ -1185,10 +1205,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
         if( (pDef->funcFlags & SQLITE_SUBTYPE) 
          || ExprHasProperty(pExpr, EP_SubtArg) 
         ){
-          int ii;
-          for(ii=0; ii<n; ii++){
-            ExprSetProperty(pList->a[ii].pExpr, EP_SubtArg);
-          }
+          resolveSetExprSubtypeArg(pList);
         }
 
         if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){