# legacy_alter_table

> Use the pre 3.25 ALTER TABLE RENAME behavior that leaves most schema references untouched.

Source: https://sqlly.app/sql-configuration/sqlite/legacy-alter-table
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).

**Default**

`0 (off)`

**Range**

0, 1

**Restart needed**

No

**Default checked on**

SQLite 3.5x

## What it does

Off by default, a rename rewrites every reference to the table anywhere in the schema. With it on, only the name in the CREATE TABLE statement and in associated CREATE INDEX and CREATE TRIGGER statements changes; references inside trigger bodies, views, the table's own CHECK constraints and partial-index WHERE clauses keep the old name. New applications should leave it off.

## Default value

`0 (off)`. Off (a stock SQLite 3.5x build). For compatibility with older virtual table implementations SQLite toggles it on only inside their xRename call.

## Check the current value

```
PRAGMA legacy_alter_table;

SELECT * FROM pragma_legacy_alter_table;   -- table-valued form, usable in queries
```

## Change it

```
PRAGMA legacy_alter_table = ON;   -- this connection only
```

No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.

## When to change it

Running old code that depends on the pre 3.25 rename behavior, for example migration scripts that rename a table and patch references by hand.

## What can go wrong

With it on, a rename leaves views, triggers and partial indexes pointing at the old name, so the next use of those objects fails or keeps resolving to another table that owns the old name, and nothing warns about the dangling references.

## Questions about legacy_alter_table

### What is the default value of legacy_alter_table in SQLite?

0 (off). Off (a stock SQLite 3.5x build). For compatibility with older virtual table implementations SQLite toggles it on only inside their xRename call.

### Does changing legacy_alter_table require a restart?

No. No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.

### When should I change legacy_alter_table?

Running old code that depends on the pre 3.25 rename behavior, for example migration scripts that rename a table and patch references by hand.

Back to all [SQLite settings](https://sqlly.app/sql-configuration/sqlite), or check the [SQLite manual](https://www.sqlite.org/pragma.html) for every option.

## Related SQLite settings

- [`recursive_triggers` Allow triggers to fire other triggers recursively, including themselves.](https://sqlly.app/sql-configuration/sqlite/recursive-triggers)
- [`trusted_schema` Whether SQL functions and virtual tables used in the schema (views, triggers, CHECK constraints) are trusted to run.](https://sqlly.app/sql-configuration/sqlite/trusted-schema)
