Re: [PATCHES] xpath_array with namespaces support

2007-05-21 Thread Peter Eisentraut
Am Dienstag, 10. April 2007 14:01 schrieb Nikolay Samokhvalov: > Here is new version that adds following changes: > 4. Function is now strict, per discussion. > 5. Return empty array in case when XPath expression detects nothing > (previously, NULL was returned in such case), per discussion. >

Re: [PATCHES] xpath_array with namespaces support

2007-04-22 Thread Bruce Momjian
Thanks, added to queue. --- Nikolay Samokhvalov wrote: > What's with this patch? > I do not see it in unapplied patches list, neither it was commited... > What we have now in CVS is not a good thing. > > On 4/10/07, Nikolay

Re: [PATCHES] xpath_array with namespaces support

2007-04-22 Thread Bruce Momjian
Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon as one of the PostgreSQL committers reviews and approves it. --- Ni

Re: [PATCHES] xpath_array with namespaces support

2007-04-22 Thread Nikolay Samokhvalov
What's with this patch? I do not see it in unapplied patches list, neither it was commited... What we have now in CVS is not a good thing. On 4/10/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: Here is new version that adds following changes: 4. Function is now strict, per discussion. 5.

Re: [PATCHES] xpath_array with namespaces support

2007-04-16 Thread Nikolay Samokhvalov
It's also worth to take care of the very last lines of XML functions doc (http://momjian.us/main/writings/pgsql/sgml/functions-xml.html): "XML to SQL Mapping This involves converting XML data to and from relational structures. PostgreSQL has no internal support for such mapping, and relies on

Re: [PATCHES] xpath_array with namespaces support

2007-04-10 Thread Peter Eisentraut
Am Dienstag, 10. April 2007 15:17 schrieb Andrew Dunstan: > Nikolay Samokhvalov wrote: > > 6. (bugfix) Work with fragments with prologue: select xpath('/a', > > ''); // now XML datum is always wrapped > > with dummy ..., XML prologue simply goes away (if any). > > Is that legal XML? I though only

Re: [PATCHES] xpath_array with namespaces support

2007-04-10 Thread Andrew Dunstan
Nikolay Samokhvalov wrote: 6. (bugfix) Work with fragments with prologue: select xpath('/a', ''); // now XML datum is always wrapped with dummy ..., XML prologue simply goes away (if any). Is that legal XML? I though only documents could have prologs. cheers andrew -

Re: [PATCHES] xpath_array with namespaces support

2007-04-10 Thread Nikolay Samokhvalov
Here is new version that adds following changes: 4. Function is now strict, per discussion. 5. Return empty array in case when XPath expression detects nothing (previously, NULL was returned in such case), per discussion. 6. (bugfix) Work with fragments with prologue: select xpath('/a', ''); //

Re: [PATCHES] xpath_array with namespaces support

2007-04-08 Thread Nikolay Samokhvalov
I've realized that Peter's criticism (concerning comparing beginning of datum with "". I'll propose a modification of the patch as long as fixes for NULLs as input and output values very soon (in a day or so). On 4/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: The patch attached contains

Re: [PATCHES] xpath_array with namespaces support

2007-04-04 Thread Nikolay Samokhvalov
On 4/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: So, choosing between two inefficient approaches: 1. mine, which in some cases use dummy element wrapping, that we could escape; 2. proposed by you, which leads to +1 parsing. ... I'd definitely choose the first one. I'd make it a bi

Re: [PATCHES] xpath_array with namespaces support

2007-04-04 Thread Peter Eisentraut
Am Mittwoch, 4. April 2007 15:20 schrieb Nikolay Samokhvalov: > > To determine if an XML datum is a document, call xml_is_document(). The > > implementation of that function is probably not the best possible one, > > but what the xpath() code does it totally wrong nevertheless. > > You are proposi

Re: [PATCHES] xpath_array with namespaces support

2007-04-04 Thread Peter Eisentraut
Am Mittwoch, 4. April 2007 14:43 schrieb Nikolay Samokhvalov: > > Why do we even need to support xpath on fragments? > > Why not? I find it useful and convenient. Well, rather than inventing bogus root wrapper elements, why not let users call xmlelement() to produce the wrapper element themselves

Re: [PATCHES] xpath_array with namespaces support

2007-04-04 Thread Peter Eisentraut
Am Mittwoch, 4. April 2007 14:42 schrieb Nikolay Samokhvalov: > > Why is the function not strict? > > Because in case of 3rd argument (NS mappings) being NULL, we shouldn't > return NULL immediately: If the namespace mapping is NULL then it is unknown, and therefore the result of the XPath expres

Re: [PATCHES] xpath_array with namespaces support

2007-04-04 Thread Peter Eisentraut
Am Mittwoch, 4. April 2007 14:42 schrieb Nikolay Samokhvalov: > Maybe it's worth to start keeping additional information in xml datum (i.e. > bit IS_DOCUMENT and, what is more important for xpath() function, a bit > indicating that XML value has only one root and can be considered as a tree > => th

Re: [PATCHES] xpath_array with namespaces support

2007-04-02 Thread Bruce Momjian
Nikolay Samokhvalov wrote: > I apologize for it. I was extremely busy that week. > Fixes will follow ASAP, I'm working on it. 2 days are enough, it's good > deadline for me. > Sorry for delay. Yes, that is fine. Thanks. ---

Re: [PATCHES] xpath_array with namespaces support

2007-04-02 Thread Bruce Momjian
Nikolay Samokhvalov wrote: > On 3/22/07, Peter Eisentraut <[EMAIL PROTECTED]> wrote: > > Bruce Momjian wrote: > > > Patch applied. > > > > This code seems to think that if an xml datum starts with " > document. That is completely bogus. > > Agreed. I'll fix it. Nikolay, it has been a week, and I

Re: [PATCHES] xpath_array with namespaces support

2007-03-22 Thread Peter Eisentraut
Nikolay Samokhvalov wrote: > Also, maybe someone can suggest better approach for passing namespace > bindings (more convenient than ARRAY[ARRAY[...], ARRAY[...]])? Your code assumes ARRAY[ARRAY['myns', 'myns2'], ARRAY['http://example.com', 'http://example2.com']] Shouldn't it be ARRAY[ARRAY['m

Re: [PATCHES] xpath_array with namespaces support

2007-03-22 Thread Peter Eisentraut
Andrew Dunstan wrote: > Would it be better to use some more unlikely name for the dummy root > element used to process fragments than ? Why do we even need to support xpath on fragments? -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)-

