1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Reinsert an SCopy operation that was removed in (5523) because coverage

testing indicated that it was dead code.  Ticket #3324 shows that the
code was not as dead as we thought it was. (CVS 5578)

FossilOrigin-Name: 6855711595b58d4b6fbaf9480720b788904d0e2d
This commit is contained in:
drh
2008-08-21 14:15:59 +00:00
parent 69556698e0
commit 6a012f04d5
4 changed files with 75 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
C Patch\sto\smkfunction\sto\stry\sand\sdetect\smiscompiles.\s\sAdd\san\sunimportant\nassert\sback\sto\spcache.c.\s(CVS\s5577) C Reinsert\san\sSCopy\soperation\sthat\swas\sremoved\sin\s(5523)\sbecause\scoverage\ntesting\sindicated\sthat\sit\swas\sdead\scode.\s\sTicket\s#3324\sshows\sthat\sthe\ncode\swas\snot\sas\sdead\sas\swe\sthought\sit\swas.\s(CVS\s5578)
D 2008-08-21T12:32:12 D 2008-08-21T14:15:59
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 0b1c022000f55221454a7846022f11674d8024bf F Makefile.in 0b1c022000f55221454a7846022f11674d8024bf
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -145,7 +145,7 @@ F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
F src/resolve.c e688f240bdacf4003047c2b023c3a4ee3a3eca98 F src/resolve.c e688f240bdacf4003047c2b023c3a4ee3a3eca98
F src/select.c 0a0ed2d14bfa216c1584fa8516e8820115b1047b F src/select.c eed74c3d00c45a01808a16aaca8a676e222bf2fa
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967 F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
F src/sqlite.h.in 54e51c22e2294c5989156b0aec87aa44168ac1f0 F src/sqlite.h.in 54e51c22e2294c5989156b0aec87aa44168ac1f0
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
@@ -465,7 +465,7 @@ F test/select1.test d0a4cad954fd41c030ec16ffbd2d08a4c0548742
F test/select2.test 272a3d3e35b1d3a0760168ababf555e656357fc4 F test/select2.test 272a3d3e35b1d3a0760168ababf555e656357fc4
F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054 F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054
F test/select4.test b64d5d248d008e1dc365f451c76090bde907e665 F test/select4.test b64d5d248d008e1dc365f451c76090bde907e665
F test/select5.test 2c5464283438e06531a1e8801c674279dd01dd04 F test/select5.test e758b8ef94f69b111df4cb819008856655dcd535
F test/select6.test faad87c6e691bf69a822b69cd6808137a34d19e8 F test/select6.test faad87c6e691bf69a822b69cd6808137a34d19e8
F test/select7.test 7906735805cfbee4dddc0bed4c14e68d7f5f9c5f F test/select7.test 7906735805cfbee4dddc0bed4c14e68d7f5f9c5f
F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
@@ -623,7 +623,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P d025866b09352b32a6d35b97144eaad2fafb7165 P a2f375fffb49b6f6adbfd59d24e9c6a170fd5ebb
R b4969a898ecc1333175a9c194ed1293f R a28baeafe56f2cc5b7a4255743c38809
U drh U drh
Z 4309b6f5bb92174f920621883fba8649 Z 48f409680bd6268427d83dfae2ba5930

View File

@@ -1 +1 @@
a2f375fffb49b6f6adbfd59d24e9c6a170fd5ebb 6855711595b58d4b6fbaf9480720b788904d0e2d

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite. ** to handle SELECT statements in SQLite.
** **
** $Id: select.c,v 1.466 2008/08/20 16:35:10 drh Exp $ ** $Id: select.c,v 1.467 2008/08/21 14:15:59 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -3773,20 +3773,14 @@ int sqlite3Select(
struct AggInfo_col *pCol = &sAggInfo.aCol[i]; struct AggInfo_col *pCol = &sAggInfo.aCol[i];
if( pCol->iSorterColumn>=j ){ if( pCol->iSorterColumn>=j ){
int r1 = j + regBase; int r1 = j + regBase;
#ifndef NDEBUG int r2;
int r2 =
#endif
sqlite3ExprCodeGetColumn(pParse,
pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0);
j++;
/* sAggInfo.aCol[] only contains one entry per column. So r2 = sqlite3ExprCodeGetColumn(pParse,
** The reference to pCol->iColumn,pCol->iTable must have been pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0);
** the first reference to that column. Hence, if( r1!=r2 ){
** sqliteExprCodeGetColumn is guaranteed to put the result in sqlite3VdbeAddOp2(v, OP_SCopy, r2, r1);
** the column requested. }
*/ j++;
assert( r1==r2 );
} }
} }
regRecord = sqlite3GetTempReg(pParse); regRecord = sqlite3GetTempReg(pParse);

