possible to create multivalued index from xpath() results in 8.3? - Mailing list pgsql-general

From Matt Magoffin
Subject possible to create multivalued index from xpath() results in 8.3?
Date
Msg-id 52218.192.168.1.108.1195458742.squirrel@msqr.us
Whole thread Raw
Responses Re: possible to create multivalued index from xpath() results in 8.3?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I've working with XML in Postgres 8.3 and am trying to find a way to
create a text-based index from an XPath that returns multiple nodes. For
example, if I have an XPath like

/elem[@key="mykey"]/text()

which might return a few text nodes like

value1
value2
value3

I'd like 3 index values associated with this row's index key: {value1,
value2, value3). I was trying to figure out a way to define an index like
this but ran into a couple of issues:

1) The xpath() function returns an array of XML type, but in the above
example the text nodes are joined together into a single xml result node,
like {value1value2value3}. How can I get it to return 3 individual text
nodes, so an array of 3 values instead of 1?

2) Even if I could have an xpath() result return an array with multiple
values, like {value1,value2,value3} I wasn't able to define a GIN index
against the xml[] type. Should this be possible?

-- m@

pgsql-general by date:

Previous
From: Ow Mun Heng
Date:
Subject: Re: Calculation for Max_FSM_pages : Any rules of thumb?
Next
From: "Francis Waweru"
Date:
Subject: Function Problems