aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/printf.c13
-rw-r--r--src/resolve.c1
-rw-r--r--src/sqliteInt.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/printf.c b/src/printf.c
index 9fea2d6ef..a8cfc1931 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -935,6 +935,19 @@ void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){
}
/*
+** If pExpr has a byte offset for the start of a token, record that as
+** as the error offset.
+*/
+void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){
+ if( db->errByteOffset>=0 ) return;
+ while( pExpr && (ExprHasProperty(pExpr,EP_FromJoin) || pExpr->w.iOfst<=0) ){
+ pExpr = pExpr->pLeft;
+ }
+ if( pExpr==0 ) return;
+ db->errByteOffset = pExpr->w.iOfst;
+}
+
+/*
** Enlarge the memory allocation on a StrAccum object so that it is
** able to accept at least N more bytes of text.
**
diff --git a/src/resolve.c b/src/resolve.c
index 78135cf3b..8250ce9ef 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -620,6 +620,7 @@ static int lookupName(
}else{
sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
}
+ sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr);
pParse->checkSchema = 1;
pTopNC->nNcErr++;
}
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 58fe64ea0..1ed600f4d 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -4995,6 +4995,7 @@ void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*);
void sqlite3SelectDestInit(SelectDest*,int,int);
Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
void sqlite3RecordErrorByteOffset(sqlite3*,const char*);
+void sqlite3RecordErrorOffsetOfExpr(sqlite3*,const Expr*);
void sqlite3BackupRestart(sqlite3_backup *);
void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);