Correlated CTEs should not generate a materialization subroutine. If they
need to be materialized, each use case must be materialized separately. dbsqlfuzz 01b8355086998f0a452cb31208e80b9d29ca739a. FossilOrigin-Name: d72d865d3e8503a545603038eb26044bee42e4e8725522be678059ce6517fc8d
This commit is contained in:
parent
080fe6dec9
commit
d685dd6be6
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Add\sa\sNEVER()\son\sa\sbranch\sthat\swas\smade\sunreachable\sby\sthe\n"circular\sreference"\sfix.
|
||||
D 2021-03-18T20:04:46.953
|
||||
C Correlated\sCTEs\sshould\snot\sgenerate\sa\smaterialization\ssubroutine.\s\sIf\sthey\nneed\sto\sbe\smaterialized,\seach\suse\scase\smust\sbe\smaterialized\sseparately.\ndbsqlfuzz\s01b8355086998f0a452cb31208e80b9d29ca739a.
|
||||
D 2021-03-19T13:53:34.650
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -542,7 +542,7 @@ F src/printf.c 2b03a80d7c11bb422115dca175a18bf430e9c9dbaa0eee63b758f0c022f8f34f
|
||||
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c dd47248c2c914feb0d4428c27d782e2723971d32cfa5536f49306d080df4d45a
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 72b2a58bf6e01812c7ea392ab3dc9c7faa814d5558f98d9e4fd6a142f562c608
|
||||
F src/select.c 734cf12e42f81f2fe461e41214e6552375e55b62a802784a4f0066ac592e7f4a
|
||||
F src/shell.c.in 8df3912a7ca4873a1443d4adef1b25baee8c086ab479fd9c4f13ab03f98049ab
|
||||
F src/sqlite.h.in 3426a080ea1f222a73e3bd91e7eacbd30570a0117c03d42c6dde606f33e5e318
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
@ -1788,7 +1788,7 @@ F test/windowerr.test a8b752402109c15aa1c5efe1b93ccb0ce1ef84fa964ae1cd6684dd0b3c
|
||||
F test/windowfault.test d543d46571b32d19f198cb04b6505747fabf3cc369970daae47074ee793612be
|
||||
F test/windowpushd.test 5b9c114e8173c3addacf58a0fcd941437b14649f2033700184479a13f188ad00
|
||||
F test/with1.test 780be387f01e290e768bdfd1827280f9e37ba37223eb4736aba386864fac5a94
|
||||
F test/with2.test de3b9070ab4e4a8fdbba8d46dd06a17e47088314a3070479bd3882f178f61593
|
||||
F test/with2.test 000fb95f1f29dae868cea0f41505eb5126077d49eb967ff88f9ee46212ad8863
|
||||
F test/with3.test 2f1e05aef7aeef9a741cbf36deeb4be73003dc541921c3abc78becbbf5b7852d
|
||||
F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f198205
|
||||
F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8
|
||||
@ -1910,7 +1910,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P ee86e2f4c5999a090a5d2fe8251107cf55e621a6b988f315eb82f462cc1e377d
|
||||
R 51db1a8cd353cea4b335d0a191e38003
|
||||
P 114d9780aecdd9f03f235fc1f2ab81ef89cb00b3bafa61cff612e939595ff5f0
|
||||
R 5b9e8bca84d94a1c983f6d5cd7f00b21
|
||||
U drh
|
||||
Z 06f86de8c8593bdbc3934905423493ca
|
||||
Z 816415a058e22d518551f844fc582ad4
|
||||
|
@ -1 +1 @@
|
||||
114d9780aecdd9f03f235fc1f2ab81ef89cb00b3bafa61cff612e939595ff5f0
|
||||
d72d865d3e8503a545603038eb26044bee42e4e8725522be678059ce6517fc8d
|
@ -6386,7 +6386,9 @@ int sqlite3Select(
|
||||
sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
|
||||
pSub->nSelectRow = pPrior->pSelect->nSelectRow;
|
||||
}else{
|
||||
/* Generate a subroutine that will materialize the view. */
|
||||
/* Materalize the view. If the view is not correlated, generate a
|
||||
** subroutine to do the materialization so that subsequent uses of
|
||||
** the same view can reuse the materialization. */
|
||||
int topAddr;
|
||||
int onceAddr = 0;
|
||||
int retAddr;
|
||||
@ -6413,7 +6415,7 @@ int sqlite3Select(
|
||||
VdbeComment((v, "end %s", pItem->pTab->zName));
|
||||
sqlite3VdbeChangeP1(v, topAddr, retAddr);
|
||||
sqlite3ClearTempRegCache(pParse);
|
||||
if( pItem->fg.isCte ){
|
||||
if( pItem->fg.isCte && pItem->fg.isCorrelated==0 ){
|
||||
CteUse *pCteUse = pItem->u2.pCteUse;
|
||||
pCteUse->addrM9e = pItem->addrFillSub;
|
||||
pCteUse->regRtn = pItem->regReturn;
|
||||
|
@ -533,4 +533,20 @@ do_execsql_test 9.2 {
|
||||
} {}
|
||||
} ;# end ifcapable vtab
|
||||
|
||||
# 2021-03-19
|
||||
# dbsqlfuzz 01b8355086998f0a452cb31208e80b9d29ca739a
|
||||
#
|
||||
# Correlated CTEs should not be materialized.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 10.1 {
|
||||
SELECT 1 AS c WHERE (
|
||||
SELECT (
|
||||
WITH t1(a) AS (VALUES( c ))
|
||||
SELECT ( SELECT t1a.a FROM t1 AS t1a, t1 AS t1x )
|
||||
FROM t1 AS xyz GROUP BY 1
|
||||
)
|
||||
)
|
||||
} {1}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user