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

From Peter Eisentraut
Subject Re: [PATCH] Bug in XPATH() if expression returns a scalar value
Date
Msg-id 1307365019.20678.6.camel@fsopti579.F-Secure.com
Whole thread Raw
In response to Re: [PATCH] Bug in XPATH() if expression returns a scalar value  (Florian Pflug <fgp@phlo.org>)
Responses Re: [PATCH] Bug in XPATH() if expression returns a scalar value
List pgsql-hackers
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.

> However, to avoid confusion,
> XPATH() should then be taught to raise an error if used for
> scalar-value
> returning expressions, instead of silently returning an empty array as
> it does now.

Sounds reasonable.



pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Range Types and extensions
Next
From: Peter Eisentraut
Date:
Subject: Re: Domains versus polymorphic functions, redux