BUG #5434: select from xpath_table gives wrong results

Поиск
Список
Период
Сортировка
От Oleg
Тема BUG #5434: select from xpath_table gives wrong results
Дата
Msg-id 201004220845.o3M8jpKi042967@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5434: select from xpath_table gives wrong results  (Robert Haas <robertmhaas@gmail.com>)
Re: BUG #5434: select from xpath_table gives wrong results  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5434
Logged by:          Oleg
Email address:      sacramento_fan@mail.ru
PostgreSQL version: 8.4.3
Operating system:   KUbuntu
Description:        select from xpath_table gives wrong results
Details:

Here is a code:

create table tmp_xml(rowId SERIAL UNIQUE NOT NULL,
                  xml_context xml,
                  CONSTRAINT PK_tmp_xml PRIMARY KEY (rowId));

insert into tmp_xml (xml_context)
values('<root>'
         '<obj obj_id="1" obj_name="First Object"/>'
         '<obj obj_id="2" obj_name="Second Object" obj_master="1"/>'
         '<obj obj_id="3" obj_name="Third Object"/>'
         '<obj obj_id="4" obj_name="Fourth Object" obj_master="1"/>'
       '</root>');

SELECT t.OBJ_ID, t.OBJ_NAME, t.OBJ_MASTER
FROM xpath_table('rowId',
                 'xml_context',
                'tmp_xml',

'/root/obj/@obj_id|/root/obj/@obj_name|/root/obj/@obj_master|',
                 'true')
        AS t(row_id integer,
             OBJ_ID integer,
             OBJ_NAME varchar(255),
             OBJ_MASTER INT
             );

I was sure, that result of this query should be like this:

obj_id | obj_name        | obj_master
----------------------------------------
   1   |   First Object  |
   2   |   Second Object |    1
   3   |   Third Object  |
   4   |   Fourth Object |    1

But instead of I got this result:

obj_id | obj_name        | obj_master
----------------------------------------
   1   |   First Object  |    1
   2   |   Second Object |    1
   3   |   Third Object  |
   4   |   Fourth Object |

Why is this so? Maybe I use xpath_table wrong way?

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: Fwd: BUG #5433: pg_dump (8.4.3) copy database failure!
Следующее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5434: select from xpath_table gives wrong results