From: | Mathieu Arnold <mat(at)mat(dot)cc> |
---|---|
To: | josh(at)agliodbs(dot)com |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: triggers and plpgsql question |
Date: | 2002-08-28 14:22:37 |
Message-ID: | 454316312.1030551754@andromede.reaumur.absolight.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
--On mercredi 28 août 2002 08:42 +0200 Mathieu Arnold <mat(at)mat(dot)cc> wrote:
>
>
> --On mardi 27 août 2002 15:38 -0700 Josh Berkus <josh(at)agliodbs(dot)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
Attachment | Content-Type | Size |
---|---|---|
triggers.c | application/octet-stream | 4.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2002-08-28 14:24:11 | Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1? |
Previous Message | Tom Lane | 2002-08-28 14:11:18 | Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1? |