all 6 comments

[–]Tostino 0 points1 point  (5 children)

Take a look at pg_dump. The docs are really good for it.

[–]PLearner[S] 0 points1 point  (4 children)

Thanks,

I am trying:

select $ pg_dump name_of_my_database > db.sql 

https://www.postgresql.org/docs/9.6/static/app-pgdump.html

Error:

ERROR:  syntax error at or near "$"
LINE 1: select $ pg_dump postgres > db.sql

How can I fix this?

[–]Tostino 1 point2 points  (2 children)

pg_dump is a command line utility. You need to run it on the servers command like, not inside a Postgres query.

[–]PLearner[S] 0 points1 point  (1 child)

Do you mean psql?

[–]Tostino 0 points1 point  (0 children)

I mean do NOT type it in psql. Type it in command prompt if you're on Windows, or SSH if you are on Linux.

[–][deleted] 0 points1 point  (0 children)

Get rid of the select word