restore a table in a database

From: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: restore a table in a database
Date: 2008-12-03 19:21:58
Message-ID: B0D7C0A3F35FE144A70312D086CBCA9B0213A9273E@ExchMailbox2.univ.dir.wwu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

How do I restore just a table to a database? I was able to create a backup of the required table from a backup of the database as follows.
I don't know how to properly restore the backed up table "departments" to the original "sms" database.

create a new db
createdb -U postgres smstest

restore a backup of the db to the new db
psql -U postgres smstest < /tmp/postgresql-sms-11-24-2008_04-05-database

backup up the specific table from the restored db
pg_dump -U postgres -a -t departments smstest > /tmp/smsdepartments

The table backup is smsdepartments. How do I restore smsdepartments to the table called departments in the sms database?

Thanks

Marc

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Vladimir Rusinov 2008-12-03 20:03:47 slow slow query log
Previous Message Fabricio 2008-12-03 18:09:00 Re: User info?