Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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: Wed, 24 May 2006 16:14:46 -0700 (PDT)
  • Message-id: <Pine(dot)GSO(dot)4(dot)58(dot)0605241531300(dot)27929(at)e4e(dot)oac(dot)uci(dot)edu>

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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group