Index: src/insert.c ================================================================== --- src/insert.c +++ src/insert.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.148 2005/11/14 22:29:05 drh Exp $ +** $Id: insert.c,v 1.149 2005/11/24 13:15:33 drh Exp $ */ #include "sqliteInt.h" /* ** Set P3 of the most recently inserted opcode to a column affinity @@ -21,13 +21,15 @@ ** string for index pIdx. A column affinity string has one character ** for each column in the table, according to the affinity of the column: ** ** Character Column affinity ** ------------------------------ -** 'n' NUMERIC -** 't' TEXT -** 'o' NONE +** 'a' TEXT +** 'b' NONE +** 'c' NUMERIC +** 'd' INTEGER +** 'e' REAL */ void sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){ if( !pIdx->zColAff ){ /* The first time a column affinity string for a particular index is ** required, it is allocated and populated here. It is then stored as @@ -58,13 +60,15 @@ ** for each column indexed by the index, according to the affinity of the ** column: ** ** Character Column affinity ** ------------------------------ -** 'n' NUMERIC -** 't' TEXT -** 'o' NONE +** 'a' TEXT +** 'b' NONE +** 'c' NUMERIC +** 'd' INTEGER +** 'e' REAL */ void sqlite3TableAffinityStr(Vdbe *v, Table *pTab){ /* The first time a column affinity string for a particular table ** is required, it is allocated and populated here. It is then ** stored as a member of the Table structure for subsequent use. @@ -358,11 +362,10 @@ ** the result. Store the result in a temporary table */ srcTab = pParse->nTab++; sqlite3VdbeResolveLabel(v, iInsertBlock); sqlite3VdbeAddOp(v, OP_MakeRecord, nColumn, 0); - sqlite3TableAffinityStr(v, pTab); sqlite3VdbeAddOp(v, OP_NewRowid, srcTab, 0); sqlite3VdbeAddOp(v, OP_Pull, 1, 0); sqlite3VdbeAddOp(v, OP_Insert, srcTab, 0); sqlite3VdbeAddOp(v, OP_Return, 0, 0); ADDED test/tkt1536.test Index: test/tkt1536.test ================================================================== --- /dev/null +++ test/tkt1536.test @@ -0,0 +1,38 @@ +# 2005 November 24 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. +# +# This file implements tests to verify that ticket #1536 is +# fixed. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_test tkt1536-1.1 { + execsql { + CREATE TABLE t1( + a INTEGER PRIMARY KEY, + b TEXT + ); + INSERT INTO t1 VALUES(1,'01'); + SELECT typeof(a), typeof(b) FROM t1; + } +} {integer text} +do_test tkt1536-1.2 { + execsql { + INSERT INTO t1(b) SELECT b FROM t1; + SELECT b FROM t1 WHERE rowid=2; + } +} {01} + + +finish_test Index: www/optoverview.tcl ================================================================== --- www/optoverview.tcl +++ www/optoverview.tcl @@ -1,9 +1,9 @@ # # Run this TCL script to generate HTML for the goals.html file. # -set rcsid {$Id: optoverview.tcl,v 1.4 2005/09/20 01:36:30 drh Exp $} +set rcsid {$Id: optoverview.tcl,v 1.5 2005/11/24 13:15:34 drh Exp $} source common.tcl header {The SQLite Query Optimizer Overview} proc CODE {text} { puts "
"
@@ -86,11 +86,11 @@
   indices to restrict a search.  But virtual terms never generate code
   that is tested against input rows.
 }
 
 PARAGRAPH {
-  In order be used by an index, a term must be of one of the following
+  To be usable by an index a term must be of one of the following
   forms:
 }
 SYNTAX {
   /column/ = /expression/
   /column/ > /expression/