Re: Simple row serialization? - Mailing list pgsql-general

From Ivan Voras
Subject Re: Simple row serialization?
Date
Msg-id fng4np$pk7$1@ger.gmane.org
Whole thread Raw
In response to Simple row serialization?  (Ivan Voras <ivoras@freebsd.org>)
List pgsql-general
Adam Rich wrote:
>> I'd like to implement some simple data logging via triggers on a small
>> number of infrequently updated tables and I'm wondering if there are
>> some helpful functions, plugins or idioms that would serialize a row
>
>
> If you're familiar with perl, you can try PL/Perl.

Thanks, but another solution has been suggested to me, much simpler:

create or replace function data_log() returns trigger as $$
         declare
                 sdata   text;
         begin
                 sdata = new;
                 insert into log(data) values (sdata);
                 return NULL;
         end;
$$ language plpgsql;

create trigger data_insert after insert on data
     for each row execute procedure data_log();

(from idea by Tom Lane)


Attachment

pgsql-general by date:

Previous
From: "Adam Rich"
Date:
Subject: Re: Simple row serialization?
Next
From: Sushant Sinha
Date:
Subject: tsearch2: stop words and stemming separate?