cannot alter type of a column used by a view or rule

SQLSTATE 0A000 condition feature_not_supported class 0A — Feature Not Supported severity ERROR
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 11 Jun 2026 · Reproduced live with the SQL on this page.

Symptoms

An ALTER TABLE … ALTER COLUMN … TYPE was blocked because the column is used by a view or rule. PostgreSQL raises SQLSTATE 0A000 (feature_not_supported).

What the server log shows

ERROR:  cannot alter type of a column used by a view or rule
DETAIL:  rule _RETURN on view order_summary depends on column "amount"

Why PostgreSQL raises this — what the manual says

As the ALTER TABLE reference (SET DATA TYPE) explains:

Changing a column’s data type requires reparsing dependent object definitions; because the stored definition of a view cannot be automatically converted to the new type, PostgreSQL blocks the change until the dependent view is dropped or recreated.

Views and rules store the types of the columns they reference. Changing the base column’s type could invalidate them, and PostgreSQL does not automatically rewrite dependents, so it reports 0A000.

Common causes

How to fix it

  1. Drop the dependent view(s)/rule(s), alter the column, then recreate them.
  2. Use a migration tool that scripts drop/recreate of dependents.
  3. Identify dependents via pg_depend before altering.

Related & next steps

Reference: PostgreSQL 18 — ALTER TABLE.