mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Fix a serious bug in INSERT when the source is a SELECT. (CVS 366)
FossilOrigin-Name: 20ea737536700b016385c70105a2af8b2bffce2b
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.50 2002/02/03 17:37:36 drh Exp $
|
||||
** $Id: btree.c,v 1.51 2002/02/03 19:06:03 drh Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
@ -2461,7 +2461,7 @@ int sqliteBtreeUpdateMeta(Btree *pBt, int *aMeta){
|
||||
** All of the following code is omitted if the library is compiled with
|
||||
** the -DNDEBUG=1 compiler option.
|
||||
******************************************************************************/
|
||||
#ifndef NDEEBUG
|
||||
#ifndef NDEBUG
|
||||
|
||||
/*
|
||||
** Print a disassembly of the given page on standard output. This routine
|
||||
|
@ -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.41 2002/02/03 00:56:10 drh Exp $
|
||||
** $Id: insert.c,v 1.42 2002/02/03 19:06:03 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -238,7 +238,7 @@ void sqliteInsert(
|
||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||
sqliteVdbeChangeP3(v, -1, pTab->aCol[i].zDflt, P3_STATIC);
|
||||
}else if( srcTab>=0 ){
|
||||
sqliteVdbeAddOp(v, OP_Column, srcTab, i);
|
||||
sqliteVdbeAddOp(v, OP_Column, srcTab, j);
|
||||
}else{
|
||||
sqliteExprCode(pParse, pList->a[j].pExpr);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle SELECT statements in SQLite.
|
||||
**
|
||||
** $Id: select.c,v 1.56 2002/01/28 15:53:05 drh Exp $
|
||||
** $Id: select.c,v 1.57 2002/02/03 19:06:03 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -335,7 +335,7 @@ static int fillInColumnList(Parse *pParse, Select *p){
|
||||
if( pTabList->a[i].zName==0 ){
|
||||
/* No table name is given. Instead, there is a (SELECT ...) statement
|
||||
** the results of which should be used in place of the table. The
|
||||
** was this is implemented is that the (SELECT ...) writes its results
|
||||
** way this is implemented is that the (SELECT ...) writes its results
|
||||
** into a temporary table which is then scanned like any other table.
|
||||
*/
|
||||
sqliteSetString(&pParse->zErrMsg,
|
||||
|
13
src/vdbe.c
13
src/vdbe.c
@ -30,7 +30,7 @@
|
||||
** But other routines are also provided to help in building up
|
||||
** a program instruction by instruction.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.116 2002/02/03 03:34:09 drh Exp $
|
||||
** $Id: vdbe.c,v 1.117 2002/02/03 19:06:03 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -3493,7 +3493,7 @@ case OP_CreateTable: {
|
||||
** This opcode is used for testing purposes only.
|
||||
*/
|
||||
case OP_SanityCheck: {
|
||||
#if 1 /* This opcode used for testing only */
|
||||
#ifndef NDEBUG /* This opcode used for testing only */
|
||||
int nRoot;
|
||||
int *aRoot;
|
||||
int tos = ++p->tos;
|
||||
@ -3503,10 +3503,8 @@ case OP_SanityCheck: {
|
||||
HashElem *i;
|
||||
char *z;
|
||||
|
||||
if( iSet<0 || iSet>=p->nSet ){
|
||||
goto bad_instruction;
|
||||
}
|
||||
VERIFY( if( NeedStack(p, p->tos) ) goto no_mem; )
|
||||
if( iSet<0 || iSet>=p->nSet ) goto bad_instruction;
|
||||
if( NeedStack(p, p->tos) ) goto no_mem;
|
||||
pSet = &p->aSet[iSet];
|
||||
nRoot = sqliteHashCount(&pSet->hash);
|
||||
aRoot = sqliteMalloc( sizeof(int)*(nRoot+1) );
|
||||
@ -3525,7 +3523,8 @@ case OP_SanityCheck: {
|
||||
aStack[tos].n = strlen(z) + 1;
|
||||
aStack[tos].flags = STK_Str | STK_Dyn;
|
||||
}
|
||||
#endif /* SQLITE_TEST */
|
||||
sqliteFree(aRoot);
|
||||
#endif /* !define(NDEBUG) */
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user