Simple row serialization? - Mailing list pgsql-general

From Ivan Voras
Subject Simple row serialization?
Date
Msg-id fnfup3$9ba$1@ger.gmane.org
Whole thread Raw
Responses Re: Simple row serialization?
List pgsql-general
Hi,

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
(received for example in a AFTER INSERT trigger) into a string that I'd
store in the log table. There's a limited number of field types
involved: varchars, integers and booleans. I'm not looking for anything
fancy, comma-separated string result would be just fine; even better,
something like a dictionary ("field_name":"field_value",...) would be
nice. The reason for trying to do it this way is that want to have a
single log table to log many tables (again, they are infrequently
updated). I need this for PostgreSQL 8.1.

I got suggestions to try composite types but I don't think they could be
useful for this. What I need is possibly a generic "row" type ("any" and
"record" generate syntax error in CREATE TABLE) - any ideas on where to
start looking?




Attachment

pgsql-general by date:

Previous
From: Louis-David Mitterrand
Date:
Subject: Re: can't create index with 'dowcast' row
Next
From: "Adam Rich"
Date:
Subject: Re: Simple row serialization?