PostgreSQL: Generate full Database Script using PGAdmin Tool

Before few days back, One of the SQL Server Developer asked me this question.
How to generate full database schema script or data script in PostgreSQL?

In PostgreSQL, We can also generate Database full script using Backup Option of PGAdmin tool.
When we require to create a fresh database without data, mostly we require to generate Database Schema Script.
We have one PLAIN text database backup type in PostgreSQL, which creates .sql file including Schema + Data.

Below are screenshots to generate Database Script using PGAdmin Tool:

Step 1:
Right click on the database and select backup option.
In backup dialog box, select PLAIN backup type and give a file name.

Postgresql Plain Text Backup

Step 2:
Default PLAIN text backup included both Database Schema + Data script.
In case of any changes, go to dump option tab and select data or schema only.

Postgresql Plain Data Schema Option

Step 3:
If you want to filter your objects, go to object tab and check or unchecked objects from the list.

Postgresql Plain Backup Object Selection

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of