Use a vdbe memory cell to allocate the space required for vdbe cursors. (CVS 4912)

FossilOrigin-Name: 047153648155654b0cd70b811935209d2e21776c
diff --git a/src/insert.c b/src/insert.c
index 9a2cb56..f7950d0 100644
--- a/src/insert.c
+++ b/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.232 2008/03/19 20:42:14 drh Exp $
+** $Id: insert.c,v 1.233 2008/03/25 09:47:35 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -537,8 +537,7 @@
       ** back up and execute the SELECT code above.
       */
       sqlite3VdbeJumpHere(v, iInitCode);
-      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, 0);
-      sqlite3VdbeAddOp2(v, OP_SetNumColumns, srcTab, nColumn);
+      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, nColumn);
       sqlite3VdbeAddOp2(v, OP_Goto, 0, iSelectLoop);
       sqlite3VdbeResolveLabel(v, iCleanup);
     }else{
@@ -629,8 +628,8 @@
   /* Open the temp table for FOR EACH ROW triggers
   */
   if( triggers_exist ){
+    sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol);
     sqlite3VdbeAddOp2(v, OP_OpenPseudo, newIdx, 0);
-    sqlite3VdbeAddOp2(v, OP_SetNumColumns, newIdx, pTab->nCol);
   }
     
   /* Initialize the count of rows to be inserted