The behaviour of ALTER TABLE changed in 3.25.0 and breaks compatibility with many existing applications. Your statements (corrected for use of single quotes, as Ryan mentioned) work for me when `PRAGMA legacy_alter_table=1;`.
More info on SQLite's website: https://www.sqlite.org/lang_altertable.html Scott > On Mar 15, 2019, at 06:29, tjerzyko <tjerz...@poczta.onet.pl> wrote: > > I'm having corruption problem with a certain database file. You can download > it here: > https://drive.google.com/file/d/1RCPoPgoLdc2VgF2uX2zPFrkheFi9z3b_/view?usp=sharing > It was created with SQLite 3.8.7 or older version (I cannot say for sure now) > I open it with sqlite3.exe and run the following script: > > begin; > alter table fs_params rename to fs_params_20291_27910; > CREATE TABLE FS_PARAMS(FS_NO INTEGER,FS_OWNER_ID TEXT,FS_OWNER_NAME TEXT); > drop table 'fs_params_20291_27910'; > alter table file_locks rename to file_locks_27446_24559; > CREATE TABLE FILE_LOCKS(FILE_ID INTEGER, PLAYER_ID TEXT UNIQUE, USER_NAME > TEXT, FOREIGN KEY(FILE_ID) REFERENCES FILE(FILE_ID)); > drop table 'file_locks_27446_24559'; > CREATE INDEX L_FILE_ID ON FILE_LOCKS(FILE_ID); > alter table cam_in_file rename to cam_in_file_22705_10035; > end; > > It throws the following error: > Error: near line 9: error in trigger T_FILE_BDELETE: no such table: > main.file_locks_27446_24559 > > Probably my script is incorrect, but another thing worries me more. I open > the database again and: > > e:\recorder\DB\LOOP-003>sqlite3 loop-003.dat > SQLite version 3.27.2 2019-02-25 16:06:06 > Enter ".help" for usage hints. > sqlite> .tables > AUDIO_IN_FILE FS_ATTRIBUTES REC_RECORDING_MODE > AUDIO_IN_FRAGMENT FS_PARAMS REC_WORKING_MODE > CAM_IN_FILE INTEGRITY_TEST STORAGE_BLOCK > CAM_IN_FRAGMENT LOOP_FRAGMENT T_SCHEDULE > FILE REC_LATEST_CONNECTION > FILE_LOCKS REC_LIST_TIMESTAMP > sqlite> select * from CAM_IN_FILE; > Error: no such table: CAM_IN_FILE > sqlite> > > The table exists, but not quite. The database seems to be corrupted. > > When I tried the same procedure on database created with newer SQLite > version, there were no such problems. > > Tomasz Jerzykowski > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users