Re: review: xml_is_well_formed

From: Mike Fowler <mike(at)mlfowler(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, 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-06 13:43:52
Message-ID: 4C5C1198.6080205@mlfowler.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/08/10 12:31, Robert Haas wrote:
>>>
>>> Maybe there should be
>>>
>>> xml_is_well_formed()
>>> xml_is_well_formed_document()
>>> xml_is_well_formed_content()
>>>
>>> I agree that consistency with SQL/XML is desirable, but for someone
>>> coming from the outside, the unqualified claim that 'foo' is well-formed
>>> XML might sound suspicious.
>>>
>> What about making the function sensitive to the XML OPTION, such that:
>>
>> test=# SET xmloption TO DOCUMENT;
>> SET
>> text=# SELECT xml_is_well_formed('foo');
>>
>> xml_is_well_formed
>> --------------------
>> f
>> (1 row)
>>
> That will make using this function a huge hassle, won't it? Functions
> that do different things depending on GUC settings are usually
> troublesome. Having three functions would be more sensible if we need
> all three behaviors, but I don't see why we do.
>
> 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.

Regards,

--
Mike Fowler
Registered Linux user: 379787

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-06 14:02:06 Re: default of max_stack_depth
Previous Message Alanoly Andrews 2010-08-06 13:10:15 postgres 9.0 crash when bringing up hot standby