]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove additional unnecessary code associated with the setup phase of a recursive...
authordrh <>
Sun, 25 Jan 2026 11:41:49 +0000 (11:41 +0000)
committerdrh <>
Sun, 25 Jan 2026 11:41:49 +0000 (11:41 +0000)
FossilOrigin-Name: 82735513762c8adfe7ad4865dcb76c625cbd8f6976bb98f2c342cf98cfdf3b36

manifest
manifest.uuid
src/select.c

index 01cfd862264b5e6627ca4e77fc7cc931db1b7335..bef2b518a5a82314ee99da896f1f80a0df8d6962 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\san\sincorrect\sassert().
-D 2026-01-24T00:33:41.831
+C Remove\sadditional\sunnecessary\scode\sassociated\swith\sthe\ssetup\sphase\sof\sa\srecursive\sCTE.
+D 2026-01-25T11:41:49.206
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -738,7 +738,7 @@ F src/printf.c b1b29b5e58e1530d5daeee5963d3c318d8ab2d7e38437580e28755753e0c1ded
 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c 47aa7fdc9ec4c19b103ac5e79d7887d30119b5675309facf5eed1118391c868b
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
-F src/select.c b7fdfc6076f2677c04eb7381aaa03e5c8e20767f00719d2f45685928782d0b35
+F src/select.c dbad0e682bafdc8798b4e63e40a7ad006f1a5b49ee9f2a339fbed194eee243ef
 F src/shell.c.in e8818572acd50464bc00426fe0d755e98239f73d531437c3dc7721d1fecb1231
 F src/sqlite.h.in d463dcdd67d4865991cd62dc8d3f678086b38365593861f77c09c3401551d59f
 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
@@ -2193,8 +2193,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 3d76732a45333f6f3e21667bb018a859d20815243d276fad0dc126d3c667d4aa
-R b382f40b273a5b37b79497c83b0a3f58
+P b9ce349e1e4166c3d1c97d2f6fb1792b89e3316c8ec182daa032b6655e9c2c17
+R 63d914dbd8f006bb95e90bef5dc6ba51
 U drh
-Z 3f69647551165a004e932f5c9d293729
+Z a336a96790414e0a6d1d72e3b7e9e682
 # Remove this line to create a well-formed Fossil manifest.
index 128d41a920a318a6b1ddb6c0b2ab2d2eea2d65f2..6a924fa199d788cbc4d5fed1bba1a105ddf89d53 100644 (file)
@@ -1 +1 @@
-b9ce349e1e4166c3d1c97d2f6fb1792b89e3316c8ec182daa032b6655e9c2c17
+82735513762c8adfe7ad4865dcb76c625cbd8f6976bb98f2c342cf98cfdf3b36
index 68ea379e67bf86110882bc2b726743c7f8bc7006..56ab929aaa14c9af8c7fa26c530d2a4503fd6d2e 100644 (file)
@@ -3175,13 +3175,12 @@ static int generateOutputSubroutine(
 #ifndef SQLITE_OMIT_CTE
       if( pDest->eDest==SRT_DistFifo ){
         /* If the destination is DistFifo, then cursor (iParm+1) is open
-        ** on an ephemeral index. If the current row is already present
-        ** in the index, do not write it to the output. If not, add the
-        ** current row to the index and proceed with writing it to the
-        ** output table as well.  */
-        int addr = sqlite3VdbeCurrentAddr(v) + 4; /* After OP_Insert */
-        sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, addr, r1, 0); /* 20260120a */
-        VdbeCoverage(v);
+        ** on an ephemeral index that is used to enforce uniqueness on the
+        ** total result.  At this point, we are processing the setup portion
+        ** of the recursive CTE using the merge algorithm, so the results are
+        ** guaranteed to be unique anyhow.  But we still need to populate the
+        ** (iParm+1) cursor for use by the subsequent recursive phase.
+        */
         sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm+1, r1,
                              pIn->iSdst, pIn->nSdst);
       }
@@ -3189,7 +3188,6 @@ static int generateOutputSubroutine(
       sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2);
       sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2);
       sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
-      /* The OP_Found at 20260120a jumps here, after the OP_Insert */
       sqlite3ReleaseTempReg(pParse, r2);
       sqlite3ReleaseTempReg(pParse, r1);
       break;
@@ -3260,7 +3258,6 @@ static int generateOutputSubroutine(
     case SRT_Queue: {
       int nKey;
       int r1, r2, r3, ii;
-      int addrTest = 0;
       ExprList *pSO;
       int iParm = pDest->iSDParm;
       pSO = pDest->pOrderBy;
@@ -3269,14 +3266,21 @@ static int generateOutputSubroutine(
       r1 = sqlite3GetTempReg(pParse);
       r2 = sqlite3GetTempRange(pParse, nKey+2);
       r3 = r2+nKey+1;
+
+#if 0 /* <-- Why the next block of code is commented out: (tag-20260125-a)
+      **
+      ** If the destination is DistQueue, then cursor (iParm+1) is open
+      ** on a second ephemeral index that holds all values previously
+      ** added to the queue.  This code only runs during the setup phase
+      ** using the merge algorithm, and so the values here are already
+      ** guaranteed to be unique.
+      */
       if( pDest->eDest==SRT_DistQueue ){
-        /* If the destination is DistQueue, then cursor (iParm+1) is open
-        ** on a second ephemeral index that holds all values every previously
-        ** added to the queue. */
         addrTest = sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, 0,
                                         pIn->iSdst, pIn->nSdst);
         VdbeCoverage(v);
       }
+#endif
       sqlite3VdbeAddOp3(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r3);
       if( pDest->eDest==SRT_DistQueue ){
         sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r3);
@@ -3290,7 +3294,9 @@ static int generateOutputSubroutine(
       sqlite3VdbeAddOp2(v, OP_Sequence, iParm, r2+nKey);
       sqlite3VdbeAddOp3(v, OP_MakeRecord, r2, nKey+2, r1);
       sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, r2, nKey+2);
+#if 0 /* tag-20260125-a */
       if( addrTest ) sqlite3VdbeJumpHere(v, addrTest);
+#endif
       sqlite3ReleaseTempReg(pParse, r1);
       sqlite3ReleaseTempRange(pParse, r2, nKey+2);
       break;