Re: Moving a simple function to pl/pgsql (Novice question)

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: Moving a simple function to pl/pgsql (Novice question)
Дата
Msg-id 806297.7462.qm@web31805.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Moving a simple function to pl/pgsql (Novice question)  (Paul Lambert <paul.lambert@autoledgers.com.au>)
Ответы Re: Moving a simple function to pl/pgsql (Novice question)
Список pgsql-sql
--- 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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Claus Guttesen"
Дата:
Сообщение: Re: Setting high performance on huge server
Следующее
От: Gary Stainburn
Дата:
Сообщение: Solved - best way: diary functions.