| From: | Ivan Voras <ivoras(at)freebsd(dot)org> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Simple row serialization? |
| Date: | 2008-01-26 18:39:28 |
| Message-ID: | fnfup3$9ba$1@ger.gmane.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adam Rich | 2008-01-26 20:14:17 | Re: Simple row serialization? |
| Previous Message | Louis-David Mitterrand | 2008-01-26 16:47:02 | Re: can't create index with 'dowcast' row |