View File

@@ -12,7 +12,7 @@
# focus of this file is testing aggregate functions and the # focus of this file is testing aggregate functions and the
# GROUP BY and HAVING clauses of SELECT statements. # GROUP BY and HAVING clauses of SELECT statements.
# #
# $Id: select5.test,v 1.19 2008/08/20 16:35:10 drh Exp $ # $Id: select5.test,v 1.20 2008/08/21 14:15:59 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -191,10 +191,67 @@ do_test select5-6.2 {
} }
} {1 1 2 {} 2 1 3 {} 3 1 {} 5 4 2 {} 6 5 2 {} {} 6 1 7 8} } {1 1 2 {} 2 1 3 {} 3 1 {} 5 4 2 {} 6 5 2 {} {} 6 1 7 8}
do_test select5.7.2 { do_test select5-7.2 {
execsql { execsql {
SELECT count(*), count(x) as cnt FROM t4 GROUP BY y ORDER BY cnt; SELECT count(*), count(x) as cnt FROM t4 GROUP BY y ORDER BY cnt;
} }
} {1 1 1 1 1 1 5 5} } {1 1 1 1 1 1 5 5}
# See ticket #3324.
#
do_test select5-8.1 {
execsql {
CREATE TABLE t8a(a,b);
CREATE TABLE t8b(x);
INSERT INTO t8a VALUES('one', 1);
INSERT INTO t8a VALUES('one', 2);
INSERT INTO t8a VALUES('two', 3);
INSERT INTO t8a VALUES('one', NULL);
INSERT INTO t8b(rowid,x) VALUES(1,111);
INSERT INTO t8b(rowid,x) VALUES(2,222);
INSERT INTO t8b(rowid,x) VALUES(3,333);
SELECT a, count(b) FROM t8a, t8b WHERE b=t8b.rowid GROUP BY a ORDER BY a;
}
} {one 2 two 1}
do_test select5-8.2 {
execsql {
SELECT a, count(b) FROM t8a, t8b WHERE b=+t8b.rowid GROUP BY a ORDER BY a;
}
} {one 2 two 1}
do_test select5-8.3 {
execsql {
SELECT t8a.a, count(t8a.b) FROM t8a, t8b WHERE t8a.b=t8b.rowid
GROUP BY 1 ORDER BY 1;
}
} {one 2 two 1}
do_test select5-8.4 {
execsql {
SELECT a, count(*) FROM t8a, t8b WHERE b=+t8b.rowid GROUP BY a ORDER BY a;
}
} {one 2 two 1}
do_test select5-8.5 {
execsql {
SELECT a, count(b) FROM t8a, t8b WHERE b<x GROUP BY a ORDER BY a;
}
} {one 6 two 3}
do_test select5-8.6 {
execsql {
SELECT a, count(t8a.b) FROM t8a, t8b WHERE b=t8b.rowid
GROUP BY a ORDER BY 2;
}
} {two 1 one 2}
do_test select5-8.7 {
execsql {
SELECT a, count(b) FROM t8a, t8b GROUP BY a ORDER BY 2;
}
} {two 3 one 6}
do_test select5-8.8 {
execsql {
SELECT a, count(*) FROM t8a, t8b GROUP BY a ORDER BY 2;
}
} {two 3 one 9}
finish_test finish_test