Re: review: xml_is_well_formed

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Mike Fowler <mike(at)mlfowler(dot)com>
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-09 14:20:39
Message-ID: 1281363639.22702.1.camel@fsopti579.F-Secure.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-09 14:22:00 Re: is syntax columname(tablename) necessary still?
Previous Message Robert Haas 2010-08-09 14:18:20 Re: Initial review of xslt with no limits patch