Re: copy/duplicate database schemas

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jamie Kahgee <jamie(dot)kahgee(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy/duplicate database schemas
Date: 2010-06-23 20:57:36
Message-ID: AANLkTinBFx7vQqM80QcsLd7xPd0aN4yDnXFGWYa2mecQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jun 23, 2010 at 3:21 PM, Jamie Kahgee <jamie(dot)kahgee(at)gmail(dot)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

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sebastian Machuca 2010-06-23 21:06:16 Fwd: Stalled post to pgsql-es-ayuda
Previous Message Joshua D. Drake 2010-06-23 20:29:39 Re: UPDATE after Cancle