workaround for the IBM JDBC driver bug:

http://www-01.ibm.com/support/docview.wss?uid=swg1PM32361

All Connectivities: Previously, the special characters
carriage returns (#x0d), line feeds (#x0a), and tabs (#x09)
are not escaped during serialization process from binary XML,
now these characters are escaped. (wsdbu00796615)

Driver was replaced on the modern version but the bug is still
encountered.
Added "ORDER BY" clause according to the postgresql official docs:

http://www.postgresql.org/docs/current/static/functions-xml.html

to determine the order of the concatenation using 'XMLAGG' function,
as it could differ on different vendors