From: | "Thiago Silva" <thiago(dot)silva(at)kdemail(dot)net> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #2541: XML2 module: odd query results |
Date: | 2006-07-20 21:25:29 |
Message-ID: | 200607202125.k6KLPTQx067734@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 2541
Logged by: Thiago Silva
Email address: thiago(dot)silva(at)kdemail(dot)net
PostgreSQL version: 8.1
Operating system: Debian GNU/Linux
Description: XML2 module: odd query results
Details:
Hi,
Recently, I had some problems with queries using the XML2 module. I was able
to reproduce the odd results using the following commands:
DROP TABLE tag CASCADE;
CREATE TABLE tag ( id SERIAL PRIMARY KEY, data TEXT );
INSERT INTO tag ( data ) VALUES ( 'anything' );
SELECT id, data FROM tag WHERE xpath_bool(data, '/*[/tag/name="test"]');
DROP TABLE tag CASCADE;
CREATE TABLE tag ( id SERIAL PRIMARY KEY, data TEXT );
INSERT INTO tag ( data ) VALUES ( '<?xml version="1.0"
encoding="UTF-8"?><tag><name>test</name><description>testdesc</description><
systemtag>1</systemtag><ownerid></ownerid></tag>' );
SELECT id, xpath_nodeset(data, '/*[/tag/name="test" and /tag/systemtag=1]')
AS
data FROM tag WHERE xpath_bool(data, '/*[/tag/name="test"
and /tag/systemtag=1]/..');
Executing them about 10/20 times in the console (sometimes, way more) shows
2
different results for the last SELECT command. And, AFAIK, there should be
only one result, no matter how many times they are executed.
I'm using postgresql 8.1 (GNU/Linux Debian testing).
Thiago Silva
PS: The following is a copy/paste of the console for both results (using
brazilian locale, sorry) in a DB called "test":
++++++++++++++++++++++++++++++++++++++++++++++++++++++
test=> DROP TABLE tag CASCADE;
DROP TABLE
test=> CREATE TABLE tag ( id SERIAL PRIMARY KEY, data TEXT );
NOTA: CREATE TABLE criar sequncia implcita "tag_id_seq" para coluna
serial "tag.id"
NOTA: CREATE TABLE / PRIMARY KEY criar ndice implcito "tag_pkey" na
tabela "tag"
CREATE TABLE
test=> INSERT INTO tag ( data ) VALUES ( 'anything' );
INSERT 0 1
test=> SELECT id, data FROM tag WHERE
xpath_bool(data, '/*[/tag/name="test"]');
id | data
----+------
(0 registros)
test=> DROP TABLE tag CASCADE;
DROP TABLE
test=> CREATE TABLE tag ( id SERIAL PRIMARY KEY, data TEXT );
NOTA: CREATE TABLE criar sequncia implcita "tag_id_seq" para coluna
serial "tag.id"
NOTA: CREATE TABLE / PRIMARY KEY criar ndice implcito "tag_pkey" na
tabela "tag"
CREATE TABLE
test=> INSERT INTO tag ( data ) VALUES ( '<?xml version="1.0"
encoding="UTF-8"?><tag><name>test</name><description>testdesc</description><
systemtag>1</systemtag><ownerid></ownerid></tag>' );
INSERT 0 1
test=> SELECT id, xpath_nodeset(data, '/*[/tag/name="test"
and /tag/systemtag=1]') AS data FROM tag WHERE
xpath_bool(data, '/*[/tag/name="test" and /tag/systemtag=1]/..');
id |
data
----+-----------------------------------------------------------------------
----------------------------
1 |
<tag><name>test</name><description>testdesc</description><systemtag>1</syste
mtag><ownerid/></tag>
(1 registro)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
test=> DROP TABLE tag CASCADE;
DROP TABLE
test=> CREATE TABLE tag ( id SERIAL PRIMARY KEY, data TEXT );
NOTA: CREATE TABLE criar sequncia implcita "tag_id_seq" para coluna
serial "tag.id"
NOTA: CREATE TABLE / PRIMARY KEY criar ndice implcito "tag_pkey" na
tabela "tag"
CREATE TABLE
test=> INSERT INTO tag ( data ) VALUES ( 'anything' );
INSERT 0 1
test=> SELECT id, data FROM tag WHERE
xpath_bool(data, '/*[/tag/name="test"]');
id | data
----+------
(0 registros)
test=> DROP TABLE tag CASCADE;
DROP TABLE
test=> CREATE TABLE tag ( id SERIAL PRIMARY KEY, data TEXT );
NOTA: CREATE TABLE criar sequncia implcita "tag_id_seq" para coluna
serial "tag.id"
NOTA: CREATE TABLE / PRIMARY KEY criar ndice implcito "tag_pkey" na
tabela "tag"
CREATE TABLE
test=> INSERT INTO tag ( data ) VALUES ( '<?xml version="1.0"
encoding="UTF-8"?><tag><name>test</name><description>testdesc</description><
systemtag>1</systemtag><ownerid></ownerid></tag>' );
INSERT 0 1
test=> SELECT id, xpath_nodeset(data, '/*[/tag/name="test"
and /tag/systemtag=1]') AS data FROM tag WHERE
xpath_bool(data, '/*[/tag/name="test" and /tag/systemtag=1]/..');
id |
data
----+-----------------------------------------------------------------------
----------------------------------------------------------------------------
--------------------------------------
1 |
<tag><name>test</name><description>testdesc</description><systemtag>1</syste
mtag><ownerid/></tag><name>test</name><description>testdesc</description><sy
stemtag>1</systemtag><ownerid/>
(1 registro)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2006-07-20 21:39:30 | Re: BUG #2540: function upper(..) and operator 'like' problem |
Previous Message | Steve McWilliams | 2006-07-20 20:02:12 | Re: BUG #2525: 'No buffer space available' error running pg_dump on win2k for large bytea values |