diff options
author | drh <drh@noemail.net> | 2005-04-29 02:10:00 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2005-04-29 02:10:00 +0000 |
commit | 7e62779a5878d44bc1c7bd75f20cb7fc491503bb (patch) | |
tree | d97e24f9849e369097830d0058ac03b591f3eeaf /src | |
parent | 89dec819d2817337f579142ec11477fcd88888b8 (diff) | |
download | sqlite-7e62779a5878d44bc1c7bd75f20cb7fc491503bb.tar.gz sqlite-7e62779a5878d44bc1c7bd75f20cb7fc491503bb.zip |
Prevent a segfault described by ticket #1229. (CVS 2450)
FossilOrigin-Name: 0667eae9a97059125a77bd90452d19dc17c30a12
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 16 | ||||
-rw-r--r-- | src/sqliteInt.h | 5 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/select.c b/src/select.c index ee15c7216..f64645a8c 100644 --- a/src/select.c +++ b/src/select.c @@ -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) ); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index fdf4a8cdd..516455c34 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.377 2005/04/28 17:18:49 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.378 2005/04/29 02:10:00 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -715,7 +715,8 @@ struct FKey { ** comparison of the two index keys. ** ** If the KeyInfo.incrKey value is true and the comparison would -** otherwise be equal, then return a result as if the second key larger. +** otherwise be equal, then return a result as if the second key +** were larger. */ struct KeyInfo { u8 enc; /* Text encoding - one of the TEXT_Utf* values */ |