Re: [PATCH] Bug in XPATH() if expression returns a scalar value - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: [PATCH] Bug in XPATH() if expression returns a scalar value
Date
Msg-id BECD717C-8232-4427-B31D-748D9CA77A38@phlo.org
Whole thread Raw
In response to Re: [PATCH] Bug in XPATH() if expression returns a scalar value  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: [PATCH] Bug in XPATH() if expression returns a scalar value
Re: [PATCH] Bug in XPATH() if expression returns a scalar value
List pgsql-hackers
On Jun6, 2011, at 14:56 , Peter Eisentraut wrote:
> On tis, 2011-05-31 at 16:19 +0200, Florian Pflug wrote:
>> If people deem this to be a problem, we could instead add a separate
>> function XPATH_VALUE() that returns VARCHAR, and make people use that
>> for scalar-value-returning expressions.
> 
> Why not replicate what contrib/xml2 provides, namely
> 
> xpath_string()
> xpath_number()
> xpath_bool()
> 
> That way, types are preserved.


But then you lose the ability to evaluate user-supplied
XPath expressions, because there's no way of telling which of these
function to use.

Since XPATH_BOOL() can be emulated by doing XPATH(...)::text::boolean
if XPATH() implements the more lenient behaviour I proposed, that
seems like a bad tradeoff overall.

best regards,
Florian Pflug



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: reindex creates predicate lock on index root
Next
From: Heikki Linnakangas
Date:
Subject: SSI heap_insert and page-level predicate locks