I got a Postgres database with multiple schemas. I'm trying to optimise my database tables with optimal data types. more often I end with the error
cannot alter the type of a column used by a view
while using the query alter table schema.tbl_name alter column column_name type varchar(5) using column_name::varchar(5);
Is there any way (function) that I could list all the views related to the table?
Use this query:
Credit: Dataedo.com's article List tables used by a view in PostgreSQL database