> "Matt Magoffin" <[EMAIL PROTECTED]> writes:
>> 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?
>
> Dunno about your other questions, but the answer to this one is "no"
> --- AFAICS there is no indexing support of any kind for the xml type
> in 8.3.  Try casting to text[] instead.

I had tried that, but it does not actually work because of my first issue,
of a way for the XPath to return 3 individual text nodes. If I return 3
elements, like

/[EMAIL PROTECTED]"mykey"] => {
  <elem key="mykey">value1</elem>,
  <elem key="mykey">value2</elem>,
  <elem key="mykey">value3</elem>
}

and cast that to text[], I get 3 XML strings, including the <elem></elem>.
I want only the element text content.

Should the xpath() function return 3 individual text nodes like this:

/[EMAIL PROTECTED]"mykey"]/text() => {
  value1,
  value2,
  value3
}

rather than concatenating these into a single text node result? I also
tried something like

string(/[EMAIL PROTECTED]"mykey"])

but that throws an XPath error. It looks like the code is converting this
to /x/string(/[EMAIL PROTECTED]"mykey"] internally, which is not a valid XPath.

So if xpath() cannot return individual text node results, would a possible
solution be to write a trigger function that generates a tsvector from the
XML array, and then use text search to locate matches?

-- m@

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to