Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
709bb22d6ddbd713029059180aaf77ac |
User & Date: | drh 2004-09-17 17:23:15.000 |
Context
2004-09-17
| ||
19:39 | Fix a bug in the test3.c module that was causing failures in btree5.test. (CVS 1962) (check-in: cd200cf833 user: drh tags: trunk) | |
17:23 | 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) (check-in: 709bb22d6d user: drh tags: trunk) | |
2004-09-15
| ||
13:38 | The callback on sqlite3_trace() is invoked the first time sqlite3_step() is called after sqlite3_prepare() or sqlite3_reset(). Ticket #900. (CVS 1960) (check-in: 0cc2f40e6a user: drh tags: trunk) | |
Changes
Changes to src/insert.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** ** $Id: insert.c,v 1.117 2004/09/17 17:23:15 drh Exp $ */ #include "sqliteInt.h" /* ** Set P3 of the most recently inserted opcode to a column affinity ** string for index pIdx. A column affinity string has one character ** for each column in the table, according to the affinity of the column: |
︙ | ︙ | |||
282 283 284 285 286 287 288 | ** A temp table must be used if the table being updated is also one ** of the tables being read by the SELECT statement. Also use a ** temp table in the case of row triggers. */ if( row_triggers_exist ){ useTempTable = 1; }else{ | | > > > | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | ** A temp table must be used if the table being updated is also one ** of the tables being read by the SELECT statement. Also use a ** temp table in the case of row triggers. */ if( row_triggers_exist ){ useTempTable = 1; }else{ int addr = 0; useTempTable = 0; 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; } } } if( useTempTable ){ |
︙ | ︙ |
Changes to test/insert2.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the INSERT statement that takes is # result from a SELECT. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the INSERT statement that takes is # result from a SELECT. # # $Id: insert2.test,v 1.12 2004/09/17 17:23:15 drh 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 { |
︙ | ︙ | |||
187 188 189 190 191 192 193 194 195 | ROLLBACK; } } {1} do_test insert2-3.8 { db changes } {159} integrity_check insert2-3.9 finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | ROLLBACK; } } {1} do_test insert2-3.8 { db changes } {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 |