Re: trigger output to a file

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: pgsql-sql <pgsql-sql(at)fc(dot)emc(dot)com(dot)ph>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: trigger output to a file
Date: 2001-03-23 18:02:31
Message-ID: 200103231802.NAA18716@jupiter.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

pgsql-sql wrote:
> Hello Everyone,
>
> Here's my simple question.
>
> I just want to know/get the recent changes made to a table.
> Deeper? I wanted the Postgresql server to *publish* every
> changes made to a table (similar to replication, incremental transfer,
> etc.).
> What is the best way to go about it?
>
> My idea is to create a trigger for every insert/update that will
> select the new/updated record and output it to a file. Or better
> yet, I would like to output the actual sql query to file.
> Is it possible to output the result of an sql query from a trigger
> to a file? How?

Putting the SQL query to a file would be my approach too.

The trigger approach lacks the capability to discard changes
already logged in case of a transaction rollback. Thus, I
wouldn't buy it.

For the query string logging, alot more is required. Not only
the queries themself are needed, you'd need to serialize
snapshot creation, log sequence allocations and the like. And
the program rolling forward this kind of log into another
database needs control mechanisms to tell the database that
it's in this recovery mode and has to ask for those values in
case it needs them.

You might guess it already, I've been thinking about it for a
year or so now. And I'm still not past the point to start
implementing it.

>
> I would appreciate any answer. Thank you very much.
> Sherwin
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2001-03-23 18:08:15 Re: SOME PL/PGSQL PROBLEMS
Previous Message Jie Liang 2001-03-23 17:52:56 Re: drop table in PL/pgSQL