PG_CATCH used without PG_RETHROW

From: Greg Stark <stark(at)mit(dot)edu>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: PG_CATCH used without PG_RETHROW
Date: 2015-09-03 19:12:04
Message-ID: CAM-w4HOq4AbiS00Eet7W7HWnV3i7jJnXGwfnA2J_H0LK1hKRCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-09-03 19:31:06 Re: pg_ctl/pg_rewind tests vs. slow AIX buildfarm members
Previous Message Alvaro Herrera 2015-09-03 18:52:16 Re: Is this a bug?