Re: review: xml_is_well_formed

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: review: xml_is_well_formed
Дата
Msg-id AANLkTik0mkL9_J0YrzJtiHEE4Dk6hjOWgV7qGU=dXvf9@mail.gmail.com
обсуждение исходный текст
Ответ на Re: review: xml_is_well_formed  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: review: xml_is_well_formed  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Mon, Aug 9, 2010 at 10:20 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On lör, 2010-08-07 at 16:47 +0100, Mike Fowler wrote:
>> 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;
>
> Note that this wouldn't necessarily work because it is not guaranteed
> that the well-formedness test is executed before the cast to xml.  SQL
> doesn't short-circuit left to right.  (A CASE expression could work.)

There's also the fact that it would probably end up parsing the data
twice.  Given xmloption, I'm inclined to think Tom has it right:
provided xml_is_well_formed() that follows xmloption, plus a specific
version for each of content and document.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Initial review of xslt with no limits patch
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: is syntax columname(tablename) necessary still?