Problems understanding functions.

Поиск
Список
Период
Сортировка
От Duncan Adams (DNS)
Тема Problems understanding functions.
Дата
Msg-id 034A824BAA3FBA4CA0CBEF1031A02F3519F1D7@zablv02001.vodacom.corp
обсуждение исходный текст
Ответы Re: Problems understanding functions.  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-novice
Hi all

I must be reading the wrong documentation but i just can't get the following
function working.
I don't get an error but it appears as if the function goes in to a loop.
I could do this with PHP but would really like to get it right in plpgsql.

could someone please look at it and also add a 'plpgsql for dummies' URL

thanx Duncan.

drop function fun_power_ups();
create function fun_power_ups() RETURNS OPAQUE as '
    begin
        update power set ups = substring(power.phase from 1 for 1)
where old.power_id = new.power_id;
        return new;
    end;
' language 'plpgsql';

drop trigger tri_power_ups on power;
create trigger tri_power_ups after insert or update on power for each row
execute PROCEDURE fun_power_ups();

(this is all on one table.)

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 7.2.2 java configure problem on Mac OS X 10.1.5
Следующее
От: Oliver Elphick
Дата:
Сообщение: Re: Problems understanding functions.