Selective dump

When refactoring a certain view, including adding a new column or changing the column type, you need 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 ...

Get Learning PostgreSQL 11 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.