PostgreSQL Version 9.1,
i have a table,
xmltest=# \d xmltest
Table "public.xmltest"
Column | Type | Modifiers
---------+---------+-----------
id | integer | not null
xmldata | xml |
Indexes:
"xmltest_pkey" PRIMARY KEY, btree (id)
xmltest=# select * from xmltest;
id | xmldata
----+---------------------------------------
1 | <root> +
| <child1>somedata for child1 </child1>+
| <child2>somedata for child2 </child2>+
| </root>
(1 row)
now how to update the value inside the element/tag child2,
i don't prefer to update the whole column at once,
is their a way to do update/add/delete that particular value of tag, if so please share :)
PostgreSQL XML functions are aimed a producing and processing XML, not so much at manipulating it, I am afraid.
You can extract values with xpath()
, there are a number of functions to build XML , but I would not know of built-in functionality to update elements inside a given XML value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.