Skip to main content

Documentation Index

Fetch the complete documentation index at: https://planetscale.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

What this error means

INVALID_COLUMN_REFERENCED_IN_VIEW means a view references a column that Vitess cannot resolve in the final schema. This can also happen when a view uses a star expression that cannot be safely expanded. Common underlying messages include:
view `active_users` references unqualified but non-existent column `email`
view `active_users` references unqualified but non unique column `id`
view `active_users` has invalid star expression

Why PlanetScale rejects it

A view must remain valid after the deploy request is applied. If a column is dropped, renamed, ambiguous across joined tables, or hidden behind SELECT *, Vitess cannot reliably generate a safe schema diff.

How to fix it

Use explicit column lists and update the view before dropping or renaming columns. Avoid this:
CREATE VIEW active_users AS
SELECT * FROM users WHERE active = 1;
Prefer this:
CREATE VIEW active_users AS
SELECT id, email, created_at
FROM users
WHERE active = 1;
If you need to rename a column used by a view, split the migration:
  1. Add the new column and update application writes.
  2. Update the view to reference the new column.
  3. Drop the old column after the view and application no longer use it.

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.