Re: Exception Handling in C-Language Functions? - Mailing list pgsql-general

From Neil Conway
Subject Re: Exception Handling in C-Language Functions?
Date
Msg-id 428F09B9.6080806@samurai.com
Whole thread Raw
In response to Exception Handling in C-Language Functions?  ("Felix E. Klee" <felix.klee@inka.de>)
Responses Re: Exception Handling in C-Language Functions?
List pgsql-general
Felix E. Klee wrote:
> I have the created a C-Language function (code is below).  Now, I
> wonder: How do I handle exceptions, for example if malloc cannot assign
> the necessary memory?  Do "palloc" and "pfree" handle such a case
> cleanly?

Yes -- they will roll back the current transaction on if there is no
memory available. You can catch the error via PG_TRY() in 8.0, although
in the case of OOM there isn't probably a lot your exception handler
could do...

-Neil

pgsql-general by date:

Previous
From: "Felix E. Klee"
Date:
Subject: Exception Handling in C-Language Functions?
Next
From: "Felix E. Klee"
Date:
Subject: Re: Exception Handling in C-Language Functions?