Re: xml_is_document and selective pg_re_throw

Поиск
Список
Период
Сортировка
От Nikhil Sontakke
Тема Re: xml_is_document and selective pg_re_throw
Дата
Msg-id CANgU5ZcsxWpEixWiMZc6nNN7QEJ01e1qv9G8qNSJKQzwgMZ5VA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: xml_is_document and selective pg_re_throw  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
 
No, I don't see any particular risk there.  The places that might throw
ERRCODE_INVALID_XML_DOCUMENT are sufficiently few (as in, exactly one,
in this usage) that we can have reasonable confidence we know what the
system state is when we catch that error.


Hmmm, I was writing some code in which I happened to hold a LWLock when this function was called. The first catch/rethrow cleaned up the InterruptHoldoffCount value. A subsequent release of that LWLock tripped up the (Assert(InterruptHoldoffCount > 0);) inside RESUME_INTERRUPTS().

I know holding an lwlock like this might not be a good idea, but this behavior just got me thinking about other probable issues.

Regards,
Nikhils
 
> A better way would have been to modify xml_parse to take an additional
> boolean argument "to_rethrow" and not to rethrow if that is false?

We could do that, but it would greatly complicate xml_parse IMO, since
it still needs its own PG_TRY block to handle other error cases, and
only one of those error cases ought to optionally return failure instead
of re-throwing.

                       regards, tom lane

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: initdb and fsync
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: hint bit i/o reduction