Create index on xml field
| От | Brad Balmer |
|---|---|
| Тема | Create index on xml field |
| Дата | |
| Msg-id | 823649.108851231865793097.JavaMail.root@pmsvl02 обсуждение исходный текст |
| Ответы |
Re: Create index on xml field
|
| Список | 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
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 по дате отправления: