Re: [HACKERS] Memory context in exception handler

2007-01-14 Thread Peter Eisentraut
Tom Lane wrote: > As near as I can tell, you're using CopyErrorData not because you > need an actual copy but just because elog.c doesn't export any other > API to let you see the current sqlerrorcode. Perhaps adding a > function to return the top stack entry's sqlerrorcode would be a > better API

Re: [HACKERS] Memory context in exception handler

2007-01-13 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > But this fails because CopyErrorData() complains by way of assertion > that we're still in ErrorContext. A nearby comment suggests to switch > away to another context to preserve the data across FlushErrorState(), > but that doesn't seem necessary

[HACKERS] Memory context in exception handler

2007-01-13 Thread Peter Eisentraut
I'm trying to use the PG_TRY/PG_CATCH exception handling: bool xml_is_document(xmltype *arg) { boolresult; xmlDocPtr doc; PG_TRY(); { doc = xml_parse((text *) arg, true, true); result = true; } PG_CA