Re: Delete subset of database - Mailing list pgsql-admin

From Hornyak Laszlo
Subject Re: Delete subset of database
Date
Msg-id Pine.LNX.4.21.0310020130370.16471-100000@tiger.tigrasoft.hu
Whole thread Raw
In response to Delete subset of database  (j sk <jsk817@yahoo.com>)
List 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@postgresql.org so that your
>       message can get through to the mailing list cleanly
>


pgsql-admin by date:

Previous
From:
Date:
Subject:
Next
From: Kerv
Date:
Subject: PostgreSQL & cygwin