Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:postgres:pg_dump [2008/01/15 10:27] billhdocs:postgres:pg_dump [2009/04/16 11:51] (current) billh
Line 3: Line 3:
 ===== Tips ===== ===== Tips =====
   * you may need to specify the -i flag, to ignore differences in the database version and pg_dump executable; if this is done, it might be best to use a plain text format for the dump to be safe   * you may need to specify the -i flag, to ignore differences in the database version and pg_dump executable; if this is done, it might be best to use a plain text format for the dump to be safe
 +  * the -d flag does not specify a database, but rather specifies that you want INSERT statements instead of COPY statements
  
 ===== Examples ===== ===== Examples =====
-**Dump all tables, with acl/permissions, with create table scripts, to a plain text file with sql commands:**+**Dump all tables, with acl/permissions, with create table scripts, to a plain text file (note that -d means to use INSERT statements instead of COPY statements, not to specify a db) with sql commands:**
 <code> <code>
 pg_dump --file=/path/to/output/file.sql --no-owner --format=p \ pg_dump --file=/path/to/output/file.sql --no-owner --format=p \
Line 14: Line 15:
 <code> <code>
 pg_dump --data-only --file=/path/to/output/file.sql --no-owner --format=t \ pg_dump --data-only --file=/path/to/output/file.sql --no-owner --format=t \
---table=sometable --no-privileges --disable-triggers -h hostname -d database+--table=sometable --no-privileges --disable-triggers -h hostname database 
 +</code> 
 + 
 +** Dump database schema, without owners or permissions: ** 
 +<code> 
 +pg_dump --schema-only --no-owner --no-privileges -h hostname -U username databasename > dumpfile.sql
 </code> </code>
  • docs/postgres/pg_dump.1200418074.txt.gz
  • Last modified: 2008/08/03 00:25
  • (external edit)