Re: [HACKERS] Rule system (trigger names)

Started by Andreas Zeugswetterover 27 years ago2 messages
#1Andreas Zeugswetter
andreas.zeugswetter@telecom.at

possible:

CREATE TRIGGER on_insert AFTER INSERT on emp
FOR EACH ROW EXECUTE PROCEDURE on_ins_emp();

CREATE TRIGGER on_insert AFTER INSERT on payroll
FOR EACH ROW EXECUTE PROCEDURE on_ins_payroll();

The name of the trigger is the same but the table they
triggered for differs and they call different functions.

I think trigger names shoud be unique. Like in Informix, Oracle, DB/2.

Remember to drop a trigger, the syntax usually is:
drop trigger on_insert;

so you could safely name the function _trig_<triggername> e.g.

Andreas

#2Noname
jwieck@debis.com
In reply to: Andreas Zeugswetter (#1)

possible:

CREATE TRIGGER on_insert AFTER INSERT on emp
FOR EACH ROW EXECUTE PROCEDURE on_ins_emp();

CREATE TRIGGER on_insert AFTER INSERT on payroll
FOR EACH ROW EXECUTE PROCEDURE on_ins_payroll();

The name of the trigger is the same but the table they
triggered for differs and they call different functions.

I think trigger names shoud be unique. Like in Informix, Oracle, DB/2.

Remember to drop a trigger, the syntax usually is:
drop trigger on_insert;

Not in PostgreSQL. Here it is

DROP TRIGGER trigname ON relation;

so you could safely name the function _trig_<triggername> e.g.

Andreas

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #