Does XMLSERIALIZE output xmlattributes in a stable order?

Поиск
Список
Период
Сортировка
От Chapman Flack
Тема Does XMLSERIALIZE output xmlattributes in a stable order?
Дата
Msg-id 62ce7506-b315-d358-97dd-48846baeade8@anastigmatix.net
обсуждение исходный текст
Ответы Re: Does XMLSERIALIZE output xmlattributes in a stable order?
Список pgsql-hackers
Suppose I have a query that generates some XML content, and I want
to do this on a periodic schedule and check the resulting XML into
a version control system.

To avoid spurious diffs, I know I can control the order of child
elements generated by xmlagg by slipping an ORDER BY into the
aggregate expression.

But then, there are the attributes of elements. Order of attributes
is not significant in XML, and is not required (by the "XML Infoset"
standard) to be preserved. Nevertheless, it would be a useful
property (for a purpose like I've described) if XMLSERIALIZE were
known to at least produce the attributes in some consistent order
across evaluations of the same query.

Is that true of the implementation in PostgreSQL? I might find out
with a quick test, but it seemed worth explicitly asking.

This is subtle enough that, if it's true, it is probably worth
mentioning in the docs. (If it isn't true, it might even be worth
making it true, then mentioning it in the docs.) While [XML Infoset]
does say that an element's attributes are an "unordered set",
[XQuery and XPath Data Model (XDM)] says "the order of Attribute Nodes
is stable but implementation dependent", and it's the latter document
that's referenced by [XSLT and XQuery Serialization], which is the
standard upon which XMLSERIALIZE is defined in [SQL/XML]. (Phew!)

-Chap


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Treating work_mem as a shared resource (Was: Parallel Hash take II)
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: feature request: consume asynchronous notification via a function