Re: Delete subset of database

From: Hornyak Laszlo <kocka(at)tigrasoft(dot)hu>
To: j sk <jsk817(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Delete subset of database
Date: 2003-10-01 23:43:33
Message-ID: Pine.LNX.4.21.0310020130370.16471-100000@tiger.tigrasoft.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi!

What about this?
(dirty hack, but worx)
----

#!/bin/bash
#sorry for syntax failures

tables_to_drop=`psql olddb -c "select * from pg_class where relkind =
'r' and name not like 'pg_%'"`;

for i in $tables_to_drop; do
psql newdb -c "drop table $i ";
done;

----

Of course it is very risky, so first do it on your test environment.

Laszlo Hornyak

On Wed, 1 Oct 2003, j sk wrote:

> Hi all,
> Ive got two databases, say full_db and sub_db.
> sub_db is nothing but a subset of full_db.
>
> What I would like to do is delete the data and tables
> in sub_db from full_db. In essence, Im trying to
> remove the redundant data and have distinct databases.
>
>
> This is an attempt to archive the historic or inactive
> data. I would be glad if anyone could point a way to
> handle this situation.
>
> Thanks,
> SK
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kerv 2003-10-02 07:45:34 Re: initdb error on windows - urgent, please
Previous Message j sk 2003-10-01 20:08:25 Delete subset of database