mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Fix errors in in.test. Also add a few tests to selectB.test. (CVS 5337)
FossilOrigin-Name: 8f9d1abb315a3d4aa3a580fd5cf3ae572cc330f4
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sanother\smemory\sleak\srelated\sto\sUNION\sALL\sand\ssub-selects.\s(CVS\s5336)
|
C Fix\serrors\sin\sin.test.\sAlso\sadd\sa\sfew\stests\sto\sselectB.test.\s(CVS\s5337)
|
||||||
D 2008-07-01T17:39:27
|
D 2008-07-01T18:26:50
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042
|
F Makefile.in 325dfac0a0dd1cb4d975f1ace6453157892e6042
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -140,7 +140,7 @@ F src/pragma.c 9a95f5b3708f6d3ddd987eab5f369a19ffcb6795
|
|||||||
F src/prepare.c aba51dad52308e3d9d2074d8ff4e612e7f1cab51
|
F src/prepare.c aba51dad52308e3d9d2074d8ff4e612e7f1cab51
|
||||||
F src/printf.c 8b063da9dcde26b7c500a01444b718d86f21bc6e
|
F src/printf.c 8b063da9dcde26b7c500a01444b718d86f21bc6e
|
||||||
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
|
F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
|
||||||
F src/select.c 0b01cf5fb40589d9198f33c9ced1991ac628a2f8
|
F src/select.c 154b3feee700273671b74a8436c31331309171e5
|
||||||
F src/shell.c 484e7297e066f22830f9c15d7abbcdd2acb097b0
|
F src/shell.c 484e7297e066f22830f9c15d7abbcdd2acb097b0
|
||||||
F src/sqlite.h.in 76c144d23f8824e8811e837e9396b9f1361f5902
|
F src/sqlite.h.in 76c144d23f8824e8811e837e9396b9f1361f5902
|
||||||
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
||||||
@@ -449,7 +449,7 @@ F test/select7.test 7906735805cfbee4dddc0bed4c14e68d7f5f9c5f
|
|||||||
F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
|
F test/select8.test 391de11bdd52339c30580dabbbbe97e3e9a3c79d
|
||||||
F test/select9.test b4007b15396cb7ba2615cab31e1973b572e43210
|
F test/select9.test b4007b15396cb7ba2615cab31e1973b572e43210
|
||||||
F test/selectA.test e4501789a1d0fe9d00db15187623fb5b7031357b
|
F test/selectA.test e4501789a1d0fe9d00db15187623fb5b7031357b
|
||||||
F test/selectB.test afc43b5bbcfe405f82155f19f74f9622146ea7ad
|
F test/selectB.test 811a852ad6567f3d6f786619511f9c4b2ed1defd
|
||||||
F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
|
F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c
|
||||||
F test/shared.test c6769531e0cb751d46a9838c0532d3786606c0f6
|
F test/shared.test c6769531e0cb751d46a9838c0532d3786606c0f6
|
||||||
F test/shared2.test 0ee9de8964d70e451936a48c41cb161d9134ccf4
|
F test/shared2.test 0ee9de8964d70e451936a48c41cb161d9134ccf4
|
||||||
@@ -596,7 +596,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 3447086cd3f6e9b89a8cf61afcf4715977bbf4cd
|
P 56109b9a1f600ab3f16769aba0d47dcf782bbc95
|
||||||
R cb3df126aa8389a3fd8ddcad9fc0443a
|
R 7cae1eb722ade0f7563a43911c2df151
|
||||||
U danielk1977
|
U danielk1977
|
||||||
Z 22d640258a50fd055c660f5120001e9b
|
Z 24db410bfd4f0e01c8ce47ef0672d11f
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
56109b9a1f600ab3f16769aba0d47dcf782bbc95
|
8f9d1abb315a3d4aa3a580fd5cf3ae572cc330f4
|
||||||
28
src/select.c
28
src/select.c
@@ -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.444 2008/07/01 17:39:27 danielk1977 Exp $
|
** $Id: select.c,v 1.445 2008/07/01 18:26:50 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -3063,16 +3063,16 @@ static void substSelect(
|
|||||||
** until we introduced the group_concat() function.
|
** until we introduced the group_concat() function.
|
||||||
**
|
**
|
||||||
** (17) The sub-query is not a compound select, or it is a UNION ALL
|
** (17) The sub-query is not a compound select, or it is a UNION ALL
|
||||||
** compound without an ORDER BY, LIMIT or OFFSET clause made up
|
** compound clause made up entirely of non-aggregate queries, and
|
||||||
** entirely of non-aggregate queries, and
|
|
||||||
** the parent query:
|
** the parent query:
|
||||||
**
|
**
|
||||||
** * is not itself part of a compound select,
|
** * is not itself part of a compound select,
|
||||||
** * is not an aggregate or DISTINCT query, and
|
** * is not an aggregate or DISTINCT query, and
|
||||||
** * has no other tables or sub-selects in the FROM clause.
|
** * has no other tables or sub-selects in the FROM clause.
|
||||||
**
|
**
|
||||||
** The parent query may have WHERE, ORDER BY, LIMIT and OFFSET
|
** The parent and sub-query may contain WHERE clauses. Subject to
|
||||||
** clauses.
|
** rules (11), (13) and (14), they may also contain ORDER BY,
|
||||||
|
** LIMIT and OFFSET clauses.
|
||||||
**
|
**
|
||||||
** In this routine, the "p" parameter is a pointer to the outer query.
|
** In this routine, the "p" parameter is a pointer to the outer query.
|
||||||
** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
|
** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
|
||||||
@@ -3768,15 +3768,6 @@ int sqlite3Select(
|
|||||||
*/
|
*/
|
||||||
if( pParse->nErr>0 ) goto select_end;
|
if( pParse->nErr>0 ) goto select_end;
|
||||||
|
|
||||||
/* If writing to memory or generating a set
|
|
||||||
** only a single column may be output.
|
|
||||||
*/
|
|
||||||
#ifndef SQLITE_OMIT_SUBQUERY
|
|
||||||
if( checkForMultiColumnSelectError(pParse, pDest, pEList->nExpr) ){
|
|
||||||
goto select_end;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ORDER BY is ignored for some destinations.
|
/* ORDER BY is ignored for some destinations.
|
||||||
*/
|
*/
|
||||||
if( IgnorableOrderby(pDest) ){
|
if( IgnorableOrderby(pDest) ){
|
||||||
@@ -3867,6 +3858,15 @@ int sqlite3Select(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If writing to memory or generating a set
|
||||||
|
** only a single column may be output.
|
||||||
|
*/
|
||||||
|
#ifndef SQLITE_OMIT_SUBQUERY
|
||||||
|
if( checkForMultiColumnSelectError(pParse, pDest, pEList->nExpr) ){
|
||||||
|
goto select_end;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If possible, rewrite the query to use GROUP BY instead of DISTINCT.
|
/* If possible, rewrite the query to use GROUP BY instead of DISTINCT.
|
||||||
** GROUP BY may use an index, DISTINCT never does.
|
** GROUP BY may use an index, DISTINCT never does.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# This file implements regression tests for SQLite library.
|
# This file implements regression tests for SQLite library.
|
||||||
#
|
#
|
||||||
# $Id: selectB.test,v 1.4 2008/07/01 17:39:28 danielk1977 Exp $
|
# $Id: selectB.test,v 1.5 2008/07/01 18:26:51 danielk1977 Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@@ -144,6 +144,40 @@ for {set ii 1} {$ii <= 2} {incr ii} {
|
|||||||
UNION ALL SELECT c FROM t1 WHERE c>=10
|
UNION ALL SELECT c FROM t1 WHERE c>=10
|
||||||
ORDER BY 1 LIMIT 3
|
ORDER BY 1 LIMIT 3
|
||||||
} {12 12 14}
|
} {12 12 14}
|
||||||
|
|
||||||
|
test_transform selectB-$ii.12 {
|
||||||
|
SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2 LIMIT 2)
|
||||||
|
} {
|
||||||
|
SELECT a FROM t1 UNION ALL SELECT d FROM t2 LIMIT 2
|
||||||
|
} {2 8}
|
||||||
|
|
||||||
|
test_transform selectB-$ii.13 {
|
||||||
|
SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY a ASC)
|
||||||
|
} {
|
||||||
|
SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 ASC
|
||||||
|
} {2 3 8 12 14 21}
|
||||||
|
|
||||||
|
test_transform selectB-$ii.14 {
|
||||||
|
SELECT * FROM (SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY a DESC)
|
||||||
|
} {
|
||||||
|
SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 DESC
|
||||||
|
} {21 14 12 8 3 2}
|
||||||
|
|
||||||
|
test_transform selectB-$ii.14 {
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY a DESC
|
||||||
|
) LIMIT 2 OFFSET 2
|
||||||
|
} {
|
||||||
|
SELECT a FROM t1 UNION ALL SELECT d FROM t2 ORDER BY 1 DESC LIMIT 2 OFFSET 2
|
||||||
|
} {12 8}
|
||||||
|
|
||||||
|
test_transform selectB-$ii.15 {
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT a, b FROM t1 UNION ALL SELECT d, e FROM t2 ORDER BY a ASC, e DESC
|
||||||
|
)
|
||||||
|
} {
|
||||||
|
SELECT a, b FROM t1 UNION ALL SELECT d, e FROM t2 ORDER BY a ASC, e DESC
|
||||||
|
} {2 4 3 6 8 10 12 15 14 16 21 24}
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test selectB-3.0 {
|
do_test selectB-3.0 {
|
||||||
@@ -291,6 +325,38 @@ for {set ii 3} {$ii <= 4} {incr ii} {
|
|||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
}
|
}
|
||||||
} {6 9 15 18 24 27}
|
} {6 9 15 18 24 27}
|
||||||
|
|
||||||
|
do_test selectB-$ii.17 {
|
||||||
|
execsql {
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT a FROM t1 UNION ALL SELECT d FROM t2 LIMIT 4
|
||||||
|
) LIMIT 2
|
||||||
|
}
|
||||||
|
} {2 8}
|
||||||
|
|
||||||
|
do_test selectB-$ii.18 {
|
||||||
|
execsql {
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT a FROM t1 UNION ALL SELECT d FROM t2 LIMIT 4 OFFSET 2
|
||||||
|
) LIMIT 2
|
||||||
|
}
|
||||||
|
} {14 3}
|
||||||
|
|
||||||
|
do_test selectB-$ii.19 {
|
||||||
|
execsql {
|
||||||
|
SELECT * FROM (
|
||||||
|
SELECT DISTINCT (a/10) FROM t1 UNION ALL SELECT DISTINCT(d%2) FROM t2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} {0 1 0 1}
|
||||||
|
|
||||||
|
do_test selectB-$ii.20 {
|
||||||
|
execsql {
|
||||||
|
SELECT DISTINCT * FROM (
|
||||||
|
SELECT DISTINCT (a/10) FROM t1 UNION ALL SELECT DISTINCT(d%2) FROM t2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} {0 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|||||||
Reference in New Issue
Block a user