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

2011-06-14 Thread Florian Pflug
On Jun13, 2011, at 21:24 , Peter Eisentraut wrote: On ons, 2011-06-08 at 10:14 +0200, Florian Pflug wrote: 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. Perhaps having both variants, one type-safe

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

2011-06-13 Thread Peter Eisentraut
On ons, 2011-06-08 at 10:14 +0200, Florian Pflug wrote: 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. Perhaps having both variants, one type-safe and one not, would work. I don't agree with doing

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

2011-06-09 Thread Florian Pflug
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

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

2011-06-08 Thread Florian Pflug
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

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

2011-06-06 Thread Peter Eisentraut
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

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

2011-05-31 Thread Florian Pflug
Sorry for the self-reply but I figured it'd be helpful to add information that I discovered only after my initial post. On May30, 2011, at 15:17 , Florian Pflug wrote: The XPath expression 'name(/*)', for example, is supposed to return 'root' when applied to the XML fragment

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

2011-05-31 Thread Ross J. Reedstrom
On Tue, May 31, 2011 at 04:19:29PM +0200, Florian Pflug wrote: Sorry for the self-reply but I figured it'd be helpful to add information that I discovered only after my initial post. On May30, 2011, at 15:17 , Florian Pflug wrote: The XPath expression 'name(/*)', for example, is supposed to

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

2011-05-31 Thread Florian Pflug
On May31, 2011, at 19:15 , Ross J. Reedstrom wrote: What you describe, making XPATH return something for the scalar functions, is sorely needed. Constraining the return values to be valid XML fragments is the sort of wart that makes XML processing in postgresql seem odd to those familiar with

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

2011-05-30 Thread Florian Pflug
Hi The in-core XPATH() function currently only handles XPath expressions which return a node set correctly. For XPath expressions which return boolean, numeric or string values, XPATH() returns an empty array. (This is the case for XPath expressions whose top-level syntactic construct isn't a