I am mikek's Blog

The personal blog of Mike Karthauser, who you may know from Brightstorm Limited or the internet.

Exporting table schema in postgres

Heres how to export a specific table schema in postgres.

pg_dump -h localhost -p 5432 -U USER_NAME -F p -s -s -v -f “/full_path/to/file.sql” -t ‘TABLE_NAME’ DB_NAME

replace USER_NAME, TABLE_NAME, DB_NAME and ‘/full_path/to/file’ accordingly.

BTW we did find an issue with using relative paths on mac osx (ie ~/file.sql) so if you are getting errors check that.

Advertisements

Filed under: development, ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

mikek on twitter

%d bloggers like this: