New DBs from existing schemas

From: Nishad Prakash <prakashn(at)uci(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: New DBs from existing schemas
Date: 2006-05-24 23:14:46
Message-ID: Pine.GSO.4.58.0605241531300.27929@e4e.oac.uci.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I want to create a new database with the exact schema of an existing one,
but a different name. After some reading, it seems

pg_dump -s old_db > old_schema
createdb -t old_schema new_db

should work. Will it? Note that old_db has lots of stored functions and
user-defined operators in addition to tables and indices.

Also, is there any way to selectively restore some of the data from old_db
into new_db as well? I'll settle for all data if selectivity isn't
possible. Here, I don't have any good guesses, as the docs for pg_restore
don't say anything specific about restoring into a db other than the one
dumped from.

Is there a nice way to do these things that doesn't involve pg_dump | sed?

nishad
--
"Underneath the concrete, the dream is still alive" -- Talking Heads

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2006-05-24 23:49:43 Re: compiling source code!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Previous Message Tom Lane 2006-05-24 23:04:04 Re: recompliing c-language functions with new releases of postgres