Обсуждение: BUG #5285: contrib\xml2 package's xpath_table function

Поиск
Список
Период
Сортировка

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

От
"heyong"
Дата:
The following bug has been logged online:

Bug reference:      5285
Logged by:          heyong
Email address:      hewy126@126.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

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

От
Robert Haas
Дата:
On Mon, Jan 18, 2010 at 5:13 AM, heyong <hewy126@126.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5285
> Logged by:          heyong
> Email address:      hewy126@126.com
> PostgreSQL version: postgresql-8.3
> Operating system:   solarias
> Description:        contrib\xml2 package's xpath_table function
> Details:
>
> <FEATURELIST>
>        <FEATURE id=3D"1" name=3D"=B7=A2=BB=F5=C6=DA=CF=DE" type=3D"enum" =
value=3D"10" fid=3D"874"
> unit=3D"=CC=EC=C4=DA=B7=A2=BB=F5" isneeded=3D"N" fieldflag=3D"sendlimit" =
/>
>        <FEATURE id=3D"2" name=3D"=C0=E0=B1=F0" type=3D"enum" value=3D"=CF=
=B4=D2=C2=B7=BF=C9=E8=B1=B8"
> fid=3D"1835" isneeded=3D"Y" />
>        <FEATURE id=3D"3" name=3D"=B9=A9=D3=A6=C9=CC=C0=E0=D0=CD" type=3D"=
enum" value=3D"=B4=FA=C0=ED=C9=CC"
> fid=3D"4441" isneeded=3D"Y" fieldflag=3D"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=3D1 and id=3D155015037'
>            )
> AS t(   offer_id        NUMERIC
>        ,fid            text
>        ,name           text
>        ,VALUE          text
>        ,fieldflag      text
>        )
>
> the result is
>
>  offer_id  | fid  |    name    |   value    |  fieldflag
> -----------+------+------------+------------+--------------
>  155015037 | 874  | =B7=A2=BB=F5=C6=DA=CF=DE   | 10         | sendlimit
>  155015037 | 1835 | =C0=E0=B1=F0       | =CF=B4=D2=C2=B7=BF=C9=E8=B1=B8 |=
 providertype
>  155015037 | 4441 | =B9=A9=D3=A6=C9=CC=C0=E0=D0=CD | =B4=FA=C0=ED=C9=CC  =
   |
>
>
> 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=3D# load 'pgxml';
LOAD
rhaas=3D# \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=3D# create table articles (article_id integer, article_xml xml,
date_entered date);
CREATE TABLE
rhaas=3D# insert into articles (article_id, article_xml, date_entered)
values (2, '<article><author>test</author><pages>37</pages></article>',
now());
INSERT 0 1
rhaas=3D# 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