Index: ext/ota/ota3.test ================================================================== --- ext/ota/ota3.test +++ ext/ota/ota3.test @@ -73,7 +73,31 @@ do_execsql_test 2.2 { PRAGMA integrity_check; } {ok} +#-------------------------------------------------------------------- +# Test that missing columns are detected. +# +forcedelete ota.db +reset_db + +do_execsql_test 2.0 { + CREATE TABLE x1(a INTEGER PRIMARY KEY, b, c); + CREATE INDEX i1 ON x1(b, c); +} {} + +do_test 2.1 { + sqlite3 db2 ota.db + db2 eval { + CREATE TABLE data_x1(a, b, ota_control); + INSERT INTO data_x1 VALUES(1, 'a', 0); + } + db2 close + list [catch { run_ota test.db ota.db } msg] $msg +} {1 {SQLITE_ERROR - no such column: c}} + +do_execsql_test 2.2 { + PRAGMA integrity_check; +} {ok} finish_test Index: ext/ota/sqlite3ota.c ================================================================== --- ext/ota/sqlite3ota.c +++ ext/ota/sqlite3ota.c @@ -297,11 +297,11 @@ /* ** Allocate a buffer and populate it with the double-quoted version of the ** string in the argument buffer, suitable for use as an SQL identifier. ** For example: ** -** [quick "brown" fox] -> ["quick ""brown"" fox"] +** [quick `brown` fox] -> [`quick ``brown`` fox`] ** ** Assuming the allocation is successful, a pointer to the new buffer is ** returned. It is the responsibility of the caller to free it using ** sqlite3_free() at some point in the future. Or, if the allocation fails, ** a NULL pointer is returned. @@ -310,16 +310,16 @@ int nName = strlen(zName); char *zRet = sqlite3_malloc(nName * 2 + 2 + 1); if( zRet ){ int i; char *p = zRet; - *p++ = '"'; + *p++ = '`'; for(i=0; i