How to get my db structure without the data, (schema, tables, ...) as a script by command line.
+4
A:
http://www.postgresql.org/docs/current/interactive/app-pgdump.html
pg_dump -s -U username database > backup.sql
Haven't tested it though, so not sure if it works.
edit: had the german link up there ;)
DrColossos
2010-06-20 11:41:13
And the english version: http://www.postgresql.org/docs/current/interactive/app-pgdump.html-s only dumps the object definitions (schema), not data.
Frank Heikens
2010-06-20 11:51:32
just noticed the wrong language myself, edited it
DrColossos
2010-06-20 11:54:47
What's with the links to the beta docs?
Milen A. Radev
2010-06-20 12:00:06
Argh, thank you again for noticing
DrColossos
2010-06-20 12:12:17
Hi, thanks for replying ..I got a permission denied could u tell me why? maybe I wrote some parameters in a wrong way, may you be specific and tell me "username" indicates to a db creator or what ? thanks again
Figo
2010-06-20 23:36:46
`username` is the user that has permissions on the database to do the opertaions. This doesn't need to be the DB creator per se, but when this user created it, there will be also the proper permissions.
DrColossos
2010-06-21 05:44:24