PRAGMA legacy_alter_table
This pragma sets or queries the value of the legacy_alter_table flag.
PRAGMA legacy_alter_table; PRAGMA legacy_alter_table = boolean
On the sample database
What PRAGMA legacy_alter_table returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js:
| legacy_alter_table |
|---|
| 0 |
What the SQLite documentation says
This pragma sets or queries the value of the legacy_alter_table flag. When this flag is on, the ALTER TABLE RENAME command (for changing the name of a table) works as it did in SQLite 3.24.0 (2018-06-04) and earlier. More specifically, when this flag is on the ALTER TABLE RENAME command only rewrites the initial occurrence of the table name in its CREATE TABLE statement and in any associated CREATE INDEX and CREATE TRIGGER statements. Other references to the table are unmodified, including:
- References to the table within the bodies of triggers and views.
- References to the table within CHECK constraints in the original CREATE TABLE statement.
- References to the table within the WHERE clauses of partial indexes.
This pragma is provided as a work-around for older programs that contain code that expect the incomplete behavior of ALTER TABLE RENAME found in older versions of SQLite. New applications should leave this flag turned off.
For compatibility with older virtual table implementations, this flag is turned on temporarily while the sqlite3_module.xRename method is being run. The value of this flag is restored after the sqlite3_module.xRename method finishes.
The legacy alter table behavior can also be toggled on and off using the SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option to the sqlite3_db_config() interface.
The legacy alter table behavior is a per-connection setting. Turning this features on or off affects all attached database files within the database connection. The setting does not persist. Changing this setting in one connection does not affect any other connections.
From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.