Re: Schema as versioning strategy

From: Richard Huxton <dev(at)archonet(dot)com>
To: Jonathan Vanasco <jvanasco(at)2xlp(dot)com>
Cc: Owen Hartnett <owen(at)clipboardinc(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Schema as versioning strategy
Date: 2007-04-26 08:23:54
Message-ID: 4630619A.3040609@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Jonathan Vanasco wrote:
>
> On Apr 25, 2007, at 2:05 PM, Richard Huxton wrote:
>
>> Owen Hartnett wrote:
>>> I want to "freeze" a snapshot of the database every year (think of
>>> end of year tax records). However, I want this frozen version (and
>>> all the previous frozen versions) available to the database user as
>>> read-only. My thinking is to copy the entire public schema (which is
>>> where all the current data lives) into a new schema, named 2007
>>> (2008, etc.)
>>
>> Sounds perfectly reasonable. You could either do it as a series of:
>> CREATE TABLE archive2007.foo AS SELECT * FROM public.foo;
>> or do a pg_dump of schema "public", tweak the file to change the
>> schema names and restore it.
>
> the create table method won't copy the constraints + fkeys .

Shouldn't matter for an archive though, since you'd not want anyone to
have permissions. Still, pg_dump is my preference. Apart from anything
else, you can keep a copy of the dump around too.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-04-26 08:31:21 Re: pg_connect sometimes works sometimes not
Previous Message Alban Hertroys 2007-04-26 08:07:46 Re: Schema as versioning strategy

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-04-26 08:29:20 Re: Avoiding unnecessary reads in recovery
Previous Message Alban Hertroys 2007-04-26 08:07:46 Re: Schema as versioning strategy