Andrea Smetko
Andrea Smetko

Reputation: 43

How to export database from PostgreSQL?

I am working on a team project in object-relational databases and one of us has made the database in PostgreSQL, and the rest of us will make the application based on that database. How can he export the database for us to use with C# (Visual Studio)? Can Postgres make some file with the database or something similar?

Upvotes: 2

Views: 853

Answers (2)

Craig Ringer
Craig Ringer

Reputation: 325051

@andrefsp is quite right that you'll want probably want to dump the DB schema and then load it into a local PostgreSQL install on your machine for testing.

Additionally, it's often helpful to create some schema visualisation and documentation. I find the free tool SchemaSpy useful for this, but many others exist. It produces a tree of HTML files and images that you can use to browse the database structure.

PgAdmin-III (generally installed with PostgreSQL) also provides some basic tools for looking around the database structure.

Upvotes: 3

andrefsp
andrefsp

Reputation: 3710

Yes, PostgreSQL can do that and much more. What you are looking for is a dump of the database, which is basically a file containing all the database.

Have a look at the official documentation for pg_dump

This command will generate a backup from the original database and than you can use it with a pg_restore command to load the database somewhere else.

Upvotes: 2

Related Questions