patternsqlModerate
Postgres Dump To TXT File
Viewed 0 times
dumptxtfilepostgres
Problem
Is there a way to convert a Postgres dump file to a text file?
I'm experiencing issues getting the dump to the proper file location of I would just restore from the dump file and then export to text.
Really I just need to import it into a SQLite database.
I think it's a binary dump. Here's what latest dump looks like:
I'm experiencing issues getting the dump to the proper file location of I would just restore from the dump file and then export to text.
Really I just need to import it into a SQLite database.
I think it's a binary dump. Here's what latest dump looks like:
Solution
This is a dump file produced by
To create a text file containing SQL commands from it, use pg_restore.
The basic syntax is
pg_dump -Fc. The dump may or may not contain the data depending on the options it was made with.To create a text file containing SQL commands from it, use pg_restore.
The basic syntax is
pg_restore -f output.sql file.dump, that is, you don't specify a target database (notice the missing-d option). -f- may be used instead of -f output.sql to send the SQL script to the standard output.Context
StackExchange Database Administrators Q#49369, answer score: 18
Revisions (0)
No revisions yet.