Re: xpath_array with namespaces support

Lists: pgsql-patches
From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Nikolay Samokhvalov <nikolay(at)samokhvalov(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-02 23:27:29
Message-ID: 200704022327.l32NRTa21709@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Nikolay Samokhvalov wrote:
> On 3/22/07, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> > Bruce Momjian wrote:
> > > Patch applied.
> >
> > This code seems to think that if an xml datum starts with "<?xml" it's a
> > document. That is completely bogus.
>
> Agreed. I'll fix it.

Nikolay, it has been a week, and I have see no fixes from you in
response to requests from Peter. If the patch doesn't arrive in 1-2
days, I will have to revert your patch and it will be kept for 8.4.
Feature freeze was April 1, 2007.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: "Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-08 17:34:47
Message-ID: e431ff4c0704081034x38d841f4o2f5b4493f38c6734@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

I've realized that Peter's criticism (concerning comparing beginning
of datum with "<?xml") is right: current approach is unable to work
with XML values such as "<?xml ...?><a /><b />".

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 <nikolay(at)samokhvalov(dot)com> wrote:
> The patch attached contains following changes:
> 1. The function name xmlpath() is changed to xpath();
> 2. Approach of passing of namepspace mappings to the function is changed:
> now that array (the 3rd argument) should be a 2-dimentional array with the
> length of the second axis = 2 (e.g., ARRAY[ARRAY['a1', 'http://a1'],
> ARRAY['a2', 'http://a2'], ARRAY['a2', 'http://a2']]);
> 3. Description of xpath() function in docs (I'm sorry for possible
> mistakes in English and docbook formatting, please check it...)
>
>
> On 4/3/07, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Nikolay Samokhvalov wrote:
> > > On 3/22/07, Peter Eisentraut < peter_e(at)gmx(dot)net> wrote:
> > > > Bruce Momjian wrote:
> > > > > Patch applied.
> > > >
> > > > This code seems to think that if an xml datum starts with "<?xml" it's
> a
> > > > document. That is completely bogus.
> > >
> > > Agreed. I'll fix it.
> >
> > Nikolay, it has been a week, and I have see no fixes from you in
> > response to requests from Peter. If the patch doesn't arrive in 1-2
> > days, I will have to revert your patch and it will be kept for 8.4.
> > Feature freeze was April 1, 2007.
> >
> > --
> > Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> > EnterpriseDB
> http://www.enterprisedb.com
> >
> > + If your life is a hard drive, Christ can be your backup. +
> >
>
>
>
> --
> Best regards,
> Nikolay
>

--
Best regards,
Nikolay


From: "Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-10 12:01:28
Message-ID: e431ff4c0704100501m6a41adcaw47fe07dfe606c846@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

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',
'<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
with dummy <x>...</x>, XML prologue simply goes away (if any).
7. Some cleanup.

On 4/4/07, Nikolay Samokhvalov <nikolay(at)samokhvalov(dot)com> wrote:
> The patch attached contains following changes:
> 1. The function name xmlpath() is changed to xpath();
> 2. Approach of passing of namepspace mappings to the function is changed:
> now that array (the 3rd argument) should be a 2-dimentional array with the
> length of the second axis = 2 (e.g., ARRAY[ARRAY['a1', 'http://a1'],
> ARRAY['a2', 'http://a2'], ARRAY['a2', 'http://a2']]);
> 3. Description of xpath() function in docs (I'm sorry for possible
> mistakes in English and docbook formatting, please check it...)
>
>
> On 4/3/07, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Nikolay Samokhvalov wrote:
> > > On 3/22/07, Peter Eisentraut < peter_e(at)gmx(dot)net> wrote:
> > > > Bruce Momjian wrote:
> > > > > Patch applied.
> > > >
> > > > This code seems to think that if an xml datum starts with "<?xml" it's
> a
> > > > document. That is completely bogus.
> > >
> > > Agreed. I'll fix it.
> >
> > Nikolay, it has been a week, and I have see no fixes from you in
> > response to requests from Peter. If the patch doesn't arrive in 1-2
> > days, I will have to revert your patch and it will be kept for 8.4.
> > Feature freeze was April 1, 2007.
> >
> > --
> > Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> > EnterpriseDB
> http://www.enterprisedb.com
> >
> > + If your life is a hard drive, Christ can be your backup. +
> >
>
>
>
> --
> Best regards,
> Nikolay
>

--
Best regards,
Nikolay

Attachment Content-Type Size
xpath.fixes.20070410.patch text/x-patch 18.2 KB

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: nikolay(at)samokhvalov(dot)com
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-10 13:17:48
Message-ID: 461B8E7C.1040603@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Nikolay Samokhvalov wrote:
>
> 6. (bugfix) Work with fragments with prologue: select xpath('/a',
> '<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
> with dummy <x>...</x>, XML prologue simply goes away (if any).
>

Is that legal XML? I though only documents could have prologs.

cheers

andrew


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: nikolay(at)samokhvalov(dot)com, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-10 15:19:39
Message-ID: 200704101719.40231.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Am Dienstag, 10. April 2007 15:17 schrieb Andrew Dunstan:
> Nikolay Samokhvalov wrote:
> > 6. (bugfix) Work with fragments with prologue: select xpath('/a',
> > '<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
> > with dummy <x>...</x>, XML prologue simply goes away (if any).
>
> Is that legal XML? I though only documents could have prologs.

It's not a legal XML document, but it's a legal XML content fragment,
specified by SQL/XML.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: "Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-17 05:26:12
Message-ID: e431ff4c0704162226g7dbd68f6q4874203ade3ba5c3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

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 external tools to do such conversions."

It's not quite rigth as of now, because "rel->XML" mapping
capabilities exist in the core: it's XML/SQL publishing functions and
alternative mapping functions (such as table_to_xml() ).

On 4/10/07, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com> wrote:
> 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',
> '<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
> with dummy <x>...</x>, XML prologue simply goes away (if any).
> 7. Some cleanup.
>
> On 4/4/07, Nikolay Samokhvalov <nikolay(at)samokhvalov(dot)com> wrote:
> > The patch attached contains following changes:
> > 1. The function name xmlpath() is changed to xpath();
> > 2. Approach of passing of namepspace mappings to the function is changed:
> > now that array (the 3rd argument) should be a 2-dimentional array with the
> > length of the second axis = 2 (e.g., ARRAY[ARRAY['a1', 'http://a1'],
> > ARRAY['a2', 'http://a2'], ARRAY['a2', 'http://a2']]);
> > 3. Description of xpath() function in docs (I'm sorry for possible
> > mistakes in English and docbook formatting, please check it...)
> >
> >
--
Best regards,
Nikolay


From: "Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-22 07:21:55
Message-ID: e431ff4c0704220021y72ef7778q957600c21162da68@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

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 <samokhvalov(at)gmail(dot)com> wrote:
> 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',
> '<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
> with dummy <x>...</x>, XML prologue simply goes away (if any).
> 7. Some cleanup.
>
> On 4/4/07, Nikolay Samokhvalov <nikolay(at)samokhvalov(dot)com> wrote:
> > The patch attached contains following changes:
> > 1. The function name xmlpath() is changed to xpath();
> > 2. Approach of passing of namepspace mappings to the function is changed:
> > now that array (the 3rd argument) should be a 2-dimentional array with the
> > length of the second axis = 2 (e.g., ARRAY[ARRAY['a1', 'http://a1'],
> > ARRAY['a2', 'http://a2'], ARRAY['a2', 'http://a2']]);
> > 3. Description of xpath() function in docs (I'm sorry for possible
> > mistakes in English and docbook formatting, please check it...)

--
Best regards,
Nikolay


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: nikolay(at)samokhvalov(dot)com
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-22 13:29:09
Message-ID: 200704221329.l3MDT9w10453@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


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.

---------------------------------------------------------------------------

Nikolay Samokhvalov wrote:
> 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',
> '<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
> with dummy <x>...</x>, XML prologue simply goes away (if any).
> 7. Some cleanup.
>
> On 4/4/07, Nikolay Samokhvalov <nikolay(at)samokhvalov(dot)com> wrote:
> > The patch attached contains following changes:
> > 1. The function name xmlpath() is changed to xpath();
> > 2. Approach of passing of namepspace mappings to the function is changed:
> > now that array (the 3rd argument) should be a 2-dimentional array with the
> > length of the second axis = 2 (e.g., ARRAY[ARRAY['a1', 'http://a1'],
> > ARRAY['a2', 'http://a2'], ARRAY['a2', 'http://a2']]);
> > 3. Description of xpath() function in docs (I'm sorry for possible
> > mistakes in English and docbook formatting, please check it...)
> >
> >
> > On 4/3/07, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > > Nikolay Samokhvalov wrote:
> > > > On 3/22/07, Peter Eisentraut < peter_e(at)gmx(dot)net> wrote:
> > > > > Bruce Momjian wrote:
> > > > > > Patch applied.
> > > > >
> > > > > This code seems to think that if an xml datum starts with "<?xml" it's
> > a
> > > > > document. That is completely bogus.
> > > >
> > > > Agreed. I'll fix it.
> > >
> > > Nikolay, it has been a week, and I have see no fixes from you in
> > > response to requests from Peter. If the patch doesn't arrive in 1-2
> > > days, I will have to revert your patch and it will be kept for 8.4.
> > > Feature freeze was April 1, 2007.
> > >
> > > --
> > > Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> > > EnterpriseDB
> > http://www.enterprisedb.com
> > >
> > > + If your life is a hard drive, Christ can be your backup. +
> > >
> >
> >
> >
> > --
> > Best regards,
> > Nikolay
> >
>
>
> --
> Best regards,
> Nikolay

[ Attachment, skipping... ]

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: nikolay(at)samokhvalov(dot)com
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-04-22 13:29:20
Message-ID: 200704221329.l3MDTKN10471@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


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 Samokhvalov <samokhvalov(at)gmail(dot)com> wrote:
> > 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',
> > '<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
> > with dummy <x>...</x>, XML prologue simply goes away (if any).
> > 7. Some cleanup.
> >
> > On 4/4/07, Nikolay Samokhvalov <nikolay(at)samokhvalov(dot)com> wrote:
> > > The patch attached contains following changes:
> > > 1. The function name xmlpath() is changed to xpath();
> > > 2. Approach of passing of namepspace mappings to the function is changed:
> > > now that array (the 3rd argument) should be a 2-dimentional array with the
> > > length of the second axis = 2 (e.g., ARRAY[ARRAY['a1', 'http://a1'],
> > > ARRAY['a2', 'http://a2'], ARRAY['a2', 'http://a2']]);
> > > 3. Description of xpath() function in docs (I'm sorry for possible
> > > mistakes in English and docbook formatting, please check it...)
>
> --
> Best regards,
> Nikolay

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: nikolay(at)samokhvalov(dot)com
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: xpath_array with namespaces support
Date: 2007-05-21 17:11:50
Message-ID: 200705211911.51256.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

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.
> 6. (bugfix) Work with fragments with prologue: select xpath('/a',
> '<?xml version="1.0"?><a /><b />'); // now XML datum is always wrapped
> with dummy <x>...</x>, XML prologue simply goes away (if any).
> 7. Some cleanup.

Applied.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/