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

issue with postgres/xml

From: Cindy Moore <ctmoore(at)uci(dot)edu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: issue with postgres/xml
Date: 2008-09-09 17:29:56
Message-ID: 48C6B294.6010706@uci.edu (view raw or flat)
Thread:
Lists: pgsql-bugs
I looked through the lists and couldn't figure out where else to put
this.  I'm trying to create indices on xpath expressions for columns
of type xml.
I'm running postgres version 8.3.3, running on solaris.

Text=# create index trclass on lsj_xml ((xpath
('//span[(at)class="tr"]/text()', entry)::text));
ERROR:  functions in index expression must be marked IMMUTABLE

If I can't cast it as a text, then what?  xml has no comparator
functions, and I need indices because the xpath lookups are very slow.
I've tried a number of variations including

Text=# create index trclass on lsj_xml (xmlserialize(content xpath
('//span[(at)class="tr"]/text()', entry) as text));
ERROR:  argument of XMLSERIALIZE must be type xml, not type xml[]

which i understand, because the xpath is returning an array of xml
bits.  But I'm a bit stumped here, so any help, tips, or suggestions
would be appreciated.  I've been scouring the internet for any info on
postgres/xml, but there's very little out there since this is so
new...


If you need the table info:

Text=# \d lsj_xml
     Table "public.lsj_xml"
  Column   |  Type   | Modifiers
------------+---------+-------
----
 id         | integer | not null
 headword   | text    | not null
 caseunax   | text    | not null
 uncaseax   | text    | not null
 uncaseunax | text    | not null
 entry      | xml     | not null
Indexes:
   "lsjxml_headword_idx" btree (headword)
   "lsjxml_id_idx" btree (id)
   "lsjxml_uncaseunax_idx" btree (uncaseunax)


Thanks for any help!
Cindy
ctmoore(at)uci(dot)edu <mailto:ctmoore(at)uci(dot)edu>

Responses

pgsql-bugs by date

Next:From: KevinDate: 2008-09-09 20:11:23
Subject: BUG #4412: Check constraints cannot be added to the table for fields that are mixed case
Previous:From: CindyDate: 2008-09-09 17:29:00
Subject: a question on postgres/xml

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