# Tables and Views dependencies

DevFeed: [Tables and Views dependencies](<https://devfeed.tech/articles/tables-and-views-dependencies-34418.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2011/05/tables-and-views-dependencies/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2011-05-04T09:45:00Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>)

Tags: [alter](<https://devfeed.tech/tags/alter.md>), [locking](<https://devfeed.tech/tags/locking.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [script](<https://devfeed.tech/tags/script.md>), [table](<https://devfeed.tech/tags/table.md>), [view](<https://devfeed.tech/tags/view.md>)

## AI overview

This tutorial explains how to handle PostgreSQL ALTER TABLE operations when dependent views prevent a column type change. It describes using system catalog queries to identify affected views and generate scripts for dropping, altering, and recreating them, while noting that the query may produce false-positive candidates.

## Source excerpt

Let's say you need to ALTER TABLE foo ALTER COLUMN bar TYPE bigint;, and PostgreSQL is helpfully telling you that no you can't because such and such views depend on the column. The basic way to deal with that is to copy paste from the error message the names of the views involved, then prepare a script wherein you first DROP VIEW then ALTER TABLE and finally CREATE VIEW again, all in the same transaction.