Re: Writing a user defined function

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Suresh_ <suiyengar(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Writing a user defined function
Date: 2008-07-18 20:38:05
Message-ID: 4880FF2D.2010602@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 18/07/2008 17:07, Suresh_ wrote:
> CREATE OR REPLACE FUNCTION udf()
> RETURNS integer AS $$
> BEGIN
> for i in 1..2000 loop
> for j in 1...10000 loop
> end loop;
> begin work;

^^^^^^----- Here's your problem!

You can't have a transaction inside a function - the function is already
executed inside a transaction.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message user 2008-07-18 20:45:14 Calling Python functions with parameters
Previous Message Francisco Reyes 2008-07-18 20:16:42 Re: Reducing memory usage of insert into select operations?