pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Delete subset of database
2+ messages / 2 participants
[nested] [flat]

* Delete subset of database
@ 2003-10-01 20:08  j sk <jsk817@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: j sk @ 2003-10-01 20:08 UTC (permalink / raw)
  To: pgsql-admin

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Delete subset of database
@ 2003-10-01 23:43  Hornyak Laszlo <kocka@tigrasoft.hu>
  parent: j sk <jsk817@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Hornyak Laszlo @ 2003-10-01 23:43 UTC (permalink / raw)
  To: j sk <jsk817@yahoo.com>; +Cc: 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
> 




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-10-01 23:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-01 20:08 Delete subset of database j sk <jsk817@yahoo.com>
2003-10-01 23:43 ` Hornyak Laszlo <kocka@tigrasoft.hu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox