| From: | Doug McNaught <doug(at)mcnaught(dot)org> |
|---|---|
| To: | Joep DeVocht <joep(at)masktools(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Clearing tables questions |
| Date: | 2003-01-31 19:35:48 |
| Message-ID: | m3hebpglij.fsf@varsoon.wireboard.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Joep DeVocht <joep(at)masktools(dot)com> writes:
> Hi,
>
> I have two fairly simple questions (I think) but I can't
> seem to find the answer in the docs or mailing-lists.
>
> I'm using pg_dump and pg_restore to backup my dbase.
> However, I noticed that when I do a pg_restore, the
> dumped contents are added to the currents ones.
> This is not what I want. The tables should be cleared first.
> How do I do this initializing the dbase?
pg_restore assumes the database is completely empty. If it's not you
may get duplicate information.
> Another question I have is the following.
> What sql command can I use to clear (delete) all tables not
> starting with 'pg_'.
Easiest thing to do is probably:
1. use 'pg_dump -s' to save the schema
2. DROP DATABASE
3. CREATE DATABASE
4. psql mydb < schema_dump.sql
-Doug
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Medi Montaseri | 2003-01-31 19:56:32 | Re: SELECT question |
| Previous Message | Dmitry Tkach | 2003-01-31 19:30:46 | Query performance PLEASE HELP |