Re: copy/duplicate database schemas - Mailing list pgsql-general

From Dimitri Fontaine
Subject Re: copy/duplicate database schemas
Date
Msg-id 877hlou6x8.fsf@hi-media-techno.com
Whole thread Raw
In response to Re: copy/duplicate database schemas  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
Merlin Moncure <mmoncure@gmail.com> writes:
> On Wed, Jun 23, 2010 at 3:21 PM, Jamie Kahgee <jamie.kahgee@gmail.com> wrote:
>> I have an application in a schema and now i need to create other schemas b/c
>> the app needs to support different languages,  is there an easy way to copy
>> an entire schema to a new one (tables, contents, trigges, functions, etc..)?
>> right now i just have
>>
>> schema
>>
>> what I want is
>>
>> schema
>> schema_ar
>> schema_ru
>> etc...
>
> sure:
> 1) pg_dump -n your_schema -s
> 2) sed the resulting schema s/old_schema/new_schema
> if you are lucky, you will have few if any improper replacements, if
> not, tweak sed till it's right
> 3) cat it back into psql

I think you could also :
1) pg_dump -n your_schema -s > your_schema.sql
2) alter schema your_schema rename to your_schema_ar;
3) psql -f your_schema.sql
4) goto 2, pick another name

Regards,
--
dim

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Bad query performance with more conditions?
Next
From: "kaifeng.zhu"
Date:
Subject: Re: Bad query performance with more conditions?