When refactoring a certain view, including adding a new column or changing the column type, one needs to refactor all the views that depend on this particular view. Unfortunately, PostgreSQL does not provide the means to create a logical dump of a dependent object.
PostgreSQL provides pg_dump to dump a certain database or a specific set of objects in a database. Also, in development, it is recommended that you keep the code in a Git repository.
Plan your development cycle in advance, including development, testing, staging, and production. Use code versioning tools such as Git and database migration tools such as flyway to define your processes. This will save you a lot of time.
Unfortunately, often the SQL code for legacy applications is not maintained in the version control system and in migration tools such as flyway. In this case, if you need to change...