The INSERT code generator does a better job of detecting if the table
being written into is used in the SELECT on the right-hand side. ticket #901. (CVS 1961) FossilOrigin-Name: 709bb22d6ddbd713029059180aaf77ac483b5bb8
This commit is contained in:
parent
c16a03b54b
commit
a42707b234
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C The\scallback\son\ssqlite3_trace()\sis\sinvoked\sthe\sfirst\stime\ssqlite3_step()\nis\scalled\safter\ssqlite3_prepare()\sor\ssqlite3_reset().\s\sTicket\s#900.\s(CVS\s1960)
|
||||
D 2004-09-15T13:38:11
|
||||
C The\sINSERT\scode\sgenerator\sdoes\sa\sbetter\sjob\sof\sdetecting\sif\sthe\stable\nbeing\swritten\sinto\sis\sused\sin\sthe\sSELECT\son\sthe\sright-hand\sside.\nticket\s#901.\s(CVS\s1961)
|
||||
D 2004-09-17T17:23:15
|
||||
F Makefile.in 9cdfc3af2647055085969968ca2394f24c3c6166
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -37,7 +37,7 @@ F src/expr.c 9130794d8c86af2cbf2b8cdc66f2158167fd15b1
|
||||
F src/func.c 1fbc5256639586573fd0e70814d6dcd8bc10afc1
|
||||
F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
|
||||
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
||||
F src/insert.c bfd21070c28dd94e58ae918260a6985d2b5e4477
|
||||
F src/insert.c 1f2d34d6762279e5e63dfb4a60772d30a5525b00
|
||||
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
||||
F src/main.c 82a952ef3e5f7bacaa1b20060d0588f8767a6774
|
||||
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
||||
@ -122,7 +122,7 @@ F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
|
||||
F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
|
||||
F test/index.test 31ed90af028d1ec9a3a8a4f0d7021717ba05dd16
|
||||
F test/insert.test ebbab63db4ad69395a058514bccb3cdb0a029d48
|
||||
F test/insert2.test ea5d4f8dcbc68d8ad85eaa5f03d9812757610f90
|
||||
F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
|
||||
F test/interrupt.test 9142ce4448605127640eda5e283952f75f67ed91
|
||||
F test/intpkey.test c8efd06db62b8b27216558ef439cc867d113cfec
|
||||
F test/ioerr.test 7d087bfd1a1a53442940e000df936e0df0c5b886
|
||||
@ -247,7 +247,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P c1f1320be5ce0b6e52491577078ba2b939882fbd
|
||||
R aecc6b7d054a0a0bc5b475a58b060454
|
||||
P 0cc2f40e6afa157ead45140c4e28a9a33c469b73
|
||||
R 4638fdb57c25dfafa54254201f37cbfd
|
||||
U drh
|
||||
Z 08c3c5131edf3b7397865edadac24eb1
|
||||
Z 58d52698abacf48a5d5a56e83ebdab52
|
||||
|
@ -1 +1 @@
|
||||
0cc2f40e6afa157ead45140c4e28a9a33c469b73
|
||||
709bb22d6ddbd713029059180aaf77ac483b5bb8
|
11
src/insert.c
11
src/insert.c
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle INSERT statements in SQLite.
|
||||
**
|
||||
** $Id: insert.c,v 1.116 2004/09/06 17:24:13 drh Exp $
|
||||
** $Id: insert.c,v 1.117 2004/09/17 17:23:15 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -286,10 +286,13 @@ void sqlite3Insert(
|
||||
if( row_triggers_exist ){
|
||||
useTempTable = 1;
|
||||
}else{
|
||||
int addr = sqlite3VdbeFindOp(v, 0, OP_OpenRead, pTab->tnum);
|
||||
int addr = 0;
|
||||
useTempTable = 0;
|
||||
if( addr>0 ){
|
||||
VdbeOp *pOp = sqlite3VdbeGetOp(v, addr-2);
|
||||
while( useTempTable==0 ){
|
||||
VdbeOp *pOp;
|
||||
addr = sqlite3VdbeFindOp(v, addr, OP_OpenRead, pTab->tnum);
|
||||
if( addr==0 ) break;
|
||||
pOp = sqlite3VdbeGetOp(v, addr-2);
|
||||
if( pOp->opcode==OP_Integer && pOp->p1==pTab->iDb ){
|
||||
useTempTable = 1;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing the INSERT statement that takes is
|
||||
# result from a SELECT.
|
||||
#
|
||||
# $Id: insert2.test,v 1.11 2004/06/21 06:50:29 danielk1977 Exp $
|
||||
# $Id: insert2.test,v 1.12 2004/09/17 17:23:15 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -192,4 +192,30 @@ do_test insert2-3.8 {
|
||||
} {159}
|
||||
integrity_check insert2-3.9
|
||||
|
||||
# Ticket #901
|
||||
#
|
||||
do_test insert2-4.1 {
|
||||
execsql {
|
||||
CREATE TABLE Dependencies(depId integer primary key,
|
||||
class integer, name str, flag str);
|
||||
CREATE TEMPORARY TABLE DepCheck(troveId INT, depNum INT,
|
||||
flagCount INT, isProvides BOOL, class INTEGER, name STRING,
|
||||
flag STRING);
|
||||
INSERT INTO DepCheck
|
||||
VALUES(-1, 0, 1, 0, 2, 'libc.so.6', 'GLIBC_2.0');
|
||||
INSERT INTO Dependencies
|
||||
SELECT DISTINCT
|
||||
NULL,
|
||||
DepCheck.class,
|
||||
DepCheck.name,
|
||||
DepCheck.flag
|
||||
FROM DepCheck LEFT OUTER JOIN Dependencies ON
|
||||
DepCheck.class == Dependencies.class AND
|
||||
DepCheck.name == Dependencies.name AND
|
||||
DepCheck.flag == Dependencies.flag
|
||||
WHERE
|
||||
Dependencies.depId is NULL;
|
||||
};
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user