Skip site navigation (1) Skip section navigation (2)

Re: return data before the update

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: return data before the update
Date: 2010-01-09 06:47:32
Message-ID: 20100109064732.GA5725@tux (view raw or flat)
Thread:
Lists: pgsql-novice
Luis Silva <lfs12(at)hotmail(dot)com> wrote:

> Hi all,
> Is it possible to perform an update and return the old data, i.e., the data
> updated? Do I need a store procedure?

What do you want to do with the old data? Store i a other table (like a
log-table)?

I think, you needs a TRIGGER, and the TRIGGER has to store the old
values in your log-table.

Do you know tablelog?
http://andreas.scherbaum.la/blog/archives/100-Log-Table-Changes-in-PostgreSQL-with-tablelog.html


Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

In response to

Responses

pgsql-novice by date

Next:From: Luis SilvaDate: 2010-01-10 23:44:17
Subject: Re: return data before the update
Previous:From: Luis SilvaDate: 2010-01-08 23:58:30
Subject: return data before the update

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group