From: | Brad Balmer <bbalmer(at)peapod(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Create index on xml field |
Date: | 2009-01-13 16:56:33 |
Message-ID: | 823649.108851231865793097.JavaMail.root@pmsvl02 |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2009-01-13 19:42:14 | Re: Create index on xml field |
Previous Message | Ivan Sergio Borgonovo | 2009-01-12 00:48:52 | Re: some howto/theory book/tutorial on practical problem solving in SQL |