Re: query_to_xml() returns invalid XML when query returns no rows

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: query_to_xml() returns invalid XML when query returns no rows
Дата
Msg-id fb97da86-2397-4ccb-38a4-38153de31df0@2ndquadrant.com
обсуждение исходный текст
Ответ на query_to_xml() returns invalid XML when query returns no rows  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: query_to_xml() returns invalid XML when query returns no rows
Список pgsql-general
On 3/12/18 08:18, Thomas Kellerer wrote:
> I am not sure if this qualifies as a bug: 
> 
> query_to_xml() returns an empty XML document when the query returns no rows, e.g:
> 
>    select query_to_xml('select 42 where false', false, true, '');
> 
> The problem with this is, that if the resulting XML is then fed into e.g. the xpath() function, that function fails
becausethe "empty" document is an invalid XML:
 

That's because you have the tableforest argument set to true.  If you
want a proper XML document, then you should write

    select query_to_xml('select 42 where false', false, false, '');

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Reindex doesn't eliminate bloat
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Reindex doesn't eliminate bloat