pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mathieu Arnold <mat@mat.cc>
To: josh@agliodbs.com
Cc: pgsql-sql@postgresql.org
Subject: Re: triggers and plpgsql question
Date: Wed, 28 Aug 2002 16:22:37 +0200
Message-ID: <454316312.1030551754@andromede.reaumur.absolight.net> (raw)
In-Reply-To: <169617531.1030524133@sauron>
References: <374862253.1030472287@andromede.reaumur.absolight.net>
	<200208271538.45877.josh@agliodbs.com>
	<169617531.1030524133@sauron>



--On mercredi 28 août 2002 08:42 +0200 Mathieu Arnold <mat@mat.cc> wrote:

> 
> 
> --On mardi 27 août 2002 15:38 -0700 Josh Berkus <josh@agliodbs.com> wrote:
> 
>> 
>> Mathieu,
>> 
>>> The thing I need, is to be able to know what does NEW contains, and I
>>> have not found out any mean to do so. If it's not possible to do so,
>>> I'll write a function per table, but for the beauty of all this, I would
>>> have liked to do it the way above.
>> 
>> You can't do this in PL/pgSQL.   See the online documentation on writing 
>> triggers in C; that is the only way to get what you want.
> 
> So, if I want to avoid C, I'll have to write a function per table. I'll
> have a look at SPI (as I believe after a short readout of the doc, I'll
> need it).

After a few hours of work, here is what I did. What it does is to log
everything that gets inserted, deleted or updated into a table. I post it
here because I believe that someone else might be interested.

-- 
Mathieu Arnold

Attachments:

  triggers.c (application/octet-stream, 4.2K) download

view thread (4+ messages)

Message-ID: <454316312.1030551754@andromede.reaumur.absolight.net>
Permalink:  ../454316312.1030551754@andromede.reaumur.absolight.net/
Also on:    postgresql.org/message-id/454316312.1030551754@andromede.reaumur.absolight.net

 · 

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: mat@mat.cc, josh@agliodbs.com
  Subject: Re: triggers and plpgsql question
  In-Reply-To: <454316312.1030551754@andromede.reaumur.absolight.net>

* 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