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:
Right click on the database and select backup option.
In backup dialog box, select PLAIN backup type and give a file name.
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.
If you want to filter your objects, go to object tab and check or unchecked objects from the list.