Re: how to get trigger start function not procedure

Поиск
Список
Период
Сортировка
От rob
Тема Re: how to get trigger start function not procedure
Дата
Msg-id 002201c07264$7417b260$4100fd0a@cabrion.org
обсуждение исходный текст
Ответ на how to get trigger start function not procedure  (chris Günther <guenther@uscreen.de>)
Ответы Re: how to get trigger start function not procedure
Список pgsql-novice
create function set_timestamp() returns opaque as
'begin
new.timestamp := now();
new.user := getpgusername()
end if;
return new;
end;' language 'plpgsql';

create trigger MyUpdateTrigger before insert or update on YourTable for each
row execute procedure set_timestamp;



----- Original Message -----
From: "chris Günther" <guenther@uscreen.de>
To: <pgsql-novice@postgresql.org>
Sent: Friday, December 29, 2000 11:23 AM
Subject: how to get trigger start function not procedure


> Hi folks,
>
> my name is chris and I'm pretty new to pSQL.
> I used to work with MS SQL Server 6.5 and have
> some problems adjusting myself with pSQL.
>
> Now my question. As mentioned in the subject I
> want a trigger to fire an sql-function - not a
> c procedure - although this would be much cooler.
> I'm trying to get something to work I always did
> with MS SQL. When a dataset is inserted in a
> table I want a trigger to be fired to set the
> creation-date and -time plus the user and a trigger
> setting the update-date -time and user.
>
> Does anyone has any idea of how to do this with pSQL???
>
> In MS SQL server i just created a trigger with the
> necessary SQL-commands inside the trigger but in pSQL
> it seems that trigger just start procdures.
>
> thanks in advance
>
> chris
>
> --
>


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: newbie sql question re: subqueries, order by, and limit
Следующее
От: chris Günther
Дата:
Сообщение: Re: how to get trigger start function not procedure