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

Fix the ALTER TABLE RENAME algorithm so that it is not confused

by comments in the CREATE TABLE statement.  Ticket #3102. (CVS 5110)

FossilOrigin-Name: ab18b4e75916b05863b31bc63625aa64a104a42c
This commit is contained in:
drh
2008-05-09 14:17:51 +00:00
parent 8a54f9f05c
commit 7382945199
4 changed files with 38 additions and 13 deletions

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.43 2008/03/19 21:45:51 drh Exp $
** $Id: alter.c,v 1.44 2008/05/09 14:17:52 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -54,8 +54,8 @@ static void renameTableFunc(
sqlite3 *db = sqlite3_context_db_handle(context);
/* The principle used to locate the table name in the CREATE TABLE
** statement is that the table name is the first token that is immediatedly
** followed by a left parenthesis - TK_LP - or "USING" TK_USING.
** statement is that the table name is the first non-space token that
** is immediately followed by a left parenthesis - TK_LP - or "USING" TK_USING.
*/
if( zSql ){
do {
@@ -74,7 +74,7 @@ static void renameTableFunc(
do {
zCsr += len;
len = sqlite3GetToken(zCsr, &token);
} while( token==TK_SPACE );
} while( token==TK_SPACE || token==TK_COMMENT );
assert( len>0 );
} while( token!=TK_LP && token!=TK_USING );