Re: copy template X -> Y

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: jef peeraer <jef(dot)peeraer(at)telenet(dot)be>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy template X -> Y
Date: 2006-11-15 12:29:23
Message-ID: 455B0823.6000001@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

jef peeraer wrote:
> is it possible to copy one template, say X to a new template , called Y ?

CREATE DATABASE Y TEMPLATE X;

> Or better, i want a sort of a basic template that can be used to create
> a new schema.

A template for a schema... Not directly AFAIK, but you can write SQL
files to generate your schema contents. Don't forget to set your
search_path before executing it though. Something like:

BEGIN;
CREATE SCHEMA test;
SET search_path TO test;
\i schema_template.sql
-- And if you're satisfied with the results
COMMIT;

--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Mair 2006-11-15 13:27:38 Re: The old Insert and retrieving your Serial problem in
Previous Message jef peeraer 2006-11-15 11:19:06 copy template X -> Y