pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Lambert <paul.lambert@autoledgers.com.au>
To: pgsql-sql@postgresql.org
Subject: Re: Moving a simple function to pl/pgsql (Novice question)
Date: Thu, 05 Apr 2007 06:20:01 +0800
Message-ID: <46142491.2080808@autoledgers.com.au> (raw)
In-Reply-To: <806297.7462.qm@web31805.mail.mud.yahoo.com>
References: <806297.7462.qm@web31805.mail.mud.yahoo.com>

Richard Broersma Jr wrote:
> --- Paul Lambert <paul.lambert@autoledgers.com.au> wrote:
>> The purpose being when a row in a table in one database is updated, it 
>> will copy (or replicate I guess) the record into a different table into 
>> another database in the same server. (deleting said record first if it 
>> already exists)
>>
>> What is the best way to do this within Postgres?
> 
> In postgresql, there are two parts to implementing a trigger; the trigger function and the actual
> trigger on the table that calls this function.
> 
> Here is a good example:
> http://www.postgresql.org/docs/8.2/interactive/plpgsql-trigger.html#PLPGSQL-TRIGGER-AUDIT-EXAMPLE
> 
> One other point to be aware of, Postgresql does not allow your to reference other databases in the
> DB-cluster directly.  It is possible but you need to add a contrib module called dblink:
> http://pgfoundry.org/projects/snapshot/
> 
> Hope this helps,
> Regards,
> Richard Broersma Jr.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
> 
> 

Perfect, thanks Richard.

Regards,
Paul.

-- 
Paul Lambert
Database Administrator
AutoLedgers




view thread (3+ messages)

Message-ID: <46142491.2080808@autoledgers.com.au>
Permalink:  ../46142491.2080808@autoledgers.com.au/
Also on:    postgresql.org/message-id/46142491.2080808@autoledgers.com.au

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: paul.lambert@autoledgers.com.au
  Subject: Re: Moving a simple function to pl/pgsql (Novice question)
  In-Reply-To: <46142491.2080808@autoledgers.com.au>

* 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