diff options
author | drh <drh@noemail.net> | 2018-01-10 00:40:06 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-01-10 00:40:06 +0000 |
commit | 6116ee4eeefeec9a0fc81ef4784cb774d50e36a2 (patch) | |
tree | db18275a5eac35261c27a73aaab8969e1d21d31c /src | |
parent | dc006e05aa8ed9181b14924aa742e072dabba79a (diff) | |
download | sqlite-6116ee4eeefeec9a0fc81ef4784cb774d50e36a2.tar.gz sqlite-6116ee4eeefeec9a0fc81ef4784cb774d50e36a2.zip |
Compute the correct column name even if the column identifier is the
very last token in the SQL statement. This fixes a problem introduced
by check-in [0fdf97efe5df745510c6b] and reported by the community during
beta-testing.
FossilOrigin-Name: 36b89d728ff13d395fe0e1db8e7c01263f73dccb278b3ece27f6ef78e909b492
Diffstat (limited to 'src')
-rw-r--r-- | src/build.c | 2 | ||||
-rw-r--r-- | src/parse.y | 7 | ||||
-rw-r--r-- | src/tokenize.c | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/build.c b/src/build.c index 26eb0579e..58b39d647 100644 --- a/src/build.c +++ b/src/build.c @@ -2124,7 +2124,7 @@ void sqlite3CreateView( ** the end. */ sEnd = pParse->sLastToken; - assert( sEnd.z[0]!=0 ); + assert( sEnd.z[0]!=0 || sEnd.n==0 ); if( sEnd.z[0]!=';' ){ sEnd.z += sEnd.n; } diff --git a/src/parse.y b/src/parse.y index e780f8c3a..d9cf1cb87 100644 --- a/src/parse.y +++ b/src/parse.y @@ -31,8 +31,11 @@ // %syntax_error { UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */ - assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */ - sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); + if( TOKEN.z[0] ){ + sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); + }else{ + sqlite3ErrorMsg(pParse, "incomplete input"); + } } %stack_overflow { sqlite3ErrorMsg(pParse, "parser stack overflow"); diff --git a/src/tokenize.c b/src/tokenize.c index 2aab334ae..e6da3fb54 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -526,7 +526,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ }else{ tokenType = TK_SEMI; } - zSql -= n; + n = 0; } if( tokenType>=TK_SPACE ){ assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL ); |