PG_CATCH used without PG_RETHROW - Mailing list pgsql-hackers

From Greg Stark
Subject PG_CATCH used without PG_RETHROW
Date
Msg-id CAM-w4HOq4AbiS00Eet7W7HWnV3i7jJnXGwfnA2J_H0LK1hKRCQ@mail.gmail.com
Whole thread Raw
Responses Re: PG_CATCH used without PG_RETHROW  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
My understanding is that PG_TRY/PG_CATCH doesn't save enough state to
avoid rethrowing errors and if you want to actually continue the
transaction you must use a subtransaction. As a result I was under the
impression it was mandatory to PG_RETHROW as a result.

If that's the case then I think I just came across a bug in
utils/adt/xml.c where there's no PG_RETHROW:

/** Functions for checking well-formed-ness*/

#ifdef USE_LIBXML
static bool
wellformed_xml(text *data, XmlOptionType xmloption_arg)
{
bool result;
volatile xmlDocPtr doc = NULL;

/* We want to catch any exceptions and return false */
PG_TRY();
{
doc = xml_parse(data, xmloption_arg, true, GetDatabaseEncoding());
result = true;
}
PG_CATCH();
{
FlushErrorState();
result = false;
}
PG_END_TRY();

if (doc)
xmlFreeDoc(doc);

return result;
}
#endif

-- 
greg



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Is this a bug?
Next
From: Tom Lane
Date:
Subject: Re: pg_ctl/pg_rewind tests vs. slow AIX buildfarm members