Re: [PATCHES] xpath_array with namespaces support

2007-03-22 Thread Peter Eisentraut
Nikolay Samokhvalov wrote: > On 3/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: > > I'll fix these issues and extend the patch with resgression tests > > and docs for xpath_array(). I'll resubmit it very soon. > > Here is a new version of the patch. I didn't change any part of docs > yet. Si

Re: [PATCHES] xpath_array with namespaces support

2007-03-22 Thread Peter Eisentraut
Bruce Momjian wrote: > Patch applied. This code seems to think that if an xml datum starts with "http://developer.postgresql.org/~petere/ ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [PATCHES] xpath_array with namespaces support

2007-03-22 Thread Peter Eisentraut
Nikolay Samokhvalov wrote: > Here is a new version of the patch. I didn't change any part of docs > yet. Since there were no objections I've changed the name of the > function to xmlpath(). I didn't see any discussion about changing the name to xmlpath. Seeing that the function implements xpath,

Re: [HACKERS] [PATCHES] xpath_array with namespaces support

2007-03-22 Thread Bruce Momjian
Applying newest version of this patch now; still needs documentation. --- Nikolay Samokhvalov wrote: > On 3/5/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: > > On 3/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote:

Re: [PATCHES] xpath_array with namespaces support

2007-03-22 Thread Bruce Momjian
Patch applied. Please provide a documentation addition. Thanks. --- Nikolay Samokhvalov wrote: > On 3/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: > > I'll fix these issues and extend the patch with resgression te

Re: [PATCHES] xpath_array with namespaces support

2007-03-18 Thread Nikolay Samokhvalov
On 3/5/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: On 3/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: > I'll fix these issues and extend the patch with resgression tests and > docs for xpath_array(). I'll resubmit it very soon. Here is a new version of the patch. I didn't change an

Re: [PATCHES] xpath_array with namespaces support

2007-03-17 Thread Andrew Dunstan
Nikolay Samokhvalov wrote: On 3/17/07, Andrew Dunstan <[EMAIL PROTECTED]> wrote: In principle I am in favor of the patch. Would it be better to use some more unlikely name for the dummy root element used to process fragments than ? Perhaps even something in a special namespace? I did thi

Re: [PATCHES] xpath_array with namespaces support

2007-03-17 Thread Andrew Dunstan
Nikolay Samokhvalov wrote: What about it? W/o this not large patch XML functionality in 8.3 will be weak... Will it be accepted? In principle I am in favor of the patch. Would it be better to use some more unlikely name for the dummy root element used to process fragments than ? Perhap

Re: [PATCHES] xpath_array with namespaces support

2007-03-17 Thread Nikolay Samokhvalov
What about it? W/o this not large patch XML functionality in 8.3 will be weak... Will it be accepted? On 3/5/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: On 3/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: > I'll fix these issues and extend the patch with resgression tests and > docs

Re: [PATCHES] xpath_array with namespaces support

2007-03-08 Thread Nikolay Samokhvalov
On 3/3/07, Bruce Momjian <[EMAIL PROTECTED]> wrote: I tried this patch bug found this regression failure: -- Considering only built-in procs (prolang = 12), look for multiple uses -- of the same internal function (ie, matching prosrc fields). It's OK to -- have several entries with diffe

Re: [PATCHES] xpath_array with namespaces support

2007-03-04 Thread Nikolay Samokhvalov
On 3/4/07, Nikolay Samokhvalov <[EMAIL PROTECTED]> wrote: I'll fix these issues and extend the patch with resgression tests and docs for xpath_array(). I'll resubmit it very soon. Here is a new version of the patch. I didn't change any part of docs yet. Since there were no objections I've chang

Re: [PATCHES] xpath_array with namespaces support

2007-03-03 Thread Bruce Momjian
I tried this patch bug found this regression failure: -- Considering only built-in procs (prolang = 12), look for multiple uses -- of the same internal function (ie, matching prosrc fields). It's OK to -- have several entries with different pronames for the same internal function, -- bu

Re: [PATCHES] xpath_array with namespaces support

2007-02-28 Thread Bruce Momjian
Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches It will be applied as soon as one of the PostgreSQL committers reviews and approves it. --- Ni

[PATCHES] xpath_array with namespaces support

2007-02-20 Thread Nikolay Samokhvalov
As a result of discussion with Peter, I provide modified patch for xpath_array() with namespaces support. The signature is: _xml xpath_array(text xpathQuery, xml xmlValue[, _text namespacesBindings]) The third argument is 2-dimensional array defining bindings for namespaces. Simple examples: x