was field updated

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: was field updated
Date: 2009-07-13 05:51:57
Message-ID: 4A5ACB7D.1080500@compulab.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I need to know if a field was updated in an update statement, even if it
was updated to the same value that it already contained.

Basically, I want the field to be automatically set to null if the
update statement didn't manually set it to something.

I could not figure out how to do this with a trigger or rules, as if the
value was populated before the update statement, it will be in both the
new and the old structures.

My only thought is to have a trigger change the value that is updated
and then if it is the same value in the new and the old then I know that
it was not updated, but that is uglier then I would like.

Any thoughts?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Philippe Lang 2009-07-13 06:05:58 Start With... Connect By?
Previous Message Dennis Gearon 2009-07-13 05:03:24 Re: indexes on float8 vs integer