PostgreSQL pg_dump – Differences Between .out and .sql

pg-dumppostgresql

I create a backup file of postgeSQL database:

>pg_dump --dbname=db_test --host=localhost --username=user -F c -f dump_test.out

In documentation for pg_dump is used extension .sql and for pg_dumpall is used .out

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

https://www.postgresql.org/docs/9.2/app-pg-dumpall.html

What is the differences between the extensions of .out and .sql in pg_dump in PostgreSQL? what is the recommendation and why?

Best Answer

Actually in these examples the used extensions don't really matter: both exports are plain text (i.e SQL) scripts. You decide which extension to use: if you export in plain SQL it's better to use .sql extension but you can choose another one.

In general you decide which extension you use. Neither psql nor pg_restore have a mandatory extension for the export file. If you use another output file format (-Fc or -Ft) for pg_dump it's better to use another extension than .sql to remember which export format has been used.