Reputation: 264
I want to create a .dump file from a Postgres .sql file I have locally. I don't want to connect to the database to do so, I just have a local file (or remote, wouldn't really matter), that I want to convert from .sql to .dump (so I can then upload to Heroku with PG backups).
From what I've seen and read you must connect to the database in order to create a dump. Is it possible to convert a .sql file > .dump file without connecting to it?
Something like pg_dump -f '/my/local/path.sql' > 'my-output-file.dump' ?
Upvotes: 2
Views: 1062
Reputation: 246393
There is no way to create a PostgreSQL custom format dump (what you call a ".dump file") from a script file (what you call a ".sql file") other than loading the latter into a PostgreSQL database and then extracting it with pg_dump -Fc
.
The opposite, creating a SQL script from a custom format dump, can be done with pg_restore
.
Upvotes: 1