Search Postgresql Archives

Re: Simple row serialization?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux