Обсуждение: BUG #5534: IS DOCUMENT predicate errors instead of returning false

Поиск
Список
Период
Сортировка

BUG #5534: IS DOCUMENT predicate errors instead of returning false

От
"Mike Fowler"
Дата:
The following bug has been logged online:

Bug reference:      5534
Logged by:          Mike Fowler
Email address:      mike@mlfowler.com
PostgreSQL version: 9.0beta2
Operating system:   Linux 2.6.31-14-generic #48-Ubuntu SMP
Description:        IS DOCUMENT predicate errors instead of returning false
Details:

IS DOCUMENT should return false for a non-well formed document, and indeed
is coded to do such. However, the conversion to the xml type which happens
before the underlying xml_is_document function is even called fails and
exceptions out. I've mentioned this on -hackers with message ID
20100701172553.w5vdy1xbocos8g40@www.mlfowler.com

Re: BUG #5534: IS DOCUMENT predicate errors instead of returning false

От
Mike Fowler
Дата:
Quoting Mike Fowler <mike@mlfowler.com>:

>
> The following bug has been logged online:
>
> Bug reference:      5534
> Logged by:          Mike Fowler
> Email address:      mike@mlfowler.com
> PostgreSQL version: 9.0beta2
> Operating system:   Linux 2.6.31-14-generic #48-Ubuntu SMP
> Description:        IS DOCUMENT predicate errors instead of returning false
> Details:
>
> IS DOCUMENT should return false for a non-well formed document, and indeed
> is coded to do such. However, the conversion to the xml type which happens
> before the underlying xml_is_document function is even called fails and
> exceptions out. I've mentioned this on -hackers with message ID
> 20100701172553.w5vdy1xbocos8g40@www.mlfowler.com
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

The attached patch is a very small patch that changes parse_expr.c to
not convert everything to xml. This now means that when passed
malformed XML it will return false instead of throwing an exception.
In my mind this acceptable as I don't see anywhere in the standard
that mandates that:

xmlval IS NOT DOCUMENT == xmlval IS CONTENT

Regards,

--
Mike Fowler
Registered Linux user: 379787

Вложения

Re: BUG #5534: IS DOCUMENT predicate errors instead of returning false

От
Peter Eisentraut
Дата:
On fre, 2010-07-02 at 14:01 +0100, Mike Fowler wrote:
>
> The attached patch is a very small patch that changes parse_expr.c
> to
> not convert everything to xml. This now means that when passed
> malformed XML it will return false instead of throwing an exception.
> In my mind this acceptable as I don't see anywhere in the standard
> that mandates that:
>
> xmlval IS NOT DOCUMENT == xmlval IS CONTENT

It says that the declared type of the argument of IS DOCUMENT is XML,
which would be invalidated by your patch.