Re: Trigger vs Rule
От | Niklas Johansson |
---|---|
Тема | Re: Trigger vs Rule |
Дата | |
Msg-id | 5DEF8AEF-9FBD-4C6E-88BD-FA90CB1BDF31@tele2.se обсуждение исходный текст |
Ответ на | Re: Trigger vs Rule (Niklas Johansson <spot@tele2.se>) |
Ответы |
Re: Trigger vs Rule
|
Список | pgsql-performance |
On 2 apr 2006, at 23.08, Niklas Johansson wrote: > CREATE OR REPLACE FUNCTION exec_device_type() RETURNS trigger AS $$ > EXECUTE "SELECT device_type" || OLD.type || "(OLD.id)"; > $$ LANGUAGE plpgsql; Sorry, I was bitten by the bedbug there: a plpgsql function needs a little more than that to be functional :) CREATE OR REPLACE FUNCTION exec_device_type() RETURNS trigger AS $$ BEGIN EXECUTE 'SELECT device_type' || OLD.type || '(OLD.id)'; RETURN NEW/OLD/NULL; -- Depending on your application. END; $$ LANGUAGE plpgsql; But really, you should consider reworking your schema structure. Having a thousand functions doing almost the same thing is neither efficient, nor maintainable. Sincerely, Niklas Johansson
В списке pgsql-performance по дате отправления: