Do not perform the omit-unused-subquery-columns optimizations on a
subquery that is DISTINCT, as that can lead to incorrect results. FossilOrigin-Name: cc148503db8ef180bce984328da7e84959afadd6a9613c2d03bc1eafeb95dfad
This commit is contained in:
parent
6945ba787f
commit
90b7af7715
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sthe\ssubquery\sresult\scolumn\sNULL-ifier\sso\sthat\sit\scorrectly\shandles\nsubquery\scolumns\spast\sthe\s63rd\scolumn.
|
||||
D 2023-02-15T19:53:08.659
|
||||
C Do\snot\sperform\sthe\somit-unused-subquery-columns\soptimizations\son\sa\nsubquery\sthat\sis\sDISTINCT,\sas\sthat\scan\slead\sto\sincorrect\sresults.
|
||||
D 2023-02-16T15:54:55.738
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -621,7 +621,7 @@ F src/printf.c ff4b05e38bf928ff1b80d3dda4f977b10fe39ecbfe69c018224c7e5594fb2455
|
||||
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c d62c5665279cc7485f9d45b5e20911cc7b19c203f268321a90d05d74f4725750
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 98984bd8a2f00ae6e2a1c33991617c0d0db68f204ea124cdd853383204499697
|
||||
F src/select.c a723a35366d7fc695371dd80b2ea4dbc306d5fb75df81d3e6ce7e200794f7622
|
||||
F src/shell.c.in 5cb750dc00bb8b20b020031fd1bb0cb8759a6e567c27aee6b0af31d187984985
|
||||
F src/sqlite.h.in c060f9e6f646fd817abf273c068666e079fc6e8467ea1d3e8b20f355f82722e9
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
@ -1457,7 +1457,7 @@ F test/select8.test 8c8f5ae43894c891efc5755ed905467d1d67ad5d
|
||||
F test/select9.test f7586b207ce2304ab80dc93d3146469a28fd4403621dd3a82d06644563d3c812
|
||||
F test/selectA.test 6aef8b2136a4ac7a3e2e4161d2b8ca7bc6ebe2779de084f9bb66ca9e2323a937
|
||||
F test/selectB.test 954e4e49cf1f896d61794e440669e03a27ceea25
|
||||
F test/selectC.test fec14c9015ed4ec941508bbc144f30b42e40ac34a4bb33001450369865dd0b75
|
||||
F test/selectC.test 38c530b0cc5728b793c3c11f52b52c70290d39822224acd39011c89c1853bd31
|
||||
F test/selectD.test 6d1909b49970bf92f45ce657505befcef5fc7cbc13544e18103a316d32189bfb
|
||||
F test/selectE.test a8730ca330fcf40ace158f134f4fe0eb00c7edbf
|
||||
F test/selectF.test 21c94e6438f76537b72532fa9fd4710cdd455fc3
|
||||
@ -2045,8 +2045,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 5dec3cc0225296a043d17f73126d477d90a604f82b3180628176d8f950adbce8
|
||||
R d380059ff4fc01bc81597a53152668a1
|
||||
P 77b220a7240425fa83e142ceef78505208e6e38d797070e146b9f7d255f753c7
|
||||
R e479bead84e886f8b2c21d0d027a081a
|
||||
U drh
|
||||
Z d76a4bd1d7943a5eace66bda083496dd
|
||||
Z 0b93f878d511033e2fa0d6dd3c9e8431
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
77b220a7240425fa83e142ceef78505208e6e38d797070e146b9f7d255f753c7
|
||||
cc148503db8ef180bce984328da7e84959afadd6a9613c2d03bc1eafeb95dfad
|
@ -5253,10 +5253,15 @@ static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
|
||||
assert( pItem!=0 );
|
||||
assert( pItem->pTab!=0 );
|
||||
pTab = pItem->pTab;
|
||||
if( pTab->tabFlags & TF_Ephemeral ) return 0;
|
||||
if( pTab->tabFlags & TF_Ephemeral ){
|
||||
return 0;
|
||||
}
|
||||
assert( pItem->pSelect!=0 );
|
||||
pSub = pItem->pSelect;
|
||||
assert( pSub->pEList->nExpr==pTab->nCol );
|
||||
if( pSub->selFlags & SF_Distinct ){
|
||||
return 0;
|
||||
}
|
||||
for(pX=pSub; pX; pX=pX->pPrior){
|
||||
if( pX->pPrior && pX->op!=TK_ALL ){
|
||||
/* This optimization does not work for compound subqueries that
|
||||
|
@ -230,6 +230,11 @@ do_execsql_test selectC-4.2 {
|
||||
select a from (select distinct a, b from t_distinct_bug)
|
||||
} {1 1 1}
|
||||
|
||||
do_execsql_test selectC-4.2b {
|
||||
CREATE VIEW v42b AS SELECT DISTINCT a, b FROM t_distinct_bug;
|
||||
SELECT a FROM v42b;
|
||||
} {1 1 1}
|
||||
|
||||
do_execsql_test selectC-4.3 {
|
||||
select a, udf() from (select distinct a, b from t_distinct_bug)
|
||||
} {1 1 1 2 1 3}
|
||||
|
Loading…
Reference in New Issue
Block a user