1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Prevent a segfault described by ticket #1229. (CVS 2450)

FossilOrigin-Name: 0667eae9a97059125a77bd90452d19dc17c30a12
This commit is contained in:
drh
2005-04-29 02:10:00 +00:00
parent 89dec819d2
commit 7e62779a58
5 changed files with 45 additions and 13 deletions

View File

@@ -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.244 2005/04/22 02:38:38 drh Exp $
** $Id: select.c,v 1.245 2005/04/29 02:10:00 drh Exp $
*/
#include "sqliteInt.h"
@@ -689,6 +689,20 @@ static const char *columnType(NameContext *pNC, Expr *pExpr){
pNC = pNC->pNext;
}
}
if( pTab==0 ){
/* FIX ME:
** This can occurs if you have something like "SELECT new.x;" inside
** a trigger. In other words, if you reference the special "new"
** table in the result set of a select. We do not have a good way
** to find the actual table type, so call it "TEXT". This is really
** something of a bug, but I do not know how to fix it.
**
** This code does not produce the correct answer - it just prevents
** a segfault. See ticket #1229.
*/
zType = "TEXT";
break;
}
assert( pTab );
if( iCol<0 ) iCol = pTab->iPKey;
assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );