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

Re: Copy Schema

From: "Derrick Betts" <derrick(at)blueaxis(dot)com>
To: <KeithW(at)NarrowPathInc(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Copy Schema
Date: 2006-07-28 16:43:53
Message-ID: 079101c6b265$0602b6c0$0202a8c0@main (view raw or whole thread)
Lists: pgsql-novice
Thank you for your response.
    This one:  "add a predefined schema to an existing database."

I'll take a closer look at the document and information you provided.

Thanks again,

----- Original Message ----- 
From: "Keith Worthington" <KeithW(at)NarrowPathInc(dot)com>
To: "Derrick Betts" <derrick(at)blueaxis(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Sent: Friday, July 28, 2006 10:28 AM
Subject: Re: [NOVICE] Copy Schema

>>>> Is there a way to create a "template" schema, similar to modifying  the 
>>>> template1 to use for new database creation?
>>> Certainly. Any database can be used as a template. template1 is used  by 
>>> default. Check out the CREATE DATABASE docs:
>>> createdatabase.html
>>>> I read that there is a way to restore a schema with pg_restore 
>>>> command. Is the best or only way to accomplish this?
>>> Well, if you haven't loaded data into a database you want to use as a 
>>> template (or it only has data you want to include in the new  database), 
>>> you can use CREATE DATABASE as well.
>> Derrick Betts wrote:
>> I know how to create new databases by using the template1 already.  I 
>> want to create new schemas with the requirements outlined in the original 
>> email. Any thoughts?
>> Derrick
> Derrick,
> There seems to be some confusion as to whether you want to create a new 
> database with an existing schema or add a predefined schema to an existing 
> database.
> If the former then check out the docs at:
> and try something like
>   WITH TEMPLATE = mytemplatedb;
> If the latter then check out the docs at:
> and try something like
> pg_dump --file=outfile.sql
>         --format=p
>         --schema=myschema
>         --schema-only
>         --verbose
>         mytemplatedb
> to generate the schema commands and psql to run them in the target 
> database.
> -- 
> Kind Regards,
> Keith

In response to

pgsql-novice by date

Next:From: operationsengineer1Date: 2006-07-28 17:55:57
Subject: Re: Lurking Wanna Be
Previous:From: Keith WorthingtonDate: 2006-07-28 16:28:32
Subject: Re: Copy Schema

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group