Re: review: xml_is_well_formed

Поиск
Список
Период
Сортировка
От Mike Fowler
Тема Re: review: xml_is_well_formed
Дата
Msg-id 4C5D8005.4030304@mlfowler.com
обсуждение исходный текст
Ответ на Re: review: xml_is_well_formed  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: review: xml_is_well_formed  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On 06/08/10 21:55, Peter Eisentraut wrote:
> On fre, 2010-08-06 at 14:43 +0100, Mike Fowler wrote:
>>> Or perhaps it could return a string instead of a boolean: content,
>>> document, or NULL if it's neither.
>>>
>>
>> I like the sound of that. In fact this helps workaround the IS
>> DOCUMENT
>> and IS CONTENT limitations such that you can you can select only
>> content, only documents or both is you use IS NOT NULL.
>>
>> Unless anyone sees a reason that this function needs to remain a
>> boolean function, I'll rework the patch over the weekend.
>
> What is the actual use case for this function?  Is the above behavior
> actually useful?

The idea is to be able to filter a table that contains XML in TEXT that 
might not be well formed. Knowing that you're only dealing with well 
formed XML prevents you blowing up when you attempt the cast.

>
> One reason to stick with boolean is backward compatibility.
>

To be honest I'm happiest with returning a boolean, even if there is 
some confusion over content only being valid. Though changing the return 
value to DOCUMENT/CONTENT/NULL makes things a touch more explicit, the 
same results can be achieved by simply running:

SELECT data::xml FROM mixed WHERE xml_is_well_formed(data) AND data::xml 
IS DOCUMENT;

Regards,
-- 
Mike Fowler
Registered Linux user: 379787


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

Предыдущее
От: Mike Fowler
Дата:
Сообщение: Re: Review: Re: [PATCH] Re: Adding xpath_exists function
Следующее
От: Simon Riggs
Дата:
Сообщение: Moderator on Committers?