Subject Re: [Firebird-Architect] old is distinct from new
Author Adriano dos Santos Fernandes
Milan Babuskov wrote:
> 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.
I think this is implicit on ROW types (already on the tracker). Once ROW
types exists, OLD and NEW are of this type and IS DISTINCT should
compare the elements.


Adriano