PostgreSQL: Export database to .sql file
command, database, export, postgresql, postgresql-9.1
Solution
pg_dump defaults to plain SQL export. both data and structure.
open command prompt and run `pg_dump -U username -h localhost databasename >> sqlfile.sql`
Above command is preferable as most of the times there will be an error which will be something like - `...FATAL: Peer authentication failed for user ...`
Problem
I want to export my database as a `.sql` file. Can someone help me? The solutions I have found don't work. A detailed description please. On Windows 7.