Triggers
Hello, I have this doubt since I started using PostgreSQL, a few months ago.
Why triggers are defined that way? I mean, in others DBMS you simply write:
CREATE TRIGGER <trigger_name> ... bla bla bla
BEGIN
....
END;
Why you should write a function first and then the trigger, which must call
that function?
What are the advantages/disadvantages of that? Where can I find more
information?
--
Germán Hüttemann Arza
Why you should write a function first and then the trigger, which must
call that function?What are the advantages/disadvantages of that? Where can I find more
information?
The PG way seems very natural to me:
you can write functions that do something and then have many triggers
call that same function.
Also there's not just PL/PGSQL: you might want
to define a function in C or Perl and then have a trigger call it.
Bye, Chris.
--
Chris Mair
http://www.1006.org
Chris Mair <chrisnospam@1006.org> writes:
Why you should write a function first and then the trigger, which must
call that function?
... there's not just PL/PGSQL: you might want
to define a function in C or Perl and then have a trigger call it.
Right, that's the real reason: this approach doesn't constrain which
PL you can write your triggers in.
regards, tom lane