Re: stack depth limit exceeded

From: "Frank L(dot) Parks" <fparks(at)ezbizpartner(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: stack depth limit exceeded
Date: 2005-08-29 14:21:23
Message-ID: 431319E3.6060004@ezbizpartner.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I think that you forgot the table name.

CREATE TRIGGER "updateContact" AFTER INSERT OR UPDATE
ON contacts FOR EACH ROW
EXECUTE PROCEDURE "contacts"."addContactField"();

Frank

Jamie Deppeler wrote:

> What i am trying to do is update the field contact with field values
> in firstname and lastname
>
> Trigger
>
> CREATE TRIGGER "updateContact" AFTER INSERT OR UPDATE
> ON FOR EACH ROW
> EXECUTE PROCEDURE "contacts"."addContactField"();
>
> Procedure
>
> 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;
>
> Tom Lane wrote:
>
>> Jamie Deppeler <jamie(at)doitonce(dot)net(dot)au> writes:
>>
>>
>>> At the moment i am trying to execute a very simple function but i am
>>> getting the following error stack depth limit exceeded
>>>
>>
>>
>> You didn't really show the complete context, but seeing that this is a
>> trigger and it's trying to do an "UPDATE person" internally, I'll bet
>> a nickel that the trigger itself is on update events on person, and
>> therefore that you've written an infinite recursion.
>>
>> Had you shown more context, I could have given some advice on a better
>> way to do it. If you're trying to alter the row that's about to be
>> stored, you just have to assign to field(s) of the NEW row within the
>> trigger. If you want to do something else, you need to explain what.
>>
>> regards, tom lane
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Have you searched our list archives?
>>
>> http://archives.postgresql.org
>>
>>
>>
>>
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message CSN 2005-08-29 16:58:38 About dropped notifications
Previous Message Tom Lane 2005-08-29 13:56:31 Re: Planner create a slow plan without an available index