Re: cloning database

From: hubert depesz lubaczewski <depesz(at)gmail(dot)com>
To: Philipp Kraus <philipp(dot)kraus(at)flashpixx(dot)de>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: cloning database
Date: 2014-09-19 11:04:36
Message-ID: CAKrjmhfXBjk=n+xzDk_fxpDf87fPFrCRPq=n2-4t4dyWLU2+ng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 19, 2014 at 8:35 AM, Philipp Kraus <philipp(dot)kraus(at)flashpixx(dot)de>
wrote:

> Is there a buildin way to clone the "database_source" with all structure
> and data into a new database "database1..150" ?
>

assuming you're using bash shell, this should work:

for i in {1..150}; do createdb -T database_source database$i; done

it's not a built-in, but very close.

depesz

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2014-09-19 12:16:00 Re: ALTER TEXT field to VARCHAR(1024)
Previous Message Chris Travers 2014-09-19 08:34:32 Re: Why isn't Java support part of Postgresql core?