Re: pl/pythonu - Mailing list pgsql-general

From C G
Subject Re: pl/pythonu
Date
Msg-id Law12-F103AxGbjVzht0004f86f@hotmail.com
Whole thread Raw
In response to pl/pythonu  ("C G" <csgcsg39@hotmail.com>)
Responses Re: pl/pythonu  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
> > Dear All,
> >
> > Could anyone explain why this function does will not work? The error
>message
> > is
> > DETAIL: exceptions.RuntimeError: maximum recursion depth exceeded.
> >
> > CREATE FUNCTION testing() RETURNS trigger AS'
> >
> > plan=plpy.prepare(''INSERT INTO t1 values ($1)'',[''text''])
> > plpy.execute(plan,[''blah''])
> > return ''MODIFY''
> >
> > 'LANGUAGE plpythonu;
>
>Perhaps the plpy.execute is inserting into the same table as the trigger
>is on?  If that's the case, then the trigger will be recursively called
>over and over until the "maximum recursion depth" is "exceeded".

Yes, that is what is happening. My question is now, if I have a trigger on
table t1, how should I write my function to insert 'blah' into my table when
it is triggered?

Thanks

Colin

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: pl/pythonu
Next
From: "Ed L."
Date:
Subject: Re: DB cache size strategies