Database Reference
In-Depth Information
different structures. A good example would be a payment order and rows, where the
first record returned by the function is the XML for the order header followed by one
or more records of XML for order rows, all returned from the same function in one
call.
There are currently five variants of *_to_xml functions:
cursor_to_xml(cursor refcursor, count integer,
nulls bool, tableforest bool,
targetns text)
query_to_xml(query text,
nulls bool, tableforest bool,
targetns text)
table_to_xml(tbl regclass,
nulls boolean, tableforest
boolean, targetns text)
schema_to_xml(schema name,
nulls boolean, tableforest
boolean, targetns text)
database_to_xml(nulls boolean, tableforest
bool, targetns text)
The cursor_to_xml(...) function which iterates over an open cursor is recom-
mended for large data sets, as it can convert the data in chunks of rows without first
accumulating all data in memory.
The next three functions return a string representing either a SQL query, a table
name, or a schema name, and return all data from the named object. The table_
to_xml() function also works on views. Then there is the data-
base_to_xml(...) function which converts all of the current database to XML
document. However, a common result of running it on a production database is an
out of memory error:
hannu=# select database_to_xml(true, true, 'n');
ERROR: out of memory
DETAIL: Failed on request of size 1024.
Search WWH ::




Custom Search