Re: stack depth limit exceeded

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: stack depth limit exceeded
Дата
Msg-id 20050830034133.GA10762@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: stack depth limit exceeded  (Jamie Deppeler <jamie@doitonce.net.au>)
Список pgsql-general
On Mon, Aug 29, 2005 at 01:45:32PM +1000, Jamie Deppeler wrote:
>
> CREATE TRIGGER "updateContact" AFTER INSERT OR UPDATE
> ON  FOR EACH ROW
> EXECUTE PROCEDURE "contacts"."addContactField"();

Please show the actual commands that you're running; the above fails
with a syntax error because it's missing a table name.  Is this
trigger on contacts.person?

> CREATE OR REPLACE FUNCTION "contacts"."addContactField" () RETURNS
> trigger AS
> $body$
> begin
>  update contacts.person
>  set "contact" = new.firstname
>  where person."primary" = new."primary";
>  return null;
> end;
> $body$
> LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

As Tom mentioned, if you want to modify the record being inserted
then simply assign a value to one of NEW's columns and have the
function return NEW.  In such a case the function will need to be
called in a BEFORE trigger.  See "Triggers" and "Trigger Procedures"
in the documentation for more information:

http://www.postgresql.org/docs/8.0/static/triggers.html
http://www.postgresql.org/docs/8.0/static/plpgsql-trigger.html

--
Michael Fuhr

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: PQConnectdb SSL (sslmode): Is this a bug
Следующее
От: "Matt A."
Дата:
Сообщение: Re: [SQL] question