This doesn't work either. The error now occurs in the "ALTER TABLE" line, which is correct as the table "x" being refered to doesn't exist that moment. Tested with both 3.25.2 and 3.26.
Btw, has the "correct vs. incorrect" table that you've cited already been there before release 3.25? ----- Original Message ----- From: Shawn Wagner <shawnw.mob...@gmail.com> To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Sent: Wednesday, December 12, 2018, 18:02:54 Subject: [sqlite] ALTER TABLE, modifying columns You're using a workflow that https://www.sqlite.org/lang_altertable.html explicitly calls out as incorrect and error prone... Try to create a new table, copy data over, drop the original and then rename the new one to see if that fixes the issue. On Wed, Dec 12, 2018, 8:54 AM Thomas Kurz <sqlite.2...@t-net.ruhr wrote: > Dear all, > I don't know whether the behavior is intentional or a bug, so let me > describe it (occurs since 3.25): > Due to the lack of ALTER TABLE MODIFY COLUMN, I use the following > construction: > PRAGMA foreign_keys=0 > BEGIN TRANSACTION > ALTER TABLE x RENAME TO x_old > CREATE TABLE IF NOT EXISTS x (... new declaration ...) > INSERT INTO x (...) SELECT ... FROM x_old > DROP TABLE x_old > .... more to do here ... > COMMIT > PRAGMA foreign_keys=1 > Usually, this works fine, but now I have a VIEW that references table x, > which leads to an error "error in view ...: no such table: main.x_old". > Of course, this happens because renaming x to x_old also changes the > view's reference from x to x_old which is not intended in this case. > As a workaround, I have now added "PRAGMA legacy_alter_table" before and > after the transaction. > The behavior makes modifying columns even more complicated, so I'd like to > beg for an ALTER TABLE MODIFY COLUMN statement once more ;-)) > Kind regards, > Thomas > _______________________________________________ > 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 _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users