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

Returning old value on update

From: Gerhard Heift <ml-postgresql-20081012-3518(at)gheift(dot)de>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Returning old value on update
Date: 2009-01-31 13:03:12
Message-ID: 20090131130312.GA3728@gheift (view raw)
Hello,

is it possible to get the old value of an update, something like this:

INSERT INTO my_table (col) VALUES (2);

UPDATE my_table SET col = 4 RETURNING old.col;

Should give me the 2.

Regards,
  Gerhard

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