How to do XML canonical comparison with PostgreSQL?

萝らか妹 提交于 2019-12-06 16:33:57

I contributed to the XML type implementation in PostgreSQL and probably wrote most of the documentation you are citing.

There are a number of reasons why this is currently the way it is:

  • The SQL standard specifies no comparison operator for type xml.
  • At the time the implementation was started, Canonical XML wasn't widely used and understood (at least by the people involved, arguably).
  • There are certain limitations where XML canonicalization doesn't work. Although these might be rarely seen in practice, this would yield the situation where some values of a data type can't be compared, which would lead to problems with indexing for example. (The NaN value of floating-point types is assigned an ordering position for similar reasons.)
  • It's still debatable whether comparison by canonicalization is appropriate for all uses and what users always want.

An implementation of an XML canonicalization function for optional use would certainly be welcome. I would actually like to see a separate xmlcanonical type, but that would be quite a bit more work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!