From: | Mike Fowler <mike(at)mlfowler(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: review: xml_is_well_formed |
Date: | 2010-08-07 15:47:17 |
Message-ID: | 4C5D8005.4030304@mlfowler.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Marc G. Fournier | 2010-08-07 18:36:04 | Re: Moderator on Committers? |
Previous Message | Mike Fowler | 2010-08-07 15:38:06 | Re: Review: Re: [PATCH] Re: [HACKERS] Adding xpath_exists function |