Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
docs:postgres:pg_dump [2008/01/14 10:35] – created billh | docs:postgres:pg_dump [2009/04/16 11:51] (current) – billh | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== pg_dump ====== | ====== pg_dump ====== | ||
+ | |||
+ | ===== 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 | ||
+ | * 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/ | + | **Dump all tables, with acl/ |
< | < | ||
pg_dump --file=/ | pg_dump --file=/ | ||
Line 11: | Line 15: | ||
< | < | ||
pg_dump --data-only --file=/ | pg_dump --data-only --file=/ | ||
- | --table=sometable --no-privileges --disable-triggers -h hostname | + | --table=sometable --no-privileges --disable-triggers -h hostname database |
+ | </ | ||
+ | |||
+ | ** Dump database schema, without owners or permissions: | ||
+ | < | ||
+ | pg_dump --schema-only --no-owner --no-privileges -h hostname -U username databasename > dumpfile.sql | ||
</ | </ |