Subject | old is distinct from new |
---|---|
Author | Milan Babuskov |
Post date | 2009-01-09T18:51:13Z |
Hi,
I'm not sure if ideas for potential new features should do to -devel or
-architect, so I hope you don't mind me posting here.
Few times in past recent days I had a need to check in some UPDATE
trigger whether any of the columns was changed and then do some action.
I ended up creating a trigger which looks like:
if (old.field1 is distinct from new.field1 or
old.field2 is distinct from new.field2 or
old.field3 is distinct from new.field3 or
...etc...
then
do_something;
It looks pretty ugly for this particular table because it has 30+ fields.
Now, I wonder if there is anything in SQL that would enable such
triggers to be written like this:
if (old is distinct from new) then do_something;
If there is and it's easy to implement, I'd add it to the tracker. If
not, forget it.
Thanks,
--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com
I'm not sure if ideas for potential new features should do to -devel or
-architect, so I hope you don't mind me posting here.
Few times in past recent days I had a need to check in some UPDATE
trigger whether any of the columns was changed and then do some action.
I ended up creating a trigger which looks like:
if (old.field1 is distinct from new.field1 or
old.field2 is distinct from new.field2 or
old.field3 is distinct from new.field3 or
...etc...
then
do_something;
It looks pretty ugly for this particular table because it has 30+ fields.
Now, I wonder if there is anything in SQL that would enable such
triggers to be written like this:
if (old is distinct from new) then do_something;
If there is and it's easy to implement, I'd add it to the tracker. If
not, forget it.
Thanks,
--
Milan Babuskov
http://www.flamerobin.org
http://www.guacosoft.com