Apply the correct affinity transformations when pulling values off of the

sorter index used for GROUP BY.  Ticket [e0c2ad1aa8a9c691]

FossilOrigin-Name: 101f7dea75a203f1f3aa422a607ef701eb0901ba4d5e8d1075cd350454a61956
This commit is contained in:
drh 2020-03-10 11:50:43 +00:00
parent 088489e8d9
commit 0c76e892d9
4 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C The\ssqlite3ExprCodeFactorable()\sroutine\sshould\smake\sa\scopy\sof\snon-factorable\nexpressions,\sas\sthey\smight\sbe\scoming\sfrom\sa\sDEFAULT\sor\sgenerated\scolumn\nin\sa\stable\sconstraint.
D 2020-03-10T02:57:37.726
C Apply\sthe\scorrect\saffinity\stransformations\swhen\spulling\svalues\soff\sof\sthe\nsorter\sindex\sused\sfor\sGROUP\sBY.\s\sTicket\s[e0c2ad1aa8a9c691]
D 2020-03-10T11:50:43.810
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -483,7 +483,7 @@ F src/date.c 6c408fdd2e9ddf6e8431aba76315a2d061bea2cec8fbb75e25d7c1ba08274712
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 0f55297469d4244ab7df395849e1af98eb5e95816af7c661e7d2d8402dea23da
F src/delete.c 11000121c4281c0bce4e41db29addfaea0038eaa127ece02557c9207bc3e541d
F src/expr.c 4efd019be610f8e24008a6e89c6c5dbf204edaeaade0cc996a88f285ce1d4a06
F src/expr.c 92fa379dabdb55e45811c7650a2337af91035a44ecec32b0fbc5c6682d68f575
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 4b575423b0a5d4898b1a7868ce985cf1a8ad91c741c9abbb108ff02536d20f41
F src/func.c 108577cebe8a50c86d849a93b99493a54e348dd0b846f00d13b52ca973d5baf4
@ -1303,7 +1303,7 @@ F test/securedel.test 2f70b2449186a1921bd01ec9da407fbfa98c3a7a5521854c300c194b2f
F test/securedel2.test 2d54c28e46eb1fd6902089958b20b1b056c6f1c5
F test/select1.test 009a6d8eacd9684d046302b8d13b50846a87e39d6f08e92178aa13e95ea29a2d
F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56
F test/select3.test 3905450067c28766bc83ee397f6d87342de868baa60f2bcfd00f286dfbd62cb9
F test/select3.test ddd1bc6d0c8dece136321c11bd26d0d8ad17f2b27c72935fdd6574d8cb99d1d4
F test/select4.test 5389d9895968d1196c457d59b3ee6515d771d328
F test/select5.test df9ec0d218cedceb4fe7b63262025b547b50a55e59148c6f40b60ca25f1d4546
F test/select6.test 319d45e414cdd321bf17cfacedaf19e3935ad64dac357c53f1492338c6e9b801
@ -1860,7 +1860,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 3df07e5a9a3781a4cf866fc6ee0e5c6f9cd7ca35ce0a6eb3aa7f5f3502e0ffae
R 7d49dd66db353572ddc6eafd9c0a8b97
P a2d6f108c5d07559b125823a04c9cb072c80be80d7913097891a6192c7e1e225
R 3dd418ad329a8afd1cad637d51a1b1fd
U drh
Z 57a026e3bb6ad1f9a47d83e58f8523e1
Z 43126d534c48a0ddd9165f34c835e3bc

View File

@ -1 +1 @@
a2d6f108c5d07559b125823a04c9cb072c80be80d7913097891a6192c7e1e225
101f7dea75a203f1f3aa422a607ef701eb0901ba4d5e8d1075cd350454a61956

View File

@ -3791,8 +3791,12 @@ expr_code_doover:
assert( pCol->iMem>0 );
return pCol->iMem;
}else if( pAggInfo->useSortingIdx ){
Table *pTab = pCol->pTab;
sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
pCol->iSorterColumn, target);
if( ALWAYS(pTab) && pCol->iColumn>=0 ){
sqlite3ColumnDefault(v, pTab, pCol->iColumn, target);
}
return target;
}
/* Otherwise, fall thru into the TK_COLUMN case */

View File

@ -306,4 +306,12 @@ foreach {id x} {
} {{} 1.0 ok}
}
# 2020-03-10 ticket e0c2ad1aa8a9c691
reset_db
do_execsql_test select3-9.100 {
CREATE TABLE t0(c0 REAL, c1 REAL GENERATED ALWAYS AS (c0));
INSERT INTO t0(c0) VALUES (1);
SELECT * FROM t0 GROUP BY c0;
} {1.0 1.0}
finish_test