pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: Rules and Triggers: another question
2+ messages / 2 participants
[nested] [flat]

* Re: Rules and Triggers: another question
@ 2002-09-12 12:52 Michael Paesold <mpaesold@gmx.at>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paesold @ 2002-09-12 12:52 UTC (permalink / raw)
  To: Jerome Chochon <jerome.chochon@ensma.fr>; +Cc: pgsql-sql

Jerome Chochon wrote:

> Thanks for your answer but i have another question.
> Which one is the faster ?
> 
> If i write this trigger...
> CREATE TRIGGER trigger_name
> BEFORE DELETE
> ON table_name
> FOR EACH ROW EXECUTE PROCEDURE function();
> 
> and this rule:
> CREATE RULE name_rule AS
> ON DELETE TO table_name
> DO select function();
> 
> When i delete values, whichone will call the value the first ?
> 
> Someone can help me ??

With the RULE, the function will be called earlier than with the TRIGGER.
(according to what Ross said before)

Regards,
Michael




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Rules and Triggers: another question
@ 2002-09-16 06:57 Jerome Chochon <jerome.chochon@ensma.fr>
  0 siblings, 0 replies; 2+ messages in thread

From: Jerome Chochon @ 2002-09-16 06:57 UTC (permalink / raw)
  To: pgsql-sql

Hi all.

Sorry to ask you another time this question.

Which one is the faster ?

If i write this trigger...
CREATE TRIGGER trigger_name
BEFORE DELETE
ON table_name
FOR EACH ROW EXECUTE PROCEDURE function();

and this rule:
CREATE RULE name_rule AS
ON DELETE TO table_name
DO select function();

When i delete values, which one will call the function the first ?

Someone can help me ??

And if I want to use only function, do I use Trigger or Rules ?


(Thanks to M. Michael Paesold to answer my question but I want another answer to be sure)

Best Regards.

Jérêom Chochon

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-09-16 06:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12 12:52 Re: Rules and Triggers: another question Michael Paesold <mpaesold@gmx.at>
2002-09-16 06:57 Rules and Triggers: another question Jerome Chochon <jerome.chochon@ensma.fr>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox