Create index on xml field - Mailing list pgsql-sql

From Brad Balmer
Subject Create index on xml field
Date
Msg-id 823649.108851231865793097.JavaMail.root@pmsvl02
Whole thread Raw
Responses Re: Create index on xml field
List pgsql-sql
Could somebody please help me with the correct syntax for creating an index on an xml field.  My (simple) table format is:

CREATE TABLE test_tbl (id_cd integer not null, job xml);

INSERT INTO test_tbl VALUES (200,
'<?xml version="1.0" encoding="UTF-8"?><uim:hd xmlns:uim="http://www.cmpy.com/uim"><uim:baseData><uim:internalProductId>202</uim:internalProductId><uim:upcCodes><uim:upcCode>0381370036006</uim:upcCode><uim:upcCode>0000000001236</uim:upcCode></uim:upcCodes></uim:baseData></uim:hd>');

I've tried multiple ways of creating an idex on the <uim:upcCode> element but always get an ERROR:  could not create XPath object.

Why would the following not work?
create index tstTbl_idx on test_tbl (cast(xpath ('//uim:upcCode/text()', job) as text[]));

Thanks

pgsql-sql by date:

Previous
From: Ivan Sergio Borgonovo
Date:
Subject: Re: some howto/theory book/tutorial on practical problem solving in SQL
Next
From: Peter Eisentraut
Date:
Subject: Re: Create index on xml field