Re: Exception Handling in C-Language Functions?

From: Neil Conway <neilc(at)samurai(dot)com>
To: "Felix E(dot) Klee" <felix(dot)klee(at)inka(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Exception Handling in C-Language Functions?
Date: 2005-05-21 10:13:13
Message-ID: 428F09B9.6080806@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Felix E. Klee 2005-05-21 11:21:14 Re: Exception Handling in C-Language Functions?
Previous Message Felix E. Klee 2005-05-21 09:39:31 Exception Handling in C-Language Functions?