From: Stef Telford <stef@Chronozon.dyndns.org>
To: pgsql-sql@postgresql.org
Subject: Archival of Live database to Historical database
Date: Mon, 29 Jan 2001 15:00:50 -0500 (EST)
Message-ID: <200101292000.f0TK0os06683@oberon.hades> (raw)
Hello everyone,
I have hit on a limit in my knowledge and i am looking for
some guidance. Currently I have two seperate databases, one for
live data, the other for historical data. The only difference really
being that the historical data has a Serial in it so that the tables
can keep more than one 'version history'.
What i would like to do, is after my insert transaction to the
live database, i would like the information also transferred to the
historical one. Now. I can do this via perl (and i have been doing it
this way) and using two database handles. This is rather clumsy and
I know there must be a 'better' or more 'elegant' solution.
So i stumbled onto triggers and functions. All well and good.
I create the trigger to fire off the procedure after a succesful insert
into
the table (And yes i do have triggers on the 30 tables or so i use).
The problem arises, in the procedure. I dont know the syntax
to reference another database. I assume there must be someway to
simply say (in a function) copy the data inserted into this database as
well.
If it helps any, the tables are the same name, and all the same
fields (Apart from the SERIAL in the historical version, but since that
auto
increments i wouldnt have to worry about it)
I am interested on ideas, code and pointers as to if this is a
good idea or not. thank you.
Regards,
Steff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: stef@Chronozon.dyndns.org
Subject: Re: Archival of Live database to Historical database
In-Reply-To: <200101292000.f0TK0os06683@oberon.hades>
References: <200101292000.f0TK0os06683@oberon.hades>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox