Skip site navigation (1) Skip section navigation (2)

Re: cleaning up in UDF's (user-defined functions)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: craig perras <craigp98072(at)yahoo(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: cleaning up in UDF's (user-defined functions)
Date: 2004-06-09 14:53:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
craig perras <craigp98072(at)yahoo(dot)com> writes:
> I appended an excerpt from the docs... IIUC, if I make
> a DSQL call from a UDF (written in C), and there's a
> transaction abort caused by that command, then my
> function is never called back. How do I cleanup any
> resources the function allocated if this is the case?

What resources?  Most stuff (like palloc'd memory) is taken care of
for you.  If you're maintaining your own private permanent data
structures then you may need to plug in a transaction-end hook
routine to clean those up.

pgsql-interfaces is hardly the place for discussing how to write
C-language server functions; if you want to discuss the fine points
I'd suggest pgsql-hackers.

			regards, tom lane

In response to

pgsql-interfaces by date

Next:From: David StanawayDate: 2004-06-09 21:44:12
Subject: Problem with PQexecPrepared
Previous:From: craig perrasDate: 2004-06-09 02:29:08
Subject: cleaning up in UDF's (user-defined functions)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group