possible to create multivalued index from xpath() results in 8.3?

From: "Matt Magoffin" <postgresql(dot)org(at)msqr(dot)us>
To: pgsql-general(at)postgresql(dot)org
Subject: possible to create multivalued index from xpath() results in 8.3?
Date: 2007-11-19 07:52:22
Message-ID: 52218.192.168.1.108.1195458742.squirrel@msqr.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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[(at)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@

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francis Waweru 2007-11-19 08:01:51 Function Problems
Previous Message Stefan Schwarzer 2007-11-19 07:34:35 Re: Substitute column in SELECT with static value? (Crosstab problem?)

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-11-19 08:15:17 Re: Better default_statistics_target
Previous Message Tom Lane 2007-11-18 20:57:59 Re: Re: [COMMITTERS] pgsql: GIN index build's allocatedMemory counter needs to be long, not