On 2 apr 2006, at 10.31, Ключников А.С. wrote:
What is faster?
One trigger with 1000 ELSE IF
Or 1000 rules
Faster to write and easier to maintain would be to write a trigger
function in pl/pgsql which executes the right function dynamically:
CREATE OR REPLACE FUNCTION exec_device_type() RETURNS trigger AS $$
EXECUTE "SELECT device_type" || OLD.type || "(OLD.id)";
$$ LANGUAGE plpgsql;
Best would probably be to refactor your device_typeN() functions into
one, that would take N as an argument.
Sincerely,
Niklas Johansson