Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix an obscure problem with "INSERT INTO tbl(cols) SELECT" statements where the SELECT is a compound with an ORDER BY and "cols" is a strict subset of tbl's columns. Cherrypick of [718d5d0eab04]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | branch-3.8.6 |
Files: | files | file ages | folders |
SHA1: |
3cd2b7722186ad2b2a581b7f7e7782c5 |
User & Date: | dan 2015-05-20 20:27:00 |
Context
2015-05-20
| ||
20:30 | Ensure that tables names are dequoted exactly once by the trigger and FK logic. Cherrypick of [59e92bd9521f] and [9d887b92f808]. check-in: bd357739d7 user: dan tags: branch-3.8.6 | |
20:27 | Fix an obscure problem with "INSERT INTO tbl(cols) SELECT" statements where the SELECT is a compound with an ORDER BY and "cols" is a strict subset of tbl's columns. Cherrypick of [718d5d0eab04]. check-in: 3cd2b77221 user: dan tags: branch-3.8.6 | |
20:24 | Fix a potential NULL pointer deference on a corrupt database schema. Cherrypick of [dc61b292d8ea]. check-in: 7f3943fb01 user: dan tags: branch-3.8.6 | |
2015-04-21
| ||
15:49 | Fix an obscure problem with "INSERT INTO tbl(cols) SELECT" statements where the SELECT is a compound with an ORDER BY and "cols" is a strict subset of tbl's columns. check-in: 718d5d0eab user: dan tags: trunk | |
Changes
Changes to src/select.c.
2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 |
** starting at pDest->iSdst. Then the co-routine yields.
*/
case SRT_Coroutine: {
if( pDest->iSdst==0 ){
pDest->iSdst = sqlite3GetTempRange(pParse, pIn->nSdst);
pDest->nSdst = pIn->nSdst;
}
sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSdst, pDest->nSdst);
sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
break;
}
/* If none of the above, then the result destination must be
** SRT_Output. This routine is never called with any other
** destination other than the ones handled above or SRT_Output.
|
| |
2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 |
** starting at pDest->iSdst. Then the co-routine yields.
*/
case SRT_Coroutine: {
if( pDest->iSdst==0 ){
pDest->iSdst = sqlite3GetTempRange(pParse, pIn->nSdst);
pDest->nSdst = pIn->nSdst;
}
sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSdst, pIn->nSdst);
sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
break;
}
/* If none of the above, then the result destination must be
** SRT_Output. This routine is never called with any other
** destination other than the ones handled above or SRT_Output.
|
Changes to test/insert2.test.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
270
271
272
273
274
275
276
277
278
|
# focus of this file is testing the INSERT statement that takes is
# result from a SELECT.
#
# $Id: insert2.test,v 1.19 2008/01/16 18:20:42 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Create some tables with data that we can select against
#
do_test insert2-1.0 {
execsql {CREATE TABLE d1(n int, log int);}
for {set i 1} {$i<=20} {incr i} {
for {set j 0} {(1<<$j)<$i} {incr j} {}
................................................................................
do_test insert2-5.2 {
execsql {
INSERT INTO t2 SELECT (SELECT a FROM t2), 4;
SELECT * FROM t2;
}
} {1 2 1 3 1 4}
}
finish_test
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
# focus of this file is testing the INSERT statement that takes is # result from a SELECT. # # $Id: insert2.test,v 1.19 2008/01/16 18:20:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix insert2 # Create some tables with data that we can select against # do_test insert2-1.0 { execsql {CREATE TABLE d1(n int, log int);} for {set i 1} {$i<=20} {incr i} { for {set j 0} {(1<<$j)<$i} {incr j} {} ................................................................................ do_test insert2-5.2 { execsql { INSERT INTO t2 SELECT (SELECT a FROM t2), 4; SELECT * FROM t2; } } {1 2 1 3 1 4} } do_execsql_test 6.0 { CREATE TABLE t5(a, b, c DEFAULT 'c', d); } do_execsql_test 6.1 { INSERT INTO t5(a) SELECT 456 UNION ALL SELECT 123 ORDER BY 1; SELECT * FROM t5 ORDER BY rowid; } {123 {} c {} 456 {} c {}} ifcapable fts3 { do_execsql_test 6.2 { CREATE VIRTUAL TABLE t0 USING fts4(a); } do_execsql_test 6.3 { INSERT INTO t0 SELECT 0 UNION SELECT 0 AS 'x' ORDER BY x; SELECT * FROM t0; } {0} } finish_test |