mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Clear the column cache before populating aggregate accumulator registers. Fix fo
r [883034dcb5]. FossilOrigin-Name: ffc23409c7fb45dc5a8722fad26e26d207bb3213
This commit is contained in:
26
manifest
26
manifest
@ -1,8 +1,5 @@
|
|||||||
-----BEGIN PGP SIGNED MESSAGE-----
|
C Clear\sthe\scolumn\scache\sbefore\spopulating\saggregate\saccumulator\sregisters.\sFix\sfo\nr\s[883034dcb5].
|
||||||
Hash: SHA1
|
D 2010-03-31T15:02:56
|
||||||
|
|
||||||
C Documentation\senhancements\sfor\sthe\ssqlite3_log()\sinterface.\s\sNo\sfunctional\nchanges\sto\scode.
|
|
||||||
D 2010-03-31T13:57:56
|
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
|
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@ -167,7 +164,7 @@ F src/printf.c 5f5b65a83e63f2096a541a340722a509fa0240a7
|
|||||||
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
||||||
F src/resolve.c a1648d98e869937b29f4f697461fe4d60f220a7b
|
F src/resolve.c a1648d98e869937b29f4f697461fe4d60f220a7b
|
||||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||||
F src/select.c 4113ef360430ed4e7533690ef46d06c20204adce
|
F src/select.c 5a08245cb18b7ddf2456274653599cbf738d3830
|
||||||
F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4
|
F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4
|
||||||
F src/sqlite.h.in 1b81828af38e040820577fb7a05e7f378add7e6f
|
F src/sqlite.h.in 1b81828af38e040820577fb7a05e7f378add7e6f
|
||||||
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
|
||||||
@ -566,7 +563,7 @@ F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
|
|||||||
F test/select9.test b4007b15396cb7ba2615cab31e1973b572e43210
|
F test/select9.test b4007b15396cb7ba2615cab31e1973b572e43210
|
||||||
F test/selectA.test 06d1032fa9009314c95394f2ca2e60d9f7ae8532
|
F test/selectA.test 06d1032fa9009314c95394f2ca2e60d9f7ae8532
|
||||||
F test/selectB.test f305cc6660804cb239aab4e2f26b0e288b59958b
|
F test/selectB.test f305cc6660804cb239aab4e2f26b0e288b59958b
|
||||||
F test/selectC.test 07a45610c8b3bd878943004fd23f4cc0682bd4c0
|
F test/selectC.test 33bb5673a8141df193c6fd56e6de7fea38b8d2ee
|
||||||
F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
|
F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
|
||||||
F test/shared.test 3b448dc0f7a9356e641894ed81c27599f39d809d
|
F test/shared.test 3b448dc0f7a9356e641894ed81c27599f39d809d
|
||||||
F test/shared2.test d6ba4ca1827ea36a1ac23a99e3c36eeac9165450
|
F test/shared2.test d6ba4ca1827ea36a1ac23a99e3c36eeac9165450
|
||||||
@ -797,14 +794,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 0077ed5cf4e56eb81cfa850fc98e6b033708fc03
|
P ba13a11108d7852c61f959cc8a5fc39c25202cae
|
||||||
R 56c8343b4f277bc12b9b897cd58cdd94
|
R a7012d4c6b5a7b7569f946e644ce711a
|
||||||
U drh
|
U dan
|
||||||
Z 8ebc2b432bd50e0f49413539fdd5f09e
|
Z 1ad98db4671ea4d80ce9c3a38a2ae9ea
|
||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
|
||||||
|
|
||||||
iD8DBQFLs1TnoxKgR168RlERAjpyAJ0YF9xHerWV0uBAKaw5dzIZU55JlgCfXja8
|
|
||||||
4NzKAVp1wWjQNstlPw5vIz4=
|
|
||||||
=FiSS
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
|
@ -1 +1 @@
|
|||||||
ba13a11108d7852c61f959cc8a5fc39c25202cae
|
ffc23409c7fb45dc5a8722fad26e26d207bb3213
|
12
src/select.c
12
src/select.c
@ -3498,6 +3498,18 @@ static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
|
|||||||
sqlite3ExprCacheClear(pParse);
|
sqlite3ExprCacheClear(pParse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Before populating the accumulator registers, clear the column cache.
|
||||||
|
** Otherwise, if any of the required column values are already present
|
||||||
|
** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value
|
||||||
|
** to pC->iMem. But by the time the value is used, the original register
|
||||||
|
** may have been used, invalidating the underlying buffer holding the
|
||||||
|
** text or blob value. See ticket [883034dcb5].
|
||||||
|
**
|
||||||
|
** Another solution would be to change the OP_SCopy used to copy cached
|
||||||
|
** values to an OP_Copy.
|
||||||
|
*/
|
||||||
|
sqlite3ExprCacheClear(pParse);
|
||||||
for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
|
for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
|
||||||
sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
|
sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
|
||||||
}
|
}
|
||||||
|
@ -166,4 +166,48 @@ ifcapable trigger {
|
|||||||
} {1 {no such column: new.x}}
|
} {1 {no such column: new.x}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check that ticket [883034dcb5] is fixed.
|
||||||
|
#
|
||||||
|
do_test selectC-3.1 {
|
||||||
|
execsql {
|
||||||
|
CREATE TABLE person (
|
||||||
|
org_id TEXT NOT NULL,
|
||||||
|
nickname TEXT NOT NULL,
|
||||||
|
license TEXT,
|
||||||
|
CONSTRAINT person_pk PRIMARY KEY (org_id, nickname),
|
||||||
|
CONSTRAINT person_license_uk UNIQUE (license)
|
||||||
|
);
|
||||||
|
INSERT INTO person VALUES('meyers', 'jack', '2GAT123');
|
||||||
|
INSERT INTO person VALUES('meyers', 'hill', 'V345FMP');
|
||||||
|
INSERT INTO person VALUES('meyers', 'jim', '2GAT138');
|
||||||
|
INSERT INTO person VALUES('smith', 'maggy', '');
|
||||||
|
INSERT INTO person VALUES('smith', 'jose', 'JJZ109');
|
||||||
|
INSERT INTO person VALUES('smith', 'jack', 'THX138');
|
||||||
|
INSERT INTO person VALUES('lakeside', 'dave', '953OKG');
|
||||||
|
INSERT INTO person VALUES('lakeside', 'amy', NULL);
|
||||||
|
INSERT INTO person VALUES('lake-apts', 'tom', NULL);
|
||||||
|
INSERT INTO person VALUES('acorn', 'hideo', 'CQB421');
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
org_id,
|
||||||
|
count((NOT (org_id IS NULL)) AND (NOT (nickname IS NULL)))
|
||||||
|
FROM person
|
||||||
|
WHERE (CASE WHEN license != '' THEN 1 ELSE 0 END)
|
||||||
|
GROUP BY 1;
|
||||||
|
}
|
||||||
|
} {acorn 1 lakeside 1 meyers 3 smith 2}
|
||||||
|
do_test selectC-3.2 {
|
||||||
|
execsql {
|
||||||
|
CREATE TABLE t2(a PRIMARY KEY, b);
|
||||||
|
INSERT INTO t2 VALUES('abc', 'xxx');
|
||||||
|
INSERT INTO t2 VALUES('def', 'yyy');
|
||||||
|
SELECT a, max(b || a) FROM t2 WHERE (b||b||b)!='value' GROUP BY a;
|
||||||
|
}
|
||||||
|
} {abc xxxabc def yyydef}
|
||||||
|
do_test selectC-3.3 {
|
||||||
|
execsql {
|
||||||
|
SELECT b, max(a || b) FROM t2 WHERE (b||b||b)!='value' GROUP BY a;
|
||||||
|
}
|
||||||
|
} {xxx abcxxx yyy defyyy}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
Reference in New Issue
Block a user