[ACCEPTED]-Postgres XML datatype-postgresql
Right now the biggest thing you get from 5 XML fields over raw text is XPath. So if 4 you had something similar to
CREATE TABLE pages (id int, html xml);
you could get 3 the title of page 4 by
SELECT xpath('/html/head/title/text()', html) FROM pages WHERE id = 4;
Right now XML support 2 is fairly limited, but got a lot better 1 in 8.3, current docs are at link text
Generally speaking, the benefits are the 7 same ones as for any other data type and 6 why you have data types other than text 5 at all:
- Data integrity
You can only store valid (well, well-formed) XML values in columns of type xml. - Type safety
You can only perform operations on XML values that make sense for XML.
One example is the xpath()
function (XML Path Language), which 4 only operates on values of type xml, not 3 text.
Indexing and query performance characteristics 2 are not better or worse than for say the 1 text type at the moment.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.