Re: [PATCH] Bug in XPATH() if expression returns a scalar value

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Bug in XPATH() if expression returns a scalar value
Date: 2011-06-09 23:28:21
Message-ID: 115517DA-921E-4828-8D4F-0F5C6AE92671@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jun8, 2011, at 10:14 , Florian Pflug wrote:
> 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.

Patch rebased onto HEAD.

best regards,
Florian Pflug

Attachment Content-Type Size
pg_xpath_returnvalue.v3.patch application/octet-stream 12.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2011-06-09 23:51:45 [v9.2] Start new timeline for PITR
Previous Message Tom Lane 2011-06-09 22:37:36 Re: tuning autovacuum