Skip site navigation (1) Skip section navigation (2)

Re: BUG #5285: contrib\xml2 package's xpath_table function

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: heyong <hewy126(at)126(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5285: contrib\xml2 package's xpath_table function
Date: 2010-01-21 03:59:53
Message-ID: 603c8f071001201959n236a5d7em2d5f3c2dc3dcf070@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Mon, Jan 18, 2010 at 5:13 AM, heyong <hewy126(at)126(dot)com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5285
> Logged by:          heyong
> Email address:      hewy126(at)126(dot)com
> PostgreSQL version: postgresql-8.3
> Operating system:   solarias
> Description:        contrib\xml2 package's xpath_table function
> Details:
>
> <FEATURELIST>
>        <FEATURE id="1" name="发货期限" type="enum" value="10" fid="874"
> unit="天内发货" isneeded="N" fieldflag="sendlimit" />
>        <FEATURE id="2" name="类别" type="enum" value="洗衣房设备"
> fid="1835" isneeded="Y" />
>        <FEATURE id="3" name="供应商类型" type="enum" value="代理商"
> fid="4441" isneeded="Y" fieldflag="providertype" />
> </FEATURELIST>
>
> when I run sql:
> SELECT * FROM
> xpath_table('id'
>            ,'member_define_properties'
>            ,'aquery.hy_test1'
>            ,'/FEATURELIST/FEATURE/@fid
>            |/FEATURELIST/FEATURE/@name
>            |/FEATURELIST/FEATURE/@value
>            |/FEATURELIST/FEATURE/@fieldflag
>            '
>            ,'1=1 and id=155015037'
>            )
> AS t(   offer_id        NUMERIC
>        ,fid            text
>        ,name           text
>        ,VALUE          text
>        ,fieldflag      text
>        )
>
> the result is
>
>  offer_id  | fid  |    name    |   value    |  fieldflag
> -----------+------+------------+------------+--------------
>  155015037 | 874  | 发货期限   | 10         | sendlimit
>  155015037 | 1835 | 类别       | 洗衣房设备 | providertype
>  155015037 | 4441 | 供应商类型 | 代理商     |
>
>
> which fieldflag's values is err

Please attach (as an attachment, not in the body of the email) the
complete pg_dump output of a test database that can be used to
reproduce this problem.  If possible, a test case that can be
reproduced using only ASCII characters would be helpful.

By the way, I notice that the 8.4 documentation for contrib/xml2
states that it will be removed in 8.4.  Apparently, we didn't.  But I
guess maybe we should go ahead and do that.  I crashed the server
several times while attempting to reproduce the above bug, which makes
me feel like having this code around is not a good thing.

$ psql
Line style is old-ascii.
psql (8.5devel)
Type "help" for help.

rhaas=# load 'pgxml';
LOAD
rhaas=# \i pgxml.sql
SET
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
psql:pgxml.sql:79: ERROR:  could not find function "xslt_process" in
file "/home/rhaas/project/lib/postgresql/pgxml.so"
psql:pgxml.sql:86: ERROR:  could not find function "xslt_process" in
file "/home/rhaas/project/lib/postgresql/pgxml.so"
rhaas=# create table articles (article_id integer, article_xml xml,
date_entered date);
CREATE TABLE
rhaas=# insert into articles (article_id, article_xml, date_entered)
values (2, '<article><author>test</author><pages>37</pages></article>',
now());
INSERT 0 1
rhaas=# SELECT * FROM
xpath_table('article_id',
            'article_xml',
            'articles',
            '/article/author|/article/pages|/article/title',
            'date_entered > ''2003-01-01'' ')
AS t(article_id integer, author text, page_count integer, title text);
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

...Robert

In response to

pgsql-bugs by date

Next:From: Antoine BanksDate: 2010-01-21 08:53:00
Subject: PHP .zip File
Previous:From: Heikki LinnakangasDate: 2010-01-20 20:53:01
Subject: Re: BUG #5290: Simple loop with insert into and check to avoid duplicate values fails

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group