Re: [PATCH] Add pretty-printed XML output option

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Add pretty-printed XML output option
Дата
Msg-id 3845900.1675927384@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Add pretty-printed XML output option  (Jim Jones <jim.jones@uni-muenster.de>)
Ответы Re: [PATCH] Add pretty-printed XML output option  (Jim Jones <jim.jones@uni-muenster.de>)
Список pgsql-hackers
Jim Jones <jim.jones@uni-muenster.de> writes:
> I see your point. If I got it right, you're suggesting the following
> change in the PG_TRY();

>     PG_TRY();
>      {

>          int nbytes;

>          if(!doc)
>              xml_ereport(xmlerrcxt, ERROR, ERRCODE_INTERNAL_ERROR,
>                      "could not parse the given XML document");

>          xmlDocDumpFormatMemory(doc, &xmlbuf, &nbytes, 1);

>          if(!nbytes || xmlerrcxt->err_occurred)
>              xml_ereport(xmlerrcxt, ERROR, ERRCODE_INTERNAL_ERROR,
>                      "could not indent the given XML document");


>          initStringInfo(&buf);
>          appendStringInfoString(&buf, (const char *)xmlbuf);

>      }

> .. which will catch the doc == NULL before calling xmlDocDumpFormatMemory.

Um ... why are you using PG_TRY here at all?  It seems like
you have full control of the actually likely error cases.
The only plausible error out of the StringInfo calls is OOM,
and you probably don't want to trap that at all.

            regards, tom lane



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

Предыдущее
От: Jim Jones
Дата:
Сообщение: Re: [PATCH] Add pretty-printed XML output option
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Time delayed LR (WAS Re: logical replication restrictions)